Search in sources :

Example 1 with TwoPhaseSynchronization

use of com.arjuna.wscf.tests.TwoPhaseSynchronization 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 TwoPhaseSynchronization

use of com.arjuna.wscf.tests.TwoPhaseSynchronization 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 TwoPhaseSynchronization

use of com.arjuna.wscf.tests.TwoPhaseSynchronization 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)3 TwoPhaseSynchronization (com.arjuna.wscf.tests.TwoPhaseSynchronization)3 Test (org.junit.Test)3 TwoPhaseParticipant (com.arjuna.wscf.tests.TwoPhaseParticipant)2 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)1