use of com.arjuna.mw.wst11.UserBusinessActivity in project quickstart by wildfly.
the class ClientIT method testCancel.
/**
* Tests the scenario where an item is added to the set with in a business activity that is later cancelled. The test checks
* that the item is in the set after invoking addValueToSet on the Web service. After cancelling the Business Activity, the
* work should be compensated and thus the item should no longer be in the set.
*
* @throws Exception if something goes wrong
*/
@Test
public void testCancel() throws Exception {
System.out.println("\n\nStarting 'testCancel'. This test invokes a WS within a BA. The BA is later cancelled, which causes these WS call to be compensated.");
System.out.println("[CLIENT] Creating a new Business Activity");
UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
try {
String value = "1";
System.out.println("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA will be included in this activity)");
uba.begin();
System.out.println("[CLIENT] invoking addValueToSet(1) on WS");
client.addValueToSet(value);
Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value));
System.out.println("[CLIENT] Cancelling Business Activity (This will cause the work to be compensated)");
uba.cancel();
Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value));
} finally {
cancelIfActive(uba);
client.clear();
}
}
Aggregations