Search in sources :

Example 6 with UserCoordinator

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

the class BeginCloseTest method testBeginClose.

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

Example 7 with UserCoordinator

use of com.arjuna.mw.wscf.model.sagas.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("Sagas11HLS");
        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.sagas.api.UserCoordinator) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) Test(org.junit.Test)

Aggregations

UserCoordinator (com.arjuna.mw.wscf.model.sagas.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.sagas.exceptions.CoordinatorCancelledException)2