Search in sources :

Example 1 with UserCoordinator

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

the class CancelOnlyConfirmTest method testCancelOnlyConfirm.

@Test
public void testCancelOnlyConfirm() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    try {
        ua.begin("TwoPhase11HLS");
        System.out.println("Started: " + ua.identifier() + "\n");
        ua.setCancelOnly();
        ua.confirm();
        fail("Confirm 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.twophase.api.UserCoordinator) CoordinatorCancelledException(com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException) CoordinatorCancelledException(com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException) Test(org.junit.Test)

Example 2 with UserCoordinator

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

the class SuspendResumeTest method testSuspendResume.

@Test
public void testSuspendResume() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    try {
        ua.begin("TwoPhase11HLS");
        System.out.println("Started: " + ua.identifier() + "\n");
        ActivityHierarchy hier = ua.suspend();
        System.out.println("Suspended: " + hier + "\n");
        if (ua.currentActivity() != null) {
            WSCF11TestUtils.cleanup(ua);
            fail("Hierarchy still active");
        } else {
            ua.resume(hier);
            System.out.println("Resumed: " + hier + "\n");
            ua.cancel();
            System.out.println("Cancelled");
        }
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.twophase.api.UserCoordinator) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) Test(org.junit.Test)

Example 3 with UserCoordinator

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

the class BeginCancelTest method testBeginCancel.

@Test
public void testBeginCancel() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    ua.begin("TwoPhase11HLS");
    System.out.println("Started: " + ua.identifier() + "\n");
    ua.cancel();
    System.out.println("Cancelled");
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.twophase.api.UserCoordinator) Test(org.junit.Test)

Example 4 with UserCoordinator

use of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator 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("TwoPhase11HLS");
        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.twophase.api.UserCoordinator) CoordinatorCancelledException(com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException) CoordinatorCancelledException(com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException) Test(org.junit.Test)

Example 5 with UserCoordinator

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

the class BeginConfirmTest method testBeginConfirm.

@Test
public void testBeginConfirm() throws Exception {
    System.out.println("Running test : " + this.getClass().getName());
    UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
    try {
        ua.begin("TwoPhase11HLS");
        System.out.println("Started: " + ua.identifier() + "\n");
        ua.confirm();
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.twophase.api.UserCoordinator) Test(org.junit.Test)

Aggregations

UserCoordinator (com.arjuna.mw.wscf.model.twophase.api.UserCoordinator)7 Test (org.junit.Test)7 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)3 NoCoordinatorException (com.arjuna.mw.wscf.exceptions.NoCoordinatorException)2 CoordinatorCancelledException (com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException)2