Package com.eviware.soapui.model.mock

Examples of com.eviware.soapui.model.mock.MockService


  public static boolean hasDependingMockOperations( WsdlInterface iface )
  {
    for( int c = 0; c < iface.getProject().getMockServiceCount(); c++ )
    {
      MockService mockService = iface.getProject().getMockServiceAt( c );
      for( int i = 0; i < mockService.getMockOperationCount(); i++ )
      {
        MockOperation mockOperation = mockService.getMockOperationAt( i );
        if( mockOperation.getOperation().getInterface() == iface )
          return true;
      }
    }
View Full Code Here


  public void stopMockService( MockRunner runner )
  {
    synchronized( server )
    {
      MockService mockService = runner.getMockService();
      final Integer port = new Integer( mockService.getPort() );
      Map<String, List<MockRunner>> map = runners.get( port );

      if( map == null || !map.containsKey( mockService.getPath() ) )
        return;

      map.get( mockService.getPath() ).remove( runner );
      if( map.get( mockService.getPath() ).isEmpty() )
      {
        map.remove( mockService.getPath() );
      }

      mockRunners.remove( runner );

      log.info( "Stopped MockService [" + mockService.getName() + "] on port [" + port + "]" );

      if( map.isEmpty() && !SoapUI.getSettings().getBoolean( HttpSettings.LEAVE_MOCKENGINE ) )
      {
        SoapUIConnector connector = connectors.get( port );
        if( connector == null )
View Full Code Here

    long startTime = System.nanoTime();

    for( int c = 0; c < project.getMockServiceCount(); c++ )
    {
      MockService ms = project.getMockServiceAt( c );
      if( mockService == null || ms.getName().equals( mockService ) )
        runMockService( ( WsdlMockService )ms );
    }

    log.info( "Started " + runners.size() + " runner" + ( ( runners.size() == 1 ) ? "" : "s" ) );
View Full Code Here

    WsdlMockRequest mockRequest = modelItem.getMockResult().getMockRequest();
    requestMessage.addNewMessageContent().setStringValue( mockRequest.getRequestContent() );
    requestMessage.setConversationID( "1" );
    requestMessage.setTimestamp( Calendar.getInstance() );
    requestMessage.setID( "1" );
    MockService mockService = modelItem.getMockOperation().getMockService();
    URL endpoint = new URL( "http://127.0.0.1:" + mockService.getPort() + mockService.getPath() );
    requestMessage.setSenderHostAndPort( "localhost" );

    if( endpoint.getPort() > 0 )
      requestMessage.setReceiverHostAndPort( endpoint.getHost() + ":" + endpoint.getPort() );
    else
View Full Code Here

    @Test
    public void verifyBackwardCompatibilityForBasic462ProjectWithMockService() throws XmlException, IOException, SoapUIException, URISyntaxException {

        assertThat(project.getMockServiceCount(), is(2));
        MockService mockService = project.getMockServiceByName("MockService 1");
        MockOperation mockOperation = mockService.getMockOperationByName("ConversionRate");
        MockResponse mockResponse = mockOperation.getMockResponseByName("Response 1");
        assertTrue(mockResponse.getResponseContent().contains("10"));
    }
View Full Code Here

        String script = getScript();
        if (script == null || script.trim().length() == 0) {
            return;
        }

        MockService mockService = getMockOperation().getMockService();
        MockRunner mockRunner = mockService.getMockRunner();
        MockRunContext context =
                mockRunner == null ? new WsdlMockRunContext(mockService, null) : mockRunner.getMockContext();

        context.setMockResponse(this);
View Full Code Here

    }

    @Test
    public void shouldRemoveMockServices() throws Exception {
        int mockServiceCountBefore = project.getMockServiceCount();
        MockService mocka = project.addNewMockService("Mocka");
        assertThat(project.getMockServiceCount(), is(mockServiceCountBefore + 1));

        project.removeMockService(mocka);
        assertThat(project.getMockServiceCount(), is(mockServiceCountBefore));
        assertThat(project.getMockServiceByName("Mocka"), nullValue());
View Full Code Here

    }

    @Test
    public void shouldRemoveRestMockServices() throws Exception {
        int restMockServiceCountBefore = project.getRestMockServiceCount();
        MockService mocka = project.addNewRestMockService("Mocka");
        assertThat(project.getRestMockServiceCount(), is(restMockServiceCountBefore + 1));

        project.removeMockService(mocka);
        assertThat(project.getRestMockServiceCount(), is(restMockServiceCountBefore));
        assertThat(project.getRestMockServiceByName("Mocka"), nullValue());
View Full Code Here

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

        MockService mockService = project.addNewRestMockService(name.trim());
        UISupport.select(mockService);

        return mockService;
    }
View Full Code Here

        String opEquivalentName = mockOperation instanceof RestMockAction ? "Mock Action" : "Mock Operation";

        if (UISupport.confirm("Remove " + opEquivalentName + " [" + mockOperation.getName() + "] from MockService ["
                + mockOperation.getMockService().getName() + "]", "Remove " + opEquivalentName)) {
            MockService mockService = mockOperation.getMockService();
            mockService.removeMockOperation(mockOperation);
        }
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.mock.MockService

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.