Search in sources :

Example 6 with DummyXA

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

the class XAResourceRecordUnitTest method testValid2PC.

@Test
public void testValid2PC() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    TransactionImple tx = new TransactionImple();
    DummyXA res = new DummyXA(false);
    XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null);
    assertEquals(xares.prepare(), Vote.VoteCommit);
    xares.commit();
}
Also used : DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) Test(org.junit.Test)

Example 7 with DummyXA

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

the class TransactionImpleUnitTest method test.

@Test
public void test() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    TransactionImple tx = new TransactionImple();
    DummyXA res = new DummyXA(false);
    tx.enlistResource(res);
    tx.delistResource(res, XAResource.TMSUSPEND);
    assertTrue(tx.getResources() != null);
    assertTrue(tx.getTimeout() != -1);
    tx.commit();
    assertTrue(TransactionImple.getTransactions() != null);
    assertEquals(TransactionImple.getTransactions().size(), 0);
    try {
        tx = (TransactionImple) TransactionManager.transactionManager(new InitialContext());
        fail();
    } catch (final Throwable ex) {
    }
}
Also used : DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Example 8 with DummyXA

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

the class XAResourceRecordUnitTest method testValid1PC.

@Test
public void testValid1PC() throws Exception {
    ThreadActionData.purgeActions();
    OTSImpleManager.current().contextManager().purgeActions();
    TransactionImple tx = new TransactionImple();
    DummyXA res = new DummyXA(false);
    XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null);
    xares.commit_one_phase();
}
Also used : DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XAResourceRecord(com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord) TransactionImple(com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) Test(org.junit.Test)

Example 9 with DummyXA

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

the class XARecoveryResourceManagerUnitTest method test.

@Test
public void test() {
    XARecoveryResourceManagerImple man = new XARecoveryResourceManagerImple();
    assertTrue(man.getResource(new Uid()) != null);
    assertTrue(man.getResource(new Uid(), new DummyXA(false)) != null);
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XARecoveryResourceManagerImple(com.arjuna.ats.internal.jta.recovery.jts.XARecoveryResourceManagerImple) Test(org.junit.Test)

Example 10 with DummyXA

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

the class ResourceManagerFailureUnitTest method test.

@Test
public void test() throws Exception {
    transactionManager.begin();
    transactionManager.getTransaction().enlistResource(new DummyXA(true));
    transactionManager.getTransaction().enlistResource(new DummyXARMFail(true));
    transactionManager.commit();
    final int uidsCountBeforeRecovery = getUidsCount();
    final RecoveryModule recoveryModule = recoveryManager.getModules().get(0);
    recoveryModule.periodicWorkFirstPass();
    recoveryModule.periodicWorkSecondPass();
    Assert.assertEquals(uidsCountBeforeRecovery - 1, getUidsCount());
}
Also used : DummyXA(com.hp.mwtests.ts.jta.jts.common.DummyXA) XARecoveryModule(com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule) RecoveryModule(com.arjuna.ats.arjuna.recovery.RecoveryModule) Test(org.junit.Test)

Aggregations

DummyXA (com.hp.mwtests.ts.jta.jts.common.DummyXA)12 Test (org.junit.Test)12 TransactionImple (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple)9 Uid (com.arjuna.ats.arjuna.common.Uid)5 XAResourceRecord (com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord)4 XidImple (com.arjuna.ats.jta.xa.XidImple)3 DummyRecoverableXAConnection (com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection)3 SystemException (javax.transaction.SystemException)2 RecoveryModule (com.arjuna.ats.arjuna.recovery.RecoveryModule)1 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 XARecoveryModule (com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule)1 XARecoveryResourceImple (com.arjuna.ats.internal.jta.recovery.jts.XARecoveryResourceImple)1 XARecoveryResourceManagerImple (com.arjuna.ats.internal.jta.recovery.jts.XARecoveryResourceManagerImple)1 LastResourceRecord (com.arjuna.ats.internal.jta.resources.jts.orbspecific.LastResourceRecord)1 InitialContext (javax.naming.InitialContext)1 RollbackException (javax.transaction.RollbackException)1 XAException (javax.transaction.xa.XAException)1 Control (org.omg.CosTransactions.Control)1