use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client06 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingerIOR = ServerIORStore.loadIOR(args[args.length - 2]);
PingPong pinger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingerIOR));
String pongerIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong ponger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pongerIOR));
int numberOfCalls = 10;
for (int index = 0; index < numberOfCalls; index++) {
pinger.hit(index, ponger, pinger, null);
}
IntHolder pingerValue = new IntHolder();
pinger.get(pingerValue, null);
IntHolder pongerValue = new IntHolder();
ponger.get(pongerValue, null);
if ((pingerValue.value == (numberOfCalls / 2)) && (pongerValue.value == (numberOfCalls / 2))) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client06.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client06.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client10 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingPongIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong pingPong = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingPongIOR));
int numberOfCalls = 10;
for (int index0 = 0; index0 < numberOfCalls; index0++) {
for (int index1 = 0; index1 <= index0; index1++) {
pingPong.bad_hit(index0, index1, pingPong, pingPong, null);
}
}
IntHolder pingPongValue = new IntHolder();
pingPong.get(pingPongValue, null);
if (pingPongValue.value == 0) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client10.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client10.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client06 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingerIOR = ServerIORStore.loadIOR(args[args.length - 2]);
PingPong pinger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingerIOR));
String pongerIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong ponger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pongerIOR));
int numberOfCalls = 10;
for (int index = 0; index < numberOfCalls; index++) {
pinger.hit(index, ponger, pinger);
}
IntHolder pingerValue = new IntHolder();
pinger.get(pingerValue);
IntHolder pongerValue = new IntHolder();
ponger.get(pongerValue);
if ((pingerValue.value == (numberOfCalls / 2)) && (pongerValue.value == (numberOfCalls / 2))) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client06.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client06.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client10 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String pingPongIOR = ServerIORStore.loadIOR(args[args.length - 1]);
PingPong pingPong = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingPongIOR));
int numberOfCalls = 10;
for (int index0 = 0; index0 < numberOfCalls; index0++) {
for (int index1 = 0; index1 <= index0; index1++) {
pingPong.bad_hit(index0, index1, pingPong, pingPong);
}
}
IntHolder pingPongValue = new IntHolder();
pingPong.get(pingPongValue);
if (pingPongValue.value == 0) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client10.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client10.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client19 method main.
public static void main(String[] args) {
boolean correct = true;
int numberOfCalls = 10;
Counter counter = null;
System.err.println("Starting first init");
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
} catch (Exception exception) {
correct = false;
System.err.println("exception in first start: " + exception);
exception.printStackTrace(System.err);
}
System.err.println("Starting first block");
try {
String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
counter.increase(OTS.current().get_control());
if ((index % 2) == 0) {
atomicTransaction.commit(true);
} else {
atomicTransaction.rollback();
}
}
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
IntHolder value = new IntHolder();
counter.get(value, OTS.current().get_control());
atomicTransaction.commit(true);
if (value.value == (numberOfCalls / 2) && correct) {
correct = true;
} else {
correct = false;
}
} catch (Exception exception) {
correct = false;
System.err.println("exception in first block" + exception);
exception.printStackTrace(System.err);
}
System.err.println("Starting first shutdown");
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
correct = false;
System.err.println("exception in first shutdown" + exception);
exception.printStackTrace(System.err);
}
System.err.println("----Starting second block -------");
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
} catch (Exception exception) {
correct = false;
System.err.println("exception in second start " + exception);
exception.printStackTrace(System.err);
}
System.err.println("init done starting second block");
try {
String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
counter.set(0, OTS.current().get_control());
atomicTransaction.commit(true);
} catch (Exception exception) {
correct = false;
System.err.println("exception in set operation " + exception);
exception.printStackTrace(System.err);
}
try {
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
counter.increase(OTS.current().get_control());
if ((index % 2) == 0) {
atomicTransaction.commit(true);
} else {
atomicTransaction.rollback();
}
}
} catch (Exception exception) {
correct = false;
System.err.println("exception in second loop block " + exception);
exception.printStackTrace(System.err);
}
try {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
IntHolder value = new IntHolder();
counter.get(value, OTS.current().get_control());
atomicTransaction.commit(true);
if (value.value == (numberOfCalls / 2) && correct) {
correct = true;
} else {
correct = false;
}
} catch (Exception exception) {
correct = false;
System.err.println("exception in second test " + exception);
exception.printStackTrace(System.err);
}
System.err.println("Starting second shutdown");
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
correct = false;
System.err.println("error in second shutdown" + exception);
exception.printStackTrace(System.err);
}
System.err.println("testing result");
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
}
Aggregations