Search in sources :

Example 6 with Services

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

the class DistributedHammer2 method main.

public static void main(String[] args) throws Exception {
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    String server1 = args[0];
    String server2 = args[1];
    try {
        Services serv = new Services(myORB);
        DistributedHammerWorker2.hammerObject_1 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server1)));
        DistributedHammerWorker2.hammerObject_2 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server2)));
        TestUtility.assertTrue(DistributedHammerWorker2.hammerObject_1.set(START_VALUE_1, null));
        TestUtility.assertTrue(DistributedHammerWorker2.hammerObject_2.set(START_VALUE_2, null));
        DistributedHammerWorker2.get12('m', 0);
        DistributedHammerWorker2.get21('m', 0);
    } catch (Exception e) {
        TestUtility.fail("DistributedHammer2: " + e);
        e.printStackTrace(System.err);
    }
    TaskProgress progress1 = TaskMonitor.INSTANCE.monitorProgress("DistributedHammer2", "DistributedHammer2", 60000L);
    TaskProgress progress2 = TaskMonitor.INSTANCE.monitorProgress("DistributedHammer2", "DistributedHammer2", 60000L);
    DHThreadObject2 thr1 = new DHThreadObject2(progress1, '1');
    DHThreadObject2 thr2 = new DHThreadObject2(progress2, '2');
    thr1.start();
    thr2.start();
    try {
        thr1.join();
        thr2.join();
    } catch (InterruptedException e) {
        TestUtility.fail("DistributedHammer2: " + e);
        e.printStackTrace(System.err);
    }
    DistributedHammerWorker2.get12('m', 0);
    DistributedHammerWorker2.get21('m', 0);
    IntHolder value1 = new IntHolder(0);
    IntHolder value2 = new IntHolder(0);
    boolean assert1 = DistributedHammerWorker2.get1(value1) | DistributedHammerWorker2.get2(value2);
    boolean assert2 = EXPECTED_RESULT == (value1.value + value2.value);
    TestUtility.assertTrue(DistributedHammerWorker2.get1(value1) | DistributedHammerWorker2.get2(value2));
    TestUtility.assertEquals(EXPECTED_RESULT, (value1.value + value2.value));
    myOA.destroy();
    myORB.shutdown();
    int res = assert1 && assert2 && progress1.isFinished() && progress2.isFinished() ? 0 : 1;
    System.out.printf("%s%n", (res == 0 ? "Passed" : "Failed"));
    System.exit(res);
}
Also used : ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) Services(com.arjuna.orbportability.Services) DHThreadObject2(com.hp.mwtests.ts.jts.orbspecific.resources.DHThreadObject2) IntHolder(org.omg.CORBA.IntHolder) RootOA(com.arjuna.orbportability.RootOA) TaskProgress(com.hp.mwtests.ts.jts.utils.TaskProgress) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Example 7 with Services

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

the class ExplicitInterClient method main.

public static void main(String[] args) throws Exception {
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    CurrentImple current = OTSImpleManager.current();
    Control theControl = null;
    String objectReference = args[0];
    SetGet SetGetVar = null;
    short h = 0;
    try {
        current.begin();
        current.begin();
        current.begin();
    } catch (Exception e) {
        TestUtility.fail("Caught exception during begin: " + e);
        e.printStackTrace(System.err);
    }
    try {
        Services serv = new Services(myORB);
        SetGetVar = SetGetHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(objectReference)));
    } catch (Exception ex) {
        TestUtility.fail("Failed to bind to setget server: " + ex);
        ex.printStackTrace(System.err);
    }
    try {
        theControl = current.get_control();
        SetGetVar.set((short) 2, theControl);
        // SetGetVar.set((short) 2, theControl);
        theControl = null;
        System.out.println("Set value.");
    } catch (Exception ex1) {
        TestUtility.fail("Unexpected system exception during set: " + ex1);
        ex1.printStackTrace(System.err);
    }
    try {
        System.out.println("committing first nested action");
        current.commit(true);
        // SetGetVar.set((short) 4, current.get_control());
        System.out.println("committing second nested action");
        current.commit(true);
    } catch (Exception sysEx) {
        TestUtility.fail("Caught unexpected exception during commit: " + sysEx);
        sysEx.printStackTrace(System.err);
    }
    try {
        theControl = current.get_control();
        h = SetGetVar.get(theControl);
        theControl = null;
        System.out.println("Got value.");
    } catch (Exception ex2) {
        TestUtility.fail("Unexpected system exception during get: " + ex2);
        ex2.printStackTrace(System.err);
    }
    try {
        current.commit(true);
        System.out.println("committed top-level action");
    } catch (Exception ep) {
        TestUtility.fail("Caught commit exception for top-level action: " + ep);
        ep.printStackTrace(System.err);
    }
    myOA.destroy();
    myORB.shutdown();
    System.out.println("Passed");
}
Also used : ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) Services(com.arjuna.orbportability.Services) Control(org.omg.CosTransactions.Control) SetGet(com.hp.mwtests.ts.jts.TestModule.SetGet) RootOA(com.arjuna.orbportability.RootOA) CurrentImple(com.arjuna.ats.internal.jts.orbspecific.CurrentImple) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Example 8 with Services

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

the class DistributedHammer1 method main.

public static void main(String[] args) throws Exception {
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    String server1 = args[0];
    String server2 = args[1];
    try {
        Services serv = new Services(myORB);
        DistributedHammerWorker1.hammerObject_1 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server1)));
        DistributedHammerWorker1.hammerObject_2 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server2)));
        TestUtility.assertTrue(DistributedHammerWorker1.hammerObject_1.set(START_VALUE_1, null));
        TestUtility.assertTrue(DistributedHammerWorker1.hammerObject_2.set(START_VALUE_2, null));
        DistributedHammerWorker1.get12('m', 0);
        DistributedHammerWorker1.get21('m', 0);
    } catch (Exception e) {
        TestUtility.fail("DistributedHammer1: " + e);
        e.printStackTrace(System.err);
    }
    for (int i = 0; i < 100; i++) DistributedHammerWorker1.randomOperation('1', 0);
    DistributedHammerWorker1.get12('m', 0);
    DistributedHammerWorker1.get21('m', 0);
    IntHolder value1 = new IntHolder(0);
    IntHolder value2 = new IntHolder(0);
    TestUtility.assertTrue(DistributedHammerWorker1.get1(value1) | DistributedHammerWorker1.get2(value2));
    TestUtility.assertEquals(EXPECTED_RESULT, (value1.value + value2.value));
    myOA.destroy();
    myORB.shutdown();
    System.out.println("Passed");
}
Also used : ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) Services(com.arjuna.orbportability.Services) IntHolder(org.omg.CORBA.IntHolder) RootOA(com.arjuna.orbportability.RootOA) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Example 9 with Services

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

the class DistributedHammer3 method main.

public static void main(String[] args) throws Exception {
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    String server1 = args[0];
    String server2 = args[1];
    try {
        Services serv = new Services(myORB);
        DistributedHammerWorker3.hammerObject_1 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server1)));
        DistributedHammerWorker3.hammerObject_2 = HammerHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(server2)));
        TestUtility.assertTrue(DistributedHammerWorker3.hammerObject_1.set(START_VALUE_1, null));
        TestUtility.assertTrue(DistributedHammerWorker3.hammerObject_2.set(START_VALUE_2, null));
        DistributedHammerWorker3.get12(0, 0);
        DistributedHammerWorker3.get21(0, 0);
    } catch (Exception e) {
        TestUtility.fail("DistributedHammer3: " + e);
        e.printStackTrace(System.err);
    }
    DHThreadObject3b thr1 = new DHThreadObject3b(1);
    DHThreadObject3b thr2 = new DHThreadObject3b(2);
    thr1.start();
    thr2.start();
    try {
        thr1.join();
        thr2.join();
    } catch (InterruptedException e) {
        System.err.println(e);
    }
    DistributedHammerWorker3.get12(0, 0);
    DistributedHammerWorker3.get21(0, 0);
    IntHolder value1 = new IntHolder(0);
    IntHolder value2 = new IntHolder(0);
    TestUtility.assertTrue(DistributedHammerWorker3.get1(value1) | DistributedHammerWorker3.get2(value2));
    TestUtility.assertEquals(EXPECTED_RESULT, (value1.value + value2.value));
    myOA.destroy();
    myORB.shutdown();
    System.out.println("Passed");
}
Also used : ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) Services(com.arjuna.orbportability.Services) DHThreadObject3b(com.hp.mwtests.ts.jts.orbspecific.resources.DHThreadObject3b) IntHolder(org.omg.CORBA.IntHolder) RootOA(com.arjuna.orbportability.RootOA) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Example 10 with Services

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

the class ImplGridServer method main.

public static void main(String[] args) throws Exception {
    ServerORB orb = new ServerORB();
    ORB myORB = orb.getORB();
    RootOA myOA = orb.getOA();
    String refFile = args[0];
    trangrid_i gridI = new trangrid_i((short) 100, (short) 100);
    Services serv = new Services(myORB);
    try {
        TestUtility.registerService(refFile, myORB.orb().object_to_string(gridI.getReference()));
        System.out.println("Ready");
        myOA.run();
    } catch (Exception e) {
        TestUtility.fail("ImplGrid server caught exception: " + e);
    }
    myOA.shutdownObject(gridI);
    System.out.println("**ImplGrid server exiting**");
}
Also used : com.hp.mwtests.ts.jts.orbspecific.resources.trangrid_i(com.hp.mwtests.ts.jts.orbspecific.resources.trangrid_i) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) Services(com.arjuna.orbportability.Services) RootOA(com.arjuna.orbportability.RootOA) ServerORB(com.hp.mwtests.ts.jts.utils.ServerORB) ORB(com.arjuna.orbportability.ORB)

Aggregations

Services (com.arjuna.orbportability.Services)21 ORB (com.arjuna.orbportability.ORB)19 RootOA (com.arjuna.orbportability.RootOA)18 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)16 Control (org.omg.CosTransactions.Control)6 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)5 Test (org.junit.Test)5 IntHolder (org.omg.CORBA.IntHolder)5 TransactionFactory (org.omg.CosTransactions.TransactionFactory)3 SetGet (com.hp.mwtests.ts.jts.TestModule.SetGet)2 TestModule.grid (com.hp.mwtests.ts.jts.TestModule.grid)2 com.hp.mwtests.ts.jts.orbspecific.resources.trangrid_i (com.hp.mwtests.ts.jts.orbspecific.resources.trangrid_i)2 OA (com.arjuna.orbportability.OA)1 SimpleObjectImpl (com.hp.mwtests.orbportability.orbspecific.orbinstance.SimpleObjectImpl)1 ExplicitStackPOATie (com.hp.mwtests.ts.jts.TestModule.ExplicitStackPOATie)1 HammerPOATie (com.hp.mwtests.ts.jts.TestModule.HammerPOATie)1 TranGrid (com.hp.mwtests.ts.jts.TestModule.TranGrid)1 TestModule.stack (com.hp.mwtests.ts.jts.TestModule.stack)1 TestModule.stackPOATie (com.hp.mwtests.ts.jts.TestModule.stackPOATie)1 DHThreadObject2 (com.hp.mwtests.ts.jts.orbspecific.resources.DHThreadObject2)1