Package com.eviware.soapui.model.project

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


        ModelItem modelItem = context.getModelItem();

        TestStep testStep = null;
        TestCase testCase = null;
        TestSuite testSuite = null;
        Project project = null;
        MockService mockService = null;
        AbstractMockResponse mockResponse = null;
        SecurityTest securityTest = null;

        if (modelItem instanceof WsdlTestStep) {
View Full Code Here


                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    if (newValue.equals(CREATE_NEW_OPTION)) {
                        dialog.setOptions(Form.TESTSUITE, new String[]{CREATE_NEW_OPTION});
                        dialog.setOptions(Form.TESTCASE, new String[]{CREATE_NEW_OPTION});
                    } else {
                        Project project = SoapUI.getWorkspace().getProjectByName(newValue);
                        String[] names = ModelSupport.getNames(project.getTestSuiteList(),
                                new String[]{CREATE_NEW_OPTION});
                        dialog.setOptions(Form.TESTSUITE, names);
                        dialog.setValue(Form.TESTSUITE, names[0]);

                        if (names.length > 1) {
                            TestSuite testSuite = project.getTestSuiteByName(names[0]);
                            dialog.setOptions(Form.TESTCASE,
                                    ModelSupport.getNames(testSuite.getTestCaseList(), new String[]{CREATE_NEW_OPTION}));
                        } else {
                            dialog.setOptions(Form.TESTCASE, new String[]{CREATE_NEW_OPTION});
                        }
                    }
                }
            });

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

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    if (newValue.equals(CREATE_NEW_OPTION)) {
                        dialog.setOptions(Form.TESTCASE, new String[]{CREATE_NEW_OPTION});
                    } else {
                        String projectName = dialog.getValue(Form.PROJECT);
                        Project project = SoapUI.getWorkspace().getProjectByName(projectName);
                        TestSuite testSuite = project.getTestSuiteByName(newValue);
                        dialog.setOptions(Form.TESTCASE, testSuite == null ? new String[]{CREATE_NEW_OPTION}
                                : ModelSupport.getNames(testSuite.getTestCaseList(), new String[]{CREATE_NEW_OPTION}));
                    }
                }
            });

        }

        dialog.setBooleanValue(Form.MOVE, false);
        dialog.setValue(Form.NAME, "Copy of " + testStep.getName());
        WorkspaceImpl workspace = testStep.getTestCase().getTestSuite().getProject().getWorkspace();
        dialog.setOptions(Form.PROJECT,
                ModelSupport.getNames(workspace.getOpenProjectList(), new String[]{CREATE_NEW_OPTION}));

        dialog.setValue(Form.PROJECT, testStep.getTestCase().getTestSuite().getProject().getName());

        dialog.setOptions(Form.TESTSUITE, ModelSupport.getNames(testStep.getTestCase().getTestSuite().getProject()
                .getTestSuiteList(), new String[]{CREATE_NEW_OPTION}));
        dialog.setValue(Form.TESTSUITE, testStep.getTestCase().getTestSuite().getName());

        dialog.setOptions(Form.TESTCASE, ModelSupport.getNames(testStep.getTestCase().getTestSuite().getTestCaseList(),
                new String[]{CREATE_NEW_OPTION}));
        dialog.setValue(Form.TESTCASE, testStep.getTestCase().getName());

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

            WsdlProject project = testStep.getTestCase().getTestSuite().getProject();
            WsdlTestSuite targetTestSuite = null;
            WsdlTestCase targetTestCase = null;
            Set<Interface> requiredInterfaces = new HashSet<Interface>();

            // to another project project?
            if (!targetProjectName.equals(project.getName())) {
                // get required interfaces
                requiredInterfaces.addAll(testStep.getRequiredInterfaces());

                project = (WsdlProject) workspace.getProjectByName(targetProjectName);
                if (project == null) {
                    targetProjectName = UISupport.prompt("Enter name for new Project", "Clone TestStep", "");
                    if (targetProjectName == null) {
                        return;
                    }

                    try {
                        project = workspace.createProject(targetProjectName, null);
                    } catch (SoapUIException e) {
                        UISupport.showErrorMessage(e);
                    }

                    if (project == null) {
                        return;
                    }
                }

                if (requiredInterfaces.size() > 0 && project.getInterfaceCount() > 0) {
                    Map<String, Interface> bindings = new HashMap<String, Interface>();
                    for (Interface iface : requiredInterfaces) {
                        bindings.put(iface.getTechnicalId(), iface);
                    }

                    for (Interface iface : project.getInterfaceList()) {
                        bindings.remove(iface.getTechnicalId());
                    }

                    requiredInterfaces.retainAll(bindings.values());
                }

                if (requiredInterfaces.size() > 0) {
                    String msg = "Target project [" + targetProjectName + "] is missing required Interfaces;\r\n\r\n";
                    for (Interface iface : requiredInterfaces) {
                        msg += iface.getName() + " [" + iface.getTechnicalId() + "]\r\n";
                    }
                    msg += "\r\nThese will be cloned to the targetProject as well";

                    if (!UISupport.confirm(msg, "Clone TestStep")) {
                        return;
                    }

                    for (Interface iface : requiredInterfaces) {
                        project.importInterface((AbstractInterface<?>) iface, true, true);
                    }
                }
            }

            targetTestSuite = project.getTestSuiteByName(targetTestSuiteName);
            if (targetTestSuite == null) {
                targetTestSuiteName = UISupport.prompt("Specify name for new TestSuite", "Clone TestStep", "Copy of "
                        + testStep.getTestCase().getTestSuite().getName());
                if (targetTestSuiteName == null) {
                    return;
                }

                targetTestSuite = project.addNewTestSuite(targetTestSuiteName);
            }

            targetTestCase = targetTestSuite.getTestCaseByName(targetTestCaseName);
            if (targetTestCase == null) {
                targetTestCaseName = UISupport.prompt("Specify name for new TestCase", "Clone TestStep", "Copy of "
View Full Code Here

        if (!UISupport.confirm("Add Request [" + source.getName() + "] to TestCase [" + testCase.getName() + "]",
                "Add Request to TestCase")) {
            return false;
        }

        Project targetProject = testCase.getTestSuite().getProject();
        if (targetProject != source.getOperation().getInterface().getProject()) {
            HashSet<Interface> requiredInterfaces = new HashSet<Interface>();
            requiredInterfaces.add(source.getOperation().getInterface());

            if (!DragAndDropSupport
View Full Code Here

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    if (newValue.equals(CREATE_NEW_OPTION)) {
                        dialog.setOptions(Form.TESTSUITE, new String[]{CREATE_NEW_OPTION});
                    } else {
                        Project project = SoapUI.getWorkspace().getProjectByName(newValue);
                        dialog.setOptions(Form.TESTSUITE,
                                ModelSupport.getNames(project.getTestSuiteList(), new String[]{CREATE_NEW_OPTION}));
                    }
                }
            });
            dialog.getFormField(Form.CLONE_DESCRIPTION).addFormFieldListener(new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                    if (dialog.getBooleanValue(Form.CLONE_DESCRIPTION)) {
                        dialog.getFormField(Form.DESCRIPTION).setEnabled(false);
                    } else {
                        dialog.getFormField(Form.DESCRIPTION).setEnabled(true);
                    }

                }
            });
        }

        dialog.setBooleanValue(Form.MOVE, false);
        dialog.setBooleanValue(Form.CLONE_DESCRIPTION, true);
        dialog.getFormField(Form.DESCRIPTION).setEnabled(false);
        dialog.setValue(Form.DESCRIPTION, testCase.getDescription());
        dialog.setValue(Form.NAME, "Copy of " + testCase.getName());
        WorkspaceImpl workspace = testCase.getTestSuite().getProject().getWorkspace();
        dialog.setOptions(Form.PROJECT,
                ModelSupport.getNames(workspace.getOpenProjectList(), new String[]{CREATE_NEW_OPTION}));

        dialog.setValue(Form.PROJECT, testCase.getTestSuite().getProject().getName());

        dialog.setOptions(Form.TESTSUITE, ModelSupport.getNames(
                testCase.getTestSuite().getProject().getTestSuiteList(), new String[]{CREATE_NEW_OPTION}));

        dialog.setValue(Form.TESTSUITE, testCase.getTestSuite().getName());

        boolean hasLoadTests = testCase.getLoadTestCount() > 0;
        dialog.setBooleanValue(Form.CLONE_LOADTESTS, hasLoadTests);
        dialog.getFormField(Form.CLONE_LOADTESTS).setEnabled(hasLoadTests);

        boolean hasSecurityTests = testCase.getSecurityTestCount() > 0;
        dialog.setBooleanValue(Form.CLONE_SECURITYTESTS, hasSecurityTests);
        dialog.getFormField(Form.CLONE_SECURITYTESTS).setEnabled(hasSecurityTests);

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

            WsdlProject project = testCase.getTestSuite().getProject();
            WsdlTestSuite targetTestSuite = null;
            Set<Interface> requiredInterfaces = new HashSet<Interface>();

            // to another project project?
            if (!targetProjectName.equals(project.getName())) {
                // get required interfaces
                for (int y = 0; y < testCase.getTestStepCount(); y++) {
                    WsdlTestStep testStep = testCase.getTestStepAt(y);
                    requiredInterfaces.addAll(testStep.getRequiredInterfaces());
                }

                project = (WsdlProject) workspace.getProjectByName(targetProjectName);
                if (project == null) {
                    targetProjectName = UISupport.prompt("Enter name for new Project", "Clone TestCase", "");
                    if (targetProjectName == null) {
                        return;
                    }

                    try {
                        project = workspace.createProject(targetProjectName, null);
                    } catch (SoapUIException e) {
                        UISupport.showErrorMessage(e);
                    }

                    if (project == null) {
                        return;
                    }
                }

                if (requiredInterfaces.size() > 0 && project.getInterfaceCount() > 0) {
                    Map<String, Interface> bindings = new HashMap<String, Interface>();
                    for (Interface iface : requiredInterfaces) {
                        bindings.put(iface.getTechnicalId(), iface);
                    }

                    for (Interface iface : project.getInterfaceList()) {
                        bindings.remove(iface.getTechnicalId());
                    }

                    requiredInterfaces.retainAll(bindings.values());
                }

                if (requiredInterfaces.size() > 0) {
                    String msg = "Target project [" + targetProjectName + "] is missing required Interfaces;\r\n\r\n";
                    for (Interface iface : requiredInterfaces) {
                        msg += iface.getName() + " [" + iface.getTechnicalId() + "]\r\n";
                    }
                    msg += "\r\nShould these will be cloned to the targetProject as well?";

                    Boolean result = UISupport.confirmOrCancel(msg, "Clone TestCase");
                    if (result == null) {
                        return;
                    }

                    if (result) {
                        for (Interface iface : requiredInterfaces) {
                            project.importInterface((AbstractInterface<?>) iface, true, true);
                        }
                    }
                }
            }

            targetTestSuite = project.getTestSuiteByName(targetTestSuiteName);
            if (targetTestSuite == null) {
                targetTestSuiteName = UISupport.prompt("Specify name for new TestSuite", "Clone TestCase", "Copy of "
                        + testCase.getTestSuite().getName());
                if (targetTestSuiteName == null) {
                    return;
                }

                targetTestSuite = project.addNewTestSuite(targetTestSuiteName);
            }

            boolean move = dialog.getBooleanValue(Form.MOVE);
            WsdlTestCase newTestCase = targetTestSuite.importTestCase(testCase, name, -1,
                    dialog.getBooleanValue(Form.CLONE_LOADTESTS), dialog.getBooleanValue(Form.CLONE_SECURITYTESTS),
View Full Code Here

        return testStep;
    }

    public TestStepConfig createNewTestStep(WsdlTestCase testCase, String name) {
        // build list of available interfaces / operations
        Project project = testCase.getTestSuite().getProject();
        List<String> options = new ArrayList<String>();
        List<Operation> operations = new ArrayList<Operation>();

        for (int c = 0; c < project.getInterfaceCount(); c++) {
            Interface iface = project.getInterfaceAt(c);
            for (int i = 0; i < iface.getOperationCount(); i++) {
                options.add(iface.getName() + " -> " + iface.getOperationAt(i).getName());
                operations.add(iface.getOperationAt(i));
            }
        }
View Full Code Here

    public GroovyUtils(PropertyExpansionContext context) {
        this.context = context;
    }

    public final String getProjectPath() {
        Project project = ModelSupport.getModelItemProject(context.getModelItem());

        String path = project.getPath();
        int ix = path.lastIndexOf(File.separatorChar);
        return ix == -1 ? "" : path.substring(0, ix);
    }
View Full Code Here

        return hasRunningLoadTest(testCase) || hasRunningSecurityTest(testCase) || hasRunningTestCase(testCase);
    }

    public void init(Workspace workspace) {
        for (int c = 0; c < workspace.getProjectCount(); c++) {
            Project project = workspace.getProjectAt(c);
            monitorProject(project);
        }

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

        return holder;
    }

    @SuppressWarnings("unchecked")
    public static Map<String, String> projectEntriesList(SensitiveInfoExposureAssertion sensitiveInfoExposureAssertion) {
        Project project = ModelSupport.getModelItemProject(sensitiveInfoExposureAssertion);
        AbstractWsdlModelItem<ModelItemConfig> modelItem = (AbstractWsdlModelItem<ModelItemConfig>) project
                .getModelItem();
        XmlObjectConfigurationReader reader = new XmlObjectConfigurationReader(((ProjectConfig) modelItem.getConfig())
                .getSensitiveInformation());
        String[] strngArray = reader.readStrings(ProjectSensitiveInformationPanel.PROJECT_SPECIFIC_EXPOSURE_LIST);
        if (strngArray != null) {
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.