Search in sources :

Example 1 with CoordinatorManager

use of com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager in project narayana by jbosstm.

the class AddParticipantTest method testAddParticipant.

@Test
public void testAddParticipant() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        cm.begin("Sagas11HLS");
        cm.enlistParticipant(new SagasParticipant(null));
        System.out.println("Started: " + cm.identifier() + "\n");
        cm.complete();
        cm.close();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : SagasParticipant(com.arjuna.wscf.tests.SagasParticipant) CoordinatorManager(com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager) Test(org.junit.Test)

Example 2 with CoordinatorManager

use of com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager in project narayana by jbosstm.

the class ParticipantExitedCloseTest method testParticipantExitedClose.

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

Example 3 with CoordinatorManager

use of com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager 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 CoordinatorManager

use of com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager 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)

Example 5 with CoordinatorManager

use of com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager in project narayana by jbosstm.

the class SagasTestLocal method cannotComplete.

@Test(expected = CoordinatorCancelledException.class)
public void cannotComplete() throws Exception {
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    cm.begin("Sagas11HLS");
    cm.enlistParticipant(new Participant("p1"));
    cm.enlistParticipant(new Participant("p2"));
    cm.participantCompleted("p1");
    cm.participantCannotComplete("p2");
    cm.close();
}
Also used : CoordinatorManager(com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager) Test(org.junit.Test)

Aggregations

CoordinatorManager (com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager)9 Test (org.junit.Test)9 SagasParticipant (com.arjuna.wscf.tests.SagasParticipant)5 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)2 CoordinatorCancelledException (com.arjuna.mw.wscf.model.sagas.exceptions.CoordinatorCancelledException)2