protected ThreadLocal<Map<String, Cache>> cachesTL = new ThreadLocal<Map<String, Cache>>();
private ThreadLocal<ClassLoader> orig_TCL_TL = new ThreadLocal<ClassLoader>();
public void testBuddyBackupActivation() throws Exception
{
CacheSPI cache1 = createCache("cache1", true, true, true);
CacheSPI cache2 = createCache("cache2", true, true, true);
Fqn A = Fqn.fromString("/a");
TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
// create the regions on the two caches first
Region c1 = cache1.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
Region c2 = cache2.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
assertFalse(c1.isActive());
assertFalse(c2.isActive());
c1.activate();
cache1.put(A_B, "name", JOE);
// TestingUtil.sleepThread(getSleepTimeout());
System.out.println("Cache dump BEFORE activation");
System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
c2.activate();
System.out.println("Cache dump AFTER activation");
System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
Fqn fqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
assertEquals("State transferred with activation", JOE, cache2.get(fqn, "name"));
}