}
public void testTwoPhaseCommitSyncWithXAOKViaXATerminator() throws Exception
{
final Xid xid = new XidImple(new Uid());
final TransactionImple tm = TxImporter.importTransaction(xid);
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
final TestXAResource xaResource = new TestXAResource();
xaResource.setPrepareReturnValue(XAResource.XA_OK);
tm.enlistResource(xaResource);
final XATerminator xaTerminator = new XATerminatorImple();
assertEquals(XAResource.XA_OK, xaTerminator.prepare(xid));
xaTerminator.commit(xid, false);
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, tm.getStatus());
}