Search in sources :

Example 16 with FailureXAResource

use of com.hp.mwtests.ts.jta.common.FailureXAResource in project narayana by jbosstm.

the class XAResourceRecordUnitTest method testCommitFailure.

@Test
public void testCommitFailure() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    FailureXAResource fxa = new FailureXAResource(FailureXAResource.FailLocation.commit);
    TransactionImple tx = new TransactionImple();
    XAResourceRecord xares = new XAResourceRecord(tx, fxa, tx.getTxId(), null);
    assertEquals(xares.prepare(), Vote.VoteCommit);
    try {
        xares.commit();
        fail();
    } catch (final HeuristicMixed ex) {
    }
    xares.forget();
}
Also used : XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) FailureXAResource(com.hp.mwtests.ts.jta.common.FailureXAResource) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) HeuristicMixed(org.omg.CosTransactions.HeuristicMixed) Test(org.junit.Test)

Aggregations

FailureXAResource (com.hp.mwtests.ts.jta.common.FailureXAResource)16 Test (org.junit.Test)16 TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple)12 XAException (javax.transaction.xa.XAException)9 RollbackException (javax.transaction.RollbackException)8 HeuristicMixedException (javax.transaction.HeuristicMixedException)7 XAResourceRecord (com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord)3 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)3 TestResource (com.hp.mwtests.ts.jta.common.TestResource)3 XAResourceRecord (com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord)2 SystemException (javax.transaction.SystemException)2 HeuristicMixed (org.omg.CosTransactions.HeuristicMixed)2 Uid (com.arjuna.ats.arjuna.common.Uid)1 SubordinateTransaction (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction)1 XATerminatorImple (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.XATerminatorImple)1 XidImple (com.arjuna.ats.jta.xa.XidImple)1 DummyXA (com.hp.mwtests.ts.jta.common.DummyXA)1