Search in sources :

Example 6 with CoordinatorManager

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

the class SagasTestLocal method completeTest.

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

Example 7 with CoordinatorManager

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

the class SagasTestLocal method cancelTest.

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

Example 8 with CoordinatorManager

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

the class HierarchyTest method testComparision.

@Test
public void testComparision() throws Exception {
    CoordinatorManager cm1 = CoordinatorManagerFactory.coordinatorManager();
    CoordinatorManager cm2 = CoordinatorManagerFactory.coordinatorManager();
    cm1.begin("Sagas11HLS");
    ActivityHierarchy hierarchy1 = cm1.suspend();
    cm2.begin("Sagas11HLS");
    ActivityHierarchy hierarchy2 = cm2.suspend();
    try {
        Assert.assertFalse(hierarchy1.equals(hierarchy2));
    } finally {
        cm1.resume(hierarchy1);
        cm1.close();
        cm2.resume(hierarchy2);
        cm2.close();
    }
}
Also used : ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) CoordinatorManager(com.arjuna.mw.wscf.model.sagas.api.CoordinatorManager) Test(org.junit.Test)

Example 9 with CoordinatorManager

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

the class SuspendResumeMultiParticipantTest method testSuspendResumeMultiParticipant.

@Test
public void testSuspendResumeMultiParticipant() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        cm.begin("Sagas11HLS");
        cm.enlistParticipant(new SagasParticipant("p1"));
        cm.enlistParticipant(new SagasParticipant("p2"));
        System.out.println("Started: " + cm.identifier() + "\n");
        ActivityHierarchy hier = cm.suspend();
        System.out.println("Suspended: " + hier + "\n");
        if (cm.currentActivity() != null) {
            WSCF11TestUtils.cleanup(cm);
            fail("Hierarchy still active.");
        }
        cm.resume(hier);
        System.out.println("Resumed: " + hier + "\n");
        cm.close();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : SagasParticipant(com.arjuna.wscf.tests.SagasParticipant) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) 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