}
return session;
}
private void executeRequests() throws PlaybackException {
RequestData request = null;
int testNumber = 0;
try {
List requestList = getSession().getRequestData();
if ( log.isDebugEnabled() ) {
log.debug( "beginning test execution" );
}
for ( testNumber = 0; testNumber < requestList.size(); testNumber++ ) {
request = (RequestData) requestList.get( testNumber );
if ( log.isDebugEnabled() ) {
log.debug( "beginning execution for test number( " + ( testNumber + 1 ) + " )" );
}
HttpMethod method = createPlaybackMethod( request, getTest() );
if ( log.isDebugEnabled() ) {
log.debug( "playback URI( " + method.getURI() + " )" );
}
ResponseData response = execute( getTestClient(), method );
if ( log.isDebugEnabled() ) {
log.debug( "playback response, status code( " + response.getStatusCode() + " )" );
log.debug( "playback response, body(\n" + response.getBody() + " )" );
}
String outcome = response.getHeader( Constants.OUTCOME_HEADER );
if ( log.isDebugEnabled() ) {
log.debug( "outcome( " + outcome + " )" );
}
if ( response.getStatusCode() >= 400 ) {
String msg = "WARNING: unable to access URI( " + method.getURI() +
" ), status code( " + response.getStatusCode() + " ) returned";
System.out.println( msg );
if ( log.isWarnEnabled() ) {
log.warn( msg );
}
}
}
}
catch ( Exception e ) {
String msg = "ERROR: failed executing request for test( " + getTest().getName() +
" ), testNumber( " + testNumber + " ), path( " + request.getPath() + " ), exception( "
+ e.getMessage() + " )";
log.error( msg, e );
if ( e instanceof PlaybackException ) {
throw (PlaybackException) e;
}