Package common

Examples of common.WrappedProcess


     */
    public void simpleSubflow() throws Exception {
  importProcessDefinition("/process/subflow.xml");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "withSimpleSub");
  //WfProcess proc = mgr.createProcess(requester);
  WrappedProcess proc = new WrappedProcess(mgr.createProcess(requester));
  proc.start();
  // Wait for completion
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  assertTrue(((String)data.get("TransitionPath"))
       .equals("PATH:act1:sub_act1:act3"));
  procDir.removeProcess(proc.getWfProcess());
  defDir.removeProcessDefinition("SystemTest", "withSimpleSub")
  defDir.removeProcessDefinition("SystemTest", "simpleSub")
    }
View Full Code Here


     */
    public void complexSubflow() throws Exception {
  importProcessDefinition("/process/complexSubflow.xml");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "complexSub");
  //WfProcess proc = mgr.createProcess(requester);
  WrappedProcess proc = new WrappedProcess(mgr.createProcess(requester));
  proc.start();
  // Wait for completion
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  assertTrue(((String)data.get("sub1Completed"))
       .equals("OK"));
  assertTrue(((String)data.get("sub2Completed"))
       .equals("OK"));
  procDir.removeProcess(proc.getWfProcess());
  defDir.removeProcessDefinition("SystemTest", "complexSub")
  defDir.removeProcessDefinition("SystemTest", "sub1")
  defDir.removeProcessDefinition("SystemTest", "sub2")
  defDir.removeProcessDefinition("SystemTest", "subsub")
    }
View Full Code Here

  assertTrue(defDir.isEnabled("SystemTest_minimal", "minimal"));
  defDir.setEnabled("SystemTest_minimal", "minimal", false);
  ProcessMgr mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  int noprocs = mgr.processes().size();
  //WfProcess proc = null;
  WrappedProcess proc = null;
  // Make sure that default is "disabled"
  assertTrue(mgr.processMgrState() == WfProcessMgr.DISABLED);
  // Test that process creation is not possible
  try {
      //proc = mgr.createProcess(requester);
      proc = new WrappedProcess(mgr.createProcess(requester));
  } catch (NotEnabledException exc) {
      gotException = true;
  }
  assertTrue(gotException);
  // Enable now and make sure that process can be created
  mgr.setProcessMgrState(WfProcessMgr.ENABLED);
  assertTrue(mgr.processes().size() == noprocs);
  proc = new WrappedProcess(mgr.createProcess(requester));
  createdProcs.add (proc);
  assertTrue(mgr.processes().size() == noprocs+1);
    }
View Full Code Here

  assertTrue(gotException);   
  // Try correct identifier
  ProcessMgr mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  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);
    }
View Full Code Here

    public void removeProcesses() throws Exception {
  int noprocs = procDir.processes().size();
  Iterator procs = createdProcs.iterator ();
  while (procs.hasNext()) {
      //WfProcess proc = (Process)procs.next();
      WrappedProcess proc = (WrappedProcess)procs.next();
      procDir.removeProcess(proc.getWfProcess());
  }
  assertTrue
      (procDir.processes().size() == noprocs - createdProcs.size ());
  createdProcs.clear();
    }
View Full Code Here

  assertTrue(mgrFull.name().equals("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 attributes of processes without existing process definition
  defDir.removeProcessDefinition("SystemTest_minimal", "minimal");
  defDir.removeProcessDefinition("SystemTest_full", "full");
  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

  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];
  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")) {
    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());
    }
View Full Code Here

     * @exception Exception if an error occurs
     */
    public void testActivitiesBlock1() throws Exception {
  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")) {
    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")) {
    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());
    }
View Full Code Here

     * @exception Exception if an error occurs
     */
    public void testActivitiesBlock2() throws Exception {
  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")) {
    assertTrue(act.nextActivities().size() == 2);
    acts.add("S1A3");
    acts.add("S1A4");
    assertTrue(activitiesIncluded(act.nextActivities(), acts));
      } else if (act.name().equals("S1A2")) {
    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());
    }
View Full Code Here

  assertTrue(defDir.isEnabled("SystemTest_minimal", "minimal"));
  defDir.setEnabled("SystemTest_minimal", "minimal", false);
  ProcessMgr mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  int noprocs = mgr.processes().size();
  //WfProcess proc = null;
  WrappedProcess proc = null;
  Util.sleep(15000);
  // Make sure that default is "disabled"
  assertTrue(mgr.processMgrState() == WfProcessMgr.DISABLED);
  // Test that process creation is not possible
  try {
      //proc = mgr.createProcess(requester);
      proc = new WrappedProcess(mgr.createProcess(requester));
  } catch (NotEnabledException exc) {
      gotException = true;
  }
  assertTrue(gotException);
  // Enable now and make sure that process can be created
  mgr.setProcessMgrState(WfProcessMgr.ENABLED);
  Util.sleep(15000);
  assertTrue(mgr.processes().size() == noprocs);
  proc = new WrappedProcess(mgr.createProcess(requester));
  createdProcs.add (proc);
  assertTrue(mgr.processes().size() == noprocs+1);
  Util.logExit("testEnabled");
    }
View Full Code Here

TOP

Related Classes of common.WrappedProcess

Copyright © 2018 www.massapicom. 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.