Search in sources :

Example 1 with Failure

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

the class TimeoutTest method testTimeout.

@Test
public void testTimeout() throws Exception {
    UserActivity ua = UserActivityFactory.userActivity();
    int timeout = ua.getTimeout();
    try {
        ua.setTimeout(1);
        ua.start("dummy");
        Thread.currentThread();
        Thread.sleep(2000);
        if (!(ua.status() instanceof Completed)) {
            ua.end();
            fail("Activity status should be Completed " + ua.status());
        }
        if (!(ua.getCompletionStatus() instanceof Failure)) {
            fail("Activity completion status should be Failure " + ua.getCompletionStatus());
        }
        System.out.println("Activity status: " + ua.status());
    } finally {
        ua.setTimeout(timeout);
        WSASTestUtils.cleanup(ua);
    }
}
Also used : Completed(com.arjuna.mw.wsas.status.Completed) UserActivity(com.arjuna.mw.wsas.UserActivity) Failure(com.arjuna.mw.wsas.completionstatus.Failure) Test(org.junit.Test)

Aggregations

UserActivity (com.arjuna.mw.wsas.UserActivity)1 Failure (com.arjuna.mw.wsas.completionstatus.Failure)1 Completed (com.arjuna.mw.wsas.status.Completed)1 Test (org.junit.Test)1