Search in sources :

Example 1 with SubordinateAtomicTransaction

use of com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.SubordinateAtomicTransaction in project narayana by jbosstm.

the class SubordinateTxUnitTest method testAtomicTransaction.

@Test
public void testAtomicTransaction() throws Exception {
    XidImple xid = new XidImple(new Uid());
    SubordinateAtomicTransaction saa1 = new SubordinateAtomicTransaction(new Uid());
    SubordinateAtomicTransaction saa2 = new SubordinateAtomicTransaction(new Uid(), xid, 0);
    assertEquals(saa2.getXid(), xid);
    try {
        saa2.end(true);
        fail();
    } catch (final WrongTransaction ex) {
    }
    try {
        saa2.abort();
        fail();
    } catch (final WrongTransaction ex) {
    }
    DummySubordinateAtomicTransaction dsat = new DummySubordinateAtomicTransaction();
    assertFalse(dsat.checkForCurrent());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) SubordinateAtomicTransaction(com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.SubordinateAtomicTransaction) WrongTransaction(org.omg.CORBA.WrongTransaction) Test(org.junit.Test)

Example 2 with SubordinateAtomicTransaction

use of com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.SubordinateAtomicTransaction in project narayana by jbosstm.

the class XARecoveryModuleUnitTest method testRecover.

@Test
public void testRecover() throws Exception {
    ArrayList<String> r = new ArrayList<String>();
    TransactionImple tx = new TransactionImple();
    assertTrue(tx.enlistResource(new RecoveryXAResource()));
    SubordinateAtomicTransaction sat = new SubordinateAtomicTransaction(tx.get_uid(), tx.getTxId(), 0);
    assertEquals(sat.doPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
    r.add("com.hp.mwtests.ts.jta.recovery.DummyXARecoveryResource");
    jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveryClassNames(r);
    XARecoveryModule xarm = new XARecoveryModule();
    for (int i = 0; i < 11; i++) {
        xarm.periodicWorkFirstPass();
        xarm.periodicWorkSecondPass();
    }
}
Also used : SubordinateAtomicTransaction(com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.SubordinateAtomicTransaction) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) ArrayList(java.util.ArrayList) RecoveryXAResource(com.hp.mwtests.ts.jta.common.RecoveryXAResource) XARecoveryModule(com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule) Test(org.junit.Test)

Aggregations

SubordinateAtomicTransaction (com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.SubordinateAtomicTransaction)2 Test (org.junit.Test)2 Uid (com.arjuna.ats.arjuna.common.Uid)1 XARecoveryModule (com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule)1 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)1 XidImple (com.arjuna.ats.jta.xa.XidImple)1 RecoveryXAResource (com.hp.mwtests.ts.jta.common.RecoveryXAResource)1 ArrayList (java.util.ArrayList)1 WrongTransaction (org.omg.CORBA.WrongTransaction)1