protected List<ModelTestSuite> modelTestSuiteList = FastList.newInstance();
public JunitSuiteWrapper(String componentName, String suiteName, String testCase) {
for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(componentName)) {
ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler();
try {
Document testSuiteDocument = testSuiteResource.getDocument();
// TODO create TestSuite object based on this that will contain its TestCase objects
Element documentElement = testSuiteDocument.getDocumentElement();
ModelTestSuite modelTestSuite = new ModelTestSuite(documentElement, testCase);
// make sure there are test-cases configured for the suite
if (suiteName != null && !modelTestSuite.getSuiteName().equals(suiteName)) {
continue;
}
if (modelTestSuite.getTestList().size() > 0) {
this.modelTestSuiteList.add(modelTestSuite);
}
} catch (GenericConfigException e) {
String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]";
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
}
}
}