Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.ProcessMgr


    /**
     * Test initial values of process data.
     * @exception Exception if an error occurs
     */
    public void testData() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest_full", "full");
  WfProcess proc = mgr.createProcess(requester);
  ProcessData data = proc.processContext();
  assertTrue(((Boolean)data.get("packageBooleanData")).booleanValue());
  assertTrue(((String)data.get("testString")).equals("WfMOpen"));
  assertTrue((((String)data.get("packageStringData")) == null));
  assertTrue(((Long)data.get("packageIntegerData")).intValue() == 3);

  // Test access to context info via activity
  assertTrue(proc.steps().size() > 0);
  WfActivity act = (WfActivity)proc.steps().toArray()[0];
  data = act.processContext();
  assertTrue(((Boolean)data.get("packageBooleanData")).booleanValue());
  assertTrue(((String)data.get("testString")).equals("WfMOpen"));
  assertTrue((((String)data.get("packageStringData")) == null)
       || (((String)data.get("packageStringData")).equals("")));
  assertTrue(((Long)data.get("packageIntegerData")).intValue() == 3)

  procDir.removeProcess(proc);

  mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  proc = mgr.createProcess(requester);
  assertTrue(proc.processContext().isEmpty());
  procDir.removeProcess(proc);
    }
View Full Code Here


    /**
     * Test modification of process data.
     * @exception Exception if an error occurs
     */
    public void modifyData() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest_full", "full");
  WfProcess proc = mgr.createProcess(requester);
  ProcessData data = proc.processContext();
 
  assertTrue(((Boolean)data.get("packageBooleanData")).booleanValue());
  assertTrue(((String)data.get("testString")).equals("WfMOpen"));
  assertTrue((((String)data.get("packageStringData")) == null));
  assertTrue(((Long)data.get("packageIntegerData")).intValue() == 3);
  data.put("", null);
  // Illegal empty entry
  boolean invalidData = false;
  try {
      proc.setProcessContext(data);
  } catch (InvalidDataException exc) {
      invalidData = true;   
  }
  assertTrue(invalidData);
  data.remove("");
  data.put("teststring", "illegal");
  data.put("packageIntegerData", "5");
  // Misspelled teststring and wrong data type for Integer
  invalidData = false;
  try {
      proc.setProcessContext(data);
  } catch (InvalidDataException exc) {
      invalidData = true;   
  }
  data.remove("teststring");
  Iterator it = data.keySet().iterator();
  // Still wrong data type for Integer
  invalidData = false;
  try {
      proc.setProcessContext(data);
  } catch (InvalidDataException exc) {
      invalidData = true;   
  }
  data.put("packageIntegerData", new Integer("5"));

  proc.setProcessContext(data);
  ProcessDataInfo ctxInfo = mgr.contextSignature();
  // Fetch data to check modifications
  data = proc.processContext();
  assertTrue(((Long)data.get("packageIntegerData")).intValue() == 5);

  procDir.removeProcess(proc);

  mgr = defDir.processMgr("SystemTest_minimal", "minimal");
  proc = mgr.createProcess(requester);
  data = proc.processContext();
  assertTrue(data.isEmpty());
  proc.setProcessContext(data);
  data.put("", null);
  invalidData = false;
View Full Code Here

    public void checkWSIFToolInvocation() throws Exception {
  // create the process
  ProcessDefinitionDirectory pdd
      = workflowService().processDefinitionDirectory();
  // dynamic invoke WSIF with WSDL definition as DOM tree.
  ProcessMgr pmgr = pdd.processMgr("st-testWSIF", "testWSIF1");
  WfProcess process = pmgr.createProcess(defaultRequester());
   process.start();
  checkResult(process);
  // dynamic invoke WSIF with WSDL definition retrieved from URL.
  ProcessMgr pmgr2 = pdd.processMgr("st-testWSIF", "testWSIF2");
  WfProcess process2 = pmgr2.createProcess(defaultRequester());
   process2.start();
  checkResult(process2);
    }
View Full Code Here

     * Test a soap tool invocation which returns a complex data type of JDOM
     * element.
     * @exception Exception if an error occurs
     */
    public void googleSearch() throws Exception {
  ProcessMgr pmgr3 = pdd.processMgr("st-testWSIF", "testWSIF3");
  WfProcess process3 = pmgr3.createProcess(defaultRequester());
   process3.start();
  Thread.sleep(30000);
   Map map = (Map)process3.result();
  for (Iterator it2 = map.keySet().iterator(); it2.hasNext();) {
      String name = (String) it2.next();
View Full Code Here

     */
    protected Process createProcess (String pkgId, String prcId)
        throws Exception {
  ProcessDefinitionDirectory pdd
      = workflowService().processDefinitionDirectory();
  ProcessMgr pmgr = pdd.processMgr(pkgId, prcId);
  Process process = (Process) pmgr.createProcess (defaultRequester());
  return process;
    }
View Full Code Here

    public void testEnabled() throws Exception {
  boolean gotException = false;
  // test default setting
  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

     * Test creating a process, passing through and (automatically) removing.
     * @exception Exception if an error occurs
     */
    public void testRun() throws Exception {
  List msgList = importProcessDefinition("/process/minimal.xml");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "stopOnStart");
  WfProcess proc = mgr.createProcess(requester);
  String procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "open.running.running",
        "open.not_running.suspended.suspended"));
  Activity act = (Activity)proc.steps().toArray()[0];
  act.resume();
  assertTrue(stateReached(proc, "closed.completed",
        "closed.completed"));
  // Assure that process has to be removed manually
  assertTrue(mgr.processByKey(procKey) != null);
  procDir.removeProcess(proc);
  boolean processRemoved = false;
  try {
      mgr.processByKey(procKey);
  } catch (InvalidKeyException exc) {
      processRemoved = true;
  }
  assertTrue(processRemoved);
 
  mgr = defDir.processMgr("SystemTest", "stopOnFinish");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "open.running.running",
        "open.not_running.suspended.suspended"));
  act = (Activity)proc.steps().toArray()[0];
  act.resume();
  assertTrue(stateReached(proc, "closed.completed",
        "closed.completed"));
  // Assure that process has to be removed manually
  assertTrue(mgr.processByKey(procKey) != null);
  procDir.removeProcess(proc);
  processRemoved = false;
  try {
      mgr.processByKey(procKey);
  } catch (InvalidKeyException exc) {
      processRemoved = true;
  }
  assertTrue(processRemoved);

  mgr = defDir.processMgr("SystemTest", "completeNoRemoval");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed",
        "closed.completed"));
  // Assure that process has to be removed manually
  assertTrue(mgr.processByKey(procKey) != null);
  procDir.removeProcess(proc);
  processRemoved = false;
  try {
      mgr.processByKey(procKey);
  } catch (InvalidKeyException exc) {
      processRemoved = true;
  }
  assertTrue(processRemoved);

  mgr = defDir.processMgr("SystemTest", "completeRemoval");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  // Assure that process has been removed automatically
  processRemoved = false;
  int maxRetries = 5;
  boolean test = true;
  while (test){
      if (maxRetries-- > 0) {
    try {
        mgr.processByKey(procKey);
        Thread.sleep(1000);
    } catch (InvalidKeyException exc) {
        processRemoved = true;
        test = false;
    }
View Full Code Here

  } catch (InvalidKeyException exc) {
      gotException = true;
  }
  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

     * Test the transition path when executing processes.
     * @exception Exception if an error occurs
     */
    public void testPath() throws Exception {
  List msgList = importProcessDefinition("/process/transition1.xml");
  ProcessMgr mgr = defDir.processMgr("SystemTest", "simplePath");
  WfProcess proc = mgr.createProcess(requester);
  proc.start();
  // Wait for completion
  assertTrue(stateReached(proc, "closed.completed",
        "closed.completed"));
  ProcessData data = proc.processContext();
  assertTrue(((String)data.get("TransitionPath"))
       .equals("PATH:act1:act2:act3"));
  procDir.removeProcess(proc);

  mgr = defDir.processMgr("SystemTest", "block_2_in_2_out");
  proc = mgr.createProcess(requester);
  proc.start();
  // Wait for completion
  assertTrue("Process not completed in time",
       stateReached(proc, "closed.completed",
        "closed.completed"));
View Full Code Here

     * Test all accessible attributes of process manager and process
     * (except process data and process context information).
     * @exception Exception if an error occurs
     */
    public void testProcAttributes() throws Exception {
  ProcessMgr mgrMin = defDir.processMgr("SystemTest_minimal", "minimal");
  ProcessMgr mgrFull = defDir.processMgr("SystemTest_full", "full");

  // Test attributes of process manager
  assertTrue(mgrMin.category() == null);
  assertTrue(mgrMin.description() == null);
  assertTrue(mgrMin.version() == null);
  assertTrue(mgrMin.name().equals("SystemTest_minimal/minimal"));
  assertTrue(mgrFull.category().equals("System Test (procdef)"));
  assertTrue(mgrFull.description()
       .equals("Description for test of all accessible attributes"));
 
  assertTrue(mgrFull.version().equals("beta 1"));
  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 {
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.ProcessMgr

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.