use of com.centurylink.mdw.plugin.designer.model.AutomatedTestResults 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;
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestResults in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestActionGroup method createOpenProcessInstanceAction.
private IAction createOpenProcessInstanceAction() {
IAction action = new Action() {
public void run() {
if (openProcessInstanceApplies(view.getSelectedItem())) {
WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
try {
Long procInstId = null;
if (view.getSelectedItem() instanceof AutomatedTestResults) {
AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
procInstId = expectedResults.getActualProcessInstanceId();
} else if (view.getSelectedItem() instanceof LegacyExpectedResults) {
LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
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.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance");
action.setText("Open Process Instance");
ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
action.setImageDescriptor(imageDesc);
return action;
}
Aggregations