Package de.danet.an.workflow.omgcore

Examples of de.danet.an.workflow.omgcore.WfActivity


  int i = 9;
  int resCnt = 0;
  while (i-- > 0) {
      boolean resd = false;
      for (Iterator it = process.steps().iterator(); it.hasNext();) {
    WfActivity a = (WfActivity)it.next();
    if (a.state().startsWith ("open.not_running.suspended")) {
        a.resume ();
        resd = true;
        resCnt += 1;
        Thread.sleep (500);
    }
      }
View Full Code Here


            stateReached(toolAct, "open.not_running.suspended.abandoning");
            toolAct.resume();
            assertTrue (stateReached (process, "closed.completed"));
            boolean found = false;
            for (Iterator i = process.steps().iterator(); i.hasNext();) {
                WfActivity act = (WfActivity)i.next ();
                if (act.name().equals("Generic")) {
                    found = true;
                    assertTrue (act.state().startsWith("closed.completed"));
                }
            }
            assertTrue (found);
            procDir.removeProcess(process);
        } finally {
View Full Code Here

            toolAct.changeState("open.not_running.suspended.clearing_exception");
            toolAct.resume();
            assertTrue (stateReached (process, "closed.completed"));
            boolean found = false;
            for (Iterator i = process.steps().iterator(); i.hasNext();) {
                WfActivity act = (WfActivity)i.next ();
                if (act.name().equals("Generic")) {
                    found = true;
                    assertTrue (act.state().startsWith("open.not_running.not_started"));
                }
            }
            assertTrue (found);
            found = false;
            for (Iterator i = process.steps().iterator(); i.hasNext();) {
                WfActivity act = (WfActivity)i.next ();
                if (act.name().equals("Normal")) {
                    found = true;
                    assertTrue (act.state().startsWith("closed.completed"));
                }
            }
            assertTrue (found);
            procDir.removeProcess(process);
        } finally {
View Full Code Here

  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  // start the activities and stop it.
  for (int i = 1; i <= 4; i++) {
      Collection c = process.steps();
      WfActivity a = null;
      for (Iterator it = c.iterator(); it.hasNext();) {
    a = (WfActivity)it.next();
    if (a.name().equals ("A2" + i)) {
        break;
    }
      }
      assertTrue(a.state() != null);
      boolean exceptionCaught = false;
      assertTrue
    (a.name() + " not open.not_running.suspended: " + a.state(),
     a.state().startsWith("open.not_running.suspended"));
      a.resume();
      Thread.sleep (1000);
      a.resume();
      Thread.sleep (1000);
      assertTrue(a.name() + " not closed.completed: " + a.state(),
           a.state().startsWith("closed.completed"));
  }
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

    public int compare (Object o1, Object o2) {
        return ((WfActivity)o1).toString()
      .compareTo (((WfActivity)o2).toString());
    }
      });
  WfActivity a41 = (WfActivity)actArray[0];
  WfActivity a42 = (WfActivity)actArray[1];
  WfActivity a43 = (WfActivity)actArray[2];
  WfActivity a44 = (WfActivity)actArray[3];
  // start A41
  assertTrue(a41.state().startsWith("open.not_running.suspended"));
  a41.resume();
  Thread.sleep (1000);
  assertTrue(a42.state().startsWith("open.not_running.suspended"));
  assertTrue(a43.state().startsWith("open.not_running.not_started"));
  assertTrue(a44.state().startsWith("open.not_running.not_started"));
  // start A42
  a42.resume();
  Thread.sleep (1000);
  assertTrue(a43.state().startsWith("open.not_running.not_started"));
  assertTrue(a44.state().startsWith("open.not_running.suspended"));
  // start A44
  a44.resume();
  Thread.sleep (1000);
  // process terminated
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

    public int compare (Object o1, Object o2) {
        return ((WfActivity)o1).toString()
      .compareTo (((WfActivity)o2).toString());
    }
      });
  WfActivity a61 = (WfActivity)actArray[0];
  WfActivity a62 = (WfActivity)actArray[1];
  WfActivity a63 = (WfActivity)actArray[2];
  WfActivity a64 = (WfActivity)actArray[3];
  WfActivity a65 = (WfActivity)actArray[4];
  WfActivity a66 = (WfActivity)actArray[5];
  WfActivity a67 = (WfActivity)actArray[6];
  WfActivity a68 = (WfActivity)actArray[7];
  // start A61
  assertTrue(a61.state().startsWith("open.not_running.suspended"));
  a61.resume();
  Thread.sleep (1000);
  assertTrue(a62.state().startsWith("open.not_running.not_started"));
  assertTrue(a63.state().startsWith("open.not_running.suspended"));
  assertTrue(a64.state().startsWith("open.not_running.not_started"));
  // start A63
  a63.resume();
  Thread.sleep (1000);
  assertTrue(a66.state().startsWith("open.not_running.suspended"));
  assertTrue(a65.state().startsWith("open.not_running.not_started"));
  // start A66 and then stop it.
  a66.resume();
  Thread.sleep (1000);
  // start A67
  a67.resume();
  Thread.sleep (1000);
  // start A68
  a68.resume();
  Thread.sleep (1000);
  // process terminated
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

    private boolean allActivitiesOfProcessHaveState (WfProcess proc,
                 String state)
  throws Exception {
  Iterator it = proc.steps().iterator();
  while (it.hasNext()) {
      WfActivity a = (WfActivity)it.next();
      if (!a.state().startsWith(state)) {
    return false;
      }
  }
  return true;
    }
View Full Code Here

  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  // start the first two activities and stop it.
  Collection c = process.steps();
  for (int i = 1; i <= 2; i++) {
      WfActivity a = null;
      for (Iterator it = c.iterator(); it.hasNext();) {
    a = (WfActivity)it.next();
    if (a.name().equals ("A1" + i)) {
        break;
    }
      }
      if (a.name().equals("A12")) {
    Thread.sleep (1000);
    a.resume();
      }
      Thread.sleep (1000);
      assertTrue(a.name() + " not closed.completed: " + a.state(),
           a.state().startsWith("closed.completed"));
  }
  assertTrue(!process.state().equals("closed.completed"));

  // try to remove the process (should result into an exception)
  boolean removeExceptionCaught = false;
  try {
      //Process p = processDirectory().lookupProcess(null, process.key());
      processDirectory().removeProcess(process);
      assertTrue(false);
  } catch (CannotRemoveException cre) {
      removeExceptionCaught = true;
  } catch (Exception e) {
      e.printStackTrace();
      assertTrue("Unexpected exception caugth", false);
  }
  assertTrue("did not receive CannotRemoveException for a process "
       + "that has not been terminated",
       removeExceptionCaught);
 
  // start the last activity and stop it.
  for (int i = 3; i <= 3; i++) {
      WfActivity a = null;
      for (Iterator it = c.iterator(); it.hasNext();) {
    a = (WfActivity)it.next();
    if (a.name().equals ("A1" + i)) {
        break;
    }
      }
      assertTrue(a.state() != null);
      boolean exceptionCaught = false;
      assertTrue
        (a.name() + " not open.not_running.suspended: " + a.state(),
       a.state().startsWith("open.not_running.suspended"));
      a.resume();
      Thread.sleep (1000);
      a.resume();
      Thread.sleep (1000);
      assertTrue(a.name() + " not closed.completed: " + a.state(),
             a.state().startsWith("closed.completed"));
  }
  assertTrue(process + " not closed.completed: " + process.state(),
       process.state().startsWith("closed.completed"));
 
  // finally remove the process and retry to access it
View Full Code Here

    = pmgr.createProcess(new DefaultRequester (workflowService));
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      boolean found = false;
      for (Iterator i = process.steps().iterator(); i.hasNext();) {
          WfActivity act = (WfActivity)i.next ();
          if (act.name().equals("Generic")) {
              found = true;
              assertTrue (act.state().startsWith("closed.completed"));
          }
      }
      assertTrue (found);
      procDir.removeProcess(process);
  } finally {
View Full Code Here

    = pmgr.createProcess(new DefaultRequester (workflowService));
      process.start();
      assertTrue (stateReached (process, "closed.terminated"));
            boolean found = false;
            for (Iterator i = process.steps().iterator(); i.hasNext();) {
                WfActivity act = (WfActivity)i.next ();
                if (act.name().equals("Get stock quote")) {
                    found = true;
                    assertTrue (act.state().startsWith("closed.terminated"));
                }
            }
            assertTrue (found);     
      procDir.removeProcess(process);
  } finally {
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.omgcore.WfActivity

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.