tester1 = (EntityTest)ctx1.lookup("EntityTestBean/remote");
tester0.getCache("persistence.unit");
tester1.getCache("persistence.unit");
Customer customer = tester0.createCustomer();
//Call finder twice since Hibernate seems to not actually save collections
//into cache on persist(), so make sure it is put into cache on find.
System.out.println("Find node 0");
customer = tester0.findByCustomerId(customer.getId());
System.out.println("Find(2) node 0");
customer = tester0.findByCustomerId(customer.getId());
//Check everything was in cache
System.out.println("Check cache 0");
assertEquals(null, tester0.loadedFromCache());
// The above placement of the collection in the cache is replicated async
// so pause a bit before checking node 1
sleep(SLEEP_TIME);
//Now connect to cache on node2 and make sure it is all there
System.out.println("Find node 1");
customer = tester1.findByCustomerId(customer.getId());
//Check everything was in cache
System.out.println("Check cache 1");
assertEquals(null, tester1.loadedFromCache());
}