Search in sources :

Example 1 with CoordinatorCancelledException

use of com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException in project narayana by jbosstm.

the class CancelOnlyCloseTest method testCancelOnlyClose.

@Test
public void testCancelOnlyClose() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    try {
        ua.begin("Sagas11HLS");
        System.out.println("Started: " + ua.identifier() + "\n");
        ua.setCancelOnly();
        ua.close();
        fail("Close succeeded after setCancelOnly");
    } catch (CoordinatorCancelledException ex) {
        // we should get here
        WSCF11TestUtils.cleanup(ua);
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.sagas.api.UserCoordinator) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) Test(org.junit.Test)

Example 2 with CoordinatorCancelledException

use of com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException in project narayana by jbosstm.

the class CancelOnlyCancelTest method testCancelOnlyCancel.

@Test
public void testCancelOnlyCancel() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    try {
        ua.begin("Sagas11HLS");
        System.out.println("Started: " + ua.identifier() + "\n");
        ua.setCancelOnly();
        ua.cancel();
    } catch (CoordinatorCancelledException ex) {
        // why is it ok to get here?
        WSCF11TestUtils.cleanup(ua);
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.sagas.api.UserCoordinator) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) Test(org.junit.Test)

Example 3 with CoordinatorCancelledException

use of com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException in project narayana by jbosstm.

the class ParticipantCannotCompleteCloseTest method testParticipantCannotCompleteClose.

@Test
public void testParticipantCannotCompleteClose() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        String id = "1234";
        cm.begin("Sagas11HLS");
        SagasParticipant participant = new SagasParticipant(id);
        cm.enlistParticipant(participant);
        cm.participantCannotComplete(id);
        System.out.println("Started: " + cm.identifier() + "\n");
        cm.close();
        fail("Close succeeded after participantFaulted");
    } catch (CoordinatorCancelledException ex) {
        WSCF11TestUtils.cleanup(cm);
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) SagasParticipant(com.arjuna.wscf.tests.SagasParticipant) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) CoordinatorManager(com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager) Test(org.junit.Test)

Example 4 with CoordinatorCancelledException

use of com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException in project narayana by jbosstm.

the class ParticipantFaultedCloseTest method testParticipantFaultedClose.

@Test
public void testParticipantFaultedClose() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        String id = "1236";
        cm.begin("Sagas11HLS");
        SagasParticipant participant = new SagasParticipant(id);
        cm.enlistParticipant(participant);
        cm.participantFaulted(id);
        System.out.println("Started: " + cm.identifier() + "\n");
        cm.close();
        fail("Close succeeded after participantFaulted");
    } catch (CoordinatorCancelledException ex) {
        WSCF11TestUtils.cleanup(cm);
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) SagasParticipant(com.arjuna.wscf.tests.SagasParticipant) CoordinatorCancelledException(com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException) CoordinatorManager(com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager) Test(org.junit.Test)

Aggregations

CoordinatorCancelledException (com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException)4 Test (org.junit.Test)4 CoordinatorManager (com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager)2 UserCoordinator (com.arjuna.mw.wscf.model.sagas.api.UserCoordinator)2 SagasParticipant (com.arjuna.wscf.tests.SagasParticipant)2