Search in sources :

Example 16 with WrongStateException

use of com.arjuna.wst.WrongStateException 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 17 with WrongStateException

use of com.arjuna.wst.WrongStateException 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 18 with WrongStateException

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

the class SuspendCommitTransactionTest method testSuspendCommitTransaction.

@Test
public void testSuspendCommitTransaction() throws Exception {
    UserTransaction ut = UserTransaction.getUserTransaction();
    TransactionManager tm = TransactionManager.getTransactionManager();
    ut.begin();
    try {
        TxContext ctx = tm.suspend();
        System.out.println("Suspended: " + ctx);
    } catch (Exception eouter) {
        try {
            ut.rollback();
        } catch (Exception einner) {
        }
        throw eouter;
    }
    try {
        ut.commit();
    } catch (WrongStateException ex) {
    // we should arrive here
    }
}
Also used : UserTransaction(com.arjuna.mw.wst11.UserTransaction) TransactionManager(com.arjuna.mw.wst11.TransactionManager) WrongStateException(com.arjuna.wst.WrongStateException) TxContext(com.arjuna.mw.wst.TxContext) WrongStateException(com.arjuna.wst.WrongStateException) Test(org.junit.Test)

Example 19 with WrongStateException

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

the class SingleParticipantCompletionParticipantCloseTest 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("completed");
    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("close failure " + exception);
    }
    message("finished");
    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 20 with WrongStateException

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

the class MultiParticipantParticipantCompletionParticipantCloseTest 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("close");
    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("close");
    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("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("{subservice1}");
    commands.add("completed");
    commands.add("{P2}");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    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)

Aggregations

WrongStateException (com.arjuna.wst.WrongStateException)43 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)42 SystemException (com.arjuna.wst.SystemException)41 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)28 ArrayList (java.util.ArrayList)18 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)14 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)12 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)9 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)9 Context (com.arjuna.mw.wsc11.context.Context)6 UserTransaction (com.arjuna.mw.wst11.UserTransaction)6 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)6 TxContext (com.arjuna.mw.wst.TxContext)5 InvalidActivityException (com.arjuna.mw.wsas.exceptions.InvalidActivityException)3 CannotRegisterException (com.arjuna.wsc.CannotRegisterException)3 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)3 InvalidStateException (com.arjuna.wsc.InvalidStateException)3 BusinessActivityTerminatorRPCStub (com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub)3 BusinessActivityTerminatorStub (com.arjuna.wst11.stub.BusinessActivityTerminatorStub)3