mockComponent = new DefaultInterceptor() {
public Object invoke(InstanceContext newInstanceContext) throws Throwable {
MockConnection mockConnection = (MockConnection) connectionFactory.getConnection();
mockManagedConnection = mockConnection.getManagedConnection();
userTransaction.begin();
MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
assertEquals("XAResource should know one xid", 1, mockXAResource.getKnownXids().size());
assertNull("Should not be committed", mockXAResource.getCommitted());
userTransaction.commit();
assertNotNull("Should be committed", mockXAResource.getCommitted());
mockConnection.close();
return null;
}
};
transactionContextManager.newUnspecifiedTransactionContext();
userTransaction = new UserTransactionImpl();
userTransaction.setUp(transactionContextManager, connectionTrackingCoordinator);
userTransaction.setOnline(true);
defaultComponentInterceptor.invoke(defaultComponentContext);
MockXAResource mockXAResource = (MockXAResource) mockManagedConnection.getXAResource();
assertEquals("XAResource should know 1 xid", 1, mockXAResource.getKnownXids().size());
assertNotNull("Should be committed", mockXAResource.getCommitted());
mockXAResource.clear();
}