{
UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
com.arjuna.wst11.BAParticipantManager bpm1 = null;
com.arjuna.wst11.BAParticipantManager bpm2 = null;
DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, "1241");
FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_COMPENSATE, "5680");
try {
uba.begin();
bpm1 = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1241");
bpm2 = bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5680");
bpm1.completed();
bpm2.completed();
} catch (Exception eouter) {
try {
uba.cancel();
} catch(Exception einner) {
}
throw eouter;
}
// the cancel/compensate should succeed even though the participant fails to compensate
uba.cancel();
assertTrue(p.passed());
}