Package de.danet.an.workflow.omgcore

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


            = propsNode.addChildElement("ContextData", Consts.ASAP_PREFIX);
               
        contextData.addNamespaceDeclaration
            (Consts.CD_PREFIX, getResourceReference().getNamespace());
       
        ProcessData context = proc.processContext();
       
        Iterator iterator = context.keySet().iterator();
        while (iterator.hasNext()) {
            String name = (String) iterator.next();
            Object value = context.get(name);
            SOAPElement dataNode
                = contextData.addChildElement(name, Consts.CD_PREFIX);
            maybeAddObjectAsTextNode(respMsg, value, dataNode);
        }
    }
View Full Code Here


        ProcessDataInfo resultSignature = procdef.resultSignature();

        resultData.addNamespaceDeclaration
            (Consts.RS_PREFIX, getResourceReference().getNamespace());
       
        ProcessData result;
        result = proc.result();
       
        Iterator iterator = resultSignature.keySet().iterator();
        while (iterator.hasNext()) {
            String name = (String) iterator.next();
            Object value = result.get(name);
            SOAPElement dataNode
                = resultData.addChildElement(name, Consts.RS_PREFIX);
            maybeAddObjectAsTextNode(respMsg, value, dataNode);
        }
    }
View Full Code Here

        }
       
        SOAPElement data = findChildNode(action, "Data");
        if (data != null) {
            ProcessDefinition procdef = proc.processDefinition();
            ProcessData procData;
            try {
                procData = getProcessData(procdef, data);
                proc.setProcessContext(procData);
            } catch (ParseException e) {
                FaultUtils.setFault(respMsg,
View Full Code Here

     */
    private ProcessData getProcessData(ProcessDefinition procdef,
            SOAPElement contextData)
        throws RemoteException, SOAPException, ParseException {
        ProcessDataInfo info = procdef.contextSignature();
        ProcessData procData = new DefaultProcessData();
       
        for (Iterator pdi = contextData.getChildElements(); pdi.hasNext();) {
            SOAPElement current = (SOAPElement) pdi.next();
            String pdname = current.getLocalName();
            Object type = info.get(pdname);
            if (type == null) {
                throw new SOAPException("process does not contain a variable "
                                + "with name " + pdname);
            }
            String pdvalue = XMLUtil.getFirstLevelTextContent(current);
           
            Object value;
           
            if (type.equals(String.class)) {
                value = pdvalue;
            } else if (type.equals(Long.class)) {
                value = new Long(pdvalue);
            } else if (type.equals(Double.class)) {
                value = new Double(XMLUtil.parseXsdDouble(pdvalue));
            } else if (type.equals(Boolean.class)) {
                value = new Boolean(XMLUtil.parseXsdBoolean(pdvalue));
            } else if (type.equals(Date.class)) {
                value = XMLUtil.parseXsdDateTime(pdvalue);
            } else if (type.equals(org.w3c.dom.Element.class)) {
                // TODO: Check other values for schema types.
                value = current.getFirstChild();
            } else {
                // cannot resolve the type. leave it as a string and pray.
                value = pdvalue;
            }
           
            procData.put(pdname, value);
        }
       
        return procData;
    }
View Full Code Here

  //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

  //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")
View Full Code Here

  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

  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

  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

  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,
        !timestampTo.before(timestampRes) );
  procDir.removeProcess(proc);
View Full Code Here

TOP

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

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.