GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
TransactionTable table = cache.getTransactionTable();
OptimisticTransactionContext entry = (OptimisticTransactionContext) table.get(gtx);
assertNotNull(mgr.getTransaction());
WriteCommand command = entry.getModifications().get(0);
mgr.commit();
//test local calls
List<?> calls = dummy.getAllCalledIds();
assertEquals(OptimisticPrepareCommand.METHOD_ID, calls.get(0));
assertEquals(CommitCommand.METHOD_ID, calls.get(1));
assertNull(mgr.getTransaction());
assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
GlobalTransaction remoteGtx = new GlobalTransaction();
remoteGtx.setAddress(EasyMock.createNiceMock(Address.class));
//hack the method call to make it have the remote globalTransaction
command.setGlobalTransaction(remoteGtx);
//call our remote method
OptimisticPrepareCommand prepareCommand = new OptimisticPrepareCommand(remoteGtx, injectDataVersion(entry.getModifications()), (Address) remoteGtx.getAddress(), Boolean.FALSE);
try
{
TestingUtil.replicateCommand(cache, prepareCommand);