Search in sources :

Example 11 with UserActivity

use of com.arjuna.mw.wsas.UserActivity in project narayana by jbosstm.

the class HierarchyTest method testHierarchy.

@Test
public void testHierarchy() throws Exception {
    UserActivity ua = UserActivityFactory.userActivity();
    try {
        ua.start("dummy");
        System.out.println("Started: " + ua.activityName());
        ua.start("dummy");
        System.out.println("Started: " + ua.activityName());
        ActivityHierarchy ctx = ua.currentActivity();
        System.out.println("\nHierarchy: " + ctx);
        if (ctx == null) {
            fail("current activity should not be null");
        } else {
            ua.end();
            System.out.println("\nCurrent: " + ua.activityName());
            ua.end();
            try {
                if (ua.activityName() != null) {
                    fail("activity name should be null but is " + ua.activityName());
                }
            } catch (NoActivityException ex) {
            // ok if we get here
            }
        }
    } catch (Exception ex) {
        WSASTestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserActivity(com.arjuna.mw.wsas.UserActivity) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) Test(org.junit.Test)

Example 12 with UserActivity

use of com.arjuna.mw.wsas.UserActivity in project narayana by jbosstm.

the class NullEndTest method testNullEnd.

@Test
public void testNullEnd() throws Exception {
    UserActivity ua = UserActivityFactory.userActivity();
    try {
        ua.end();
        fail("should have thrown NoActivityException");
    } catch (NoActivityException ex) {
    // it's ok if we arrive here?
    } catch (Exception ex) {
        WSASTestUtils.cleanup(ua);
        throw ex;
    }
}
Also used : UserActivity(com.arjuna.mw.wsas.UserActivity) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) NoActivityException(com.arjuna.mw.wsas.exceptions.NoActivityException) Test(org.junit.Test)

Aggregations

UserActivity (com.arjuna.mw.wsas.UserActivity)12 Test (org.junit.Test)12 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)3 HLS (com.arjuna.mw.wsas.activity.HLS)3 ContextManager (com.arjuna.mw.wsas.context.ContextManager)3 NoActivityException (com.arjuna.mw.wsas.exceptions.NoActivityException)3 DemoHLS (com.arjuna.wsas.tests.DemoHLS)3 Context (com.arjuna.mw.wsas.context.Context)2 SOAPContext (com.arjuna.mw.wsas.context.soap.SOAPContext)2 DemoSOAPContextImple (com.arjuna.wsas.tests.DemoSOAPContextImple)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 Outcome (com.arjuna.mw.wsas.activity.Outcome)1 GlobalId (com.arjuna.mw.wsas.common.GlobalId)1 Failure (com.arjuna.mw.wsas.completionstatus.Failure)1 Completed (com.arjuna.mw.wsas.status.Completed)1 FailureHLS (com.arjuna.wsas.tests.FailureHLS)1