private static TestDefinitions getTestDefinitionsInstance( TestType[] testTypes, Categories categories,
Webapps webapps )
throws ConfigException {
List list = new ArrayList();
TestDefinition testDef = null;
TestType type = null;
String[] testCategoryStrings = null;
List testCategories = null;
WebappConfig webapp = null;
for ( int i = 0; i < testTypes.length; i++ ) {
type = testTypes[i];
if ( type.getCategories() != null ) {
testCategoryStrings = type.getCategories().getCategoryArray();
testCategories = getCategories( testCategoryStrings, categories );
}
else {
testCategories = new ArrayList();
}
webapp = webapps.getWebapp( type.getWebapp() );
if ( webapp == null ) {
ConfigException ce = new ConfigException( "ERROR: unable to find test recorder webapp with name( " +
type.getWebapp() +
" ) referenced in test definition( " + type.getName() + " )" );
log.fatal( ce );
throw ce;
}
testDef =
new TestDefinition( type.getName().trim(), type.getDescription().trim(), webapp,
testCategories );
categories.addTest( testDef );
list.add( testDef );
}
TestDefinitions defs = new TestDefinitions( list, categories, webapps );