assertEquals(null, dummy.getCalledCommand());
TransactionTable table = cache.getTransactionTable();
GlobalTransaction gtx = table.get(tx);
OptimisticTransactionContext entry = (OptimisticTransactionContext) 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.getCalledCommand());
//lets change one of the underlying version numbers
//now let us do a prepare
OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(gtx, entry.getModifications(), (Address) gtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.replicateCommand(cache, prepareCommand);
fail();
}
catch (Throwable t)
{
assertTrue(true);
}
CommitCommand commitCommand = new CommitCommand(gtx);
TestingUtil.replicateCommand(cache, commitCommand);
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(commitCommand, dummy.getCalledCommand());
NodeSPI<Object, Object> node = workspace.getNode(Fqn.fromString("/")).getNode();
//assert we can navigate