Search in sources :

Example 1 with FirstXAResource

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

the class JTAOrder method test.

@Test
public void test() throws Exception {
    ORB myORB = null;
    RootOA myOA = null;
    myORB = ORB.getInstance("test");
    myOA = OA.getRootOA(myORB);
    myORB.initORB(new String[] {}, null);
    myOA.initOA();
    ORBManager.setORB(myORB);
    ORBManager.setPOA(myOA);
    boolean passed = false;
    jtaPropertyManager.getJTAEnvironmentBean().setTransactionManagerClassName(com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.class.getName());
    jtaPropertyManager.getJTAEnvironmentBean().setUserTransactionClassName(com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple.class.getName());
    try {
        javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
        XAResource theResource = new TestResource();
        FirstXAResource first = new FirstXAResource();
        LastXAResource last = new LastXAResource();
        System.out.println("Starting top-level transaction.");
        tm.begin();
        javax.transaction.Transaction theTransaction = tm.getTransaction();
        theTransaction.enlistResource(theResource);
        theTransaction.enlistResource(last);
        theTransaction.enlistResource(first);
        System.err.println("Committing transaction.");
        tm.commit();
    } catch (Exception e) {
        e.printStackTrace();
    }
    myOA.destroy();
    myORB.shutdown();
}
Also used : FirstXAResource(com.hp.mwtests.ts.jta.jts.common.FirstXAResource) RootOA(com.arjuna.orbportability.RootOA) TestResource(com.hp.mwtests.ts.jta.jts.common.TestResource) XAResource(javax.transaction.xa.XAResource) FirstXAResource(com.hp.mwtests.ts.jta.jts.common.FirstXAResource) LastXAResource(com.hp.mwtests.ts.jta.jts.common.LastXAResource) LastXAResource(com.hp.mwtests.ts.jta.jts.common.LastXAResource) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Aggregations

ORB (com.arjuna.orbportability.ORB)1 RootOA (com.arjuna.orbportability.RootOA)1 FirstXAResource (com.hp.mwtests.ts.jta.jts.common.FirstXAResource)1 LastXAResource (com.hp.mwtests.ts.jta.jts.common.LastXAResource)1 TestResource (com.hp.mwtests.ts.jta.jts.common.TestResource)1 XAResource (javax.transaction.xa.XAResource)1 Test (org.junit.Test)1