nodeInterceptor.setNext(dummy);
cache.setInterceptorChain(interceptor);
// first set up a node with a pojo
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
mgr.begin();
Transaction tx = mgr.getTransaction();
// inject InvocationContext
cache.getInvocationContext().setTransaction(tx);
cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));
SamplePojo pojo = new SamplePojo(21, "test");
cache.put("/one/two", "key1", pojo);
//suspend current transaction
mgr.suspend();
//start a new transaction
mgr.begin();
Transaction tx2 = mgr.getTransaction();
cache.getInvocationContext().setTransaction(tx2);
cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));
SamplePojo pojo2 = new SamplePojo(21, "test");
cache.put("/one/two", "key2", pojo2);
assertEquals(null, dummy.getCalled());
TransactionTable table = cache.getTransactionTable();
GlobalTransaction gtx = table.get(tx);
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
TransactionWorkspace workspace = entry.getTransactionWorkSpace();
//resume the suspended transaction
GlobalTransaction gtx2 = table.get(tx2);
OptimisticTransactionEntry entry2 = (OptimisticTransactionEntry) table.get(gtx2);
TransactionWorkspace 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"));