Search in sources :

Example 1 with TransactionImple

use of com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple in project narayana by jbosstm.

the class SubordinateTxUnitTest method testTransactionImple.

@Test
public void testTransactionImple() throws Exception {
    TransactionImple tx = new TransactionImple(0);
    TransactionImple dummy = new TransactionImple(0);
    assertFalse(tx.equals(dummy));
    try {
        tx.commit();
        fail();
    } catch (final IllegalStateException ex) {
    }
    try {
        tx.rollback();
        fail();
    } catch (InvalidTerminationStateException ex) {
    }
    assertEquals(tx.doPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
    tx.doCommit();
    dummy.doRollback();
    tx = new TransactionImple(10);
    tx.doOnePhaseCommit();
    tx.doForget();
    tx.doBeforeCompletion();
    assertTrue(tx.toString() != null);
    assertTrue(tx.activated());
}
Also used : TransactionImple(com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple) InvalidTerminationStateException(com.arjuna.ats.jta.exceptions.InvalidTerminationStateException) Test(org.junit.Test)

Aggregations

TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.TransactionImple)1 InvalidTerminationStateException (com.arjuna.ats.jta.exceptions.InvalidTerminationStateException)1 Test (org.junit.Test)1