use of org.jboss.jbossts.qa.Utils.Setup in project narayana by jbosstm.
the class Test02 method main.
public static void main(String[] args) {
Setup orbClass = null;
try {
boolean needOrb = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-local")) {
needOrb = false;
}
}
if (needOrb) {
Class c = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.jbossts.qa.Utils.OrbSetup");
orbClass = (Setup) c.newInstance();
orbClass.start(args);
}
boolean correct = true;
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
transactionManager.begin();
correct = correct && (transactionManager.getTransaction() != null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_ACTIVE);
try {
transactionManager.begin();
correct = false;
} catch (NotSupportedException notSupportedException) {
}
correct = correct && (transactionManager.getTransaction() != null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_ACTIVE);
transactionManager.commit();
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.print("Test02.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.out.println("Failed");
System.err.print("Test02.main: ");
error.printStackTrace(System.err);
}
try {
if (orbClass != null) {
orbClass.stop();
}
} catch (Exception exception) {
System.err.print("Test02.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.err.print("Test02.main: ");
error.printStackTrace(System.err);
}
}
use of org.jboss.jbossts.qa.Utils.Setup in project narayana by jbosstm.
the class Test04 method main.
public static void main(String[] args) {
Setup orbClass = null;
try {
boolean needOrb = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-local")) {
needOrb = false;
}
}
if (needOrb) {
Class c = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.jbossts.qa.Utils.OrbSetup");
orbClass = (Setup) c.newInstance();
orbClass.start(args);
}
int numberOfTransactions = Integer.parseInt(args[args.length - 1]);
boolean correct = true;
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
for (int index = 0; index < numberOfTransactions; index++) {
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
transactionManager.begin();
correct = correct && (transactionManager.getTransaction() != null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_ACTIVE);
if ((index % 2) == 0) {
transactionManager.commit();
} else {
transactionManager.rollback();
}
}
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.print("Test04.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.out.println("Failed");
System.err.print("Test04.main: ");
error.printStackTrace(System.err);
}
try {
if (orbClass != null) {
orbClass.stop();
}
} catch (Exception exception) {
System.err.print("Test04.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.err.print("Test04.main: ");
error.printStackTrace(System.err);
}
}
use of org.jboss.jbossts.qa.Utils.Setup in project narayana by jbosstm.
the class Test06 method main.
public static void main(String[] args) {
Setup orbClass = null;
try {
boolean needOrb = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-local")) {
needOrb = false;
}
}
if (needOrb) {
Class c = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.jbossts.qa.Utils.OrbSetup");
orbClass = (Setup) c.newInstance();
orbClass.start(args);
}
int numberOfWorkers = Integer.parseInt(args[args.length - 2]);
int numberOfTransactions = Integer.parseInt(args[args.length - 1]);
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
Worker[] workers = new Worker[numberOfWorkers];
for (int index = 0; index < workers.length; index++) {
workers[index] = new Worker(numberOfTransactions, transactionManager);
}
for (int index = 0; index < workers.length; index++) {
workers[index].start();
}
boolean correct = true;
for (int index = 0; index < workers.length; index++) {
workers[index].join();
correct = correct && workers[index].isCorrect();
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.print("Test06.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.out.println("Failed");
System.err.print("Test06.main: ");
error.printStackTrace(System.err);
}
try {
if (orbClass != null) {
orbClass.stop();
}
} catch (Exception exception) {
System.err.print("Test06.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.err.print("Test06.main: ");
error.printStackTrace(System.err);
}
}
use of org.jboss.jbossts.qa.Utils.Setup in project narayana by jbosstm.
the class Test01 method main.
public static void main(String[] args) {
Setup orbClass = null;
try {
boolean needOrb = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-local")) {
needOrb = false;
}
}
if (needOrb) {
Class c = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.jbossts.qa.Utils.OrbSetup");
orbClass = (Setup) c.newInstance();
orbClass.start(args);
}
boolean correct = true;
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
try {
transactionManager.commit();
correct = false;
} catch (IllegalStateException illegalStateException) {
}
try {
transactionManager.rollback();
correct = false;
} catch (IllegalStateException illegalStateException) {
}
try {
transactionManager.setRollbackOnly();
correct = false;
} catch (IllegalStateException illegalStateException) {
}
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.suspend() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.print("Test01.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.out.println("Failed");
System.err.print("Test01.main: ");
error.printStackTrace(System.err);
}
try {
if (orbClass != null) {
orbClass.stop();
}
} catch (Exception exception) {
System.err.print("Test01.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.err.print("Test01.main: ");
error.printStackTrace(System.err);
}
}
use of org.jboss.jbossts.qa.Utils.Setup in project narayana by jbosstm.
the class Test05 method main.
public static void main(String[] args) {
Setup orbClass = null;
try {
boolean needOrb = true;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("-local")) {
needOrb = false;
}
}
if (needOrb) {
Class c = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.jbossts.qa.Utils.OrbSetup");
orbClass = (Setup) c.newInstance();
orbClass.start(args);
}
int numberOfTransactions = Integer.parseInt(args[args.length - 1]);
boolean correct = true;
javax.transaction.TransactionManager transactionManager = com.arjuna.ats.jta.TransactionManager.transactionManager();
Transaction[] transactions = new Transaction[numberOfTransactions];
for (int index = 0; index < transactions.length; index++) {
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
transactionManager.begin();
transactions[index] = transactionManager.suspend();
}
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
for (int index = 0; index < transactions.length; index++) {
transactionManager.resume(transactions[index]);
correct = correct && (transactionManager.getTransaction() != null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_ACTIVE);
if ((index % 2) == 0) {
transactionManager.commit();
} else {
transactionManager.rollback();
}
}
correct = correct && (transactionManager.getTransaction() == null);
correct = correct && (transactionManager.getStatus() == Status.STATUS_NO_TRANSACTION);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.print("Test05.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.out.println("Failed");
System.err.print("Test05.main: ");
error.printStackTrace(System.err);
}
try {
if (orbClass != null) {
orbClass.stop();
}
} catch (Exception exception) {
System.err.print("Test05.main: ");
exception.printStackTrace(System.err);
} catch (Error error) {
System.err.print("Test05.main: ");
error.printStackTrace(System.err);
}
}
Aggregations