use of com.arjuna.mw.wsas.activity.ActivityHierarchy in project narayana by jbosstm.
the class HierarchyTest method testComparision.
@Test
public void testComparision() throws Exception {
CoordinatorManager cm1 = CoordinatorManagerFactory.coordinatorManager();
CoordinatorManager cm2 = CoordinatorManagerFactory.coordinatorManager();
cm1.begin("Sagas11HLS");
ActivityHierarchy hierarchy1 = cm1.suspend();
cm2.begin("Sagas11HLS");
ActivityHierarchy hierarchy2 = cm2.suspend();
try {
Assert.assertFalse(hierarchy1.equals(hierarchy2));
} finally {
cm1.resume(hierarchy1);
cm1.close();
cm2.resume(hierarchy2);
cm2.close();
}
}
use of com.arjuna.mw.wsas.activity.ActivityHierarchy 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;
}
}
use of com.arjuna.mw.wsas.activity.ActivityHierarchy in project narayana by jbosstm.
the class SuspendResumeMultiParticipantTest method testSuspendResumeMultiParticipant.
@Test
public void testSuspendResumeMultiParticipant() throws Exception {
System.out.println("Running test : " + this.getClass().getName());
CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
try {
cm.begin("Sagas11HLS");
cm.enlistParticipant(new SagasParticipant("p1"));
cm.enlistParticipant(new SagasParticipant("p2"));
System.out.println("Started: " + cm.identifier() + "\n");
ActivityHierarchy hier = cm.suspend();
System.out.println("Suspended: " + hier + "\n");
if (cm.currentActivity() != null) {
WSCF11TestUtils.cleanup(cm);
fail("Hierarchy still active.");
}
cm.resume(hier);
System.out.println("Resumed: " + hier + "\n");
cm.close();
} catch (Exception ex) {
WSCF11TestUtils.cleanup(cm);
throw ex;
}
}
use of com.arjuna.mw.wsas.activity.ActivityHierarchy 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;
}
}
use of com.arjuna.mw.wsas.activity.ActivityHierarchy 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;
}
}
Aggregations