public void test2InstanceCommit() throws Exception
{
groupIncreaser++;
CacheSPI<Object, Object> cache = createSyncReplicatedCache();
CacheSPI<Object, Object> cache2 = createSyncReplicatedCache();
LockManager lockManager = TestingUtil.extractLockManager(cache);
LockManager lockManager2 = TestingUtil.extractLockManager(cache2);
TransactionManager mgr = cache.getConfiguration().getRuntimeConfig().getTransactionManager();
assertNull(mgr.getTransaction());
mgr.begin();
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
SamplePojo pojo = new SamplePojo(21, "test");
cache.put("/one/two", "key1", pojo);
mgr.commit();
// cache asserts
assertNull(mgr.getTransaction());
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.getRoot().getChild("one"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.getRoot().getChild("one"));
assertEquals(false, lockManager.isLocked(cache.getRoot()));
assertEquals(false, lockManager.isLocked(cache.getNode("/one")));
assertEquals(false, lockManager.isLocked(cache.getNode("/one/two")));
assertNotNull(cache.getNode("/one").getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
// cache2 asserts
assertEquals(0, cache2.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache2.getTransactionTable().getNumLocalTransactions());
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.getRoot().getChild("one"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.getRoot().getChild("one"));
assertEquals(false, lockManager2.isLocked(cache2.getRoot()));
assertEquals(false, lockManager2.isLocked(cache2.getNode("/one")));
assertEquals(false, lockManager2.isLocked(cache2.getNode("/one/two")));
assertNotNull(cache2.getNode("/one").getChild("two"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
TestingUtil.killCaches((Cache<Object, Object>) cache);
TestingUtil.killCaches((Cache<Object, Object>) cache2);