Search in sources :

Example 1 with NoCoordinatorException

use of com.arjuna.mw.wscf.exceptions.NoCoordinatorException in project narayana by jbosstm.

the class SuspendCloseTest method testSuspendClose.

@Test
public void testSuspendClose() 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.");
        }
        ua.close();
    } catch (NoCoordinatorException ex) {
        WSCF11TestUtils.cleanup(ua);
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.sagas.api.UserCoordinator) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) Test(org.junit.Test)

Example 2 with NoCoordinatorException

use of com.arjuna.mw.wscf.exceptions.NoCoordinatorException in project narayana by jbosstm.

the class SuspendTest method testSuspend.

@Test
public void testSuspend() 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.");
        }
    } catch (NoCoordinatorException ex) {
    // why is it ok to get here?
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.sagas.api.UserCoordinator) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) Test(org.junit.Test)

Example 3 with NoCoordinatorException

use of com.arjuna.mw.wscf.exceptions.NoCoordinatorException in project narayana by jbosstm.

the class SuspendConfirmTest method testSuspendConfirm.

@Test
public void testSuspendConfirm() 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.");
        }
        ua.confirm();
    } catch (NoCoordinatorException 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) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) Test(org.junit.Test)

Example 4 with NoCoordinatorException

use of com.arjuna.mw.wscf.exceptions.NoCoordinatorException in project narayana by jbosstm.

the class SuspendTest method testSuspend.

@Test
public void testSuspend() 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.");
        }
    } catch (NoCoordinatorException ex) {
    // why is it ok to get here?
    } catch (Exception ex) {
        WSCF11TestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserCoordinator(com.arjuna.mw.wscf.model.twophase.api.UserCoordinator) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) NoCoordinatorException(com.arjuna.mw.wscf.exceptions.NoCoordinatorException) Test(org.junit.Test)

Aggregations

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