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

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


        }
        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 AddMockResponseToTestCaseAction() {
        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

        if (mockResponse.getMockOperation().getOperation() == null) {
            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

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

            WsdlProject project = 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

        return mockService;
    }

    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

            if (!UISupport.confirm("Request is missing response, create default mock response instead?", title)) {
                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 = (WsdlMockOperation) mockService.addNewMockOperation(request.getOperation());
        }

        WsdlMockResponse mockResponse = mockOperation.addNewMockResponse(
                "Response " + (1 + mockOperation.getMockResponseCount()), false);
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.