TransactionTable table = cache.getTransactionTable();
GlobalTransaction gtx = table.get(tx);
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
@SuppressWarnings("unchecked")
TransactionWorkspace<Object, Object> workspace = entry.getTransactionWorkSpace();
//resume the suspended transaction
GlobalTransaction gtx2 = table.get(tx2);
OptimisticTransactionEntry entry2 = (OptimisticTransactionEntry) table.get(gtx2);
@SuppressWarnings("unchecked")
TransactionWorkspace<Object, Object> workspace2 = entry2.getTransactionWorkSpace();
//commit both tx
mgr.commit();
mgr.resume(tx);
mgr.commit();
//assert that our keys are in one space
assertEquals(3, workspace.getNodes().size());
assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
assertEquals(pojo, workspace.getNode(Fqn.fromString("/one/two")).get("key1"));
assertEquals(null, workspace.getNode(Fqn.fromString("/one/two")).get("key2"));
assertTrue(entry.getLocks().isEmpty());
assertEquals(1, entry.getModifications().size());
//assert that our keys are in one space
assertEquals(3, workspace2.getNodes().size());
assertNotNull(workspace2.getNode(Fqn.fromString("/one/two")));
assertEquals(null, workspace2.getNode(Fqn.fromString("/one/two")).get("key1"));
assertEquals(pojo2, workspace2.getNode(Fqn.fromString("/one/two")).get("key2"));
assertTrue(entry2.getLocks().isEmpty());
assertEquals(1, entry2.getModifications().size());
assertTrue(!cache.exists("/one/two"));
assertEquals(null, dummy.getCalled());
}