CacheSPI<Object, Object> cache2 = createCache("cache2", false, true, true);
// Pause to give caches time to see each other
TestingUtil.blockUntilViewsReceived(new CacheSPI[]{cache1, cache2}, 60000);
CacheLoader loader = cache2.getCacheLoaderManager().getCacheLoader();
assertNull("/a/b transferred to loader against policy", loader.get(A_B));
assertNull("/a/b name transferred against policy", cache2.get(A_B, "name"));
assertNull("/a/b age transferred against policy", cache2.get(A_B, "age"));
assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
createAndActivateRegion(cache2, A_B);
assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
assertNull("/a/c transferred to loader against policy", loader.get(A_C));
assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
assertNull("/a/c name transferred against policy", cache2.get(A_C, "name"));
assertNull("/a/c age transferred against policy", cache2.get(A_C, "age"));
cache1.put(A_D, "name", JANE);
assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
createAndActivateRegion(cache2, A_C);
assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
assertEquals("Incorrect name from loader for /a/c", BOB, loader.get(A_C).get("name"));
assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
assertNull("/a/d name transferred against policy", cache2.get(A_D, "name"));
createAndActivateRegion(cache2, A_D);
assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
assertEquals("Incorrect name from loader for /a/c", BOB, loader.get(A_C).get("name"));
assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
assertEquals("Incorrect name from loader for /a/d", JANE, loader.get(A_D).get("name"));
assertEquals("Incorrect name for /a/b", JOE, cache2.get(A_B, "name"));
assertEquals("Incorrect age for /a/b", TWENTY, cache2.get(A_B, "age"));
assertEquals("Incorrect name for /a/c", BOB, cache2.get(A_C, "name"));
assertEquals("Incorrect age for /a/c", FORTY, cache2.get(A_C, "age"));
assertEquals("Incorrect name for /a/d", JANE, cache2.get(A_D, "name"));
cache1.getRegion(A, false).deactivate();
createAndActivateRegion(cache1, A_B);
createAndActivateRegion(cache1, A_C);
createAndActivateRegion(cache1, A_D);
loader = cache1.getCacheLoaderManager().getCacheLoader();
assertEquals("Incorrect name from loader for /a/b", JOE, loader.get(A_B).get("name"));
assertEquals("Incorrect age from loader for /a/b", TWENTY, loader.get(A_B).get("age"));
assertEquals("Incorrect name from loader for /a/c", BOB, loader.get(A_C).get("name"));
assertEquals("Incorrect age from loader for /a/c", FORTY, loader.get(A_C).get("age"));
assertEquals("Incorrect name from loader for /a/d", JANE, loader.get(A_D).get("name"));
assertEquals("Incorrect name for /a/b", JOE, cache1.get(A_B, "name"));
assertEquals("Incorrect age for /a/b", TWENTY, cache1.get(A_B, "age"));
assertEquals("Incorrect name for /a/c", BOB, cache1.get(A_C, "name"));
assertEquals("Incorrect age for /a/c", FORTY, cache1.get(A_C, "age"));