Search in sources :

Example 1 with DHThreadObject3b

use of com.hp.mwtests.ts.jts.orbspecific.resources.DHThreadObject3b 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)

Aggregations

ORB (com.arjuna.orbportability.ORB)1 RootOA (com.arjuna.orbportability.RootOA)1 Services (com.arjuna.orbportability.Services)1 DHThreadObject3b (com.hp.mwtests.ts.jts.orbspecific.resources.DHThreadObject3b)1 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)1 IntHolder (org.omg.CORBA.IntHolder)1