String uri = genUri( "http", server.getHostname(), server.getPort(), webapp.getServletUri() );
HttpMethod method = new GetMethod( uri );
queryParams[2] = configParam;
method.setQueryString( queryParams );
InputStream is = executeXMLRequest( method, uri, Constants.CONFIG_FILE );
Config config = null;
try {
config = XMLHelper.getConfig( is, Constants.CONFIG_FILE );
}
catch ( Exception e ) {
String msg = "ERROR: encountered exception processing resource( " + Constants.CONFIG_FILE + " )";
log.fatal( msg, e );
if ( e instanceof ConfigException ) {
throw (ConfigException) e;
}
throw new ConfigException( msg, e );
}
finally {
try {
if ( is != null ) {
is.close();
}
}
catch ( IOException e ) {
if ( log.isWarnEnabled() ) {
log.warn( "WARNING: received exception closing HTTP stream for( " + Constants.CONFIG_FILE +
" )", e );
}
//ignore
}
method.releaseConnection();
}
if ( log.isInfoEnabled() ) {
log.info( "config( " + config + " )" );
}
method = new GetMethod( uri );
queryParams[2] = webappParam;
method.setQueryString( queryParams );
is = executeXMLRequest( method, uri, Constants.WEBAPPS_FILE );
Webapps webapps = null;
try {
webapps = XMLHelper.getWebapps( is, Constants.WEBAPPS_FILE, config );
}
catch ( Exception e ) {
String msg = "ERROR: encountered exception processing resource( " + Constants.WEBAPPS_FILE + " )";
log.fatal( msg, e );
if ( e instanceof ConfigException ) {
throw (ConfigException) e;
}
throw new ConfigException( msg, e );
}
finally {
try {
if ( is != null ) {
is.close();
}
}
catch ( IOException e ) {
if ( log.isWarnEnabled() ) {
log.warn( "WARNING: received exception closing HTTP stream for( " + Constants.WEBAPPS_FILE +
" )", e );
}
// ignore
}
method.releaseConnection();
}
if ( log.isInfoEnabled() ) {
log.info( "webapps( " + webapps + " )" );
}
method = new GetMethod( uri );
queryParams[2] = testsParam;
method.setQueryString( queryParams );
is = executeXMLRequest( method, uri, Constants.TESTS_FILE );
TestDefinitions testDefinitions = null;
try {
testDefinitions = XMLHelper.getTestDefinitionsInstance( is, Constants.TESTS_FILE, webapps,
config.getBaseDirectory().getAbsolutePath() );
}
catch ( Exception e ) {
String msg = "ERROR: encountered exception processing resource( " + Constants.TESTS_FILE + " )";
log.fatal( msg, e );
if ( e instanceof ConfigException ) {