Package de.danet.an.workflow.omgcore

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


  try {
      procDefDir = workflowService.processDefinitionDirectory();
      procDir = workflowService.processDirectory();
      ProcessMgr pmgr = procDefDir
    .processMgr ("jellytests", "insertTest");
      WfProcess process
    = pmgr.createProcess(new DefaultRequester (workflowService));
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      procDir.removeProcess(process);
  } finally {
      workflowService.release (procDefDir);
      workflowService.release (procDir);
View Full Code Here


  try {
      procDefDir = workflowService.processDefinitionDirectory();
      procDir = workflowService.processDirectory();
      ProcessMgr pmgr = procDefDir
    .processMgr ("jellytests", "resultsTest");
      WfProcess process
    = pmgr.createProcess(new DefaultRequester (workflowService));
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      procDir.removeProcess(process);
  } finally {
      workflowService.release (procDefDir);
      workflowService.release (procDir);
View Full Code Here

  try {
      procDefDir = workflowService.processDefinitionDirectory();
      procDir = workflowService.processDirectory();
      ProcessMgr pmgr = procDefDir
    .processMgr ("jellytests", "dbTest");
      WfProcess process
    = pmgr.createProcess(new DefaultRequester (workflowService));
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      procDir.removeProcess(process);
  } finally {
      workflowService.release (procDefDir);
      workflowService.release (procDir);
View Full Code Here

     */
    private void listActivities(SOAPMessage reqMsg, SOAPMessage respMsg)
        throws SOAPException, RemoteException {
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        WfProcess proc = null;
        try {
            proc = getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        } catch (NoSuchElementException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        }
       
        Collection activities;
        try {
            activities = proc.activitiesInState("open.running");
        } catch (InvalidStateException e) {
            FaultUtils.setFault(respMsg, ASAPException.ASAP_OPERATION_FAILED,
                    e.getMessage());
           
            return;
View Full Code Here

    private void changeState(SOAPElement action, SOAPMessage reqMsg,
            SOAPMessage respMsg)
        throws SOAPException, RemoteException {
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        WfProcess proc = null;
        try {
            proc = getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        } catch (NoSuchElementException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        }
       
       
        String requestedAsapState = getChildsTextContent(action, "State");
        String newAsapState;
        try {
            if (logger.isDebugEnabled()) {
                logger.debug("changing state of " + proc.name() + "/"
                        + proc.key() + " to '" + requestedAsapState + "'...");
            }

            String requestedOmgState
                = StateMapper.asap2omgState(requestedAsapState);

            proc.changeState(requestedOmgState);
           
            String newOmgState = proc.state();
            newAsapState = StateMapper.omg2asapState(newOmgState);
        } catch (InvalidStateException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_CONTEXT_DATA, e.getMessage());
            return;
        } catch (TransitionNotAllowedException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_STATE_TRANSITION,
                    e.getMessage());
            return;
        }

        SOAPBodyElement stateNode = createAsapResponseNode(respMsg,
                Consts.CHANGE_STATE_RESPONSE);
        stateNode.addNamespaceDeclaration(Consts.ASAP_PREFIX, Consts.ASAP_NS);
       
        SOAPElement newStateElement
            = stateNode.addChildElement("State", Consts.ASAP_PREFIX);
        newStateElement.addTextNode(newAsapState);
   
        if (logger.isDebugEnabled()) {
            logger.debug("changed state of " + proc.name() + "/" + proc.key()
                    + " from " + requestedAsapState + " to " + newAsapState);
        }
    }
View Full Code Here

                    + processId + "/" + processKey + "'...");
        }
       
        ProcessDirectory pd = getWorkflowService().processDirectory();
       
        WfProcess proc
            = pd.lookupProcess(packageId + "/" + processId, processKey);
       
        return proc;
    }
View Full Code Here

     * tested as well as default exception if no match is found.
     * @exception Exception if an error occurs
     */
    public void timeoutSynchr() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest", "timeoutSynchr");
  WfProcess proc = mgr.createProcess(requester);
  String procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  String path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:act1:act2:to"));
  procDir.removeProcess(proc);

  mgr = defDir.processMgr("SystemTest", "timeoutSynchrDefault");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:act1:act2:def"));
  procDir.removeProcess(proc);
    }
View Full Code Here

     * Test asynchronous deadline execution.
     * @exception Exception if an error occurs
     */
    public void timeoutASynchr() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest", "timeoutASynchr");
  WfProcess proc = mgr.createProcess(requester);
  String procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  String path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:act1:to1:to2:to3"));
  procDir.removeProcess(proc);
    }
View Full Code Here

     * Test deadline execution in combination with loops.
     * @exception Exception if an error occurs
     */
    public void timeoutLoop() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest", "timeoutLoop");
  WfProcess proc = mgr.createProcess(requester);
  String procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  String path = (String)data.get("TransitionPath");
  Long incr = (Long)data.get("increment");
  assertTrue("I: " + incr + "; " + path,
       path.equals("PATH:start:loop:to:loop:to:loop:end"));
  procDir.removeProcess(proc);
View Full Code Here

     * activities and/or the process.
     * @exception Exception if an error occurs
     */
    public void timeoutSuspend() throws Exception {
  ProcessMgr mgr = defDir.processMgr("SystemTest", "suspendStartMan");
  WfProcess proc = mgr.createProcess(requester);
  String procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  ProcessData data = proc.processContext();
  String path = (String)data.get("TransitionPath");
  assertTrue(path,
       path.equals("PATH:start:t1:t2:end"));
  procDir.removeProcess(proc);

  mgr = defDir.processMgr("SystemTest", "suspendEndMan");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path,
       path.equals("PATH:start:a1:t1:a2:t2:end"));
  procDir.removeProcess(proc);

  // One test case with two variants:
  // 1. activity is suspended: (deadline is triggered after resume)
  mgr = defDir.processMgr("SystemTest", "suspendAbsolute");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  Activity act = null;
  Iterator i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("A1")) {
    break;
      }
  }
  assertTrue(act.state(), stateReached(act, "open.running"));
  Thread.sleep(1000); // allow some time to invoke first tool
  act.suspend();
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:start:a1"));
  assertTrue(act.state(),
       stateReached(act, "open.not_running.suspended"));
  Thread.sleep(15000);
  Date timestampRes = new Date();
  act.resume();
  assertTrue(act.state(),
       stateReached(act, "closed.completed.abandoned"));
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  Date timestampTo = (Date)data.get("timestamp_to");
  assertTrue(path,
       path.equals("PATH:start:a1:t1:end"));
  assertTrue( timestampTo + ":" + timestampRes,
        timestampTo.after(timestampRes) );
  procDir.removeProcess(proc);

  // 2. whole process is suspended: (deadline is triggered before resume
  // but cannot be started until process is resumed)
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  act = null;
  i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("A1")) {
    break;
      }
  }
  assertTrue(act.state(), stateReached(act, "open.running"));
  Thread.sleep(1000); // allow some time to invoke first tool
  proc.suspend();
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:start:a1"));
  assertTrue(act.state(),
       stateReached(act, "closed.completed.abandoned"));
  Thread.sleep(10000);
  act = null;
  i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("TIMEOUT1")) {
    break;
      }
  }
  assertTrue(act.state(),
       stateReached(act, "open.not_running.not_started"));
  timestampRes = new Date();
  proc.resume();
  assertTrue(act.state(),
       stateReached(act, "closed.completed"));
  assertTrue(act.state(),
       !proc.state().equals("closed.completed.abandoned"));
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  timestampTo = (Date)data.get("timestamp_to");
  assertTrue(path,
       path.equals("PATH:start:a1:t1:end"));
  assertTrue( timestampTo + ":" + timestampRes,
View Full Code Here

TOP

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

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.