Examples of WrappedProcess


Examples of common.WrappedProcess

  // Try correct identifier
  ProcessMgr mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  Util.sleep(15000);
  int noprocs = mgr.processes().size();
  //WfProcess proc = mgr.createProcess(requester);
  WrappedProcess proc = new WrappedProcess(mgr.createProcess(requester));
  assertTrue(mgr.processes().size() == noprocs+1);
  createdProcs.add (proc);
  Util.logExit("createMinimal");
    }
View Full Code Here

Examples of common.WrappedProcess

  Util.logEntry("removeProcesses");
  int noprocs = procDir.processes().size();
  Iterator procs = createdProcs.iterator ();
  while (procs.hasNext()) {
      //WfProcess proc = (Process)procs.next();
      WrappedProcess proc = (WrappedProcess)procs.next();
      Util.sleep(15000);
      procDir.removeProcess(proc.getWfProcess());
  }
  assertTrue
      (procDir.processes().size() == noprocs - createdProcs.size ());
  createdProcs.clear();
  Util.logExit("removeProcesses");
View Full Code Here

Examples of common.WrappedProcess

//   WfProcess proc1 = mgrMin.createProcess(requester);
//   WfProcess proc2 = mgrFull.createProcess(requester);
//   WfProcess proc3 = mgrFull.createProcess(requester);
  Util.sleep(15000);
  WrappedProcess proc1
      = new WrappedProcess(mgrMin.createProcess(requester));
  WrappedProcess proc2
      = new WrappedProcess(mgrFull.createProcess(requester));
  WrappedProcess proc3
      = new WrappedProcess(mgrFull.createProcess(requester));
  // Test attributes of processes without existing process definition
  defDir.removeProcessDefinition("SystemTest_minimal", "minimal");
  defDir.removeProcessDefinition("SystemTest_full", "full");
  Util.sleep(15000);
  boolean procdefRemoved = false;
  try {
      mgrMin = defDir.processMgr("SystemTest_minimal", "minimal");
  } catch (InvalidKeyException exc) {
      procdefRemoved = true;
  }
  assertTrue(procdefRemoved);
  procdefRemoved = false;
  try {
      mgrFull = defDir.processMgr("SystemTest_full", "full");
  } catch (InvalidKeyException exc) {
      procdefRemoved = true;
  }
  assertTrue(procdefRemoved);

  assertTrue(proc1.name() == null);
  proc1.setName("minimal Process");
  assertTrue(proc2.name().equals("PROCESS_COMPLETE_ATTRIBUTES"));
  assertTrue(proc3.name().equals("PROCESS_COMPLETE_ATTRIBUTES"));
  proc2.setName(null);
  assertTrue(proc1.name().equals("minimal Process"));
  assertTrue(proc2.name() == null);
  assertTrue(proc3.name().equals("PROCESS_COMPLETE_ATTRIBUTES"));
  assertTrue(!proc2.key().equals(proc3.key()));
  assertTrue(proc1.description() == null);
  assertTrue(proc2.description()
       .equals("Description for test of all accessible attributes"));
  assertTrue(proc3.description()
       .equals("Description for test of all accessible attributes"));
  proc3.setDescription("full");
  assertTrue(proc2.description()
       .equals("Description for test of all accessible attributes"));
  assertTrue(proc3.description().equals("full"));
  assertTrue(proc1.priority() == 3); // default priority
  assertTrue(proc2.priority() == 5);
  boolean gotException = false;
  try {
      proc1.setPriority(0);
  } catch (InvalidPriorityException exc) {
      gotException = true;
  }
  assertTrue(gotException);
  proc1.setPriority(1);
  gotException = false;
  try {
      proc2.setPriority(6);
  } catch (InvalidPriorityException exc) {
      gotException = true;
  }
  assertTrue(gotException);
  proc2.setPriority(4);
  assertTrue(proc1.priority() == 1);
  assertTrue(proc2.priority() == 4);

  /* Make sure that process attributes are no longer
     accessible after removal of process */
  procDir.removeProcess(proc1.getWfProcess());
  procDir.removeProcess(proc2.getWfProcess());
  procDir.removeProcess(proc3.getWfProcess());
  boolean processNotAccessible = false;
  try {
      int dummy = proc1.priority();
  } catch (RemoteException exc) {
      processNotAccessible = true;
View Full Code Here

Examples of common.WrappedProcess

  ProcessMgr mgrMin = defDir.processMgr("SystemTest_minimal", "minimal");
  ProcessMgr mgrFull = defDir.processMgr("SystemTest_full", "full");
//   WfProcess proc1 = mgrMin.createProcess(requester);
//   WfProcess proc2 = mgrFull.createProcess(requester);
//   WfProcess proc3 = mgrFull.createProcess(requester);
  WrappedProcess proc1
      = new WrappedProcess(mgrMin.createProcess(requester));
  WrappedProcess proc2
      = new WrappedProcess(mgrFull.createProcess(requester));
  WrappedProcess proc3
      = new WrappedProcess(mgrFull.createProcess(requester));

  // Test activity of process 1
  assertTrue(proc1.steps().size() == 1);
  WrappedActivity act = (WrappedActivity)proc1.steps().toArray()[0];
  Util.sleep(15000);
  assertTrue(act.assignments().size() == 0);
  assertTrue(act.name() == null);
  assertTrue(act.priority() == 3); // Default priority
  assertTrue(act.container().key().equals(proc1.key()));
  assertTrue(act.nextActivities().size() == 0);

  // Test activities of processes 2 and 3
  assertTrue(proc2.steps().size() == 3);
  assertTrue(proc3.steps().size() == 3);
  Iterator it = proc2.steps().iterator();
  List acts = new LinkedList();
  while (it.hasNext()) {
      act = (WrappedActivity)it.next();
      acts.clear();
      if (act.name().equals("ACT1")) {
    Util.sleep(15000);
    assertTrue(act.priority() == 1);
    assertTrue(act.description()
         .equals("Activity with dummy implementation"));
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.container().equals(proc2));
    assertTrue(act.nextActivities().size() == 1);
    acts.add("SET1");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("ACT2")) {
    assertTrue(act.priority() == 2);
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 1);
    acts.add("SET1");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("SET1")) {
    assertTrue(act.priority() == 3); // default priority
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 0);
      } else {
    assertTrue("Invalid activity " + act.name(), false);
      }
  }
  it = proc3.steps().iterator();
  Set step3Keys = new HashSet();
  while (it.hasNext()) {
      step3Keys.add(((WrappedActivity) it.next()).key());
  }
  it = proc3.activitiesInState("open.not_running.not_started")
      .iterator();
  Set state3NSKeys = new HashSet();
  while (it.hasNext()) {
      state3NSKeys.add(((WrappedActivity) it.next()).key());
  }
  it = proc3.activitiesInState("open.not_running.not_started")
      .iterator();
  Set state3NRKeys = new HashSet();
  while (it.hasNext()) {
      state3NRKeys.add(((WrappedActivity) it.next()).key());
  }
  it = proc2.activitiesInState("open.not_running")
      .iterator();
  Set state2Keys = new HashSet();
  while (it.hasNext()) {
      state2Keys.add(((WrappedActivity) it.next()).key());
  }
  // Make sure that all activities are in state
  // "open.not_running.not_started" and differ between process
  // instances.
  assertTrue(step3Keys.equals(state3NSKeys));
  assertTrue(step3Keys.equals(state3NRKeys));
  assertTrue(!step3Keys.equals(state2Keys));
  assertTrue(proc3.activitiesInState("open.not_running.suspended")
       .size() == 0);
  assertTrue(proc3.steps().size()
       == proc3.activitiesInState("open").size());
  assertTrue(proc3.activitiesInState("closed").size() == 0);
 
  assertTrue(proc1.workflowState() == WfExecutionObject.State.OPEN);
  assertTrue(proc2.workflowState() == WfExecutionObject.State.OPEN);
  assertTrue(proc3.workflowState() == WfExecutionObject.State.OPEN);

  procDir.removeProcess(proc1.getWfProcess());
  procDir.removeProcess(proc2.getWfProcess());
  procDir.removeProcess(proc3.getWfProcess());
  Util.logExit("testActivities");
    }
View Full Code Here

Examples of common.WrappedProcess

     */
    public void testActivitiesBlock1() throws Exception {
  Util.logEntry("testActivitiesBlock1");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "block_2_in_2_out");
  //WfProcess proc = mgr.createProcess(requester);
  WrappedProcess proc = new WrappedProcess(mgr.createProcess(requester));

  // Test activities of process
  assertTrue(proc.steps().size() == 9);
  Iterator it = proc.steps().iterator();
  List acts = new LinkedList();
  while (it.hasNext()) {
      WrappedActivity act = (WrappedActivity)it.next();
      acts.clear();
      if (act.name().equals("ACT1")) {
    Util.sleep(15000);
    assertTrue(act.priority() == 1);
    assertTrue(act.description()
         .equals("Activity with dummy implementation"));
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.container().key().equals(proc.key()));
    assertTrue(act.nextActivities().size() == 2);
    acts.add("B1");
    acts.add("B2");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("ACT2")) {
    Util.sleep(15000);
    assertTrue(act.priority() == 2);
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("B1");
    acts.add("B2");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("ACT3")) {
    assertTrue(act.priority() == 3);
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 0);
      } else if (act.name().equals("ACT4")) {
    assertTrue(act.priority() == 4);
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 0);
      } else if (act.name().equals("B0")) {
    assertTrue(act.priority() == 3); // default priority
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("B3");
    acts.add("B4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("B1")) {
    assertTrue(act.priority() == 3); // default priority
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 1);
    acts.add("B0");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("B2")) {
    assertTrue(act.priority() == 3); // default priority
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 1);
    acts.add("B0");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("B3")) {
    assertTrue(act.priority() == 5);
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("ACT3");
    acts.add("ACT4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("B4")) {
    assertTrue(act.priority() == 3); // default priority
    assertTrue(act.description() == null);
    assertTrue(act.assignments().size() == 0);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("ACT3");
    acts.add("ACT4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else {
    assertTrue("Invalid activity " + act.name(), false);
      }
  }
  procDir.removeProcess(proc.getWfProcess());
  Util.logExit("testActivitiesBlock1");
    }
View Full Code Here

Examples of common.WrappedProcess

     */
    public void testActivitiesBlock2() throws Exception {
  Util.logEntry("testActivitiesBlock2");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "block_diamond");
  //  WfProcess proc = mgr.createProcess(requester);
  WrappedProcess proc = new WrappedProcess(mgr.createProcess(requester));
  // Test activities of process
  assertTrue(proc.steps().size() == 15);
  Iterator it = proc.steps().iterator();
  List acts = new LinkedList();
  while (it.hasNext()) {
      WrappedActivity act = (WrappedActivity)it.next();
      acts.clear();
      if (act.name().equals("S1A1")) {
    Util.sleep(15000);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("S1A3");
    acts.add("S1A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S1A2")) {
    Util.sleep(15000);
    assertTrue(act.nextActivities().size() == 2);
    acts.add("S1A3");
    acts.add("S1A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S1A3")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S2A1");
    acts.add("S3A1");
    acts.add("S3A2");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S1A4")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S2A1");
    acts.add("S3A1");
    acts.add("S3A2");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S2A1")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S2A2");
    acts.add("S2A3");
    acts.add("S2A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S2A2")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S4A1");
    acts.add("S4A2");
    acts.add("S4A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S2A3")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S4A1");
    acts.add("S4A2");
    acts.add("S4A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S2A4")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S4A1");
    acts.add("S4A2");
    acts.add("S4A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S3A1")) {
    assertTrue(act.nextActivities().size() == 1);
    acts.add("S3A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S3A2")) {
    assertTrue(act.nextActivities().size() == 1);
    acts.add("S3A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S3A3")) {
    assertTrue(act.nextActivities().size() == 3);
    acts.add("S4A1");
    acts.add("S4A2");
    acts.add("S4A3");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S4A1")) {
    assertTrue(act.nextActivities().size() == 1);
    acts.add("S4A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S4A2")) {
    assertTrue(act.nextActivities().size() == 1);
    acts.add("S4A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S4A3")) {
    assertTrue(act.nextActivities().size() == 1);
    acts.add("S4A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S4A4")) {
    assertTrue(act.nextActivities().size() == 0);
      } else {
    assertTrue("Invalid activity " + act.name(), false);
      }
  }
  procDir.removeProcess(proc.getWfProcess());
  Util.logExit("testActivitiesBlock2");
    }
View Full Code Here

Examples of org.rzo.yajsw.wrapper.WrappedProcess

        p.setService(service);
      }
    }
    else
    {
      WrappedProcess w = WrappedProcessFactory.createProcess(_config);
      // set service in wrapper so that we may stop the service in case the application terminates and we need to shutdown the wrapper
      w.setService(service);
      w.init();
      wList.add(w);
    }
   
    w = wList.get(0);

     

    // start the applications
    // the wrapper may have to wait longer for the application to come up ->
    // start the application
    // in a separate thread and then check that the wrapper is up after a
    // max timeout
    // but return as soon as possible to the windows service controller
    final long maxStartTime = w.getMaxStartTime();
    final Future future = pool.submit(new Runnable()
    {
      public void run()
      {
        try
        {
          Thread.yield();
          wList.startAll();
        }
        catch (Throwable ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: error starting wrapper " + ex.getMessage());
          Runtime.getRuntime().halt(999);
        }
      }
    });
    pool.execute(new Runnable()
    {
      public void run()
      {
        try
        {
          future.get(maxStartTime, TimeUnit.MILLISECONDS);
        }
        catch (Exception ex)
        {
          ex.printStackTrace();
          w.getWrapperLogger().info("Win Service: wrapper did not start within " + maxStartTime + " ms " + ex.getMessage());
          Runtime.getRuntime().halt(999);
        }
      }
    });
    w.getWrapperLogger().info("Win service: before service init");

    // init the service for signaling with services.exe. app will hang
    // here until service is stopped
    service.init();
    // service has terminated -> halt the wrapper jvm
    w.getWrapperLogger().info("Win service: terminated correctly");
    Runtime.getRuntime().halt(0);
  }
View Full Code Here

Examples of org.rzo.yajsw.wrapper.WrappedProcess

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.startByTimer();
  }
View Full Code Here

Examples of org.rzo.yajsw.wrapper.WrappedProcess

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.stop();
  }
View Full Code Here

Examples of org.rzo.yajsw.wrapper.WrappedProcess

   * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
   */
  public void execute(JobExecutionContext context) throws JobExecutionException
  {
    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
    WrappedProcess process = (WrappedProcess) dataMap.get("process");
    process.startByTimer();
  }
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.