use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testCleanupCommit.
@Test
public void testCleanupCommit() throws Exception {
for (int i = 0; i < 1000; i++) {
final SubordinateTransaction tm = createTransaction();
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
// don't call commit for read only case.
}
assertEquals(ActionManager.manager().getNumberOfInflightTransactions(), 0);
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testCleanupSecondPhaseRollback.
@Test
public void testCleanupSecondPhaseRollback() throws Exception {
for (int i = 0; i < 1000; i++) {
final SubordinateTransaction tm = createTransaction();
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
// don't call rollback for read only case
}
assertEquals(ActionManager.manager().getNumberOfInflightTransactions(), 0);
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testPrepareRollback.
@Test
public void testPrepareRollback() throws Exception {
final SubordinateTransaction tm = createTransaction();
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
// Due to the readonly we allow the massage - this matches doPhase2Abort in ServerTransaction
tm.doRollback();
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testTwoPhaseCommitSyncWithSeparateSync.
@Test
public void testTwoPhaseCommitSyncWithSeparateSync() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.doBeforeCompletion();
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
// don't call commit for read only case
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, tm.getStatus());
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testTwoPhaseCommitSyncWithRollbackOnly.
@Test
public void testTwoPhaseCommitSyncWithRollbackOnly() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.setRollbackOnly();
assertEquals(TwoPhaseOutcome.PREPARE_NOTOK, tm.doPrepare());
tm.doRollback();
assertFalse(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_ROLLEDBACK, tm.getStatus());
}
Aggregations