Package com.eviware.soapui.impl.wsdl

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


                    }
                });
                optionsDialog.getFormField(OptionsForm.TESTCASE).addFormFieldListener(new XFormFieldListener() {

                    public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                        WsdlTestSuite testSuite = project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE));
                        WsdlTestCase testCase = testSuite.getTestCaseByName(newValue);
                        optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, testCase.getPropertyNames());
                        ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                                .setSelectedOptions(getModelItem().getReturnProperties().toStringArray());
                    }
                });
            }

            WsdlTestCase targetTestCase = getModelItem().getTargetTestCase();

            optionsDialog.setOptions(OptionsForm.TESTSUITE, ModelSupport.getNames(project.getTestSuiteList()));
            if (targetTestCase != null) {
                optionsDialog.setValue(OptionsForm.TESTSUITE, targetTestCase.getTestSuite().getName());

                List<TestCase> testCaseList = targetTestCase.getTestSuite().getTestCaseList();
                testCaseList.remove(getModelItem().getTestCase());

                optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList));
                optionsDialog.setValue(OptionsForm.TESTCASE, targetTestCase.getName());

                optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, targetTestCase.getPropertyNames());
                ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                        .setSelectedOptions(getModelItem().getReturnProperties().toStringArray());
            } else {
                if (project.getTestSuiteCount() == 0) {
                    optionsDialog.setOptions(OptionsForm.TESTCASE, new String[0]);
                    optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]);
                } else {
                    List<TestCase> testCaseList = project.getTestSuiteAt(0).getTestCaseList();
                    testCaseList.remove(getModelItem().getTestCase());
                    optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList));

                    if (testCaseList.isEmpty()) {
                        optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]);
                    } else {
                        optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, testCaseList.get(0).getPropertyNames());
                    }
                }
            }

            switch (getModelItem().getRunMode().intValue()) {
                case RunTestCaseRunModeTypeConfig.INT_PARALLELL:
                    optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.CREATE_ISOLATED_COPY_FOR_EACH_RUN);
                    break;
                case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_FAIL:
                    optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_PRIMARY_TEST_CASE);
                    break;
                case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_WAIT:
                    optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_SYNCHRONIZED_TESTCASE);
                    break;
            }

            optionsDialog.setBooleanValue(OptionsForm.COPY_HTTP_SESSION, getModelItem().isCopyHttpSession());
            optionsDialog
                    .setBooleanValue(OptionsForm.COPY_LOADTEST_PROPERTIES, getModelItem().isCopyLoadTestProperties());
            optionsDialog.setBooleanValue(OptionsForm.IGNORE_EMPTY_PROPERTIES, getModelItem().isIgnoreEmptyProperties());

            if (optionsDialog.show()) {
                WsdlTestSuite testSuite = project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE));
                getModelItem().setTargetTestCase(
                        testSuite == null ? null
                                : testSuite.getTestCaseByName(optionsDialog.getValue(OptionsForm.TESTCASE)));
                getModelItem().setReturnProperties(
                        new StringList(
                                ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES))
                                        .getSelectedOptions()));
View Full Code Here


            if (dialog.show()) {
                String targetTestSuiteName = dialog.getValue(TESTSUITE);
                String targetTestCaseName = dialog.getValue(TESTCASE);

                WsdlTestSuite testSuite = getProject().getTestSuiteByName(targetTestSuiteName);
                if (testSuite == null) {
                    targetTestSuiteName = ModelSupport.promptForUniqueName("TestSuite", getProject(), "");
                    if (targetTestSuiteName == null) {
                        return;
                    }

                    testSuite = getProject().addNewTestSuite(targetTestSuiteName);
                }

                WsdlTestCase testCase = testSuite.getTestCaseByName(targetTestCaseName);
                if (testCase == null) {
                    targetTestCaseName = ModelSupport.promptForUniqueName("TestCase", testSuite, "");
                    if (targetTestCaseName == null) {
                        return;
                    }

                    testCase = testSuite.addNewTestCase(targetTestCaseName);
                }

                for (int row : rows) {
                    WsdlMonitorMessageExchange me = tableModel.getMessageExchangeAt(row);
                    if (me.getOperation() != null) {
View Full Code Here

        return restResource;
    }


    public WsdlTestCase makeTestCase() throws SoapUIException {
        return new WsdlTestCase(new WsdlTestSuite(project, TestSuiteConfig.Factory.newInstance()), TestCaseConfig.Factory.newInstance(), false);
    }
View Full Code Here

    public static WsdlProject makeWsdlProject() throws SoapUIException {
        return new WsdlProject((WorkspaceImpl) WorkspaceFactory.getInstance().openWorkspace("testWorkSpace", new StringToStringMap()));
    }

    public static WsdlTestCase makeTestCase() throws SoapUIException {
        return new WsdlTestCase(new WsdlTestSuite(makeWsdlProject(), TestSuiteConfig.Factory.newInstance()), TestCaseConfig.Factory.newInstance(), false);
    }
View Full Code Here

    public static MutablePropertyExpansionImpl createMutablePropertyExpansion(String pe, ModelItem modelItem,
                                                                              Object target, String propertyName) {
        WsdlTestStep testStep = null;
        WsdlTestCase testCase = null;
        WsdlTestSuite testSuite = null;
        WsdlProject project = null;
        WsdlMockService mockService = null;
        WsdlMockResponse mockResponse = null;
        TestPropertyHolder holder = 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 WsdlInterface) {
            project = ((WsdlInterface) modelItem).getProject();
        } else if (modelItem instanceof WsdlProject) {
            project = (WsdlProject) modelItem;
        } else if (modelItem instanceof WsdlMockService) {
            mockService = (WsdlMockService) modelItem;
            project = mockService.getProject();
        } else if (modelItem instanceof AbstractHttpRequestInterface<?>) {
            project = ((AbstractHttpRequest<?>) modelItem).getOperation().getInterface().getProject();
        } else if (modelItem instanceof WsdlMockOperation) {
            mockService = ((WsdlMockOperation) modelItem).getMockService();
            project = mockService.getProject();
        } else if (modelItem instanceof WsdlMockResponse) {
            mockResponse = (WsdlMockResponse) modelItem;
            mockService = mockResponse.getMockOperation().getMockService();
            project = mockService.getProject();
        } else if (modelItem instanceof SecurityTest) {
            securityTest = (SecurityTest) modelItem;
            testCase = securityTest.getTestCase();
            testSuite = testCase.getTestSuite();
            project = testSuite.getProject();
        }

        // explicit item reference?
        if (pe.startsWith(PropertyExpansion.PROJECT_REFERENCE)) {
            holder = project;
View Full Code Here

        if (project.getTestSuiteCount() == 0) {
            return addNewTestSuiteAndTestCase(project, "Missing TestSuite in project, enter name to create");
        }

        for (int c = 0; c < project.getTestSuiteCount(); c++) {
            WsdlTestSuite testSuite = project.getTestSuiteAt(c);
            for (int i = 0; i < testSuite.getTestCaseCount(); i++) {
                testCase = testSuite.getTestCaseAt(i);

                testCases.add(testCase);
                testCaseNames.add((testCaseNames.size() + 1) + ": " + testSuite.getName() + " - " + testCase.getName());
                testSuites.add(testSuite);
            }

            testCases.add(null);
            testSuites.add(testSuite);
            testCaseNames.add((testCaseNames.size() + 1) + ": " + testSuite.getName() + " -> Create new TestCase");
        }

        if (testCases.size() == 0) {
            List<String> testSuiteNames = new ArrayList<String>();

            for (int c = 0; c < project.getTestSuiteCount(); c++) {
                TestSuite testSuite = project.getTestSuiteAt(c);
                testSuiteNames.add((testSuiteNames.size() + 1) + ": " + testSuite.getName());
            }

            String selection = (String) UISupport.prompt("Select TestSuite to create TestCase in", "Select TestSuite",
                    testSuiteNames.toArray());
            if (selection == null) {
                return null;
            }

            WsdlTestSuite testSuite = project.getTestSuiteAt(testSuiteNames.indexOf(selection));

            String name = UISupport.prompt("Specify name of TestCase", "Create TestCase",
                    "TestCase " + (testSuite.getTestCaseCount() + 1));
            if (name == null) {
                return null;
            }

            return testSuite.addNewTestCase(name);
        } else {
            testCases.add(null);
            testSuites.add(null);
            testCaseNames.add((testCaseNames.size() + 1) + ": -> Create new TestSuite");

            String selection = (String) UISupport.prompt("Select TestCase", "Select TestCase", testCaseNames.toArray());
            if (selection == null) {
                return null;
            }

            testCase = testCases.get(testCaseNames.indexOf(selection));
            while (testCase != null
                    && (SoapUI.getTestMonitor().hasRunningLoadTest(testCase) || SoapUI.getTestMonitor()
                    .hasRunningSecurityTest(testCase))) {
                UISupport.showErrorMessage("Can not add to TestCase that is currently LoadTesting or SecurityTesting");

                selection = (String) UISupport.prompt("Select TestCase", "Select TestCase", testCaseNames.toArray());
                if (selection == null) {
                    return null;
                }

                testCase = testCases.get(testCaseNames.indexOf(selection));
            }

            // selected create new?
            if (testCase == null) {
                WsdlTestSuite testSuite = testSuites.get(testCaseNames.indexOf(selection));

                // selected create new testsuite?
                if (testSuite == null) {
                    return addNewTestSuiteAndTestCase(project, "Specify name of TestSuite");
                } else {
                    String name = UISupport.prompt("Specify name of TestCase", "Create TestCase", "TestCase "
                            + (testSuite.getTestCaseCount() + 1));
                    if (name == null) {
                        return null;
                    }

                    return testSuite.addNewTestCase(name);
                }
            }
        }

        return testCase;
View Full Code Here

        String testCaseName = UISupport.prompt("Specify name of TestCase", "Create TestCase", "TestCase 1");
        if (testCaseName == null) {
            return null;
        }

        WsdlTestSuite testSuite = project.addNewTestSuite(testSuiteName);
        return testSuite.addNewTestCase(testCaseName);
    }
View Full Code Here

            runner.fail(reason);
        }
    }

    public void internalRun(WsdlTestSuiteRunContext runContext) throws Exception {
        WsdlTestSuite testSuite = getTestRunnable();

        listeners = testSuite.getTestSuiteRunListeners();
        testSuite.runSetupScript(runContext, this);
        if (!isRunning()) {
            return;
        }

        if (testSuite.getTimeout() > 0) {
            startTimeoutTimer(testSuite.getTimeout());
        }

        notifyBeforeRun();
        if (!isRunning()) {
            return;
        }

        if (testSuite.getRunType() == TestSuiteRunType.SEQUENTIAL) {
            runSequential(testSuite, runContext);
        } else if (testSuite.getRunType() == TestSuiteRunType.PARALLEL) {
            runParallel(testSuite, runContext);
        }
    }
View Full Code Here

        return currentRunner;
    }

    protected void internalFinally(WsdlTestSuiteRunContext runContext) {
        WsdlTestSuite testSuite = getTestRunnable();

        try {
            testSuite.runTearDownScript(runContext, this);
        } catch (Exception e) {
            SoapUI.logError(e);
        }

        notifyAfterRun();
View Full Code Here

        return testSuite;
    }

    public static TestSuite cloneTestSuiteWithinProject(WsdlTestSuite testSuite, String name, WsdlProject project,
                                                        String description) {
        WsdlTestSuite newTestSuite = project.importTestSuite(testSuite, name, -1, true, description);
        UISupport.select(newTestSuite);
        return newTestSuite;
    }
View Full Code Here

TOP

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

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.