use of com.arjuna.ats.internal.jta.transaction.jts.AtomicTransaction in project narayana by jbosstm.
the class TransactionImpleUnitTest method test.
@Test
public void test() throws Exception {
OTSImpleManager.current().begin();
TransactionImple tx = new TransactionImple(new SubordinateAtomicTransaction(new ServerControlWrapper(OTSImpleManager.current().get_control())));
assertFalse(tx.equals(null));
assertTrue(tx.equals(tx));
assertFalse(tx.equals(new TransactionImple(new AtomicTransaction())));
assertFalse(tx.equals(new Object()));
assertTrue(tx.toString() != null);
try {
tx.commit();
fail();
} catch (final InvalidTerminationStateException ex) {
}
try {
tx.rollback();
fail();
} catch (final InvalidTerminationStateException ex) {
}
tx.doBeforeCompletion();
tx.doPrepare();
try {
tx.doCommit();
fail();
} catch (final Throwable ex) {
}
try {
tx.doRollback();
fail();
} catch (final Throwable ex) {
}
try {
tx.doOnePhaseCommit();
fail();
} catch (final Throwable ex) {
}
tx.doForget();
OTSImpleManager.current().rollback();
DummyTransactionImple dummy = new DummyTransactionImple(new AtomicTransaction());
try {
dummy.commitAndDisassociate();
} catch (final InactiveTransactionException ex) {
}
try {
dummy.rollbackAndDisassociate();
} catch (final InactiveTransactionException ex) {
}
}
use of com.arjuna.ats.internal.jta.transaction.jts.AtomicTransaction in project narayana by jbosstm.
the class UtilsUnitTest method testXidUtils.
@Test
public void testXidUtils() throws Exception {
assertTrue(XidUtils.getXid(new Uid(), true) != null);
OTSImpleManager.current().begin();
AtomicTransaction tx = new AtomicTransaction(OTSImpleManager.current().getControlWrapper());
assertTrue(XidUtils.getXid(tx.getControlWrapper().get_control(), false) != null);
try {
XidUtils.getXid((Control) null, true);
fail();
} catch (final IllegalStateException ex) {
}
assertTrue(XidUtils.getXid(OTSImpleManager.current().get_control(), true) != null);
OTSImpleManager.current().commit(true);
}
Aggregations