use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client02a method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String serviceIOR = ServerIORStore.loadIOR(args[args.length - 1]);
AfterCrashService service = AfterCrashServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR));
Thread.sleep(Delays.recoveryDelay());
boolean correct = true;
IntHolder valueHolder = new IntHolder();
service.get(valueHolder);
//
// recovery should have rolled the transaction back.
// the set(1) change should therefore have been undone.
//
correct = correct && (valueHolder.value == 0);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client02a.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client02a.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client03a method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String serviceIOR = ServerIORStore.loadIOR(args[args.length - 1]);
AfterCrashService service = AfterCrashServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR));
Thread.sleep(Delays.recoveryDelay());
boolean correct = true;
IntHolder valueHolder = new IntHolder();
// non-tx
service.get(valueHolder);
correct = correct && (valueHolder.value == 1);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client03a.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client03a.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client04a method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String serviceIOR = ServerIORStore.loadIOR(args[args.length - 1]);
AfterCrashService service = AfterCrashServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR));
Thread.sleep(Delays.recoveryDelay());
boolean correct = true;
IntHolder valueHolder = new IntHolder();
// non-tx
service.get(valueHolder);
correct = correct && (valueHolder.value == 0);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client04a.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client04a.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome01 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String matrixIOR = ServerIORStore.loadIOR(args[args.length - 1]);
Matrix matrix = MatrixHelper.narrow(ORBInterface.orb().string_to_object(matrixIOR));
boolean correct = true;
int matrixWidth = matrix.get_width();
int matrixHeight = matrix.get_height();
int total = 0;
for (int x = 0; x < matrixWidth; x++) {
for (int y = 0; y < matrixHeight; y++) {
IntHolder value = new IntHolder();
matrix.get_value(x, y, value, null);
correct = correct && ((value.value == 0) || (value.value == 1));
total += value.value;
}
}
if (correct && (total == ((matrixWidth * matrixHeight) / 2))) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome01 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String matrixIOR = ServerIORStore.loadIOR(args[args.length - 1]);
Matrix matrix = MatrixHelper.narrow(ORBInterface.orb().string_to_object(matrixIOR));
boolean correct = true;
int matrixWidth = matrix.get_width();
int matrixHeight = matrix.get_height();
int total = 0;
for (int x = 0; x < matrixWidth; x++) {
for (int y = 0; y < matrixHeight; y++) {
IntHolder value = new IntHolder();
matrix.get_value(x, y, value);
correct = correct && ((value.value == 0) || (value.value == 1));
total += value.value;
}
}
if (correct && (total == ((matrixWidth * matrixHeight) / 2))) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome01.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations