Search in sources :

Example 81 with ORB

use of com.arjuna.orbportability.ORB in project narayana by jbosstm.

the class MultipleORBInstances method test.

@Test
public void test() {
    ORB[] orbInstance = new ORB[NUMBER_OF_ORBOAS];
    RootOA[] oaInstance = new RootOA[NUMBER_OF_ORBOAS];
    for (int count = 0; count < NUMBER_OF_ORBOAS; count++) {
        System.out.println("Creating ORB and OA #" + count);
        orbInstance[count] = ORB.getInstance("orb_" + count);
        oaInstance[count] = RootOA.getRootOA(orbInstance[count]);
        assertTrue(initialiseORBandOA(new String[] {}, orbInstance[count], oaInstance[count]));
    }
    assertTrue(ensureAllORBReferencesAreUnique(orbInstance, oaInstance));
    System.out.println("Retrieving all ORBs and OAs");
    for (int count = 0; count < NUMBER_OF_ORBOAS; count++) {
        System.out.println("Retrieving ORB and OA #" + count);
        ORB orb = ORB.getInstance("orb_" + count);
        assertNotNull(orb);
        assertNotNull(OA.getRootOA(orb));
    }
    System.out.println("Destroying all ORBs and OAs");
    for (int count = 0; count < NUMBER_OF_ORBOAS; count++) {
        orbInstance[count].destroy();
        oaInstance[count].destroy();
    }
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 82 with ORB

use of com.arjuna.orbportability.ORB in project narayana by jbosstm.

the class OAPrePostShutdownTest method testOAShutdownCalled.

@Test
public void testOAShutdownCalled() throws Exception {
    ORB orb = ORB.getInstance("main_orb");
    RootOA oa = RootOA.getRootOA(orb);
    System.out.println("Initialising ORB and OA");
    orb.initORB(new String[] {}, null);
    oa.initOA();
    _currentState = NONE;
    /**
     * Register pre and post shutdown handlers
     */
    oa.addPreShutdown(new TestPreShutdown("PreShutdown", this));
    oa.addPostShutdown(new TestPostShutdown("PostShutdown", this));
    System.out.println("Shutting down ORB (expecting OA to also be destroyed)");
    orb.shutdown();
    /*
       * Ensure final state is correct
       */
    System.out.println("Final state: " + PrettyPrintState(_currentState));
    assertEquals(POSTSHUTDOWN, _currentState);
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 83 with ORB

use of com.arjuna.orbportability.ORB in project narayana by jbosstm.

the class OAPrePostShutdownTest method test.

@Test
public void test() throws Exception {
    ORB orb = ORB.getInstance("main_orb");
    RootOA oa = RootOA.getRootOA(orb);
    System.out.println("Initialising ORB and OA");
    orb.initORB(new String[] {}, null);
    oa.initOA();
    _currentState = NONE;
    /**
     * Register pre and post shutdown handlers
     */
    oa.addPreShutdown(new TestPreShutdown("PreShutdown", this));
    oa.addPostShutdown(new TestPostShutdown("PostShutdown", this));
    System.out.println("Shutting down ORB and OA");
    oa.destroy();
    orb.shutdown();
    /*
       * Ensure final state is correct
       */
    System.out.println("Final state: " + PrettyPrintState(_currentState));
    assertEquals(POSTSHUTDOWN, _currentState);
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 84 with ORB

use of com.arjuna.orbportability.ORB in project narayana by jbosstm.

the class ORBInitialisationTest method test.

@Test
public void test() {
    ORB orb = ORB.getInstance("main_orb");
    RootOA oa = RootOA.getRootOA(orb);
    try {
        _currentState = NONE;
        /*
            * Registering attributes with ORB
            */
        orb.addAttribute(new PreTestAttribute(this));
        orb.addAttribute(new PostTestAttribute(this));
        /*
	         * Initialise the ORB and OA
	         */
        System.out.println("Initialising ORB and OA");
        orb.initORB(new String[] {}, null);
        oa.initOA();
        assertEquals(POSTINIT, _currentState);
    } catch (Exception e) {
        fail("Initialisation failed: " + e);
    }
    oa.destroy();
    orb.shutdown();
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB) Test(org.junit.Test)

Example 85 with ORB

use of com.arjuna.orbportability.ORB in project narayana by jbosstm.

the class PropertyInitTest method test.

@Test
public void test() {
    Properties testProps = System.getProperties();
    testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"), "com.hp.mwtests.orbportability.initialisation.preinit.AllPreInitialisation");
    testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb"), "com.hp.mwtests.orbportability.initialisation.postinit.AllPostInitialisation");
    testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME), "com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation");
    testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME), "com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation");
    testProps.setProperty(PreInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME_2), "com.hp.mwtests.orbportability.initialisation.preinit.PreInitialisation2");
    testProps.setProperty(PostInitLoader.generateORBPropertyName("com.arjuna.orbportability.orb", ORB_INSTANCE_NAME_2), "com.hp.mwtests.orbportability.initialisation.postinit.PostInitialisation2");
    System.setProperties(testProps);
    ORB orb = ORB.getInstance(ORB_INSTANCE_NAME);
    orb.initORB(new String[] {}, null);
    assertTrue(PreInitialisation._called);
    assertTrue(PostInitialisation._called);
    assertTrue(PreInitialisation2._called);
    assertTrue(PostInitialisation2._called);
    assertTrue(AllPreInitialisation._called);
    assertTrue(AllPostInitialisation._called);
    try {
        /**
         * Reset called flags on All ORB instance pre-initialisation
         */
        AllPreInitialisation._called = false;
        AllPostInitialisation._called = false;
        orb = ORB.getInstance(ORB_INSTANCE_NAME_2);
        System.out.println("Initialising Second ORB Instance");
        orb.initORB(new String[] {}, null);
    } catch (Exception e) {
        e.printStackTrace(System.err);
        fail("ERROR - " + e);
    }
    assertTrue(PreInitialisation2._called);
    assertTrue(PostInitialisation2._called);
    assertTrue(AllPreInitialisation._called);
    assertTrue(AllPostInitialisation._called);
    try {
        orb.destroy();
    } catch (Exception e) {
        fail("ERROR - " + e);
        e.printStackTrace(System.err);
    }
}
Also used : Properties(java.util.Properties) 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