Package com.eviware.soapui.impl.wsdl.mock

Examples of com.eviware.soapui.impl.wsdl.mock.WsdlMockService


    TestStep testStep = null;
    TestCase testCase = null;
    TestSuite testSuite = null;
    Project project = null;
    WsdlMockService mockService = null;
    WsdlMockResponse mockResponse = null;
    SecurityTest securityTest = null;

    if( modelItem instanceof WsdlTestStep )
    {
      testStep = ( WsdlTestStep )modelItem;
      testCase = testStep.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestCase )
    {
      testCase = ( WsdlTestCase )modelItem;
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlLoadTest )
    {
      testCase = ( ( WsdlLoadTest )modelItem ).getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestSuite )
    {
      testSuite = ( WsdlTestSuite )modelItem;
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlInterface )
    {
      project = ( ( WsdlInterface )modelItem ).getProject();
    }
    else if( modelItem instanceof WsdlProject )
    {
      project = ( WsdlProject )modelItem;
    }
    else if( modelItem instanceof WsdlMockService )
    {
      mockService = ( WsdlMockService )modelItem;
      project = mockService.getProject();
    }
    else if( modelItem instanceof TestRequest )
    {
      testStep = ( ( TestRequest )modelItem ).getTestStep();
      testCase = testStep.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof AbstractHttpRequestInterface<?> )
    {
      project = ( ( AbstractHttpRequest<?> )modelItem ).getOperation().getInterface().getProject();
    }
    else if( modelItem instanceof WsdlMockOperation )
    {
      mockService = ( ( WsdlMockOperation )modelItem ).getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof WsdlMockResponse )
    {
      mockResponse = ( WsdlMockResponse )modelItem;
      mockService = mockResponse.getMockOperation().getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof SecurityTest )
    {
      securityTest = ( SecurityTest )modelItem;
      testCase = ( ( SecurityTest )modelItem ).getTestCase();
View Full Code Here


  {
    WsdlTestStep testStep = null;
    WsdlTestCase testCase = null;
    WsdlTestSuite testSuite = null;
    WsdlProject project = null;
    WsdlMockService mockService = null;
    WsdlMockResponse mockResponse = null;
    TestPropertyHolder holder = null;
    SecurityTest securityTest = null;

    if( modelItem instanceof WsdlTestStep )
    {
      testStep = ( WsdlTestStep )modelItem;
      testCase = testStep.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestCase )
    {
      testCase = ( WsdlTestCase )modelItem;
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlTestSuite )
    {
      testSuite = ( WsdlTestSuite )modelItem;
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlInterface )
    {
      project = ( ( WsdlInterface )modelItem ).getProject();
    }
    else if( modelItem instanceof WsdlProject )
    {
      project = ( WsdlProject )modelItem;
    }
    else if( modelItem instanceof WsdlMockService )
    {
      mockService = ( WsdlMockService )modelItem;
      project = mockService.getProject();
    }
    else if( modelItem instanceof AbstractHttpRequestInterface<?> )
    {
      project = ( ( AbstractHttpRequest<?> )modelItem ).getOperation().getInterface().getProject();
    }
    else if( modelItem instanceof WsdlMockOperation )
    {
      mockService = ( ( WsdlMockOperation )modelItem ).getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof WsdlMockResponse )
    {
      mockResponse = ( WsdlMockResponse )modelItem;
      mockService = mockResponse.getMockOperation().getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof SecurityTest )
    {
      securityTest = ( SecurityTest )modelItem;
      testCase = securityTest.getTestCase();
View Full Code Here

    super( "Add to TestCase", "Adds this MockResponse to a TestCase" );
  }

  public void perform( WsdlMockResponse mockResponse, Object param )
  {
    WsdlMockService mockService = mockResponse.getMockOperation().getMockService();
    WsdlTestCase testCase = getTargetTestCase( mockService.getProject() );
    if( testCase == null )
      return;

    addMockResponseToTestCase( mockResponse, testCase, -1 );
  }
View Full Code Here

    {
      UISupport.showErrorMessage( "Missing operation for this mock response" );
      return;
    }

    WsdlMockService mockService = mockResponse.getMockOperation().getMockService();

    if( dialog == null )
      dialog = ADialogBuilder.buildDialog( Form.class );

    dialog.setValue( Form.STEP_NAME, mockResponse.getMockOperation().getName() );
    dialog.setBooleanValue( Form.CLOSE_EDITOR, true );
    dialog.setBooleanValue( Form.SHOW_TESTCASE, true );
    dialog.setIntValue( Form.PORT, mockService.getPort() );
    dialog.setValue( Form.PATH, mockService.getPath() );

    SoapUIDesktop desktop = SoapUI.getDesktop();
    dialog.getFormField( Form.CLOSE_EDITOR ).setEnabled( desktop != null && desktop.hasDesktopPanel( mockResponse ) );

    if( !dialog.show() )
      return;

    TestStepConfig config = WsdlMockResponseStepFactory.createConfig( mockResponse.getMockOperation().getOperation(),
        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, mockService.getPort() ) );

    mockResponse.beforeSave();
    mockResponseStepConfig.getResponse().set( mockResponse.getConfig() );

    WsdlMockResponseTestStep testStep = ( WsdlMockResponseTestStep )testCase.insertTestStep( config, -1 );
View Full Code Here

    while( project.getMockServiceByName( name.trim() ) != null )
    {
      name = UISupport.prompt( "Specify unique name of MockService", "Rename MockService", name );
    }

    WsdlMockService mockService = project.addNewMockService( name );
    UISupport.select( mockService );

    return mockService;
  }
View Full Code Here

  public void perform( WsdlOperation operation, Object param )
  {
    String title = getName();

    WsdlMockService mockService = null;
    WsdlProject project = operation.getInterface().getProject();

    while( mockService == null )
    {
      if( project.getMockServiceCount() > 0 )
      {
        String[] mockServices = ModelSupport.getNames( project.getMockServiceList(),
            new String[] { CREATE_MOCKSUITE_OPTION } );

        // prompt
        String option = UISupport.prompt( "Select MockService for MockOperation", title, mockServices );
        if( option == null )
          return;

        mockService = project.getMockServiceByName( option );
      }

      // create new mocksuite?
      if( mockService == null )
      {
        String mockServiceName = UISupport.prompt( "Enter name of new MockService", title, "MockService "
            + ( project.getMockServiceCount() + 1 ) );
        if( mockServiceName == null || mockServiceName.trim().length() == 0 )
          return;

        mockService = project.addNewMockService( mockServiceName );
      }

      if( mockService.hasMockOperation( operation ) )
      {
        UISupport.showErrorMessage( "MockService [" + mockService.getName() + "] already has a MockOperation for ["
            + operation.getName() + "], please select another MockService" );
        mockService = null;
      }
    }
View Full Code Here

  public void perform( WsdlMockOperation mockOperation, Object param )
  {
    if( UISupport.confirm( "Remove MockOperation [" + mockOperation.getName() + "] from MockService ["
        + mockOperation.getMockService().getName() + "]", "Remove MockOperation" ) )
    {
      WsdlMockService mockService = mockOperation.getMockService();
      mockService.removeMockOperation( mockOperation );
    }
  }
View Full Code Here

    {
      String targetProjectName = dialog.getValue( Form.PROJECT );
      String name = dialog.getValue( Form.NAME );

      WsdlProject project = ( WsdlProject )mockService.getProject();
      WsdlMockService clonedService = null;

      // within same project?
      boolean cloneDescription = dialog.getBooleanValue( Form.CLONE_DESCRIPTION );
      String description = mockService.getDescription();
      if( !cloneDescription )
View Full Code Here

  }

  public WsdlMockService cloneMockServiceWithinProject( WsdlMockService mockService, String name, WsdlProject project,
      String description )
  {
    WsdlMockService newMockService = project.importMockService( mockService, name, true, description );
    UISupport.select( newMockService );
    return newMockService;
  }
View Full Code Here

      {
        return;
      }
    }

    WsdlMockService mockService = null;
    WsdlMockOperation mockOperation = ( WsdlMockOperation )param;
    if( mockOperation != null )
      mockService = mockOperation.getMockService();

    WsdlProject project = request.getOperation().getInterface().getProject();

    while( mockService == null )
    {
      if( project.getMockServiceCount() > 0 )
      {
        String[] mockServices = ModelSupport.getNames( project.getMockServiceList(),
            new String[] { CREATE_MOCKSUITE_OPTION } );

        // prompt
        String option = UISupport.prompt( "Select MockService for MockOperation", title, mockServices );
        if( option == null )
          return;

        mockService = project.getMockServiceByName( option );
      }

      // create new mocksuite?
      if( mockService == null )
      {
        String mockServiceName = UISupport.prompt( "Enter name of new MockService", title, "MockService "
            + ( project.getMockServiceCount() + 1 ) );
        if( mockServiceName == null || mockServiceName.trim().length() == 0 )
          return;

        mockService = project.addNewMockService( mockServiceName );
      }

      mockOperation = mockService.getMockOperation( request.getOperation() );
      if( mockOperation != null )
      {
        Boolean retval = UISupport.confirmOrCancel( "MockService [" + mockService.getName()
            + "] already has a MockOperation for [" + request.getOperation().getName()
            + "],\r\nShould MockResponse be added to this MockOperation instead", "Add Request to MockService" );

        if( retval == null )
          return;

        if( !retval.booleanValue() )
          mockService = null;
      }
    }

    // add mockoperation
    if( mockOperation == null )
      mockOperation = mockService.addNewMockOperation( request.getOperation() );

    WsdlMockResponse mockResponse = mockOperation.addNewMockResponse(
        "Response " + ( 1 + mockOperation.getMockResponseCount() ), false );

    // add expected response if available
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.mock.WsdlMockService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.