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;
}
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);
}
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;
}
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;
}
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());
}
};
}
Aggregations