Package com.eviware.soapui.model.project

Examples of com.eviware.soapui.model.project.Project


        public void actionPerformed(ActionEvent e) {
            if (dialog == null) {
                dialog = ADialogBuilder.buildDialog(LoadOptionsForm.class);
            }

            Project project = ModelSupport.getModelItemProject(holder.getModelItem());
            if (project != null) {
                FileFormField fileFormField = (FileFormField) dialog.getFormField(LoadOptionsForm.FILE);
                String currentDirectory = extractFileChooserPathForProject(project);
                fileFormField.setCurrentDirectory(currentDirectory);
            }
View Full Code Here


        result.add(findRestResource().getInterface());
        return result;
    }

    private RestResource findRestResource() {
        Project project = ModelSupport.getModelItemProject(this);
        for (Interface iface : project.getInterfaceList()) {
            if (iface.getName().equals(getRequestStepConfig().getService()) && iface instanceof RestService) {
                RestService restService = (RestService) iface;
                // get all resources with the configured path
                for (RestResource resource : restService.getResourcesByFullPath(getRequestStepConfig().getResourcePath())) {
                    // try to find matching method
View Full Code Here

        }
    }

    public void release() {
        for (int c = 0; c < workspace.getProjectCount(); c++) {
            Project project = workspace.getProjectAt(c);
            project.removeProjectListener(projectListener);

            for (int i = 0; i < project.getInterfaceCount(); i++) {
                project.getInterfaceAt(i).removeInterfaceListener(interfaceListener);
            }

            for (int i = 0; i < project.getTestSuiteCount(); i++) {
                project.getTestSuiteAt(i).removeTestSuiteListener(testSuiteListener);
            }

            for (int i = 0; i < project.getMockServiceCount(); i++) {
                project.getMockServiceAt(i).removeMockServiceListener(mockServiceListener);
            }
        }

        workspace.removeWorkspaceListener(workspaceListener);
    }
View Full Code Here

    public static String relativizeResourcePath(String path, ModelItem modelItem) {
        if (modelItem == null || StringUtils.isNullOrEmpty(path) || isRelativePath(path) || isHttpPath(path)) {
            return path;
        }

        Project project = ModelSupport.getModelItemProject(modelItem);
        if (project == null) {
            return path;
        }

        if (StringUtils.isNullOrEmpty(project.getPath()) && project.getResourceRoot().indexOf("${projectDir}") >= 0) {
            if (UISupport.confirm("Save project before setting path?", "Project has not been saved")) {
                try {
                    project.save();
                } catch (IOException e) {
                    SoapUI.logError(e);
                    UISupport.showErrorMessage(e);
                    return path;
                }
            }
        }

        String projectPath = PropertyExpander.expandProperties(project, project.getResourceRoot());
        if (StringUtils.isNullOrEmpty(projectPath)) {
            return path;
        }

        return PathUtils.relativize(path, projectPath);
View Full Code Here

                UISupport.showErrorMessage("No Parameters selected..");
            }
            return items;
        }

        Project project = securityScan.getTestStep().getTestCase().getTestSuite().getProject();
        TestSuite targetTestSuite = project.getTestSuiteByName(targetTestSuiteName);
        TestCase targetTestCase = targetTestSuite.getTestCaseByName(targetTestCaseName);
        SecurityTest targetSecurityTest = targetTestCase.getSecurityTestByName(targetSecurityTestName);
        TestStep targetTestStep = targetTestCase.getTestStepByName(targetSecurityTestStepName);

        boolean overwrite = dialog.getBooleanValue(CloneParameterDialog.OVERWRITE);
View Full Code Here

        okAction.setDialog(dialog);
        cancelAction.setDialog(dialog);
        applyAction.setDialog(dialog);

        final TestCase testCase = securityScan.getTestStep().getTestCase();
        final Project project = testCase.getTestSuite().getProject();

        dialog.getFormField(CloneParameterDialog.TARGET_TESTSUITE).addFormFieldListener(new XFormFieldListener() {
            public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                TestSuite testSuite = project.getTestSuiteByName(newValue);
                String[] testCaseNames = ModelSupport.getNames(testSuite.getTestCaseList());
                dialog.setOptions(CloneParameterDialog.TARGET_TESTCASE, testCaseNames);

                if (testCaseNames.length > 0) {
                    dialog.setValue(CloneParameterDialog.TARGET_TESTCASE, testCaseNames[0]);
                    TestCase testCase = testSuite.getTestCaseByName(testCaseNames[0]);

                    String[] testStepNames = new String[0];
                    String[] securityTestNames = ModelSupport.getNames(testCase.getSecurityTestList());
                    dialog.setOptions(CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames);
                    if (securityTestNames.length > 0) {
                        testStepNames = getSecurableTestStepsNames(testCase);
                    }
                    dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, testStepNames);

                    if (securityTestNames.length > 0) {
                        dialog.setValue(CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames[0]);
                        if (testStepNames.length > 0) {
                            dialog.setValue(CloneParameterDialog.TARGET_TESTSTEP, testStepNames[0]);
                        } else {
                            dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, new String[0]);
                        }

                        String securityTestName = dialog.getValue(CloneParameterDialog.TARGET_SECURITYTEST);
                        SecurityTest securityTest = testCase.getSecurityTestByName(securityTestName);
                        String testStepName = dialog.getValue(CloneParameterDialog.TARGET_TESTSTEP);
                        TestStep testStep = testCase.getTestStepByName(testStepName);
                        String[] securityScanNames = ModelSupport.getNames(securityTest.getTestStepSecurityScanByType(
                                testStep.getId(), AbstractSecurityScanWithProperties.class));
                        dialog.setOptions(CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames);
                    } else {
                        dialog.setOptions(CloneParameterDialog.TARGET_SECURITYTEST, new String[0]);
                        dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, new String[0]);
                        dialog.setOptions(CloneParameterDialog.TARGET_SECURITYSCAN, new String[0]);
                    }
                } else {
                    dialog.setOptions(CloneParameterDialog.TARGET_SECURITYTEST, new String[0]);
                    dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, new String[0]);
                }
            }
        });
        dialog.getFormField(CloneParameterDialog.TARGET_TESTCASE).addFormFieldListener(new XFormFieldListener() {
            public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                String testSuiteName = dialog.getValue(CloneParameterDialog.TARGET_TESTSUITE);
                TestSuite testSuite = project.getTestSuiteByName(testSuiteName);
                TestCase testCase = testSuite.getTestCaseByName(newValue);

                String[] testStepNames = new String[0];
                String[] securityTestNames = ModelSupport.getNames(testCase.getSecurityTestList());
                dialog.setOptions(CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames);
                if (securityTestNames.length > 0) {
                    testStepNames = getSecurableTestStepsNames(testCase);
                }
                dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, testStepNames);

                if (securityTestNames.length > 0) {
                    dialog.setValue(CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames[0]);
                    if (testStepNames.length > 0) {
                        dialog.setValue(CloneParameterDialog.TARGET_TESTSTEP, testStepNames[0]);
                    } else {
                        dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, new String[0]);
                    }

                    String securityTestName = dialog.getValue(CloneParameterDialog.TARGET_SECURITYTEST);
                    SecurityTest securityTest = testCase.getSecurityTestByName(securityTestName);
                    String testStepName = dialog.getValue(CloneParameterDialog.TARGET_TESTSTEP);
                    TestStep testStep = testCase.getTestStepByName(testStepName);
                    String[] securityScanNames = ModelSupport.getNames(securityTest.getTestStepSecurityScanByType(
                            testStep.getId(), AbstractSecurityScanWithProperties.class));
                    dialog.setOptions(CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames);
                } else {
                    dialog.setOptions(CloneParameterDialog.TARGET_SECURITYTEST, new String[0]);
                    dialog.setOptions(CloneParameterDialog.TARGET_TESTSTEP, new String[0]);
                    dialog.setOptions(CloneParameterDialog.TARGET_SECURITYSCAN, new String[0]);
                }
            }
        });
        dialog.getFormField(CloneParameterDialog.TARGET_TESTSTEP).addFormFieldListener(new XFormFieldListener() {
            public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                String testSuiteName = dialog.getValue(CloneParameterDialog.TARGET_TESTSUITE);
                TestSuite testSuite = project.getTestSuiteByName(testSuiteName);
                String testCaseName = dialog.getValue(CloneParameterDialog.TARGET_TESTCASE);
                TestCase testCase = testSuite.getTestCaseByName(testCaseName);
                String securityTestName = dialog.getValue(CloneParameterDialog.TARGET_SECURITYTEST);
                SecurityTest securityTest = testCase.getSecurityTestByName(securityTestName);
                TestStep testStep = testCase.getTestStepByName(newValue);

                String[] securityScanNames = ModelSupport.getNames(securityTest.getTestStepSecurityScanByType(
                        testStep.getId(), AbstractSecurityScanWithProperties.class));
                dialog.setOptions(CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames);
            }
        });
        dialog.getFormField(CloneParameterDialog.TARGET_SECURITYTEST).addFormFieldListener(new XFormFieldListener() {
            public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                String testSuiteName = dialog.getValue(CloneParameterDialog.TARGET_TESTSUITE);
                TestSuite testSuite = project.getTestSuiteByName(testSuiteName);
                String testCaseName = dialog.getValue(CloneParameterDialog.TARGET_TESTCASE);
                TestCase testCase = testSuite.getTestCaseByName(testCaseName);
                SecurityTest securityTest = testCase.getSecurityTestByName(newValue);
                String testStepName = dialog.getValue(CloneParameterDialog.TARGET_TESTSTEP);
                TestStep testStep = testCase.getTestStepByName(testStepName);
View Full Code Here

        assertEquals(GET, restMockAction.getMethod());
    }

    @Test
    public void isConstructedWithActionsAndResponses() throws SoapUIException {
        Project project = ModelItemFactory.makeWsdlProject();
        RESTMockServiceConfig config = createRestMockServiceConfig();

        RestMockService mockService = new RestMockService(project, config);

        assertEquals(config.getName(), mockService.getName());
View Full Code Here

        WsdlTestCase testCase = getTestCase();
        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())) {
                        operation = iface.getOperationAt(i);
                        break;
                    }
View Full Code Here

import com.eviware.soapui.model.propertyexpansion.resolvers.DynamicPropertyResolver.ValueProvider;
import com.eviware.soapui.model.support.ModelSupport;

public class ProjectDirProvider implements ValueProvider {
    public String getValue(PropertyExpansionContext context) {
        Project project = ModelSupport.getModelItemProject(context.getModelItem());
        if (project != null) {
            return getProjectFolder(project);
        }

        return null;
View Full Code Here

        if (workspace == null) {
            ModelItem modelItem = context.getModelItem();
            if (modelItem instanceof Workspace) {
                workspace = (Workspace) modelItem;
            } else {
                Project project = ModelSupport.getModelItemProject(modelItem);
                if (project != null) {
                    workspace = project.getWorkspace();
                }
            }
        }

        return workspace == null ? null : PathUtils.getAbsoluteFolder(workspace.getPath());
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.project.Project

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.