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

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


      if( addDialog.show() )
      {
        String targetMockServiceName = addDialog.getValue( MOCKSERVICE );

        WsdlMockService mockService = testCase.getTestSuite().getProject()
            .getMockServiceByName( targetMockServiceName );
        if( mockService == null )
        {
          targetMockServiceName = ModelSupport.promptForUniqueName( "MockService", testCase.getTestSuite()
              .getProject(), "" );
          if( targetMockServiceName == null )
            return;

          mockService = testCase.getTestSuite().getProject().addNewMockService( targetMockServiceName );
        }

        int cnt = 0;
        MessageExchangeTestStepResult result = null;
        for( int c = 0; c < getLogListModel().getSize(); c++ )
        {
          Object obj = getLogListModel().getResultAt( c );
          if( result != obj && obj instanceof MessageExchangeTestStepResult )
          {
            result = ( MessageExchangeTestStepResult )obj;

            for( MessageExchange me : result.getMessageExchanges() )
            {
              if( me.isDiscarded() )
                continue;

              WsdlMockOperation mockOperation = mockService.getMockOperation( me.getOperation() );
              if( mockOperation == null )
                mockOperation = mockService.addNewMockOperation( ( WsdlOperation )me.getOperation() );

              WsdlMockResponse mockResponse = mockOperation.addNewMockResponse( "Recorded Test Response "
                  + ( ++cnt ), false );
              mockResponse.setResponseContent( me.getResponseContent() );
View Full Code Here


      putValue( Action.SHORT_DESCRIPTION, "Opens the root WSDL page in a browser" );
    }

    public void actionPerformed( ActionEvent arg0 )
    {
      WsdlMockService mockService = getModelItem();
      Tools.openURL( mockService.getLocalEndpoint() + "?WSDL" );
    }
View Full Code Here

      }

      List<MockServiceConfig> mockServiceConfigs = getConfig().getMockServiceList();
      for( MockServiceConfig config : mockServiceConfigs )
      {
        mockServices.add( new WsdlMockService( this, config ) );
      }

      if( !getConfig().isSetWssContainer() )
        getConfig().addNewWssContainer();
View Full Code Here

      beforeSaveScriptEngine.release();
  }

  public WsdlMockService addNewMockService( String name )
  {
    WsdlMockService mockService = new WsdlMockService( this, getConfig().addNewMockService() );
    mockService.setName( name );
    mockServices.add( mockService );
    fireMockServiceAdded( mockService );

    return mockService;
  }
View Full Code Here

    MockServiceConfig mockServiceConfig = ( MockServiceConfig )getConfig().addNewMockService().set(
        mockService.getConfig().copy() );
    mockServiceConfig.setName( name );
    if( mockServiceConfig.isSetId() && createCopy )
      mockServiceConfig.unsetId();
    mockService = new WsdlMockService( this, mockServiceConfig );
    mockService.setDescription( description );
    mockServices.add( mockService );
    if( createCopy )
      ModelSupport.unsetIds( mockService );
View Full Code Here

    }
    else
    {
      MockServiceConfig config = ( MockServiceConfig )projectDocument.getSoapuiProject().addNewMockService()
          .set( newMockServiceConfig.getMockService() );
      WsdlMockService mockService = new WsdlMockService( this, config );

      ModelSupport.unsetIds( mockService );
      mockService.afterLoad();

      mockServices.add( mockService );
      fireMockServiceAdded( mockService );

      resolveImportedMockService( mockService );
View Full Code Here

    WsdlTestStep testStep = null;
    WsdlTestCase testCase = null;
    WsdlTestSuite testSuite = null;
    WsdlProject 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 WsdlTestSuite )
    {
      testSuite = ( WsdlTestSuite )modelItem;
      project = testSuite.getProject();
    }
    else if( modelItem instanceof WsdlMockService )
    {
      project = ( ( WsdlMockService )modelItem ).getProject();
    }
    else if( modelItem instanceof WsdlMockResponse )
    {
      mockResponse = ( WsdlMockResponse )modelItem;
      mockService = ( mockResponse ).getMockOperation().getMockService();
      project = mockService.getProject();
    }
    else if( modelItem instanceof WsdlProject )
    {
      project = ( WsdlProject )modelItem;
    }
    else if( modelItem instanceof AbstractHttpRequestInterface<?> )
    {
      project = ( ( AbstractHttpRequest<?> )modelItem ).getOperation().getInterface().getProject();
    }
    else if( modelItem instanceof Operation )
    {
      project = ( WsdlProject )( ( Operation )modelItem ).getInterface().getProject();
    }
    else if( modelItem instanceof SecurityTest )
    {
      securityTest = ( SecurityTest )modelItem;
      testCase = securityTest.getTestCase();
      testSuite = testCase.getTestSuite();
      project = testSuite.getProject();
    }

    TestPropertyHolder globalProperties = PropertyExpansionUtils.getGlobalProperties();
    if( globalProperties.getProperties().size() > 0 )
      targetMenu.add( createPropertyMenu( "Global", globalProperties ) );

    if( project != null )
      targetMenu.add( createPropertyMenu( "Project: [" + project.getName() + "]", project ) );

    if( testSuite != null )
      targetMenu.add( createPropertyMenu( "TestSuite: [" + testSuite.getName() + "]", testSuite ) );

    if( mockService != null )
      targetMenu.add( createPropertyMenu( "MockService: [" + mockService.getName() + "]", mockService ) );

    if( mockResponse != null )
      targetMenu.add( createPropertyMenu( "MockResponse: [" + mockResponse.getName() + "]", mockResponse ) );

    if( testCase != null )
View Full Code Here

          UISupport.showInfoMessage( "No SOAP requests selected!" );
          return;
        }
        String targetMockServiceName = dialog.getValue( MOCKSERVICE );

        WsdlMockService mockService = getProject().getMockServiceByName( targetMockServiceName );
        if( mockService == null )
        {
          targetMockServiceName = ModelSupport.promptForUniqueName( "MockService", getProject(), "" );
          if( targetMockServiceName == null )
            return;

          mockService = getProject().addNewMockService( targetMockServiceName );
          mockService.setIncomingWss( incomingResponseWss );
        }

        int cnt = 0;
        for( int row : rows )
        {
          WsdlMonitorMessageExchange me = tableModel.getMessageExchangeAt( row );
          if( me.getOperation() == null )
            continue;

          WsdlMockOperation mockOperation = mockService.getMockOperation( me.getOperation() );
          if( mockOperation == null )
            mockOperation = mockService.addNewMockOperation( me.getOperation() );

          WsdlMockResponse mockResponse = mockOperation
              .addNewMockResponse( "Monitor Response " + ( ++cnt ), false );
          mockResponse.setResponseContent( me.getResponseContent() );
View Full Code Here

        UISupport.showErrorMessage( "No Operations selected.." );
        return null;
      }

      String mockServiceName = dialog.getValue( Form.MOCKSERVICE );
      WsdlMockService mockService = ( WsdlMockService )project.getMockServiceByName( mockServiceName );

      if( mockService == null || mockServiceName.equals( CREATE_MOCKSUITE_OPTION ) )
      {
        mockServiceName = UISupport.prompt( "Specify name of MockService to create", getName(), iface.getName()
            + " MockService" );
        if( mockServiceName == null )
          return null;

        mockService = ( WsdlMockService )project.addNewMockService( mockServiceName );
      }

      mockService.setPath( dialog.getValue( Form.PATH ) );
      try
      {
        mockService.setPort( Integer.parseInt( dialog.getValue( Form.PORT ) ) );
      }
      catch( NumberFormatException e1 )
      {
      }

      for( int i = 0; i < iface.getOperationCount(); i++ )
      {
        WsdlOperation operation = ( WsdlOperation )iface.getOperationAt( i );
        if( !operations.contains( operation.getName() ) )
          continue;

        WsdlMockOperation mockOperation = ( WsdlMockOperation )mockService.addNewMockOperation( operation );
        if( mockOperation != null )
          mockOperation.addNewMockResponse( "Response 1", true );
      }

      if( dialog.getBooleanValue( Form.ADD_ENDPOINT ) )
      {
        iface.addEndpoint( mockService.getLocalEndpoint() );
      }

      if( !atCreation )
      {
        WsdlMockServiceDesktopPanel desktopPanel = ( WsdlMockServiceDesktopPanel )UISupport
View Full Code Here

    if( server == null )
      initServer();

    synchronized( server )
    {
      WsdlMockService mockService = ( WsdlMockService )runner.getMockService();
      int port = mockService.getPort();

      if( SoapUI.getSettings().getBoolean( SSLSettings.ENABLE_MOCK_SSL ) && !addedSslConnector )
      {
        updateSslConnectorSettings();
        server.addConnector( sslConnector );
        addedSslConnector = true;
      }
      else
      {
        if( addedSslConnector )
          server.removeConnector( sslConnector );

        addedSslConnector = false;
      }

      if( !runners.containsKey( port ) )
      {
        SoapUIConnector connector = new SoapUIConnector();
        PropertySupport.applySystemProperties( connector, "soapui.mock.connector", runner.getMockService() );

        connector.setPort( port );
        if( sslConnector != null )
        {
          connector.setConfidentialPort( sslConnector.getPort() );
        }

        if( mockService.getBindToHostOnly() )
        {
          String host = mockService.getHost();
          if( StringUtils.hasContent( host ) )
          {
            connector.setHost( host );
          }
        }

        boolean wasRunning = server.isRunning();

        if( wasRunning )
        {
          server.stop();
        }

        server.addConnector( connector );
        try
        {
          server.start();
        }
        catch( RuntimeException e )
        {
          UISupport.showErrorMessage( e );

          server.removeConnector( connector );
          if( wasRunning )
          {
            server.start();
            return;
          }
        }

        connectors.put( new Integer( port ), connector );
        runners.put( new Integer( port ), new HashMap<String, List<MockRunner>>() );
      }

      Map<String, List<MockRunner>> map = runners.get( port );
      String path = mockService.getPath();
      if( !map.containsKey( path ) )
      {
        map.put( path, new ArrayList<MockRunner>() );
      }
      map.get( path ).add( runner );
      mockRunners.add( runner );

      log.info( "Started mockService [" + mockService.getName() + "] on port [" + port + "] at path [" + path + "]" );
    }
  }
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.