use of org.omg.CORBA.IntHolder in project alliance by codice.
the class CatalogMgrImplTest method testHitCountWithTimeoutSet.
@Test
public void testHitCountWithTimeoutSet() throws InvalidInputParameter, SystemFault, ProcessingFault {
catalogMgr.set_default_timeout(30);
HitCountRequest hitCountRequest = catalogMgr.hit_count(testQuery, null);
IntHolder hitHolder = new IntHolder();
assertThat(hitCountRequest, notNullValue());
hitCountRequest.complete(hitHolder);
assertThat(hitHolder.value, greaterThan(0));
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome02 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));
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);
total += value.value;
}
}
if (total == (matrixWidth * matrixHeight / 2)) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client0001 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
int numberOfCalls = 1000;
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
try {
counter.increase();
} catch (InvocationException invocationException) {
}
atomicTransaction.commit(true);
}
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
IntHolder value = new IntHolder();
counter.get(value);
atomicTransaction.commit(true);
if (value.value == numberOfCalls) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client0001.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client0001.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Outcome02 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));
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);
total += value.value;
}
}
if (total == (matrixWidth * matrixHeight / 2)) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Outcome02.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CORBA.IntHolder in project narayana by jbosstm.
the class Client01 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String numberTableIOR = ServerIORStore.loadIOR(args[args.length - 1]);
NumberTable numberTable = NumberTableHelper.narrow(ORBInterface.orb().string_to_object(numberTableIOR));
boolean correct = true;
OTS.current().begin();
IntHolder valueHolder1 = new IntHolder();
IntHolder valueHolder2 = new IntHolder();
IntHolder valueHolder3 = new IntHolder();
IntHolder valueHolder4 = new IntHolder();
numberTable.get("Name_0", valueHolder1);
numberTable.get("Name_1", valueHolder2);
System.err.println("Phase 0, Name_0: " + valueHolder1.value);
System.err.println("Phase 0, Name_1: " + valueHolder2.value);
numberTable.increase("Name_0");
Thread.sleep(15000);
numberTable.increase("Name_1");
numberTable.get("Name_0", valueHolder3);
numberTable.get("Name_1", valueHolder4);
System.err.println("Phase 1, Name_0: " + valueHolder3.value);
System.err.println("Phase 1, Name_1: " + valueHolder4.value);
OTS.current().commit(true);
correct = (valueHolder1.value == valueHolder2.value) && (valueHolder3.value == valueHolder4.value) && (valueHolder1.value == (valueHolder3.value - 1)) && (valueHolder2.value == (valueHolder4.value - 1));
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (InvocationException exception) {
if (exception.myreason == Reason.ReasonCantSerializeAccess) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
System.err.println("Client01.main: " + exception);
exception.printStackTrace(System.err);
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client01.main: " + exception);
exception.printStackTrace(System.err);
} finally {
// code change to stop database locking
try {
if (OTS.current().get_control() != null) {
OTS.current().rollback();
}
} catch (Exception e) {
System.err.println("Finally has caught exception");
e.printStackTrace(System.err);
}
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client01.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations