Search in sources :

Example 1 with GlobalId

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

the class DemoHLS method begun.

/**
 * An activity has begun and is active on the current thread.
 */
public void begun() throws SystemException {
    try {
        GlobalId activityId = UserActivityFactory.userActivity().activityId();
        _id.push(activityId);
        System.out.println("DemoHLS.begun " + activityId);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : GlobalId(com.arjuna.mw.wsas.common.GlobalId)

Example 2 with GlobalId

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

the class ResumeTest method testResume.

@Test
public void testResume() throws Exception {
    UserActivity ua = UserActivityFactory.userActivity();
    try {
        GlobalId ac1 = null;
        GlobalId ac2 = null;
        ua.start("dummy");
        ac1 = ua.activityId();
        System.out.println("Started: " + ac1);
        ua.start("dummy");
        ac2 = ua.activityId();
        System.out.println("\nStarted: " + ac2);
        ActivityHierarchy ctx = ua.suspend();
        System.out.println("\nSuspended: " + ctx);
        if (ua.currentActivity() != null) {
            fail("Current activity shoudl be null " + ua.currentActivity());
        }
        ua.resume(ctx);
        if (!ac2.equals(ua.activityId())) {
            fail("Current activity id " + ua.activityId() + " should equal " + ac2);
        }
        ua.end();
        if (!ac1.equals(ua.activityId())) {
            fail("Current activity id " + ua.activityId() + " should equal " + ac1);
        }
    } finally {
        WSASTestUtils.cleanup(ua);
    }
}
Also used : UserActivity(com.arjuna.mw.wsas.UserActivity) ActivityHierarchy(com.arjuna.mw.wsas.activity.ActivityHierarchy) GlobalId(com.arjuna.mw.wsas.common.GlobalId) Test(org.junit.Test)

Example 3 with GlobalId

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

the class FailureHLS method begun.

/**
 * An activity has begun and is active on the current thread.
 */
public void begun() throws SystemException {
    if (_failPoint == FailureHLS.BEGUN_FAIL)
        throw new SystemException();
    try {
        GlobalId activityId = UserActivityFactory.userActivity().activityId();
        _id.push(activityId);
        System.out.println("FailureHLS.begun " + activityId);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : GlobalId(com.arjuna.mw.wsas.common.GlobalId)

Aggregations

GlobalId (com.arjuna.mw.wsas.common.GlobalId)3 UserActivity (com.arjuna.mw.wsas.UserActivity)1 ActivityHierarchy (com.arjuna.mw.wsas.activity.ActivityHierarchy)1 Test (org.junit.Test)1