use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testOnePhaseCommitSyncWithSeparateSync.
// ///////////
@Test
public void testOnePhaseCommitSyncWithSeparateSync() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.doBeforeCompletion();
tm.doOnePhaseCommit();
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 testRollbackSyncWithSeparateSync.
@Test
public void testRollbackSyncWithSeparateSync() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.doBeforeCompletion();
tm.doRollback();
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_ROLLEDBACK, tm.getStatus());
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testCleanupOnePhaseCommit.
@Test
public void testCleanupOnePhaseCommit() throws Exception {
for (int i = 0; i < 1000; i++) {
final SubordinateTransaction tm = createTransaction();
tm.doOnePhaseCommit();
}
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 testOnePhaseCommitSyncWithRollbackOnlyWithSeparateSync.
@Test
public void testOnePhaseCommitSyncWithRollbackOnlyWithSeparateSync() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.setRollbackOnly();
tm.doBeforeCompletion();
try {
tm.doOnePhaseCommit();
fail("did not get expected rollback exception");
} catch (RollbackException e) {
// expected - we tried to commit a rollbackonly tx.
}
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_ROLLEDBACK, tm.getStatus());
}
use of com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction in project narayana by jbosstm.
the class SubordinateTestCase method testOnePhaseCommitSyncWithRollbackOnly.
@Test
public void testOnePhaseCommitSyncWithRollbackOnly() throws Exception {
final SubordinateTransaction tm = createTransaction();
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
tm.setRollbackOnly();
try {
tm.doOnePhaseCommit();
fail("did not get expected rollback exception");
} catch (RollbackException e) {
// expected - we tried to commit a rollbackonly tx.
}
assertFalse(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_ROLLEDBACK, tm.getStatus());
}
Aggregations