Search in sources :

Example 6 with XID

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

the class CommitMarkableResourceRecordBean method init.

private void init() {
    jndiName = getUid().stringForm();
    className = "unavailable";
    eisProductName = "unavailable";
    eisProductVersion = "unavailable";
    timeout = 0;
    heuristic = -1;
    xidImple = new XidImple(new XID());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) XID(com.arjuna.ats.internal.jta.xa.XID)

Example 7 with XID

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

the class UtilsUnitTest method testXAHelper.

@Test
public void testXAHelper() throws Exception {
    assertTrue(XAHelper.printXAErrorCode(null) != null);
    XAException ex = new XAException(XAException.XA_HEURCOM);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_HEURCOM");
    ex = new XAException(XAException.XA_HEURHAZ);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_HEURHAZ");
    ex = new XAException(XAException.XA_HEURMIX);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_HEURMIX");
    ex = new XAException(XAException.XA_HEURRB);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_HEURRB");
    ex = new XAException(XAException.XA_NOMIGRATE);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_NOMIGRATE");
    ex = new XAException(XAException.XA_RBCOMMFAIL);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBCOMMFAIL");
    ex = new XAException(XAException.XA_RBDEADLOCK);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBDEADLOCK");
    ex = new XAException(XAException.XA_RBINTEGRITY);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBINTEGRITY");
    ex = new XAException(XAException.XA_RBOTHER);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBOTHER");
    ex = new XAException(XAException.XA_RBPROTO);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBPROTO");
    ex = new XAException(XAException.XA_RBROLLBACK);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBROLLBACK");
    ex = new XAException(XAException.XA_RBTIMEOUT);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBTIMEOUT");
    ex = new XAException(XAException.XA_RBTRANSIENT);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RBTRANSIENT");
    ex = new XAException(XAException.XA_RDONLY);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RDONLY");
    ex = new XAException(XAException.XA_RETRY);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XA_RETRY");
    ex = new XAException(XAException.XAER_RMERR);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_RMERR");
    ex = new XAException(XAException.XAER_ASYNC);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_ASYNC");
    ex = new XAException(XAException.XAER_DUPID);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_DUPID");
    ex = new XAException(XAException.XAER_INVAL);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_INVAL");
    ex = new XAException(XAException.XAER_NOTA);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_NOTA");
    ex = new XAException(XAException.XAER_OUTSIDE);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_OUTSIDE");
    ex = new XAException(XAException.XAER_PROTO);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_PROTO");
    ex = new XAException(XAException.XAER_RMFAIL);
    assertEquals(XAHelper.printXAErrorCode(ex), "XAException.XAER_RMFAIL");
    assertTrue(XAHelper.printXAErrorCode(new XAException(-1)) != null);
    XidImple xid1 = new XidImple(new Uid());
    XidImple xid2 = new XidImple(new Uid());
    XidImple xid3 = new XidImple(xid1);
    assertFalse(XAHelper.sameXID(xid1, xid2));
    assertTrue(XAHelper.sameXID(xid1, xid3));
    assertTrue(XAHelper.sameTransaction(xid1, xid1));
    assertTrue(XAHelper.sameTransaction(xid1, xid3));
    assertTrue(XAHelper.xidToString(xid1) != null);
    XID x = new XID();
    x.bqual_length = 1;
    x.gtrid_length = 1;
    x.data = new byte[] { '1', '2' };
    assertTrue(x.toString() != null);
    XAHelper.xidToString(new DummyXid());
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) Uid(com.arjuna.ats.arjuna.common.Uid) XID(com.arjuna.ats.internal.jta.xa.XID) XAException(javax.transaction.xa.XAException) Test(org.junit.Test)

Example 8 with XID

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

the class xidcheck method testBasic.

@Test
public void testBasic() {
    XidImple xid1 = new XidImple();
    AtomicAction A = new AtomicAction();
    assertEquals(xid1.getFormatId(), -1);
    xid1 = new XidImple(A);
    XidImple xid2 = new XidImple(new Uid());
    assertFalse(xid1.isSameTransaction(xid2));
    XidImple xid3 = new XidImple(xid1);
    assertTrue(xid3.isSameTransaction(xid1));
    assertTrue(xid1.getFormatId() != -1);
    assertTrue(xid1.getBranchQualifier().length > 0);
    assertTrue(xid1.getGlobalTransactionId().length > 0);
    assertEquals(xid1.getTransactionUid(), A.get_uid());
    assertTrue(XATxConverter.getNodeName(xid1.getXID()).equals(TxControl.getXANodeName()));
    assertTrue(xid1.getXID() != null);
    assertTrue(xid1.equals(xid3));
    XID x = new XID();
    assertFalse(xid1.equals(x));
    xid1 = new XidImple(x);
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) AtomicAction(com.arjuna.ats.arjuna.AtomicAction) Uid(com.arjuna.ats.arjuna.common.Uid) XID(com.arjuna.ats.internal.jta.xa.XID) Test(org.junit.Test)

Aggregations

XID (com.arjuna.ats.internal.jta.xa.XID)8 XidImple (com.arjuna.ats.jta.xa.XidImple)6 Uid (com.arjuna.ats.arjuna.common.Uid)3 PreparedStatement (java.sql.PreparedStatement)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataOutputStream (java.io.DataOutputStream)2 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 NamingException (javax.naming.NamingException)2 DataSource (javax.sql.DataSource)2 Xid (javax.transaction.xa.Xid)2 Test (org.junit.Test)2 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)1 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)1 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 DataInputStream (java.io.DataInputStream)1 ResultSet (java.sql.ResultSet)1