Search in sources :

Example 21 with SystemException

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

the class MultiServiceCoordinatorCompletionParticipantCloseAndExitTest 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("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    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("serve");
    commands.add("{service1}");
    commands.add("exit");
    commands.add("{P1}");
    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 22 with SystemException

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

the class SingleCoordinatorCompletionParticipantCloseTest 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("serve");
    commands.add("{service1}");
    commands.add("enlistCoordinatorCompletion");
    commands.add("complete");
    commands.add("close");
    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 23 with SystemException

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

the class MultiParticipantPrepareAndCommitTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String subserviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
    if (subserviceURL1 == null) {
        subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("subservice1", subserviceURL1);
    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("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("endblock");
    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)

Example 24 with SystemException

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

the class MultiParticipantParticipantCompletionParticipantCloseAndExitTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String subserviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
    if (subserviceURL1 == null) {
        subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("subservice1", subserviceURL1);
    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("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistParticipantCompletion");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P2");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistParticipantCompletion");
    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("{subservice1}");
    commands.add("exit");
    commands.add("{P2}");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("exit");
    commands.add("{P3}");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        Thread.sleep(10000);
        ba.close();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    } catch (InterruptedException 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 25 with SystemException

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

the class CompletionCoordinatorProcessorImpl method commit.

/**
 * Commit.
 * @param commit The commit notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void commit(final Notification commit, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            final String messageId = MessageId.getMessageId();
            try {
                participant.commit();
            } catch (final TransactionRolledBackException trbe) {
                final MAP responseAddressingContext = AddressingHelper.createResponseContext(map, messageId);
                CompletionInitiatorClient.getClient().sendAborted(participant.getParticipant(), responseAddressingContext, instanceIdentifier);
                return;
            } catch (final UnknownTransactionException ute) {
                final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, messageId);
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_1());
                CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContext, soapFault, instanceIdentifier);
                return;
            } catch (final SystemException se) {
                final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, messageId);
                final String pattern = WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_2();
                final String message = MessageFormat.format(pattern, new Object[] { se });
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
                CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContext, soapFault, instanceIdentifier);
                return;
            } catch (final Throwable th) {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Unexpected exception thrown from commit:", th);
                }
                final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
                final SoapFault soapFault = new SoapFault11(th);
                CompletionInitiatorClient.getClient().sendSoapFault(participant.getParticipant(), faultAddressingContext, soapFault, instanceIdentifier);
                return;
            }
            final MAP responseAddressingContext = AddressingHelper.createResponseContext(map, messageId);
            CompletionInitiatorClient.getClient().sendCommitted(participant.getParticipant(), responseAddressingContext, instanceIdentifier);
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Commit called on unknown participant: {0}", new Object[] { instanceIdentifier });
            }
            final MAP faultAddressingContext = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
            final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_5());
            CompletionInitiatorClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier);
        }
    } catch (Throwable throwable) {
        throwable.printStackTrace(System.err);
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) SoapFault11(com.arjuna.webservices11.SoapFault11) CompletionCoordinatorParticipant(com.arjuna.wst11.CompletionCoordinatorParticipant) MAP(org.jboss.ws.api.addressing.MAP)

Aggregations

SystemException (com.arjuna.wst.SystemException)74 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)63 WrongStateException (com.arjuna.wst.WrongStateException)45 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)39 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)20 ArrayList (java.util.ArrayList)19 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)15 SoapFault (com.arjuna.webservices.SoapFault)15 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)13 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)11 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)11 MAP (org.jboss.ws.api.addressing.MAP)11 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)10 Context (com.arjuna.mw.wsc11.context.Context)6 FaultedException (com.arjuna.wst.FaultedException)6 BusinessActivityTerminator (com.arjuna.wst11.BusinessActivityTerminator)6 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 TxContext (com.arjuna.mw.wst.TxContext)5 BusinessActivityManager (com.arjuna.mw.wst11.BusinessActivityManager)5