Search in sources :

Example 26 with ORB

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();
}
Also used : RootOA(com.arjuna.orbportability.RootOA) XACreator(com.hp.mwtests.ts.jta.jts.common.XACreator) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 27 with ORB

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();
}
Also used : RootOA(com.arjuna.orbportability.RootOA) NotSupportedException(javax.transaction.NotSupportedException) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 28 with ORB

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);
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 29 with ORB

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);
}
Also used : OA(com.arjuna.orbportability.OA) Properties(java.util.Properties) ORB(com.arjuna.orbportability.ORB) BeforeClass(org.junit.BeforeClass)

Example 30 with ORB

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();
}
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)93 RootOA (com.arjuna.orbportability.RootOA)71 Test (org.junit.Test)57 OA (com.arjuna.orbportability.OA)20 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)20 Control (org.omg.CosTransactions.Control)20 Services (com.arjuna.orbportability.Services)19 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)9 PerfTestInterface (org.jboss.jbossts.qa.performance.PerfTestInterface)7 SystemException (org.omg.CORBA.SystemException)7 IntHolder (org.omg.CORBA.IntHolder)6 Coordinator (org.omg.CosTransactions.Coordinator)6 UserException (org.omg.CORBA.UserException)5 Properties (java.util.Properties)4 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)4 Terminator (org.omg.CosTransactions.Terminator)4 AtomicObject (com.hp.mwtests.ts.jts.orbspecific.resources.AtomicObject)3 Status (org.omg.CosTransactions.Status)3 TransactionFactory (org.omg.CosTransactions.TransactionFactory)3 TransactionFactoryImple (com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple)2