use of com.arjuna.orbportability.ORB in project narayana by jbosstm.
the class JTAHammer 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);
String xaResource = "com.hp.mwtests.ts.jta.jts.common.DummyCreator";
String connectionString = null;
int threads = 10;
int work = 100;
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());
/*
* We should have a reference to a factory object (see JTA
* specification). However, for simplicity we will ignore this.
*/
XACreator creator = (XACreator) Thread.currentThread().getContextClassLoader().loadClass(xaResource).newInstance();
number = threads;
int numberOfTransactions = threads * work;
long stime = Calendar.getInstance().getTime().getTime();
Worker[] workers = new Worker[threads];
for (int i = 0; i < threads; i++) {
workers[i] = new Worker(creator, connectionString, work);
workers[i].start();
}
JTAHammer.doWait();
long ftime = Calendar.getInstance().getTime().getTime();
long timeTaken = ftime - stime;
System.out.println("time for " + numberOfTransactions + " write transactions is " + timeTaken);
System.out.println("number of transactions: " + numberOfTransactions);
System.out.println("throughput: " + (float) (numberOfTransactions / (timeTaken / 1000.0)));
myOA.destroy();
myORB.shutdown();
}
use of com.arjuna.orbportability.ORB in project narayana by jbosstm.
the class SimpleNestedDisabledTest method testDisabled.
@Test
public void testDisabled() 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());
jtaPropertyManager.getJTAEnvironmentBean().setSupportSubtransactions(false);
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
transactionManager.begin();
try {
transactionManager.begin();
fail();
} catch (final NotSupportedException ex) {
}
transactionManager.commit();
myOA.destroy();
myORB.shutdown();
}
use of com.arjuna.orbportability.ORB 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);
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
boolean passed = false;
transactionManager.setTransactionTimeout(3);
transactionManager.begin();
Thread.currentThread().sleep(4000);
try {
transactionManager.commit();
} catch (final javax.transaction.RollbackException ex) {
passed = true;
}
assertTrue(passed);
}
use of com.arjuna.orbportability.ORB in project narayana by jbosstm.
the class JTSObjStoreBrowserTest method initOrb.
@BeforeClass
public static void initOrb() throws InvalidName {
int recoveryOrbPort = jtsPropertyManager.getJTSEnvironmentBean().getRecoveryManagerPort();
final Properties p = new Properties();
p.setProperty("OAPort", "" + recoveryOrbPort);
p.setProperty("com.sun.CORBA.POA.ORBPersistentServerPort", "" + recoveryOrbPort);
p.setProperty("com.sun.CORBA.POA.ORBServerId", "" + recoveryOrbPort);
ORB orb = ORB.getInstance("test");
OA oa = OA.getRootOA(orb);
orb.initORB(new String[] {}, p);
oa.initOA();
ORBManager.setORB(orb);
ORBManager.setPOA(oa);
}
use of com.arjuna.orbportability.ORB 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();
}
Aggregations