use of org.jboss.jbossts.qa.ArjunaCore.AbstractRecord.impl.Service01 in project narayana by jbosstm.
the class Worker002 method run.
/**
* The main method of the class that will perform the work.
*/
public void run() {
try {
AtomicAction a = new AtomicAction();
// start transaction
a.begin();
mService.setupOper(true);
mService.doWork(mMaxIteration);
a.commit();
mService = new Service01(mNumberOfResources);
// start new AtomicAction
AtomicAction b = new AtomicAction();
b.begin();
mService.setupOper(true);
mService.doWork(mMaxIteration);
b.abort();
} catch (Exception e) {
mCorrect = false;
qautil.debug("exception in worker002: ", e);
}
}
use of org.jboss.jbossts.qa.ArjunaCore.AbstractRecord.impl.Service01 in project narayana by jbosstm.
the class Client001 method Test.
public void Test() {
try {
setNumberOfCalls(2);
setNumberOfResources(1);
// create container
Service01 mService = new Service01(mNumberOfResources);
startTx();
mService.setupOper();
mService.doWork(mMaxIteration);
// comit transaction
commit();
mCorrect = mService.checkCommitOper();
mService = new Service01(mNumberOfResources);
// start new AtomicAction
startTx();
mService.setupOper();
mService.doWork(mMaxIteration);
// abort transaction
abort();
// check final values
mCorrect = mCorrect && mService.checkAbortOper();
qaAssert(mCorrect);
} catch (Exception e) {
Fail("Error in Client001.test() :", e);
}
}
use of org.jboss.jbossts.qa.ArjunaCore.AbstractRecord.impl.Service01 in project narayana by jbosstm.
the class MemoryClient001 method Test.
public void Test() {
try {
setNumberOfCalls(3);
setNumberOfResources(2);
getClientThreshold(1);
BasicAbstractRecord[] mAbstractRecordList = new BasicAbstractRecord[mNumberOfResources];
// set up abstract records
for (int i = 0; i < mNumberOfResources; i++) {
mAbstractRecordList[i] = new BasicAbstractRecord();
}
// create container
Service01 mService = new Service01(mNumberOfResources);
startTx();
mService.setupOper();
mService.doWork(mMaxIteration);
// comit transaction
commit();
// get first memory reading.
getFirstReading();
mService = new Service01(mNumberOfResources);
// start new AtomicAction
startTx();
mService.setupOper();
mService.doWork(mMaxIteration);
// abort transaction
abort();
getSecondReading();
qaMemoryAssert();
} catch (Exception e) {
Fail("Error in MemoryClient001.test() :", e);
}
}
use of org.jboss.jbossts.qa.ArjunaCore.AbstractRecord.impl.Service01 in project narayana by jbosstm.
the class Client002 method Test.
public void Test() {
try {
setNumberOfCalls(2);
setNumberOfResources(1);
Service01 mService = new Service01(mNumberOfResources);
TxStats mStats = TxStats.getInstance();
startTx();
mService.setupOper(true);
mService.doWork(mMaxIteration);
commit();
mService = new Service01(mNumberOfResources);
// start new AtomicAction
startTx();
mService.setupOper(true);
mService.doWork(mMaxIteration);
abort();
// test what the final stat values are
if (mStats.getNumberOfAbortedTransactions() != 1) {
Debug("error in number of aborted transactions: " + mStats.getNumberOfAbortedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfCommittedTransactions() != 3) {
Debug("error in number of commited transactions: " + mStats.getNumberOfCommittedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfNestedTransactions() != 2) {
Debug("error in number of nested transactions: " + mStats.getNumberOfNestedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfTransactions() != 4) {
Debug("error in number of transactions: " + mStats.getNumberOfTransactions());
mCorrect = false;
}
qaAssert(mCorrect);
} catch (Exception e) {
Fail("Error in Client002.test() :", e);
}
}
use of org.jboss.jbossts.qa.ArjunaCore.AbstractRecord.impl.Service01 in project narayana by jbosstm.
the class Client001 method Test.
public void Test() {
try {
setNumberOfCalls(2);
setNumberOfResources(1);
TxStats mStats = TxStats.getInstance();
startTx();
// add abstract record
Service01 mService = new Service01(mNumberOfResources);
mService.setupOper();
mService.doWork(mMaxIteration);
// comit transaction
commit();
mService = new Service01(mNumberOfResources);
// start new AtomicAction
startTx();
mService.setupOper();
mService.doWork(mMaxIteration);
// abort transaction
abort();
if (mStats.getNumberOfAbortedTransactions() != 1) {
Debug("error in number of aborted transactions: " + mStats.getNumberOfAbortedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfCommittedTransactions() != 1) {
Debug("error in number of commited transactions: " + mStats.getNumberOfCommittedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfNestedTransactions() != 0) {
Debug("error in number of nested transactions: " + mStats.getNumberOfNestedTransactions());
mCorrect = false;
}
if (mStats.getNumberOfTransactions() != 2) {
Debug("error in number of transactions: " + mStats.getNumberOfTransactions());
mCorrect = false;
}
qaAssert(mCorrect);
} catch (Exception e) {
Fail("Error in Client001.test() :", e);
}
}
Aggregations