Search in sources :

Example 6 with TransactionRolledBackException

use of com.arjuna.wst.TransactionRolledBackException in project narayana by jbosstm.

the class ATTestCase method testAT5_3.

/**
 * testAT5_3 - 5.3 RetryPreparedAbort
 * Tests recovery from a communication failure during the prepare phase. Transaction times out.
 * @throws Exception on failure.
 */
public void testAT5_3() throws Exception {
    final String conversationId = getConversationId();
    final ATInteropRetryPreparedAbortState state = new ATInteropRetryPreparedAbortState();
    ProxyConversation.setConversationState(conversationId, state);
    try {
        final String serviceURI = ProxyURIRewriting.rewriteURI(conversationId, getParticipantURI());
        final CoordinationContextType context = ATInteropUtil.createCoordinationContext(getSourceCoordinatorURI());
        getParticipantStub().retryPreparedAbort(serviceURI, context);
        final CompletionCoordinatorParticipant participant = ATInteropUtil.registerCompletion(context, context.getIdentifier().getValue());
        participant.commit();
        fail("Transaction rollback expected");
    } catch (final TransactionRolledBackException trbe) {
        state.waitForCompletion(getTestTimeout());
    } finally {
        ProxyConversation.clearConversationState(conversationId);
    }
    assertTrue("Conversation did not complete successfully", state.isSuccessful());
}
Also used : ATInteropRetryPreparedAbortState(com.jboss.transaction.txinterop.interop.states.ATInteropRetryPreparedAbortState) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) CoordinationContextType(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType) CompletionCoordinatorParticipant(com.arjuna.wst.CompletionCoordinatorParticipant)

Example 7 with TransactionRolledBackException

use of com.arjuna.wst.TransactionRolledBackException in project narayana by jbosstm.

the class MultiParticipantParticipantCompletionParticipantCloseTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
    try {
        ba.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> resultsList;
    String participantId;
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P2");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P3");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P1}");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P2}");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P3}");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        ba.close();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("commit failure " + exception);
    }
    message("completed");
    isSuccessful = (exception == null);
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) UserBusinessActivity(com.arjuna.mw.wst11.UserBusinessActivity) WrongStateException(com.arjuna.wst.WrongStateException) ArrayList(java.util.ArrayList) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException)

Example 8 with TransactionRolledBackException

use of com.arjuna.wst.TransactionRolledBackException in project narayana by jbosstm.

the class MultiServiceCoordinatorCompletionParticipantCloseTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String serviceURL2;
    String serviceURL3;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
    serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    if (serviceURL2 == null) {
        serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
    }
    if (serviceURL3 == null) {
        serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("service2", serviceURL2);
    addDefaultBinding("service3", serviceURL3);
    UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
    try {
        ba.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> resultsList;
    String participantId;
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistCoordinatorCompletion");
    commands.add("complete");
    commands.add("close");
    commands.add("next");
    commands.add("serve");
    commands.add("{service2}");
    commands.add("enlistCoordinatorCompletion");
    commands.add("complete");
    commands.add("close");
    commands.add("next");
    commands.add("serve");
    commands.add("{service3}");
    commands.add("enlistCoordinatorCompletion");
    commands.add("complete");
    commands.add("close");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        ba.close();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("commit failure " + exception);
    }
    error("completed");
    isSuccessful = (exception == null);
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) UserBusinessActivity(com.arjuna.mw.wst11.UserBusinessActivity) WrongStateException(com.arjuna.wst.WrongStateException) ArrayList(java.util.ArrayList) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException)

Example 9 with TransactionRolledBackException

use of com.arjuna.wst.TransactionRolledBackException in project narayana by jbosstm.

the class MultiServiceParticipantCompletionParticipantCloseTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String serviceURL2;
    String serviceURL3;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
    serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    if (serviceURL2 == null) {
        serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
    }
    if (serviceURL3 == null) {
        serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("service2", serviceURL2);
    addDefaultBinding("service3", serviceURL3);
    UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
    try {
        ba.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> resultsList;
    String participantId;
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service2}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P2");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service3}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P3");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P1}");
    commands.add("next");
    commands.add("serve");
    commands.add("{service2}");
    commands.add("completed");
    commands.add("{P2}");
    commands.add("next");
    commands.add("serve");
    commands.add("{service3}");
    commands.add("completed");
    commands.add("{P3}");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        ba.close();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("commit failure " + exception);
    }
    message("completed");
    isSuccessful = (exception == null);
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) UserBusinessActivity(com.arjuna.mw.wst11.UserBusinessActivity) WrongStateException(com.arjuna.wst.WrongStateException) ArrayList(java.util.ArrayList) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException)

Example 10 with TransactionRolledBackException

use of com.arjuna.wst.TransactionRolledBackException in project narayana by jbosstm.

the class SingleParticipantPrepareAndCommitTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    UserTransaction tx = UserTransactionFactory.userTransaction();
    try {
        tx.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        tx.commit();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("commit failure " + exception);
    }
    message("completed");
    isSuccessful = (exception == null);
}
Also used : UserTransaction(com.arjuna.mw.wst11.UserTransaction) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) ArrayList(java.util.ArrayList) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException)

Aggregations

TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)41 SystemException (com.arjuna.wst.SystemException)29 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)29 WrongStateException (com.arjuna.wst.WrongStateException)22 ArrayList (java.util.ArrayList)18 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)15 CompletionCoordinatorParticipant (com.arjuna.wst.CompletionCoordinatorParticipant)8 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)8 UserTransaction (com.arjuna.mw.wst11.UserTransaction)7 SoapFault (com.arjuna.webservices.SoapFault)5 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)5 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)5 MAP (org.jboss.ws.api.addressing.MAP)5 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)4 Test (org.junit.Test)3 TxContext (com.arjuna.mw.wst.TxContext)2 TransactionManager (com.arjuna.mw.wst11.TransactionManager)2 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)2 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)2 SoapFault11 (com.arjuna.webservices11.SoapFault11)2