}
public void testFailure() throws Exception
{
TransactionManager tm = cache.getTransactionManager();
try
{
tm.begin();
cache.put("/a/b/c", "test", "test");
assertTrue(cache.get("/a/b/c", "test").equals("test"));
cache.removeNode("/a/b");
assertTrue(!cache.exists("/a/b"));
assertTrue(!cache.exists("/a/b/c"));
cache.put("/a/b/d", "test1", "test1");
assertTrue(!cache.exists("/a/b/c"));
assertTrue(cache.exists("/a/b/d"));
tm.commit();
assertTrue(cache.peek(Fqn.fromString("/a/b/c"), true, true) == null);
assertTrue(!cache.exists("/a/b/c"));
assertTrue(cache.exists("/a/b/d"));
dataContainer.printLockInfo();
}
catch (Exception ex) {
tm.rollback();
throw ex;
}
dataContainer.printLockInfo();
try
{
tm.begin();
Transaction t = tm.suspend();
try
{
cache.putForExternalRead(Fqn.fromString("/a/b/c"), "test", "test");
}
catch (Exception ignore) {
ignore.printStackTrace();
}
tm.resume(t);
cache.put("/a/b/c", "test", "test");
tm.commit();
}
catch (Exception ex) {
tm.rollback();
throw ex;
}
}