Package com.eviware.soapui.impl.rest.mock

Examples of com.eviware.soapui.impl.rest.mock.RestMockService


    @Test
    public void shouldGenerateRestMockService() throws SoapUIException {
        action.perform(restService, null);

        RestMockService restMockService = getResultingRestMockService();
        assertThat(restMockService, is(NotNull.NOT_NULL));
        assertThat(restMockService.getName(), is(restMockServiceName));
    }
View Full Code Here


    public void shouldGenerateNonStartedRestMockServiceIfSettingIsOff() throws SoapUIException {
        SoapUI.getSettings().setBoolean(HttpSettings.START_MOCK_SERVICE, FALSE);

        action.perform(restService, null);

        RestMockService restMockService = getResultingRestMockService();
        assertThat(restMockService.getMockRunner(), is(Null.NULL));
    }
View Full Code Here

        restService.addNewResource("one", "/one");
        restService.addNewResource("two", "/two");

        action.perform(restService, null);

        RestMockService restMockService = getResultingRestMockService();
        assertThat(restMockService.getMockOperationCount(), is(2));
        assertThat(restMockService.getMockOperationAt(1).getName(), is("/two"));

        for (MockOperation mockAction : restMockService.getMockOperationList()) {
            assertThat(mockAction.getMockResponseCount(), is(1));
        }
    }
View Full Code Here

        restService.addNewResource("two", "/two");

        action.perform(restService, null);

        RestMockService restMockService = getResultingRestMockService();
        assertThat(restMockService.getMockOperationCount(), is(3));
        assertMockActionWithPath(restMockService, "/onev1");
        assertMockActionWithPath(restMockService, "/one/path/again");
        assertMockActionWithPath(restMockService, "/two");
    }
View Full Code Here

        addMethod(resource, HttpMethod.GET);
        addMethod(resource, HttpMethod.POST);

        action.perform(restService, null);

        RestMockService restMockService = getResultingRestMockService();
        assertThat(restMockService.getMockOperationCount(), is(2));

        assertMockAction(HttpMethod.GET, "/one", restMockService.getMockOperationAt(0));
        assertMockAction(HttpMethod.POST, "/one", restMockService.getMockOperationAt(1));
    }
View Full Code Here

    }

    @After
    public void tearDown() {
        UISupport.setDialogs(originalDialogs);
        RestMockService restMockService = project.getRestMockServiceByName(mockServiceName);

        if (restMockService != null && restMockService.getMockRunner() != null) {
            restMockService.getMockRunner().stop();
        }

    }
View Full Code Here

    public void shouldSaveRestMockWithSetNameToProject() {
        action.perform(restRequest, notUsed);
        List<RestMockService> serviceList = project.getRestMockServiceList();
        assertThat(serviceList.size(), is(1));

        RestMockService service = project.getRestMockServiceByName(mockServiceName);
        assertThat(service.getName(), is(mockServiceName));
    }
View Full Code Here

    @Test
    public void shouldSetAGoodNameOnTheRestMockAction() {
        action.perform(restRequest, notUsed);

        RestMockService service = project.getRestMockServiceByName(mockServiceName);
        assertThat(service.getMockOperationByName(requestPath), is(NOT_NULL));
    }
View Full Code Here

    public void perform(RestService restService, Object param) {
        createDialog(restService);

        if (dialog.show()) {
            String mockServiceName = dialog.getValue(Form.MOCKSERVICE_NAME);
            RestMockService mockService = getMockService(mockServiceName, restService.getProject());

            if (mockService != null) {
                populateMockService(restService, mockService);
                restService.addEndpoint(mockService.getLocalEndpoint());

                UISupport.showDesktopPanel(mockService);
                maybeStart(mockService);
            }
        }
View Full Code Here

    @Override
    public void perform(RestRequest restRequest, Object param) {
        String title = getName();

        RestMockService mockService = null;
        WsdlProject project = restRequest.getOperation().getInterface().getProject();

        while (mockService == null) {

            if (project.getRestMockServiceCount() > 0) {
                String option = promptForMockServiceSelection(title, project);
                boolean userCancelled = option == null;
                if (userCancelled) {
                    return;
                }

                mockService = project.getRestMockServiceByName(option);
            }

            if (mockService == null) {
                mockService = createNewMockService(title, project);
                UISupport.showDesktopPanel(mockService);
                maybeStart(mockService);
            }
        }

        addRequestToMockService(restRequest, mockService);
        restRequest.getOperation().getService().addEndpoint(mockService.getLocalEndpoint());
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.rest.mock.RestMockService

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.