Search in sources :

Example 1 with LastXAResource

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

the class JTAOrder method test.

@Test
public void test() throws Exception {
    XAResource theResource = new TestResource();
    FirstXAResource first = new FirstXAResource();
    LastXAResource last = new LastXAResource();
    javax.transaction.TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
    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.out.println("Committing transaction.");
    tm.commit();
    assertEquals(Status.STATUS_COMMITTED, theTransaction.getStatus());
}
Also used : LastXAResource(com.hp.mwtests.ts.jta.common.LastXAResource) XAResource(javax.transaction.xa.XAResource) FirstXAResource(com.hp.mwtests.ts.jta.common.FirstXAResource) FirstXAResource(com.hp.mwtests.ts.jta.common.FirstXAResource) TestResource(com.hp.mwtests.ts.jta.common.TestResource) LastXAResource(com.hp.mwtests.ts.jta.common.LastXAResource) Test(org.junit.Test)

Aggregations

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