assertNotNull("Tx should have been set up by now", cache.getInvocationContext().getTransaction());
assertEquals("The same current transaction should be associated with this invocation ctx.", tm.getTransaction(), cache.getInvocationContext().getTransaction());
assertNotNull("Gtx should have been set up by now", cache.getInvocationContext().getGlobalTransaction());
Transaction tx = tm.getTransaction();
TransactionContext transactionContext = tt.get(tt.get(tx));
if (commit)
{
tm.commit();
}
else
{
tm.rollback();
}
assertNull("Tx should have been scrubbed", cache.getInvocationContext().getTransaction());
assertNull("Gtx should have been scrubbed", cache.getInvocationContext().getGlobalTransaction());
assertEquals("Method call should have been scrubbed", null, cache.getInvocationContext().getMethodCall());
assertEquals("Cache command should have been scrubbed", null, cache.getInvocationContext().getCommand());
// check that the transaction transactionContext hasn't leaked stuff.
assert transactionContext.getModifications().isEmpty() : "Should have scrubbed modifications in transaction transactionContext";
assert transactionContext.getLocks().isEmpty() : "Should have scrubbed modifications in transaction transactionContext";
assert transactionContext.getOrderedSynchronizationHandler() == null : "Should have removed the ordered sync handler";
}