use of com.hp.mwtests.ts.jts.utils.ServerORB 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");
}
use of com.hp.mwtests.ts.jts.utils.ServerORB 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");
}
use of com.hp.mwtests.ts.jts.utils.ServerORB 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**");
}
use of com.hp.mwtests.ts.jts.utils.ServerORB in project narayana by jbosstm.
the class SynchTest method test.
@Test
public void test() {
org.omg.CosTransactions.Status status = Status.StatusUnknown;
tranobject_i localObject = null;
demosync sync = null;
ORB myORB = null;
RootOA myOA = null;
try {
ServerORB orb = new ServerORB();
myORB = orb.getORB();
myOA = orb.getOA();
Control myControl = null;
org.omg.CosTransactions.Current current = OTSManager.get_current();
Coordinator coord = null;
sync = new demosync();
localObject = new tranobject_i();
current.begin();
myControl = current.get_control();
coord = myControl.get_coordinator();
coord.register_resource(localObject.getReference());
coord.register_synchronization(sync.getReference());
try {
current.commit(true);
} catch (TRANSACTION_ROLLEDBACK e1) {
System.out.println("Transaction rolledback");
}
try {
status = coord.get_status();
} catch (SystemException ex) {
// assume reference no longer valid!
status = Status.StatusUnknown;
}
} catch (UserException e1) {
fail("Caught UserException: " + e1);
e1.printStackTrace();
} catch (SystemException e2) {
fail("Caught SystemException: " + e2);
e2.printStackTrace();
}
System.out.print("Final action status: " + com.arjuna.ats.jts.utils.Utility.stringStatus(status));
System.out.println("\nTest completed successfully.");
myOA.shutdownObject(sync);
myOA.shutdownObject(localObject);
myOA.destroy();
myORB.shutdown();
}
use of com.hp.mwtests.ts.jts.utils.ServerORB in project narayana by jbosstm.
the class ImplicitClient 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];
CurrentImple current = OTSImpleManager.current();
// pointer the grid object that will be used.
TranGrid TranGridVar = null;
short h = 0, w = 0, v = 0;
try {
current.begin();
Services serv = new Services(myORB);
TranGridVar = TranGridHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(refFile)));
try {
h = TranGridVar.height();
w = TranGridVar.width();
} catch (Exception e) {
TestUtility.fail("Invocation failed: " + e);
}
System.out.println("height is " + h);
System.out.println("width is " + w);
try {
System.out.println("calling set");
TranGridVar.set((short) 2, (short) 4, (short) 123);
System.out.println("calling get");
v = TranGridVar.get((short) 2, (short) 4);
} catch (Exception sysEx) {
TestUtility.fail("Grid set/get failed: " + sysEx);
sysEx.printStackTrace(System.err);
}
// no problem setting and getting the element:
System.out.println("trangrid[2,4] is " + v);
if (v != 123) {
// oops - we didn't:
current.rollback();
TestUtility.fail("Result not as expected");
} else {
current.commit(true);
}
} catch (Exception e) {
TestUtility.fail("Caught exception: " + e);
e.printStackTrace(System.err);
}
myOA.destroy();
myORB.shutdown();
System.out.println("Passed");
}
Aggregations