Search in sources :

Example 1 with CoordinatorManager

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

the class SuspendParticipantTest method testSuspendParticipant.

@Test
public void testSuspendParticipant() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        cm.begin("TwoPhase11HLS");
        cm.enlistParticipant(new TwoPhaseParticipant("p1"));
        cm.enlistParticipant(new TwoPhaseParticipant("p2"));
        cm.enlistSynchronization(new TwoPhaseSynchronization());
        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.confirm();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : TwoPhaseSynchronization(com.arjuna.wscf.tests.TwoPhaseSynchronization) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) CoordinatorManager(com.arjuna.mw.wscf.model.twophase.api.CoordinatorManager) TwoPhaseParticipant(com.arjuna.wscf.tests.TwoPhaseParticipant) Test(org.junit.Test)

Example 2 with CoordinatorManager

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

the class AddSynchronizationTest method testAddSynchronization.

@Test
public void testAddSynchronization() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
    try {
        cm.begin("TwoPhase11HLS");
        cm.enlistSynchronization(new TwoPhaseSynchronization());
        System.out.println("Started: " + cm.identifier() + "\n");
        cm.confirm();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : TwoPhaseSynchronization(com.arjuna.wscf.tests.TwoPhaseSynchronization) CoordinatorManager(com.arjuna.mw.wscf.model.twophase.api.CoordinatorManager) Test(org.junit.Test)

Example 3 with CoordinatorManager

use of com.arjuna.mw.wscf.model.twophase.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("TwoPhase11HLS");
        cm.enlistParticipant(new TwoPhaseParticipant(null));
        System.out.println("Started: " + cm.identifier() + "\n");
        cm.confirm();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(cm);
        throw ex;
    }
}
Also used : CoordinatorManager(com.arjuna.mw.wscf.model.twophase.api.CoordinatorManager) TwoPhaseParticipant(com.arjuna.wscf.tests.TwoPhaseParticipant) Test(org.junit.Test)

Example 4 with CoordinatorManager

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

the class ParticipantSynchronizationTest method testParticipantSynchronization.

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

Aggregations

CoordinatorManager (com.arjuna.mw.wscf.model.twophase.api.CoordinatorManager)4 Test (org.junit.Test)4 TwoPhaseParticipant (com.arjuna.wscf.tests.TwoPhaseParticipant)3 TwoPhaseSynchronization (com.arjuna.wscf.tests.TwoPhaseSynchronization)3 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)1