if( !initAmfRequest( runContext ) )
{
throw new SubmitException( "AMF request is not initialised properly !" );
}
submit = amfRequest.submit( runContext, false );
AMFResponse response = submit.getResponse();
if( submit.getStatus() != Submit.Status.CANCELED )
{
if( submit.getStatus() == Submit.Status.ERROR )
{
testStepResult.setStatus( TestStepStatus.FAILED );
testStepResult.addMessage( submit.getError().toString() );
amfRequest.setResponse( null );
}
else if( response == null )
{
testStepResult.setStatus( TestStepStatus.FAILED );
testStepResult.addMessage( "Request is missing response" );
amfRequest.setResponse( null );
}
else
{
runContext.setProperty( AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult );
amfRequest.setResponse( response );
testStepResult.setTimeTaken( response.getTimeTaken() );
testStepResult.setSize( response.getContentLength() );
switch( amfRequest.getAssertionStatus() )
{
case FAILED :
testStepResult.setStatus( TestStepStatus.FAILED );
break;
case VALID :
testStepResult.setStatus( TestStepStatus.OK );
break;
case UNKNOWN :
testStepResult.setStatus( TestStepStatus.UNKNOWN );
break;
}
testStepResult.setResponse( response, testStepResult.getStatus() != TestStepStatus.FAILED );
}
}
else
{
testStepResult.setStatus( TestStepStatus.CANCELED );
testStepResult.addMessage( "Request was canceled" );
}
if( response != null )
testStepResult.setRequestContent( response.getRequestContent() );
else
testStepResult.setRequestContent( amfRequest.getRequestContent() );
testStepResult.stopTimer();
}