Package com.eviware.soapui.model.testsuite

Examples of com.eviware.soapui.model.testsuite.TestProperty


        }

        public void actionPerformed(ActionEvent e) {
            if (UISupport.confirm("Clear all property values?", "Clear Properties")) {
                for (String name : holder.getPropertyNames()) {
                    TestProperty property = holder.getProperty(name);
                    property.setValue(null);
                    if (property instanceof RestParameter) {
                        ((RestParameter) property).setDefaultValue(null);
                    }
                }
            }
View Full Code Here


        if (holder == null) {
            holder = getGlobalProperties();
        }

        TestProperty tp = holder.getProperty(pe);
        return tp == null ? null : new MutablePropertyExpansionImpl(tp, xpath, target, propertyName);
    }
View Full Code Here

                                if (holder.hasProperty(name)) {
                                    count++;
                                    holder.setPropertyValue(name, value);
                                } else if (dialog.getBooleanValue(LoadOptionsForm.CREATEMISSING)
                                        && holder instanceof MutableTestPropertyHolder) {
                                    TestProperty prop = ((MutableTestPropertyHolder) holder).addProperty(name);
                                    if (!prop.isReadOnly()) {
                                        prop.setValue(value);
                                        if (prop instanceof RestParameter) {
                                            ((RestParameter) prop).setDefaultValue(value);
                                        }
                                    }
                                    count++;
View Full Code Here

       * Idea is to drain for each parameter mutations.
       */
            for (SecurityCheckedParameter param : getParameterHolder().getParameterList()) {
                if (parameterMutations.containsKey(param)) {
                    if (parameterMutations.get(param).size() > 0) {
                        TestProperty property = getTestStep().getProperties().get(param.getName());
                        String value = context.expand(property.getValue());
                        if (param.getXpath() == null || param.getXpath().trim().length() == 0) {
                            testStep.getProperties().get(param.getName())
                                    .setValue(parameterMutations.get(param).get(0));
                            params.put(param.getLabel(), parameterMutations.get(param).get(0));
                            parameterMutations.get(param).remove(0);
                        } else {
                            // no value, do nothing.
                            if (value == null || value.trim().equals("")) {
                                continue;
                            }
                            // XmlObjectTreeModel model = new XmlObjectTreeModel(
                            // property.getSchemaType().getTypeSystem(),
                            // XmlObject.Factory.parse( value ) );
                            XmlObjectTreeModel model = new XmlObjectTreeModel(property.getSchemaType().getTypeSystem(),
                                    XmlUtils.createXmlObject(value));
                            XmlTreeNode[] nodes = model.selectTreeNodes(context.expand(param.getXpath()));
                            for (XmlTreeNode node : nodes) {
                                node.setValue(1, parameterMutations.get(param).get(0));
                            }
                            params.put(param.getLabel(), parameterMutations.get(param).get(0));
                            parameterMutations.get(param).remove(0);

                            testStep.getProperties().get(param.getName()).setValue(model.getXmlObject().toString());
                        }

                        break;
                    }
                }
            }
        } else {
            for (TestProperty property : testStep.getPropertyList()) {

                String value = context.expand(property.getValue());
                if (XmlUtils.seemsToBeXml(value)) {
                    XmlObjectTreeModel model = null;
                    // model = new XmlObjectTreeModel(
                    // property.getSchemaType().getTypeSystem(),
                    // XmlObject.Factory.parse( value ) );
                    model = new XmlObjectTreeModel(property.getSchemaType().getTypeSystem(),
                            XmlUtils.createXmlObject(value));
                    for (SecurityCheckedParameter param : getParameterHolder().getParameterList()) {
                        if (!param.isChecked()) {
                            continue;
                        }

                        if (param.getXpath() == null || param.getXpath().trim().length() == 0) {
                            if (parameterMutations.containsKey(param)) {
                                testStep.getProperties().get(param.getName())
                                        .setValue(parameterMutations.get(param).get(0));
                                params.put(param.getLabel(), parameterMutations.get(param).get(0));
                                parameterMutations.get(param).remove(0);
                            }
                        } else {
                            // no value, do nothing.
                            if (value == null || value.trim().equals("")) {
                                continue;
                            }
                            if (param.getName().equals(property.getName())) {
                                XmlTreeNode[] nodes = model.selectTreeNodes(context.expand(param.getXpath()));
                                if (parameterMutations.containsKey(param)) {
                                    if (parameterMutations.get(param).size() > 0) {
                                        for (XmlTreeNode node : nodes) {
                                            node.setValue(1, parameterMutations.get(param).get(0));
                                        }
                                        params.put(param.getLabel(), parameterMutations.get(param).get(0));
                                        parameterMutations.get(param).remove(0);
                                    }
                                }
                            }
                        }
                    }
                    if (model != null) {
                        property.setValue(model.getXmlObject().toString());
                    }
                }

            }
        }
View Full Code Here

    private void mutateParameters(TestStep testStep, SecurityTestRunContext context) throws XmlException, Exception {
        mutation = true;
        // for each parameter
        for (SecurityCheckedParameter parameter : getParameterHolder().getParameterList()) {
            if (parameter.isChecked()) {
                TestProperty property = testStep.getProperties().get(parameter.getName());
                // check parameter does not have any xpath
                // than mutate whole parameter
                if (parameter.getXpath() == null || parameter.getXpath().trim().length() == 0) {
                    for (String xpathInjectionString : xpathList.getXpathListList()) {

                        if (!parameterMutations.containsKey(parameter)) {
                            parameterMutations.put(parameter, new ArrayList<String>());
                        }
                        parameterMutations.get(parameter).add(xpathInjectionString);

                    }
                } else {
                    // we have xpath but do we have xml which need to mutate
                    // ignore if there is no value, since than we'll get exception
                    if (property.getValue() == null && property.getDefaultValue() == null) {
                        continue;
                    }
                    // get value of that property
                    String value = context.expand(property.getValue());

                    // we have something that looks like xpath, or hope so.

                    XmlObjectTreeModel model = null;

                    // model = new XmlObjectTreeModel(
                    // property.getSchemaType().getTypeSystem(),
                    // XmlObject.Factory.parse( value ) );
                    model = new XmlObjectTreeModel(property.getSchemaType().getTypeSystem(),
                            XmlUtils.createXmlObject(value));

                    XmlTreeNode[] nodes = model.selectTreeNodes(context.expand(parameter.getXpath()));

                    // for each invalid type set all nodes
View Full Code Here

        return result;
    }

    public String getPropertyValue(String name) {
        TestProperty property = getProperty(name);
        return property == null ? null : property.getValue();
    }
View Full Code Here

        TestProperty property = getProperty(name);
        return property == null ? null : property.getValue();
    }

    public TestProperty removeProperty(String propertyName) {
        TestProperty property = getProperty(propertyName);
        if (property != null) {
            if (property instanceof PropertiesStepProperty && ((PropertiesStepProperty) property).isVirtualProperty()) {
                return property;
            }
            int ix = properties.indexOf(property);
View Full Code Here

    public Set<String> keySet() {
        return new HashSet<String>(Arrays.asList(getPropertyNames()));
    }

    public TestProperty put(String key, TestProperty value) {
        TestProperty result = addProperty(key);
        result.setValue(value.getValue());
        return result;
    }
View Full Code Here

        }

        @Override
        public boolean equals(Object obj) {
            if (obj instanceof TestProperty) {
                TestProperty testProperty = (TestProperty) obj;
                if (getModelItem() != null && testProperty.getModelItem() != null) {
                    return getModelItem().equals(testProperty.getModelItem()) && getName().equals(testProperty.getName());
                } else {
                    return getName().equals(testProperty.getName());
                }
            } else {
                return false;
            }
        }
View Full Code Here

        int cnt = 0;
        Enumeration<?> names = props.propertyNames();
        while (names.hasMoreElements()) {
            String name = names.nextElement().toString();
            TestProperty property = getProperty(name);
            if (property != null) {
                property.setValue(props.get(name).toString());
                cnt++;
            } else if (createMissing) {
                addProperty(name).setValue(props.get(name).toString());
                cnt++;
            }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.testsuite.TestProperty

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.