Package com.eviware.soapui.impl.wsdl

Examples of com.eviware.soapui.impl.wsdl.WsdlOperation


            return;
        }

        Object result = UISupport.prompt("Select Operation to Mock", "New MockOperation", operations.toArray());
        if (result != null) {
            WsdlOperation operation = ((OperationWrapper) result).getOperation();
            WsdlMockOperation mockOperation = (WsdlMockOperation) mockService.addNewMockOperation(operation);
            WsdlMockResponse mockResponse = mockOperation.addNewMockResponse("Response 1", true);
            UISupport.selectAndShow(mockResponse);
        }
    }
View Full Code Here


        if (testCase == null || testCase.getTestSuite() == null) {
            return null;
        }

        Project project = testCase.getTestSuite().getProject();
        WsdlOperation operation = null;
        for (int c = 0; c < project.getInterfaceCount(); c++) {
            if (project.getInterfaceAt(c).getName().equals(requestStepConfig.getInterface())) {
                WsdlInterface iface = (WsdlInterface) project.getInterfaceAt(c);
                for (int i = 0; i < iface.getOperationCount(); i++) {
                    if (iface.getOperationAt(i).getName().equals(requestStepConfig.getOperation())) {
View Full Code Here

    public void setOperation(WsdlOperation operation) {
        if (wsdlOperation == operation) {
            return;
        }

        WsdlOperation oldOperation = wsdlOperation;
        wsdlOperation = operation;
        requestStepConfig.setInterface(operation.getInterface().getName());
        requestStepConfig.setOperation(operation.getName());

        if (oldOperation != null) {
            oldOperation.removePropertyChangeListener(this);
        }

        wsdlOperation.addPropertyChangeListener(this);

        initTestRequest(this.getConfig(), false);
View Full Code Here

                        }
                    }, new ChangeOperationResolver(this, "Operation") {

                        @Override
                        public boolean update() {
                            WsdlOperation wsdlOperation = (WsdlOperation) getSelectedOperation();
                            if (wsdlOperation == null) {
                                return false;
                            }

                            setOperation(wsdlOperation);
View Full Code Here

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    WsdlProject project = testStep.getMockService().getProject();
                    dialog.setOptions(Form.OPERATION,
                            ModelSupport.getNames(project.getInterfaceByName(newValue).getOperationList()));
                    WsdlOperation operation = testStep.getOperation();
                    dialog.setValue(Form.OPERATION, operation == null ? "" : operation.getName());
                }
            });

            dialog.getFormField(Form.RECREATE_REQUEST).addFormFieldListener(new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    boolean enabled = Boolean.parseBoolean(newValue);

                    dialog.getFormField(Form.CREATE_OPTIONAL).setEnabled(enabled);
                    dialog.getFormField(Form.KEEP_EXISTING).setEnabled(enabled);
                }
            });

            dialog.getFormField(Form.CREATE_OPTIONAL).setEnabled(false);
            dialog.getFormField(Form.KEEP_EXISTING).setEnabled(false);
        }

        WsdlOperation operation = testStep.getOperation();
        WsdlProject project = testStep.getMockService().getProject();
        String[] interfaceNames = ModelSupport.getNames(project.getInterfaceList(),
                new ModelSupport.InterfaceTypeFilter(WsdlInterfaceFactory.WSDL_TYPE));
        dialog.setOptions(Form.INTERFACE, interfaceNames);
        dialog.setValue(Form.INTERFACE, operation == null ? interfaceNames[0] : operation.getInterface().getName());

        dialog.setOptions(Form.OPERATION,
                ModelSupport.getNames(project.getInterfaceByName(dialog.getValue(Form.INTERFACE)).getOperationList()));
        dialog.setValue(Form.OPERATION, operation == null ? null : operation.getName());
        dialog.setValue(Form.NAME, target.getName());

        if (dialog.show()) {
            String ifaceName = dialog.getValue(Form.INTERFACE);
            String operationName = dialog.getValue(Form.OPERATION);

            WsdlInterface iface = (WsdlInterface) project.getInterfaceByName(ifaceName);
            operation = iface.getOperationByName(operationName);
            target.setOperation(operation);

            String name = dialog.getValue(Form.NAME).trim();
            if (name.length() > 0 && !target.getName().equals(name)) {
                target.setName(name);
            }

            if (dialog.getBooleanValue(Form.RECREATE_REQUEST)) {
                String req = operation.createResponse(dialog.getBooleanValue(Form.CREATE_OPTIONAL));
                if (req == null) {
                    UISupport.showErrorMessage("Response creation failed");
                } else {
                    for (int c = 0; c < target.getMockResponseCount(); c++) {
                        String msg = req;
View Full Code Here

    }

    public void perform(WsdlRequest request, Object param) {
        if (UISupport.confirm("Delete request [" + request.getName() + "] from operation ["
                + request.getOperation().getName() + "]", "Delete Request")) {
            WsdlOperation operation = (WsdlOperation) request.getOperation();
            operation.removeRequest(request);
        }
    }
View Full Code Here

            }

            createOptional = create.booleanValue();
        }

        WsdlOperation wsdlOperation = (WsdlOperation) request.getOperation();
        String req = wsdlOperation.createRequest(createOptional);
        if (req == null) {
            UISupport.showErrorMessage("Request creation failed");
            return;
        }

        if (request.getRequestContent() != null && request.getRequestContent().trim().length() > 0) {
            if (UISupport.confirm("Keep existing values", "Recreate Request")) {
                req = SoapUtils.transferSoapHeaders(request.getRequestContent(), req, wsdlOperation.getInterface()
                        .getSoapVersion());

                req = XmlUtils.transferValues(request.getRequestContent(), req);
            }
        }
View Full Code Here

        List<Request> result = new ArrayList<Request>();

        // first check operations
        for (int c = 0; c < iface.getOperationCount(); c++) {
            WsdlOperation operation = iface.getOperationAt(c);
            String newRequest = operation.createRequest(buildOptional);
            List<Request> requests = operation.getRequestList();

            for (Request request : requests) {
                String requestContent = request.getRequestContent();

                if (keepHeaders) {
                    newRequest = SoapUtils.transferSoapHeaders(requestContent, newRequest, iface.getSoapVersion());
                }

                String req = XmlUtils.transferValues(requestContent, newRequest);

                // changed?
                if (!req.equals(requestContent)) {
                    if (!XmlUtils.prettyPrintXml(req).equals(XmlUtils.prettyPrintXml(requestContent))) {
                        if (createBackups) {
                            WsdlRequest backupRequest = operation.addNewRequest("Backup of [" + request.getName() + "]");
                            ((WsdlRequest) request).copyTo(backupRequest, false, false);
                        }

                        ((WsdlRequest) request).setRequestContent(req);
                        count++;
View Full Code Here

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

        WsdlOperation operation = request.getOperation();
        dialog.setValue(Form.STEP_NAME, operation.getName());
        dialog.setBooleanValue(Form.CLOSE_REQUEST, true);
        dialog.setBooleanValue(Form.SHOW_TESTCASE, true);
        dialog.setIntValue(Form.PORT, 8181);
        dialog.setValue(Form.PATH, "/" + operation.getName());

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

        if (!dialog.show()) {
            return false;
        }

        TestStepConfig config = WsdlMockResponseStepFactory.createConfig(operation, request, 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, 8181));
        CompressedStringConfig responseContent = mockResponseStepConfig.getResponse().getResponseContent();

        if (request.getResponse() == null && !request.getOperation().isOneWay()) {
            create = UISupport.confirm("Request is missing response, create default mock response instead?", title);
        }

        if (create) {
            String response = operation.createResponse(operation.getSettings().getBoolean(
                    WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS));
            CompressedStringSupport.setString(responseContent, response);
        } else if (request.getResponse() != null) {
            String response = request.getResponse().getContentAsString();
            CompressedStringSupport.setString(responseContent, response);
View Full Code Here

    private void generateSingleTestCase(WsdlTestSuite testSuite, WsdlInterface iface, boolean useExisting,
                                        boolean createLoadTest, List<String> operations) {
        WsdlTestCase testCase = testSuite.addNewTestCase(iface.getName() + " TestSuite");

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

            if (useExisting && operation.getRequestCount() > 0) {
                for (int x = 0; x < operation.getRequestCount(); x++) {
                    testCase.addTestStep(WsdlTestRequestStepFactory.createConfig(operation.getRequestAt(x),
                            operation.getName()));
                }
            } else {
                testCase.addTestStep(WsdlTestRequestStepFactory.createConfig(operation, operation.getName()));
            }
        }

        if (createLoadTest) {
            testCase.addNewLoadTest("LoadTest 1");
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.WsdlOperation

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.