caches = new HashMap();
}
public void testInterop() throws Exception
{
TreeCacheMBean cache = createCache("driver");
TestingUtil.blockUntilViewReceived(cache, 2, 10000);
cache.put("/put", "key", "value");
Map map = new HashMap();
map.put("0", new Integer(0));
map.put("1", new Integer(1));
cache.put("/put/map", map);
cache.put("/remove", "key", "value");
cache.remove("/remove");
cache.put("/txremove", "key", "value");
TransactionManager tm = cache.getTransactionManager();
tm.begin();
Transaction tx = tm.getTransaction();
cache.put("/txput", "key", "value");
cache.remove("/txremove");
tx.commit();
cache.put("/rbremove", "key", "value");
tm.begin();
tx = tm.getTransaction();
cache.put("/rbput", "key", "value");
cache.remove("/rbremove");
tx.registerSynchronization(new RollbackSync(tx));
try
{
tx.commit();
}
catch (Exception ignored) {}
stopCache("driver");
cache = createCache("recipient");
TestingUtil.blockUntilViewReceived(cache, 2, 10000);
assertEquals("value", cache.get("/put", "key"));
assertEquals(new Integer(0), cache.get("/put/map", "0"));
assertEquals(new Integer(1), cache.get("/put/map", "1"));
assertNull(cache.get("/remove", "key"));
assertEquals("value", cache.get("/txput", "key"));
assertNull(cache.get("/txremove", "key"));
assertNull(cache.get("/rbput", "key"));
assertEquals("value", cache.get("/rbremove", "key"));
}