use of com.arjuna.ats.jta.exceptions.InactiveTransactionException in project narayana by jbosstm.
the class ExceptionsUnitTest method test.
@Test
public void test() throws Exception {
InactiveTransactionException ex = new InactiveTransactionException();
ex = new InactiveTransactionException("foobar");
NotImplementedException exp = new NotImplementedException();
exp = new NotImplementedException("foobar");
exp = new NotImplementedException("foobar", new NullPointerException());
exp = new NotImplementedException(new NullPointerException());
RollbackException exp2 = new RollbackException();
exp2 = new RollbackException("foobar");
exp2 = new RollbackException("foobar", new NullPointerException());
exp2 = new RollbackException(new NullPointerException());
UnexpectedConditionException ex2 = new UnexpectedConditionException();
ex2 = new UnexpectedConditionException("foobar");
}
use of com.arjuna.ats.jta.exceptions.InactiveTransactionException 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.jta.exceptions.InactiveTransactionException in project narayana by jbosstm.
the class TransactionImple method rollback.
public void rollback() throws java.lang.IllegalStateException, java.lang.SecurityException, javax.transaction.SystemException {
if (jtaxLogger.logger.isTraceEnabled()) {
jtaxLogger.logger.trace("TransactionImple.rollback");
}
boolean endSuspendedFailed = false;
if (_theTransaction != null) {
try {
if ((getStatus() != Status.STATUS_ACTIVE) && (getStatus() != Status.STATUS_MARKED_ROLLBACK))
throw new NoTransaction();
/*
* Call end on any suspended resources. If this fails, then there's
* not a lot else we can do because the transaction is about to roll
* back anyway!
*/
endSuspendedFailed = !endSuspendedRMs();
if (endSuspendedFailed) {
jtaxLogger.i18NLogger.warn_jtax_transaction_jts_endsuspendfailed1();
}
_theTransaction.abort();
} catch (WrongTransaction e1) {
InactiveTransactionException inactiveTransactionException = new InactiveTransactionException(jtaxLogger.i18NLogger.get_jtax_transaction_jts_wrongstatetx());
inactiveTransactionException.initCause(e1);
throw inactiveTransactionException;
} catch (org.omg.CORBA.NO_PERMISSION e2) {
throw new SecurityException(e2);
} catch (INVALID_TRANSACTION e3) {
InactiveTransactionException inactiveTransactionException = new InactiveTransactionException(jtaxLogger.i18NLogger.get_jtax_transaction_jts_invalidtx2());
inactiveTransactionException.initCause(e3);
throw inactiveTransactionException;
} catch (NoTransaction e4) {
throw new IllegalStateException(jtaxLogger.i18NLogger.get_jtax_transaction_jts_notx(), e4);
} catch (org.omg.CORBA.SystemException e5) {
javax.transaction.SystemException systemException = new javax.transaction.SystemException(e5.toString());
systemException.initCause(e5);
throw systemException;
} finally {
TransactionImple.removeTransaction(this);
}
if (endSuspendedFailed)
throw new InvalidTerminationStateException(jtaxLogger.i18NLogger.get_jtax_transaction_jts_endsuspendfailed2());
} else
throw new IllegalStateException(jtaxLogger.i18NLogger.get_jtax_transaction_jts_inactivetx());
}
Aggregations