Examples of UserCoordinator


Examples of com.arjuna.mw.wscf.UserCoordinator

    {
  boolean passed = false;
 
  try
  {
      UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
 
      ua.start();

      System.out.println("Started: "+ua.activityName());
     
      ua.setCompletionStatus(Success.instance());
     
      ContextManager manager = new ContextManager();
      com.arjuna.mw.wsas.context.Context[] contexts = manager.contexts();

      if (contexts != null)
      {
    for (int i = 0; i < contexts.length; i++)
        System.out.println(contexts[i]);
      }

      CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
     
      cm.addParticipant(new DemoParticipant(), Priorities.PARTICIPANT, null);

      Outcome res = ua.end();

      if (res instanceof CoordinationOutcome)
      {
    CoordinationOutcome out = (CoordinationOutcome) res;
   
View Full Code Here

Examples of com.arjuna.mw.wscf.UserCoordinator

    if (doc == null)
    {
        System.err.println("Failed to create example doc!");
    }

    UserCoordinator ua = UserCoordinatorFactory.userCoordinator(doc);
 
    ua.start();
   
    ua.end();
      }
  }
  catch (ProtocolNotRegisteredException ex)
  {
      passed = true;
View Full Code Here

Examples of com.arjuna.mw.wscf.UserCoordinator

    {
  boolean passed = false;
 
  try
  {
      UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
 
      ua.start();

      System.out.println("Started: "+ua.activityName());
     
      ua.setCompletionStatus(Success.instance());

      ua.start();

      System.out.println("Started: "+ua.activityName());
     
      ua.setCompletionStatus(Success.instance());
     
      ContextManager manager = new ContextManager();
      com.arjuna.mw.wsas.context.Context[] contexts = manager.contexts();

      if (contexts != null)
      {
    for (int i = 0; i < contexts.length; i++)
        System.out.println(contexts[i]);
      }

      CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager();
     
      cm.addParticipant(new DemoParticipant(false), Priorities.PARTICIPANT, null);

      Outcome res = ua.end();

      if (res instanceof CoordinationOutcome)
      {
    CoordinationOutcome out = (CoordinationOutcome) res;
   
    if (out.result() == TwoPhaseResult.CONFIRMED)
        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;
   
View Full Code Here

Examples of com.arjuna.mw.wscf.UserCoordinator

    {
  boolean passed = false;
 
  try
  {
      UserCoordinator ua = UserCoordinatorFactory.userCoordinator();
 
      ua.start();
     
      ua.end();

      passed = true;
  }
  catch (Exception ex)
  {
View Full Code Here

Examples of com.arjuna.mw.wscf.UserCoordinator

      System.exit(0);
  }
 
  try
  {
      UserCoordinator ua = UserCoordinatorFactory.userCoordinator(implementationDoc);
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      org.w3c.dom.Document doc = builder.newDocument();
      org.w3c.dom.Element root = doc.createElement("TopLevel3-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(DomUtil.nodeAsString(doc));

      CoordinatorManager cm = CoordinatorManagerFactory.coordinatorManager(implementationDoc);
     
      //      cm.addParticipant(new DemoXAParticipant(), Priorities.PARTICIPANT, null);
      cm.addParticipant(new DemoXAParticipant(false), 0, null);
      cm.addParticipant(new DemoXAParticipant(false), 0, null);

      System.out.println("\nEnding coordination.");
     
      ua.setCompletionStatus(Success.instance());
     
      Outcome res = ua.end();

      if (res instanceof XAOutcome)
      {
    XAOutcome out = (XAOutcome) res;
   
View Full Code Here

Examples of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator

    public void testBeginConfirm()
            throws Exception
    {
        System.out.println("Running test : " + this.getClass().getName());

        UserCoordinator ua = UserCoordinatorFactory.userCoordinator();

  try
  {
      ua.begin();

      System.out.println("Started: "+ua.identifier()+"\n");

      ua.confirm();
  }
  catch (Exception ex)
  {
      WSCFTestUtils.cleanup(ua);
        throw ex;
View Full Code Here

Examples of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator

    public void testSuspendResume()
            throws Exception
    {
        System.out.println("Running test : " + this.getClass().getName());

        UserCoordinator ua = UserCoordinatorFactory.userCoordinator();

  try
  {
      ua.begin();

      System.out.println("Started: "+ua.identifier()+"\n");

      ActivityHierarchy hier = ua.suspend();
     
      System.out.println("Suspended: "+hier+"\n");
     
      if (ua.currentActivity() != null)
      {
            WSCFTestUtils.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)
View Full Code Here

Examples of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator

    public void testCancelOnlyCancel()
            throws Exception
    {
        System.out.println("Running test : " + this.getClass().getName());

        UserCoordinator ua = UserCoordinatorFactory.userCoordinator();

  try
  {
      ua.begin();

      System.out.println("Started: "+ua.identifier()+"\n");

      ua.setCancelOnly();

      ua.cancel();
  }
  catch (CoordinatorCancelledException ex)
  {
        // why is it ok to get here?
        WSCF11TestUtils.cleanup(ua);
View Full Code Here

Examples of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator

    public void testCancelOnlyConfirm()
            throws Exception
    {
        System.out.println("Running test : " + this.getClass().getName());

        UserCoordinator ua = UserCoordinatorFactory.userCoordinator();

  try
  {
      ua.begin();

      System.out.println("Started: "+ua.identifier()+"\n");

      ua.setCancelOnly();

      ua.confirm();

        fail("Confirm succeeded after setCancelOnly");
    }
  catch (CoordinatorCancelledException ex)
  {
View Full Code Here

Examples of com.arjuna.mw.wscf.model.twophase.api.UserCoordinator

    public void testWscTranslateContext()
            throws Exception
    {
        System.out.println("Running test : " + this.getClass().getName());

        UserCoordinator ua = UserCoordinatorFactory.userCoordinator();

  try
  {
      ua.begin();

      System.out.println("Started: "+ua.identifier()+"\n");

      DeploymentContext manager = DeploymentContextFactory.deploymentContext();
      SOAPContext theContext = (SOAPContext) manager.context();

      System.out.println(theContext);

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        org.w3c.dom.Document doc = builder.newDocument();
        org.w3c.dom.Element ctx = doc.createElement("Context-test");
        final Element context = ((SOAPContext)theContext).serialiseToElement(ctx) ;
       
        org.w3c.dom.Element wscCtx = translate(context);
     
      System.out.println("\nNow got "+DomUtil.nodeAsString(wscCtx));

      ua.cancel();
  }
  catch (Exception ex)
  {
      WSCFTestUtils.cleanup(ua);
        throw ex;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.