public void testAsRemoteEJB() throws Exception
{
log.info("entering testAsRemoteEJB()");
// Get proxy to JAX-RS resource as EJB.
EJBRemoteResource remoteResource = getRemoteResource();
log.info("remote: " + remoteResource);
// Create book.
Book book1 = new Book("RESTEasy: the Sequel");
int id1 = remoteResource.createBook(book1);
log.info("id1: " + id1);
Assert.assertEquals(Counter.INITIAL_VALUE, id1);
// Create another book.
Book book2 = new Book("RESTEasy: It's Alive");
int id2 = remoteResource.createBook(book2);
log.info("id2: " + id2);
Assert.assertEquals(Counter.INITIAL_VALUE + 1, id2);
// Retrieve first book.
Book bookResponse1 = remoteResource.lookupBookById(id1);
log.info("book1 response: " + bookResponse1);
Assert.assertEquals(book1, bookResponse1);
// Retrieve second book.
Book bookResponse2 = remoteResource.lookupBookById(id2);
log.info("book2 response: " + bookResponse2);
Assert.assertEquals(book2, bookResponse2);
// Verify that EJBBookReader and EJBBookWriter haven't been used.
remoteResource.testUse(0);
// Reset counter.
remoteResource.reset();
}