assertEquals(null, dummy.getCalled());
TransactionTable table = cache.getTransactionTable();
GlobalTransaction gtx = table.get(tx);
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
@SuppressWarnings("unchecked") TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
assertEquals(3, workspace.getNodes().size());
assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
assertEquals(pojo, workspace.getNode(Fqn.fromString("/one/two")).get("key1"));
assertEquals(1, workspace.getNode(Fqn.fromString("/one/two")).getMergedData().size());
assertTrue(entry.getLocks().isEmpty());
assertEquals(1, entry.getModifications().size());
assertTrue(!cache.exists("/one/two"));
assertEquals(null, dummy.getCalled());
//lets change one of the underlying version numbers
//now let us do a prepare
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
fail();
}
catch (Throwable t)
{
assertTrue(true);
}
MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, gtx);
TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
assertEquals(3, workspace.getNodes().size());
assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
assertEquals(pojo, workspace.getNode(Fqn.fromString("/one/two")).get("key1"));
assertEquals(1, workspace.getNode(Fqn.fromString("/one/two")).getMergedData().size());
assertTrue(entry.getLocks().isEmpty());
assertEquals(1, entry.getModifications().size());
assertEquals(commitMethod.getMethod(), dummy.getCalled());
NodeSPI<Object, Object> node = workspace.getNode(Fqn.fromString("/")).getNode();
//assert we can navigate