public void testGetKeysIsolationTransaction() throws Exception
{
TreeCache cache = createCacheWithListener();
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
if (mgr.getTransaction() != null) mgr.rollback();
assertNull(mgr.getTransaction());
// first put in a value
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();
mgr.begin();
Transaction tx = mgr.getTransaction();
assertEquals(1, cache.getKeys("/one/two").size());
// start another
mgr.suspend();
mgr.begin();
cache.put("/one/two", "key2", pojo);
mgr.commit();
// assert we can see this outsode the existing tx
assertEquals(2, cache.getKeys("/one/two").size());
// resume the suspended one
mgr.resume(tx);
// assert we can't see thge change from tx2 as we already touched the node
assertEquals(1, cache.getKeys("/one/two").size());
mgr.commit();
destroyCache(cache);
}