Search in sources :

Example 96 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createStubServerAction.

private IAction createStubServerAction() {
    IAction action = new Action("Stub Server", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            WorkflowProject project = (WorkflowProject) getSelection().getFirstElement();
            actionHandler.serverAction(project, WorkflowElementActionHandler.STUB_SERVER);
            project.fireElementChangeEvent(ChangeType.STATUS_CHANGE, project.getDesignerProxy().isStubServerRunning());
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/stubserv.gif");
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)

Example 97 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method importVcsApplies.

public boolean importVcsApplies(IStructuredSelection selection) {
    if (selection.size() != 1 || !(selection.getFirstElement() instanceof WorkflowElement))
        return false;
    WorkflowElement element = (WorkflowElement) selection.getFirstElement();
    if (element.isArchived())
        return false;
    if (!(element instanceof WorkflowProject))
        return false;
    WorkflowProject project = (WorkflowProject) element;
    if (!project.isInitialized())
        return false;
    if (!project.isGitVcs() || !project.isRemote())
        return false;
    return project.getDesignerDataModel().userHasRoleInAnyGroup(UserRoleVO.PROCESS_DESIGN);
}
Also used : WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 98 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createOpenInstanceAction.

private IAction createOpenInstanceAction() {
    IAction action = new Action() {

        @Override
        public void run() {
            if (openInstanceApplies(getSelection())) {
                WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
                try {
                    Long procInstId = null;
                    if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
                        AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
                        procInstId = expectedResults.getActualProcessInstanceId();
                    } else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
                        LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
                        java.io.File resultsFile = expectedResult.getActualResultFile();
                        TestFile testFile = new TestFile(null, resultsFile.getPath());
                        testFile.load();
                        TestFileLine line1 = testFile.getLines().get(0);
                        procInstId = new Long(line1.getWord(3));
                    }
                    if (procInstId == null) {
                        MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
                        return;
                    }
                    ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
                    Long processId = procInst.getProcessId();
                    ProcessVO procVO = project.getProcess(processId).getProcessVO();
                    if (procVO == null)
                        PluginMessages.uiError("Unable to locate process: " + processId, OPEN_PROCESS_INSTANCE, project);
                    WorkflowProcess instance = new WorkflowProcess(project, procVO);
                    instance.setProcessInstance(procInst);
                    actionHandler.open(instance);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, OPEN_PROCESS_INSTANCE, project);
                }
            }
        }
    };
    action.setText(OPEN_PROCESS_INSTANCE);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) TestFileLine(com.centurylink.mdw.designer.testing.TestFileLine) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) PartInitException(org.eclipse.ui.PartInitException) ConnectException(java.net.ConnectException) NamingException(javax.naming.NamingException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException) TestFile(com.centurylink.mdw.designer.testing.TestFile) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFile(org.eclipse.core.resources.IFile) TestFile(com.centurylink.mdw.designer.testing.TestFile) File(com.centurylink.mdw.plugin.designer.model.File) JarFile(com.centurylink.mdw.plugin.designer.model.JarFile) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 99 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class AutomatedTestActionGroup method createCompareResultsAction.

private IAction createCompareResultsAction() {
    IAction action = new Action() {

        @SuppressWarnings("restriction")
        public void run() {
            if (compareResultsApplies(view.getSelectedItem())) {
                WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
                try {
                    project.getProjectFolder(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST)).refreshLocal(IResource.DEPTH_INFINITE, null);
                    Object[] items = new Object[2];
                    if (view.getSelectedItem() instanceof AutomatedTestResults) {
                        AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
                        if (project.isFilePersist()) {
                            items[0] = project.getProjectFile(expectedResults.getVcsAssetPath());
                        } else {
                            expectedResults.openTempFile(new NullProgressMonitor());
                            items[0] = expectedResults.getTempFile(expectedResults.getTempFolder());
                        }
                        String actualResultsPath = expectedResults.getPackage().getName() + "/" + expectedResults.getName();
                        items[1] = project.getProjectFile(project.getTestResultsPath(AutomatedTestCase.FUNCTION_TEST) + "/" + actualResultsPath);
                    } else if (view.getSelectedItem() instanceof LegacyExpectedResults) {
                        LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
                        items[0] = expectedResult.getExpectedResult();
                        items[1] = expectedResult.getActualResult();
                    }
                    if (items[1] == null || !((IFile) items[1]).exists()) {
                        MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file: " + ((IFile) items[1]).getLocation().toString());
                        return;
                    }
                    StructuredSelection compareSelection = new StructuredSelection(items);
                    ResultsCompareAction compareAction = new ResultsCompareAction(compareSelection);
                    compareAction.run(compareSelection);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, "Compare Test Results", project);
                }
            }
        }
    };
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "compare.results");
    action.setText("Compare Results");
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/compare.gif");
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IFile(org.eclipse.core.resources.IFile) IAction(org.eclipse.jface.action.IAction) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) IOException(java.io.IOException) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 100 with WorkflowProject

use of com.centurylink.mdw.plugin.project.model.WorkflowProject in project mdw-designer by CenturyLinkCloud.

the class AutomatedTestActionGroup method createFormatActionGroup.

private ActionGroup createFormatActionGroup() {
    formatMenu = new MenuManager("Format", null, MdwMenuManager.MDW_MENU_PREFIX + "format");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            formatMenu.removeAll();
            WorkflowProject project = view.getTestSuite().getProject();
            formatMenu.add(formatFunctionTestResultsAction);
            java.io.File resultsFile = project.getFunctionTestResultsFile();
            formatFunctionTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
            formatMenu.add(formatLoadTestResultsAction);
            resultsFile = project.getLoadTestResultsFile();
            formatLoadTestResultsAction.setEnabled(resultsFile != null && resultsFile.exists());
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IMenuManager(org.eclipse.jface.action.IMenuManager) File(java.io.File)

Aggregations

WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)128 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)31 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)25 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)22 ArrayList (java.util.ArrayList)22 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)21 CoreException (org.eclipse.core.runtime.CoreException)19 Action (org.eclipse.jface.action.Action)19 IAction (org.eclipse.jface.action.IAction)18 IProject (org.eclipse.core.resources.IProject)17 IFile (org.eclipse.core.resources.IFile)16 PartInitException (org.eclipse.ui.PartInitException)16 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)12 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)11 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 IOException (java.io.IOException)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)9