use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase in project mdw-designer by CenturyLinkCloud.
the class WorkflowElementActionHandler method open.
public boolean open(WorkflowElement element) {
if (element instanceof WorkflowProcess) {
WorkflowProcess processVersion = (WorkflowProcess) element;
try {
ProcessEditor processEditor = (ProcessEditor) getPage().openEditor(processVersion, "mdw.editors.process");
showPropertiesView();
processEditor.setFocus();
} catch (PartInitException ex) {
PluginMessages.uiError(getShell(), ex, "Open Process", processVersion.getProject());
}
} else if (element instanceof AutomatedTestCase && ((AutomatedTestCase) element).isLegacy()) {
// open the old way instead of as workflow asset
AutomatedTestCase testCase = (AutomatedTestCase) element;
IFile file = testCase.getCommandsFile();
IWorkbenchPage activePage = MdwPlugin.getActivePage();
try {
IDE.openEditor(activePage, file, true);
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open Test Case", testCase.getProject());
}
} else if (element instanceof WorkflowAsset) {
WorkflowAsset asset = (WorkflowAsset) element;
asset.openFile(new NullProgressMonitor());
} else if (element instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) element;
IFile file = expectedResult.getExpectedResult();
IWorkbenchPage activePage = MdwPlugin.getActivePage();
try {
IDE.openEditor(activePage, file, true);
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open Expected Result", expectedResult.getProject());
}
} else if (element instanceof com.centurylink.mdw.plugin.designer.model.File) {
com.centurylink.mdw.plugin.designer.model.File file = (com.centurylink.mdw.plugin.designer.model.File) element;
IFile workspaceFile = file.getWorkspaceFile();
IWorkbenchPage activePage = MdwPlugin.getActivePage();
try {
IDE.openEditor(activePage, workspaceFile, true);
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open File", file.getProject());
}
} else if (element instanceof ExternalEvent) {
ExternalEvent event = (ExternalEvent) element;
if (event.getProject().checkRequiredVersion(6, 0)) {
IFile file = event.getProject().getAssetFolder().getFolder(event.getPackage().getName().replace('.', '/')).getFile(event.getName() + EVT_HANDLER_FILE_EXTENSION);
IWorkbenchPage activePage = MdwPlugin.getActivePage();
try {
IDE.openEditor(activePage, file, true);
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open File", event.getProject());
}
}
} else {
return false;
}
return true;
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase 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);
}
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase 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;
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase 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;
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase 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);
}
Aggregations