{
boolean passed = false;
try
{
UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
org.w3c.dom.Document doc = builder.newDocument();
org.w3c.dom.Element root = doc.createElement("Nested1-test");
ua.start();
System.out.println("Started: "+ua.activityName()+"\n");
DeploymentContext manager = DeploymentContextFactory.deploymentContext();
Context theContext = manager.context();
((SOAPContext)theContext).serialiseToElement(root) ;
doc.appendChild(root);
System.out.println(com.arjuna.mw.wscf.utils.DomUtil.nodeAsString(doc));
ua.start();
System.out.println("Started: "+ua.activityName()+"\n");
theContext = manager.context();
doc = builder.newDocument();
root = doc.createElement("Nested1-test");
((SOAPContext)theContext).serialiseToElement(root) ;
doc.appendChild(root);
System.out.println(com.arjuna.mw.wscf.utils.DomUtil.nodeAsString(doc));
CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
cm.addParticipant(new DemoParticipant(), Priorities.PARTICIPANT, null);
Outcome res = ua.end();
if (res instanceof CoordinationOutcome)
{
CoordinationOutcome out = (CoordinationOutcome) res;
if (out.result() == TwoPhaseResult.CANCELLED)
passed = true;
else
System.out.println("Result is: "+TwoPhaseResult.stringForm(out.result()));
}
else
System.out.println("Outcome is: "+res);
res = ua.end();
if (res instanceof CoordinationOutcome)
{
CoordinationOutcome out = (CoordinationOutcome) res;