use of com.centurylink.mdw.designer.testing.TestResultsParser 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.designer.testing.TestResultsParser in project mdw-designer by CenturyLinkCloud.
the class AutomatedTestSuite method readLegacyCases.
public boolean readLegacyCases() {
testCases = new ArrayList<>();
File oldTestCasesDir = getProject().getOldTestCasesDir();
if (oldTestCasesDir.exists() && oldTestCasesDir.isDirectory()) {
File[] caseDirs = oldTestCasesDir.listFiles(new FileFilter() {
public boolean accept(File file) {
if (!file.isDirectory())
return false;
if (file.getName().equalsIgnoreCase("CVS") || file.getName().equals(".metadata"))
return false;
for (String commandsFileName : TestCase.LEGACY_TEST_CASE_FILENAMES.values()) {
if (new File(file.toString() + "/" + commandsFileName).exists())
return true;
}
return false;
}
});
List<TestCase> cases = new ArrayList<>();
for (File caseDir : caseDirs) {
AutomatedTestCase testCase = new AutomatedTestCase(getProject(), this, new TestCase("Legacy", caseDir));
testCases.add(testCase);
cases.add(testCase.getTestCase());
}
// update case statuses
File suiteResults = getProject().getFunctionTestResultsFile();
if (suiteResults != null && suiteResults.exists()) {
try {
TestResultsParser parser = new TestResultsParser(suiteResults, cases);
if (suiteResults.getName().endsWith(".xml"))
parser.parseXml();
else
parser.parseJson(getProject().getAssetDir());
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
return true;
}
return false;
}
Aggregations