dialog.setBooleanValue( Form.CLOSE_REQUEST, true );
dialog.setBooleanValue( Form.SHOW_TESTCASE, true );
dialog.setIntValue( Form.PORT, 8181 );
dialog.setValue( Form.PATH, "/" + operation.getName() );
SoapUIDesktop desktop = SoapUI.getDesktop();
dialog.getFormField( Form.CLOSE_REQUEST ).setEnabled( desktop != null && desktop.hasDesktopPanel( request ) );
if( !dialog.show() )
return false;
TestStepConfig config = WsdlMockResponseStepFactory.createConfig( operation, request, false );
MockResponseStepConfig mockResponseStepConfig = ( ( MockResponseStepConfig )config.getConfig() );
config.setName( dialog.getValue( Form.STEP_NAME ) );
mockResponseStepConfig.setPath( dialog.getValue( Form.PATH ) );
mockResponseStepConfig.setPort( dialog.getIntValue( Form.PORT, 8181 ) );
CompressedStringConfig responseContent = mockResponseStepConfig.getResponse().getResponseContent();
if( request.getResponse() == null && !request.getOperation().isOneWay() )
{
create = UISupport.confirm( "Request is missing response, create default mock response instead?", title );
}
if( create )
{
String response = operation.createResponse( operation.getSettings().getBoolean(
WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS ) );
CompressedStringSupport.setString( responseContent, response );
}
else if( request.getResponse() != null )
{
String response = request.getResponse().getContentAsString();
CompressedStringSupport.setString( responseContent, response );
}
WsdlMockResponseTestStep testStep = ( WsdlMockResponseTestStep )testCase.addTestStep( config );
if( dialog.getBooleanValue( Form.ADD_SCHEMA_ASSERTION ) )
testStep.addAssertion( SchemaComplianceAssertion.ID );
UISupport.selectAndShow( testStep );
if( dialog.getBooleanValue( Form.CLOSE_REQUEST ) && desktop != null )
{
desktop.closeDesktopPanel( request );
}
if( dialog.getBooleanValue( Form.SHOW_TESTCASE ) )
{
UISupport.selectAndShow( testCase );