Package com.eviware.soapui.impl.wsdl.testcase

Examples of com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase


        testRunListener = new InternalTestRunListener();
        testSuiteListener = new InternalTestSuiteListener();
        propertyChangeListener = new InternalPropertyChangeListener();

        WsdlTestCase testCase = loadTest.getTestCase();
        loadTest.addPropertyChangeListener(propertyChangeListener);
        loadTest.addLoadTestRunListener(testRunListener);
        testCase.getTestSuite().addTestSuiteListener(testSuiteListener);

        for (TestStep testStep : testCase.getTestStepList()) {
            testStep.addPropertyChangeListener(propertyChangeListener);
        }

        history = new StatisticsHistory(this);
View Full Code Here


                return data[stepIndex][statistic.getIndex()];
        }
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        WsdlTestCase testCase = loadTest.getTestCase();

        switch (columnIndex) {
            case 0:
                return rowIndex == testCase.getTestStepCount() ? null : ColorPalette.getColor(testCase
                        .getTestStepAt(rowIndex));
            case 1: {
                if (rowIndex == testCase.getTestStepCount()) {
                    return "TestCase:";
                } else {
                    return testCase.getTestStepAt(rowIndex).getLabel();
                }
            }
            case 4:
            case 7:
                return new Float((float) data[rowIndex][columnIndex - 2] / 100);
View Full Code Here

            if (StringUtils.isNullOrEmpty(name)) {
                return;
            }
        }

        WsdlTestCase testCase = testSuite.addNewTestCase(name);
        Analytics.trackAction(SoapUIActions.CREATE_TEST_CASE.getActionName());
        UISupport.showDesktopPanel(testCase);
    }
View Full Code Here

    public AddOperationAsMockResponseStepAction() {
        super("Add as MockResponse Step", "Creates a MockResponseStep for this Operation");
    }

    public void perform(WsdlOperation operation, Object param) {
        WsdlTestCase testCase = getTargetTestCase(operation.getInterface().getProject());
        if (testCase != null) {
            addMockResponse(testCase, operation);
        }
    }
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;
            pe = pe.substring(PropertyExpansion.PROJECT_REFERENCE.length());
        } else if (pe.startsWith(PropertyExpansion.TESTSUITE_REFERENCE)) {
            holder = testSuite;
            pe = pe.substring(PropertyExpansion.TESTSUITE_REFERENCE.length());
        } else if (pe.startsWith(PropertyExpansion.TESTCASE_REFERENCE)) {
            holder = testCase;
            pe = pe.substring(PropertyExpansion.TESTCASE_REFERENCE.length());
        } else if (pe.startsWith(PropertyExpansion.SECURITYTEST_REFERENCE)) {
            holder = testCase;
            pe = pe.substring(PropertyExpansion.SECURITYTEST_REFERENCE.length());
        } else if (pe.startsWith(PropertyExpansion.MOCKSERVICE_REFERENCE)) {
            holder = mockService;
            pe = pe.substring(PropertyExpansion.MOCKSERVICE_REFERENCE.length());
        } else if (pe.startsWith(PropertyExpansion.MOCKRESPONSE_REFERENCE)) {
            holder = mockResponse;
            pe = pe.substring(PropertyExpansion.MOCKRESPONSE_REFERENCE.length());
        } else if (testCase != null) {
            int sepIx = pe.indexOf(PropertyExpansion.PROPERTY_SEPARATOR);
            if (sepIx > 0) {
                holder = testCase.getTestStepByName(pe.substring(0, sepIx));
                if (holder != null) {
                    pe = pe.substring(sepIx + 1);
                }
            }
        }
View Full Code Here

    public static WsdlTestCase getTargetTestCase(WsdlProject project) {
        List<WsdlTestCase> testCases = new ArrayList<WsdlTestCase>();
        List<WsdlTestSuite> testSuites = new ArrayList<WsdlTestSuite>();
        List<String> testCaseNames = new ArrayList<String>();
        WsdlTestCase testCase;

        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);
View Full Code Here

    public void beforeStep(TestCaseRunner testRunner, TestCaseRunContext runContext) {
    }

    public void beforeStep(TestCaseRunner testRunner, TestCaseRunContext runContext, TestStep testStep) {
        WsdlTestCase testCase = (WsdlTestCase) runContext.getTestCase();
        if (testStep instanceof WsdlTestRequestStep && testCase.getWsrmEnabled()) {
            if (wsrmMap == null) {
                wsrmMap = new HashMap<String, WsrmSequence>();
            }
            WsdlTestRequestStep requestStep = (WsdlTestRequestStep) testStep;
            String endpoint = requestStep.getHttpRequest().getEndpoint();
            SoapVersion soapVersion = requestStep.getOperation().getInterface().getSoapVersion();
            if (!wsrmMap.containsKey(endpoint)) {

                WsrmUtils utils = new WsrmUtils(soapVersion);
                WsrmSequence sequence = utils.createSequence(endpoint, soapVersion, testCase.getWsrmVersionNamespace(),
                        testCase.getWsrmAckTo(), testCase.getWsrmExpires(), requestStep.getOperation(), null, null);

                wsrmMap.put(endpoint, sequence);
            }

            WsrmSequence sequence = wsrmMap.get(endpoint);
            WsdlRequest wsdlRequest = requestStep.getHttpRequest();

            wsdlRequest.getWsrmConfig().setVersion(testCase.getWsrmVersion());
            wsdlRequest.getWsrmConfig().setSequenceIdentifier(sequence.getIdentifier());
            wsdlRequest.getWsrmConfig().setLastMessageId(sequence.incrementLastMsgNumber());
            wsdlRequest.getWsrmConfig().setUuid(sequence.getUuid());
            wsdlRequest.getWsrmConfig().setWsrmEnabled(true);

            if (!testCase.getWsrmVersion().equals(WsrmVersionTypeConfig.X_1_0.toString())) {
                WsmcInjection injection = new WsmcInjection(wsdlRequest.getEndpoint(), wsdlRequest.getOperation(),
                        soapVersion, wsdlRequest.getWsrmConfig().getUuid());
                wsdlRequest.setAfterRequestInjection(injection);
            }
View Full Code Here

            currentStep.cancel();
        }
    }

    public void internalRun(T2 runContext) throws Exception {
        WsdlTestCase testCase = getTestCase();

        gotoStepIndex = -1;
        testStepResults.clear();

        // create state for testcase if specified
        if (testCase.getKeepSession()) {
            if (!(runContext.getProperty(SubmitContext.HTTP_STATE_PROPERTY) instanceof BasicHttpContext)) {
                runContext.setProperty(SubmitContext.HTTP_STATE_PROPERTY, HttpClientSupport.createEmptyContext());
            }
        } else {
            runContext.setProperty(SubmitContext.HTTP_STATE_PROPERTY, null);
        }

        fillInTestRunnableListeners();
        runSetupScripts(runContext);
        if (!isRunning()) {
            return;
        }

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

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

        initCount = getStartStep();

        setStartTime();
        for (; initCount < testCase.getTestStepCount() && isRunning(); initCount++) {
            WsdlTestStep testStep = testCase.getTestStepAt(initCount);
            if (testStep.isDisabled()) {
                continue;
            }

            try {
                testStep.prepare(this, runContext);
            } catch (Exception e) {
                setStatus(Status.FAILED);
                SoapUI.logError(e);
                throw new Exception("Failed to prepare testStep [" + testStep.getName() + "]; " + e.toString());
            }
        }

        int currentStepIndex = startStep;
        runContext.setCurrentStep(currentStepIndex);

        for (; isRunning() && currentStepIndex < testCase.getTestStepCount(); currentStepIndex++) {
            if ((currentStepIndex = runCurrentTestStep(runContext, currentStepIndex)) == -2) {
                return;
            }
        }
View Full Code Here

     * @throws Exception
     */
    protected abstract int runCurrentTestStep(T2 runContext, int currentStepIndex) throws Exception;

    protected void internalFinally(T2 runContext) {
        WsdlTestCase testCase = getTestCase();

        for (int c = 0; c < initCount && c < testCase.getTestStepCount(); c++) {
            WsdlTestStep testStep = testCase.getTestStepAt(c);
            if (!testStep.isDisabled()) {
                testStep.finish(this, runContext);
            }
        }

View Full Code Here

     * Creates a copy of the underlying WsdlTestCase with all LoadTests removed
     * and configured for LoadTesting
     */

    private synchronized WsdlTestCase createTestCase() {
        WsdlTestCase testCase = loadTest.getTestCase();
        TestCaseConfig config = null;

        if (blueprintConfig == null) {
            try {
                blueprintConfig = TestCaseConfig.Factory.parse(testCase.getConfig().xmlText());
                blueprintConfig.setLoadTestArray(new LoadTestConfig[0]);
                blueprintConfig.setSecurityTestArray(new SecurityTestConfig[0]);
            } catch (XmlException e) {
                e.printStackTrace();
            }
        }

        config = (TestCaseConfig) blueprintConfig.copy();

        // clone entire testCase
        WsdlTestCase tc = testCase.getTestSuite().buildTestCase(config, true);
        tc.afterLoad();
        tc.addTestRunListener(testRunListener);
        Settings settings = tc.getSettings();
        settings.setBoolean(HttpSettings.INCLUDE_REQUEST_IN_TIME_TAKEN,
                loadTest.getSettings().getBoolean(HttpSettings.INCLUDE_REQUEST_IN_TIME_TAKEN));
        settings.setBoolean(HttpSettings.INCLUDE_RESPONSE_IN_TIME_TAKEN,
                loadTest.getSettings().getBoolean(HttpSettings.INCLUDE_RESPONSE_IN_TIME_TAKEN));
        settings.setBoolean(HttpSettings.CLOSE_CONNECTIONS,
                loadTest.getSettings().getBoolean(HttpSettings.CLOSE_CONNECTIONS));

        // disable default pretty-printing since it takes time
        settings.setBoolean(WsdlSettings.PRETTY_PRINT_RESPONSE_MESSAGES, false);

        // don't discard.. the WsdlLoadTests internal listener will discard after
        // asserting..
        tc.setDiscardOkResults(false);
        tc.setMaxResults(0);
        return tc;
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase

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.