Search in sources :

Example 16 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class ControlCommandShell method performDeleteProcess.

private void performDeleteProcess(TestFileLine line) throws Exception {
    logCommand(line);
    String procName = parseProcessName(line.getWord(1));
    int version = parseProcessVersion(line.getWord(1));
    ProcessVO vo;
    try {
        vo = dao.getProcessDefinition(procName, version);
        dao.removeProcess(vo, true);
    } catch (Exception e) {
        log.println("Failed to delete process " + e.getClass().getName() + ": " + e.getMessage());
    }
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) IOException(java.io.IOException) ParseException(java.text.ParseException)

Example 17 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class GroovyTestCaseRun method getProcess.

ProcessVO getProcess(String target) throws TestException {
    // qualify vcs asset processes
    if (target.indexOf('/') == -1 && testCaseAsset != null && testCaseAsset.exists())
        target = testCaseAsset.getPackageName() + "/" + target;
    ProcessVO vo = processCache.get(target);
    if (vo == null) {
        try {
            String procName = target;
            // latest
            int version = 0;
            int spaceV = target.lastIndexOf(" v");
            if (spaceV > 0) {
                try {
                    version = RuleSetVO.parseVersionSpec(procName.substring(spaceV + 2));
                    procName = target.substring(0, spaceV);
                } catch (NumberFormatException ex) {
                // process name must have space v
                }
            }
            if (testCaseAsset == null || !testCaseAsset.isVcs()) {
                // trim qualifying package name for old-style
                int lastSlash = procName.lastIndexOf('/');
                if (lastSlash >= 0)
                    procName = procName.substring(lastSlash + 1);
            }
            vo = dao.getProcessDefinition(procName, version);
            if (vo == null)
                throw new TestException("Process: " + target + " not found");
            vo = dao.getProcess(vo.getId(), vo);
        } catch (TestException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new TestException("Cannot load " + target, ex);
        }
    }
    return vo;
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) JSONException(org.json.JSONException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) XmlException(org.apache.xmlbeans.XmlException)

Example 18 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class GroovyTestCaseScript method processes.

public TestCaseProcess[] processes(String... targets) throws TestException {
    List<TestCaseProcess> processes = new ArrayList<TestCaseProcess>();
    for (int i = 0; i < targets.length; i++) {
        try {
            ProcessVO processVo = getTestCaseRun().getProcess(targets[i]);
            processes.add(new TestCaseProcess(processVo));
        } catch (TestException ex) {
            getTestCaseRun().log.println("Failed to load process " + targets[i]);
            if (// by convention > 0 are subprocesses where
            i == 0)
                // exception is expected
                throw ex;
        }
    }
    return processes.toArray(new TestCaseProcess[0]);
}
Also used : ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 19 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class TestCaseRun method getProcess.

private ProcessVO getProcess(TestFileLine line, String word) throws TestException {
    ProcessVO vo = processCache.get(word);
    if (vo == null) {
        try {
            String procName = parseProcessName(word);
            int version = parseProcessVersion(word);
            vo = dao.getProcessDefinition(procName, version);
            vo = dao.getProcess(vo.getProcessId(), vo);
            processCache.put(word, vo);
        } catch (Exception e) {
            throw new TestException(line, e.getMessage());
        }
    }
    return vo;
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) JSONException(org.json.JSONException) ParseException(java.text.ParseException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) IOException(java.io.IOException) MbengException(com.qwest.mbeng.MbengException) XmlException(org.apache.xmlbeans.XmlException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException)

Example 20 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class TestCaseRun method getWaitKey.

private String getWaitKey(TestFileLine line, String masterRequestId) throws TestException {
    ProcessVO vo = getProcess(line, line.getWord(1));
    Long activityId;
    String status;
    if (line.getWordCount() == 5) {
        // wait process_name act_logical_id status timeout
        activityId = getActivityId(vo, line.getWord(2));
        status = line.getWord(3);
    } else if (line.getWordCount() == 4) {
        // wait process_name act_logical_id timeout
        activityId = getActivityId(vo, line.getWord(2));
        status = WorkStatus.STATUSNAME_COMPLETED;
    } else {
        // wait process_name timeout
        activityId = 0L;
        status = WorkStatus.STATUSNAME_COMPLETED;
    }
    if (activityId == null)
        throw new TestException(line, "Cannot find activity with logical id " + line.getWord(2));
    return monitor.createKey(masterRequestId, vo.getProcessId(), activityId, status);
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Aggregations

ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)92 ArrayList (java.util.ArrayList)29 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)28 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)25 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)17 IOException (java.io.IOException)17 HashMap (java.util.HashMap)15 RemoteException (java.rmi.RemoteException)14 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)12 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)11 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)11 JSONException (org.json.JSONException)11 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)10 XmlException (org.apache.xmlbeans.XmlException)10 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)9 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)9 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)8 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)8 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)7 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)5