use of com.hp.mwtests.ts.jta.jts.common.TestResource 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();
}
use of com.hp.mwtests.ts.jta.jts.common.TestResource in project narayana by jbosstm.
the class SimpleTest 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);
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());
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
transactionManager.begin();
Transaction currentTrans = transactionManager.getTransaction();
TestResource res1, res2;
currentTrans.enlistResource(res1 = new TestResource());
currentTrans.enlistResource(res2 = new TestResource());
currentTrans.delistResource(res2, XAResource.TMSUCCESS);
currentTrans.delistResource(res1, XAResource.TMSUCCESS);
transactionManager.commit();
myOA.destroy();
myORB.shutdown();
}
Aggregations