Search in sources :

Example 11 with TransactionException

use of org.mule.runtime.api.tx.TransactionException in project mule by mulesoft.

the class TransactionCoordinationTestCase method testCommitDoesntFailOnException.

@Test
public void testCommitDoesntFailOnException() throws Exception {
    assertThat(tc.getTransaction(), nullValue());
    Transaction tx = mock(Transaction.class);
    doThrow(new TransactionException((Throwable) null)).when(tx).commit();
    TransactionCoordination.getInstance().commitCurrentTransaction();
}
Also used : TransactionException(org.mule.runtime.api.tx.TransactionException) TestTransaction(org.mule.tck.testmodels.mule.TestTransaction) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Example 12 with TransactionException

use of org.mule.runtime.api.tx.TransactionException in project mule by mulesoft.

the class TransactionCoordinationTestCase method testRollbackDoesntFailOnException.

@Test
public void testRollbackDoesntFailOnException() throws Exception {
    assertThat(tc.getTransaction(), nullValue());
    Transaction tx = mock(Transaction.class);
    doThrow(new TransactionException((Throwable) null)).when(tx).rollback();
    TransactionCoordination.getInstance().rollbackCurrentTransaction();
}
Also used : TransactionException(org.mule.runtime.api.tx.TransactionException) TestTransaction(org.mule.tck.testmodels.mule.TestTransaction) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

TransactionException (org.mule.runtime.api.tx.TransactionException)12 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)3 InvalidTransactionException (javax.transaction.InvalidTransactionException)3 RollbackException (javax.transaction.RollbackException)3 SystemException (javax.transaction.SystemException)3 XAException (javax.transaction.xa.XAException)3 Test (org.junit.Test)3 TransactionRollbackException (org.mule.runtime.core.api.transaction.TransactionRollbackException)3 TransactionManager (javax.transaction.TransactionManager)2 Transaction (org.mule.runtime.core.api.transaction.Transaction)2 TransactionStatusException (org.mule.runtime.core.api.transaction.TransactionStatusException)2 ExternalXaTransaction (org.mule.runtime.core.internal.transaction.ExternalXaTransaction)2 XaTransaction (org.mule.runtime.core.privileged.transaction.XaTransaction)2 IllegalTransactionStateException (org.mule.runtime.core.privileged.transaction.xa.IllegalTransactionStateException)2 SmallTest (org.mule.tck.size.SmallTest)2 TestTransaction (org.mule.tck.testmodels.mule.TestTransaction)2 Thread.currentThread (java.lang.Thread.currentThread)1 Set (java.util.Set)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Transaction (javax.transaction.Transaction)1