Search in sources :

Example 21 with XidImple

use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.

the class OnePhaseUnitTest method test.

@Test
public void test() throws Exception {
    DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
    Object[] obj = new Object[1];
    SampleOnePhaseResource res = new SampleOnePhaseResource();
    obj[XAResourceRecord.XACONNECTION] = rc;
    XAOnePhaseResource xares = new XAOnePhaseResource(res, new XidImple(new Uid()), obj);
    OutputObjectState os = new OutputObjectState();
    xares.pack(os);
    InputObjectState is = new InputObjectState(os);
    xares.unpack(is);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) DummyRecoverableXAConnection(com.hp.mwtests.ts.jta.common.DummyRecoverableXAConnection) Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) Test(org.junit.Test)

Example 22 with XidImple

use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.

the class OnePhaseUnitTest method testCommit.

@Test
public void testCommit() {
    SampleOnePhaseResource res = new SampleOnePhaseResource();
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
    assertTrue(res.onePhaseCalled());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XAOnePhaseResource(com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource) SampleOnePhaseResource(com.hp.mwtests.ts.jta.common.SampleOnePhaseResource) Test(org.junit.Test)

Example 23 with XidImple

use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.

the class xidcheck method test.

@Test
public void test() {
    Uid test = new Uid();
    XidImple xidImple = new XidImple(test, true, null);
    System.err.println("Uid is: " + test);
    System.err.println("Xid is: " + xidImple);
    Uid convertedUid = xidImple.getTransactionUid();
    assertEquals(test, convertedUid);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) Test(org.junit.Test)

Example 24 with XidImple

use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.

the class TxInfoUnitTest method test.

@Test
public void test() {
    TxInfo tx = new TxInfo(new XidImple(new Uid()));
    tx.setState(-1);
    assertEquals(tx.getState(), TxInfo.UNKNOWN);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) TxInfo(com.arjuna.ats.internal.jta.xa.TxInfo) Test(org.junit.Test)

Example 25 with XidImple

use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.

the class RecoveryTest method test.

@Test
public void test() {
    Vector xaRecoveryNodes = new Vector();
    xaRecoveryNodes.add("2");
    System.err.println("Bogus XA node name: " + "2");
    XidImple xid = new XidImple(new Uid());
    String nodeName = XAUtils.getXANodeName(xid);
    // should fail.
    System.err.println("XA node name: " + nodeName);
    System.err.println("Xid to recover: " + xid);
    assertFalse(xaRecoveryNodes.contains(nodeName));
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) Vector(java.util.Vector) Test(org.junit.Test)

Aggregations

XidImple (com.arjuna.ats.jta.xa.XidImple)90 Uid (com.arjuna.ats.arjuna.common.Uid)71 Test (org.junit.Test)71 Xid (javax.transaction.xa.Xid)35 XAException (javax.transaction.xa.XAException)28 SubordinateTransaction (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction)27 Transaction (javax.transaction.Transaction)16 XATerminator (javax.resource.spi.XATerminator)15 TransactionImporter (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.TransactionImporter)12 XATerminatorImple (com.arjuna.ats.internal.jta.transaction.jts.jca.XATerminatorImple)10 IOException (java.io.IOException)10 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)9 XAOnePhaseResource (com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource)9 XAResourceRecord (com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord)9 XARecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule)8 SampleOnePhaseResource (com.hp.mwtests.ts.jta.common.SampleOnePhaseResource)8 RollbackException (javax.transaction.RollbackException)8 SystemException (javax.transaction.SystemException)8 XAResource (javax.transaction.xa.XAResource)8 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)7