Search in sources :

Example 1 with ORB

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

the class Test03 method main.

public static void main(String[] args) throws Exception {
    System.setProperty("XAConnectionRecovery1", "ExampleXAConnectionRecovery");
    ORB myORB = null;
    RootOA myOA = null;
    try {
        myORB = ORB.getInstance("test");
        myOA = OA.getRootOA(myORB);
        myORB.initORB(args, null);
        myOA.initOA();
        ORBManager.setORB(myORB);
        ORBManager.setPOA(myOA);
    } catch (Exception e) {
        System.err.println("Initialisation failed: " + e);
        System.exit(0);
    }
    com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple rm = new com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple(true);
    try {
        Thread.sleep(140000);
    } catch (Exception ex) {
    }
    if (ExampleXAResource.passed) {
        System.out.println("Passed.");
    } else {
        System.out.println("Failed.");
    }
    System.clearProperty("XAConnectionRecovery1");
}
Also used : RootOA(com.arjuna.orbportability.RootOA) ORB(com.arjuna.orbportability.ORB)

Example 2 with ORB

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

the class SingleResourceRegistration method work.

public void work() throws PerfTestException {
    try {
        /**
         * Retrieve ORB and OA references
         */
        ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
        OA oa = OA.getRootOA(orb);
        Control control = OTSManager.get_current().get_control();
        Coordinator coordinator = control.get_coordinator();
        DemoResource resource = new DemoResource();
        oa.objectIsReady(resource);
        Resource res = ResourceHelper.narrow(oa.corbaReference(resource));
        coordinator.register_resource(res);
    } catch (Exception e) {
        e.printStackTrace(System.err);
        throw new PerfTestException();
    }
}
Also used : DemoResource(org.jboss.jbossts.qa.performance.resources.DemoResource) OA(com.arjuna.orbportability.OA) Control(org.omg.CosTransactions.Control) DemoResource(org.jboss.jbossts.qa.performance.resources.DemoResource) Resource(org.omg.CosTransactions.Resource) Coordinator(org.omg.CosTransactions.Coordinator) ORB(com.arjuna.orbportability.ORB)

Example 3 with ORB

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

the class NestedTwoPhaseTrx method work.

protected void work() throws Exception {
    try {
        ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
        OA oa = OA.getRootOA(orb);
        String ref1 = getServiceConfig(0);
        String ref2 = getServiceConfig(1);
        org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
        PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
        OTSManager.get_current().begin();
        d1.work();
        org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
        PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
        OTSManager.get_current().begin();
        d2.work();
        if (isParameterDefined("-commit")) {
            // nested commit
            OTSManager.get_current().commit(true);
            // top level commit
            OTSManager.get_current().commit(true);
        } else {
            // nested rollback
            OTSManager.get_current().rollback();
            // top level rollback
            OTSManager.get_current().rollback();
        }
    } catch (Exception e) {
        System.err.println("Unexpected exception: " + e);
        e.printStackTrace(System.err);
    }
}
Also used : OA(com.arjuna.orbportability.OA) PerfTestInterface(org.jboss.jbossts.qa.performance.PerfTestInterface) ORB(com.arjuna.orbportability.ORB)

Example 4 with ORB

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

the class TwoPhaseTrx method work.

protected void work() throws Exception {
    try {
        ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
        OA oa = OA.getRootOA(orb);
        String ref1 = getServiceConfig(0);
        String ref2 = getServiceConfig(1);
        org.omg.CORBA.Object obj1 = orb.orb().string_to_object(ref1);
        PerfTestInterface d1 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj1);
        OTSManager.get_current().begin();
        d1.work();
        org.omg.CORBA.Object obj2 = orb.orb().string_to_object(ref2);
        PerfTestInterface d2 = (PerfTestInterface) PerfTestInterfaceHelper.narrow(obj2);
        d2.work();
        if (isParameterDefined("-commit")) {
            // top level commit
            OTSManager.get_current().commit(true);
        } else {
            // top level rollback
            OTSManager.get_current().rollback();
        }
    } catch (Exception e) {
        System.err.println("Unexpected Exception: " + e);
        e.printStackTrace(System.err);
    }
}
Also used : OA(com.arjuna.orbportability.OA) PerfTestInterface(org.jboss.jbossts.qa.performance.PerfTestInterface) ORB(com.arjuna.orbportability.ORB)

Example 5 with ORB

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

the class DummyImplServer method run.

/**
 * The main test method which must assert either a pass or a fail.
 */
public void run(String[] args) {
    try {
        String serviceName = args[args.length - 2];
        String serviceName2 = args[args.length - 1];
        /**
         * Retrieve ORB and OA references, intialise them
         * and then set the OTSManager ORB and OA properties
         */
        ORB orb = ORB.getInstance(PerformanceFramework.ORB_INSTANCE_NAME);
        OA oa = OA.getRootOA(orb);
        orb.initORB(args, null);
        oa.initOA(args);
        OTSManager.setORB(orb);
        OTSManager.setPOA(oa);
        DummyPerfTestImplementation obj1 = new DummyPerfTestImplementation();
        oa.objectIsReady(obj1);
        PerfTestInterface objRef1 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj1));
        ServerIORStore.storeIOR(serviceName, orb.orb().object_to_string(objRef1));
        DummyPerfTestImplementation obj2 = new DummyPerfTestImplementation();
        oa.objectIsReady(obj2);
        PerfTestInterface objRef2 = PerfTestInterfaceHelper.narrow(oa.corbaReference(obj2));
        ServerIORStore.storeIOR(serviceName2, orb.orb().object_to_string(objRef2));
        System.out.println("Ready");
        orb.orb().run();
    } catch (Exception e) {
        e.printStackTrace(System.err);
        System.out.println("Failed");
    }
}
Also used : OA(com.arjuna.orbportability.OA) DummyPerfTestImplementation(org.jboss.jbossts.qa.performance.implementations.perftestwork.DummyPerfTestImplementation) PerfTestInterface(org.jboss.jbossts.qa.performance.PerfTestInterface) ORB(com.arjuna.orbportability.ORB)

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