use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test15 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
current.rollback();
try {
current.rollback();
correct = false;
} catch (NoTransaction noTransaction) {
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test15.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test15.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test17 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
int numberOfTransactionNames = 1000;
Current current = OTS.get_current();
String[] transactionNames = new String[numberOfTransactionNames];
for (int index = 0; index < numberOfTransactionNames; index++) {
current.begin();
transactionNames[index] = current.get_transaction_name();
current.commit(true);
}
for (int index1 = 0; index1 < numberOfTransactionNames - 1; index1++) {
for (int index2 = index1 + 1; index2 < numberOfTransactionNames; index2++) {
correct = correct && (!transactionNames[index1].equals(transactionNames[index2]));
}
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test17.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test17.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test19 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
int numberOfTransactionNames = 1000;
Current current = OTS.get_current();
String[] transactionNames = new String[numberOfTransactionNames];
for (int index = 0; index < numberOfTransactionNames; index++) {
current.begin();
transactionNames[index] = current.get_transaction_name();
current.rollback();
}
for (int index1 = 0; index1 < numberOfTransactionNames - 1; index1++) {
for (int index2 = index1 + 1; index2 < numberOfTransactionNames; index2++) {
correct = correct && (!transactionNames[index1].equals(transactionNames[index2]));
}
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test19.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test19.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test21 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
Control control = current.suspend();
correct = (control == null);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test21.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test21.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test27 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
Control control = current.get_control();
current.commit(false);
try {
current.resume(control);
} catch (InvalidControl invalidControl) {
System.err.println("Failed to resume committed transaction!");
correct = false;
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test27.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Testt27.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations