Search in sources :

Example 1 with AutomatedTestSuite

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

the class WorkflowElementActionHandler method refresh.

public void refresh(WorkflowElement element) {
    if (element instanceof WorkflowProject) {
        final WorkflowProject workflowProject = (WorkflowProject) element;
        workflowProject.clear();
        workflowProject.fireElementChangeEvent(workflowProject, ChangeType.SETTINGS_CHANGE, null);
        BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {

            public void run() {
                if (!workflowProject.isFilePersist())
                    syncOpenEditors(workflowProject);
            }
        });
    } else if (element instanceof AutomatedTestSuite) {
        AutomatedTestSuite testSuite = (AutomatedTestSuite) element;
        testSuite.readLegacyCases();
        testSuite.fireElementChangeEvent(testSuite, ChangeType.SETTINGS_CHANGE, null);
    } else if (element instanceof AutomatedTestCase) {
        AutomatedTestCase testCase = (AutomatedTestCase) element;
        testCase.setTestCase(testCase.getTestCase());
        testCase.fireElementChangeEvent(testCase, ChangeType.SETTINGS_CHANGE, null);
    }
}
Also used : WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)

Example 2 with AutomatedTestSuite

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

the class ProcessExplorerActionGroup method createDebugAction.

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

        @Override
        public void run() {
            if (!debugApplies(getSelection()))
                return;
            view.setFocus();
            Object element = getSelection().getFirstElement();
            if (element instanceof AutomatedTestSuite || element instanceof AutomatedTestCase)
                actionHandler.debugTest(getSelection());
            else
                actionHandler.debug((WorkflowElement) element);
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/debug.gif");
    action.setImageDescriptor(imageDesc);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "debug");
    action.setText("Debug...");
    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) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement)

Example 3 with AutomatedTestSuite

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

the class ProcessExplorerActionGroup method createRunFromStartPageAction.

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

        @Override
        public void run() {
            if (!runFromPageApplies(getSelection()))
                return;
            view.setFocus();
            Object element = getSelection().getFirstElement();
            if (element instanceof AutomatedTestSuite || element instanceof AutomatedTestCase)
                actionHandler.test(getSelection());
            else if (element instanceof File && ((File) element).getParent() instanceof AutomatedTestCase && TestCase.LEGACY_TEST_CASE_FILENAMES.values().contains(((File) element).getName()))
                actionHandler.test(getSelection());
            else
                actionHandler.runFromPage((WorkflowElement) element);
        }
    };
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_RUN_GIF);
    action.setImageDescriptor(imageDesc);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "run.start.page");
    action.setText("Run Start Page...");
    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) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) 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) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)

Example 4 with AutomatedTestSuite

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

the class AutomatedTestLaunchShortcut method createLaunchConfiguration.

protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(WorkflowElement element, boolean debug) throws CoreException, JSONException {
    String testName = null;
    List<String> testCases = new ArrayList<>();
    WorkflowProject workflowProject = element.getProject();
    WorkflowPackage workflowPackage = null;
    boolean isLegacyLaunch = false;
    if (element instanceof WorkflowProject) {
        testName = workflowProject.getName();
        testCases = workflowProject.getTestCaseStringList();
    } else if (element instanceof WorkflowPackage) {
        workflowPackage = (WorkflowPackage) element;
        testName = workflowPackage.getName();
        testCases = workflowPackage.getTestCaseStringList();
    } else if (element instanceof AutomatedTestCase) {
        AutomatedTestCase testCase = (AutomatedTestCase) element;
        if (testCase.isLegacy()) {
            testName = workflowProject.getName() + LEGACY;
            isLegacyLaunch = true;
        } else {
            workflowPackage = testCase.getPackage();
            testName = workflowPackage.getName();
        }
        testCases = new ArrayList<>();
        if (testCase.isPostman() && testCase.getItems() != null && workflowPackage != null) {
            testCases.addAll(workflowPackage.getTestCaseItems(testCase));
        } else
            testCases.add(testCase.getPath());
    } else if (element instanceof AutomatedTestSuite) {
        testName = workflowProject.getName() + LEGACY;
        isLegacyLaunch = true;
        testCases = ((AutomatedTestSuite) element).getTestCaseStringList();
    }
    return createLaunchConfiguration(workflowProject, workflowPackage, isLegacyLaunch, testName, testCases, debug);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ArrayList(java.util.ArrayList) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestCase(com.centurylink.mdw.plugin.designer.model.AutomatedTestCase) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)

Example 5 with AutomatedTestSuite

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

the class AutomatedTestContentProvider method inputChanged.

/**
 * Registers this content provider as a listener to changes on the new input
 * (for workflow element changes), and deregisters the viewer from the old
 * input. In response to these ElementChangeEvents, we update the viewer.
 */
@SuppressWarnings("unchecked")
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    this.treeViewer = (TreeViewer) viewer;
    if (oldInput != null) {
        List<AutomatedTestSuite> oldSuites = (List<AutomatedTestSuite>) oldInput;
        for (AutomatedTestSuite oldSuite : oldSuites) {
            oldSuite.removeElementChangeListener(this);
            oldSuite.getProject().removeElementChangeListener(this);
        }
    }
    if (newInput != null) {
        List<AutomatedTestSuite> newSuites = (List<AutomatedTestSuite>) newInput;
        for (AutomatedTestSuite newSuite : newSuites) {
            newSuite.addElementChangeListener(this);
            newSuite.getProject().addElementChangeListener(this);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) AutomatedTestSuite(com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)

Aggregations

AutomatedTestSuite (com.centurylink.mdw.plugin.designer.model.AutomatedTestSuite)16 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)14 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)7 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)7 ArrayList (java.util.ArrayList)7 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)6 List (java.util.List)4 PartInitException (org.eclipse.ui.PartInitException)4 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)3 Folder (com.centurylink.mdw.plugin.designer.model.Folder)3 LegacyExpectedResults (com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults)3 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)3 Action (org.eclipse.jface.action.Action)3 IAction (org.eclipse.jface.action.IAction)3 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)3 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)3 TestFile (com.centurylink.mdw.designer.testing.TestFile)2 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)2 File (com.centurylink.mdw.plugin.designer.model.File)2 JarFile (com.centurylink.mdw.plugin.designer.model.JarFile)2