use of com.hp.mwtests.ts.jts.utils.ServerORB in project narayana by jbosstm.
the class AsyncTest method test.
@Test
public void test() throws Exception {
boolean errorp = false;
boolean errorc = false;
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
try {
Current current = OTSManager.get_current();
DemoResource.printThread = true;
current.begin();
for (int j = 0; j < 100; j++) {
if ((j == 10) && (errorp || errorc)) {
boolean heuristicPrepare = errorp;
heuristic h = new heuristic(heuristicPrepare);
current.get_control().get_coordinator().register_resource(h.getReference());
h = null;
}
DemoResource r = new DemoResource();
r.registerResource();
r = null;
}
System.out.println("committing top-level transaction");
current.commit(false);
System.out.println("Test completed.");
} catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK e) {
System.out.println("Caught exception: " + e);
assertTrue(errorp || errorc);
}
myOA.destroy();
myORB.shutdown();
}
use of com.hp.mwtests.ts.jts.utils.ServerORB in project narayana by jbosstm.
the class ExplicitStackServer 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];
ExplicitStackPOATie theObject = new ExplicitStackPOATie(new ExplicitStackImple());
myOA.objectIsReady(theObject);
Services serv = new Services(myORB);
try {
TestUtility.registerService(refFile, myORB.orb().object_to_string(myOA.corbaReference(theObject)));
System.out.println("Ready");
myOA.run();
} catch (Exception e) {
e.printStackTrace();
}
myOA.shutdownObject(theObject);
System.out.println("**ExplicitStackServer exiting**");
}
use of com.hp.mwtests.ts.jts.utils.ServerORB in project narayana by jbosstm.
the class HammerServer 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];
HammerPOATie theObject = new HammerPOATie(new HammerObject());
myOA.objectIsReady(theObject);
Services serv = new Services(myORB);
try {
TestUtility.registerService(refFile, myORB.orb().object_to_string(HammerHelper.narrow(myOA.corbaReference(theObject))));
System.out.println("\nIOR file: " + refFile);
System.out.println("Ready");
// assertReady();
myOA.run();
} catch (Exception e) {
// fail("HammerServer caught exception: "+e);
e.printStackTrace(System.err);
}
myOA.shutdownObject(theObject);
System.out.println("**HammerServer exiting**");
}
use of com.hp.mwtests.ts.jts.utils.ServerORB 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);
}
use of com.hp.mwtests.ts.jts.utils.ServerORB 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");
}
Aggregations