public void testPartialStateTransfer() throws Exception
{
log.info("Enter testPartialStateTransfer");
PojoCache cache1 = createCache("cache1", false, true, false);
cache1.activateRegion("/a");
cache1.putObject(A_B_1, joe);
cache1.putObject(A_B_2, jane);
PojoCache cache2 = createCache("cache2", false, true, false);
// Pause to give caches time to see each other
TestingUtil.blockUntilViewsReceived(new PojoCache[]
{cache1, cache2}, 60000);
assertNull("/a/b/1 not transferred per policy", cache2.getObject(A_B_1));
assertNull("/a/b/2 not transferred per policy", cache2.getObject(A_B_2));
cache2.activateRegion("/a/b");
Person ab1 = (Person) cache2.getObject(A_B_1);
Person ab2 = (Person) cache2.getObject(A_B_2);
assertEquals("Name for /a/b/1 is Joe", joe.getName(), ab1.getName());
assertEquals("City for /a/b/1 is Anytown", joe.getAddress().getCity(), ab1.getAddress().getCity());
assertEquals("Name for /a/b/2 is Jane", jane.getName(), ab2.getName());
assertEquals("City for /a/b/2 is Anytown", jane.getAddress().getCity(), ab2.getAddress().getCity());
assertTrue("Address for Joe and Jane is the same object", ab1.getAddress() == ab2.getAddress());
cache1.putObject(A_C_1, bob);
cache1.putObject(A_C_2, jill);
assertNull("/a/c/1 not transferred per policy", cache2.getObject(A_C_1));
cache2.activateRegion("/a/c");
Person ac1 = (Person) cache2.getObject(A_C_1);
Person ac2 = (Person) cache2.getObject(A_C_2);
assertEquals("Name for /a/c/1 is Bob", bob.getName(), ac1.getName());
assertEquals("City for /a/c/1 is Fremont", addr2.getCity(), ac1.getAddress().getCity());
assertEquals("Name for /a/c/2 is Jill", jill.getName(), ac2.getName());
assertEquals("City for /a/c/2 is Fremont", addr2.getCity(), ac2.getAddress().getCity());
assertTrue("Bob and Jill have same Address", ac1.getAddress() == ac2.getAddress());