use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method findTopLevelPackages.
/**
* Finds the list of top level packages (including the default if
* supported), populated with the appropriate processes, etc.
*/
private void findTopLevelPackages(ProgressMonitor progressMonitor) {
CodeTimer timer = new CodeTimer("findTopLevelPackages()");
topLevelPackages = new ArrayList<>();
topLevelUserVisiblePackages = new ArrayList<>();
activityImpls.clear();
for (PackageVO packageVO : getTopLevelPackageVOs(progressMonitor)) {
WorkflowPackage topLevelPackage = new WorkflowPackage(this, packageVO);
topLevelPackage.setProcesses(findProcesses(topLevelPackage));
topLevelPackage.setExternalEvents(findExternalEvents(topLevelPackage));
topLevelPackage.setActivityImpls(findActivityImplementors(topLevelPackage));
topLevelPackage.setAssets(findWorkflowAssets(topLevelPackage));
topLevelPackage.setTaskTemplates(findTaskTemplates(topLevelPackage));
topLevelPackages.add(topLevelPackage);
if (topLevelPackage.isVisible())
topLevelUserVisiblePackages.add(topLevelPackage);
// register as a listener so that i can pass on element change
// events
topLevelPackage.addElementChangeListener(this);
for (WorkflowProcess process : topLevelPackage.getProcesses()) process.addElementChangeListener(this);
}
Collections.sort(topLevelPackages);
Collections.sort(topLevelUserVisiblePackages);
File resultsFile = getFunctionTestResultsFile();
if (resultsFile.exists()) {
// update test case statuses
List<TestCase> testCases = new ArrayList<>();
for (WorkflowPackage pkg : topLevelPackages) {
for (WorkflowAsset asset : pkg.getAssets()) {
if (asset instanceof AutomatedTestCase)
testCases.add(((AutomatedTestCase) asset).getTestCase());
}
}
if (!testCases.isEmpty()) {
try {
TestResultsParser parser = new TestResultsParser(resultsFile, testCases);
if (resultsFile.getName().endsWith(".xml"))
parser.parseXml();
else
parser.parseJson(getAssetDir());
} catch (Exception ex) {
PluginMessages.uiError(ex, "Parse Test Results", this);
}
}
}
timer.stopAndLog();
}
use of com.centurylink.mdw.plugin.designer.model.AutomatedTestCase in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method renameWorkflowAsset.
public void renameWorkflowAsset(final WorkflowAsset asset, final String newName) {
if (asset.getPackage().workflowAssetNameExists(newName)) {
Shell shell = MdwPlugin.getActiveWorkbenchWindow().getShell();
MessageDialog.openError(shell, RENAME_ERROR, "Name already exists: '" + newName + "'");
return;
}
String progressMsg = "Renaming to '" + newName + "'";
String errorMsg = "Rename Workflow Asset";
if (!asset.isLoaded())
asset.load();
designerRunner = new DesignerRunner(progressMsg, errorMsg, asset.getProject()) {
public void perform() throws DataAccessException, RemoteException {
asset.setVersion(1);
dataAccess.getDesignerDataModel().removeRuleSet(asset.getRuleSetVO(), false);
dataAccess.getDesignerDataAccess().renameRuleSet(asset.getRuleSetVO(), newName);
if (asset instanceof AutomatedTestCase) {
if (project.isFilePersist())
((AutomatedTestCase) asset).setTestCase(new TestCase(asset.getPackage().getName(), asset.getRawFile()));
else
((AutomatedTestCase) asset).setTestCase(new TestCase(asset.getPackage().getName(), asset.getRuleSetVO()));
}
// roughly the same as db time
asset.setModifyDate(new Date());
// hopefully
cacheRefresh.fireRefresh(RuleSetVO.JAVA.equals(asset.getLanguage()));
dataAccess.getDesignerDataModel().addRuleSet(asset.getRuleSetVO());
}
};
designerRunner.run();
}
Aggregations