c.put("/one/two", "key1", "value");
GlobalTransaction gtx = c.getCurrentTransaction(tx, true);
TransactionTable table = c.getTransactionTable();
OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
assertNotNull(mgr.getTransaction());
MethodCall meth = entry.getModifications().get(0);
mgr.commit();
GlobalTransaction remoteGtx = new GlobalTransaction();
remoteGtx.setAddress(new DummyAddress());
//hack the method call to make it have the remote gtx
meth.getArgs()[0] = remoteGtx;
//call our remote method
MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null,
remoteGtx.getAddress(), Boolean.FALSE);
TestingUtil.getRemoteDelegate(c)._replicate(prepareMethod);
//our thread should be null
assertNull(mgr.getTransaction());
// there should be a registration for the remote gtx
assertNotNull(table.get(remoteGtx));
assertNotNull(table.getLocalTransaction(remoteGtx));
//assert that this is populated
//assert that the remote prepare has populated the local workspace
assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
List<?> calls = dummy.getAllCalled();
assertEquals(MethodDeclarations.optimisticPrepareMethod, calls.get(2));
assertEquals(1, c.getTransactionTable().getNumGlobalTransactions());
assertEquals(1, c.getTransactionTable().getNumLocalTransactions());