use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test20 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
int numberOfControls = 1000;
Current current = OTS.get_current();
String[] transactionNames = new String[numberOfControls];
Control[] controls = new Control[numberOfControls];
for (int index = 0; index < numberOfControls; index++) {
current.begin();
transactionNames[index] = current.get_transaction_name();
controls[index] = current.suspend();
}
for (int index = 0; index < numberOfControls; index++) {
current.resume(controls[index]);
correct = correct && transactionNames[index].equals(current.get_transaction_name());
current.commit(true);
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test20.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test20.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test30 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.commit(true);
correct = (current.get_status() == Status.StatusNoTransaction);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test30.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test30.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test34 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_only();
correct = (current.get_status() == Status.StatusMarkedRollback);
current.rollback();
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test34.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test34.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test06 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.commit(true);
try {
current.commit(false);
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("Test06.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test06.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.Current in project narayana by jbosstm.
the class Test14 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.commit(false);
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("Test14.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test14.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations