Package com.eviware.soapui.support

Examples of com.eviware.soapui.support.JsonPathFacade


        String path = "$.persons[0].firstName";
        transfer.setTargetPath(path);
        transfer.setTargetPathLanguage(PathLanguage.JSONPATH);
        transfer.transferProperties(submitContext);

        assertThat(new JsonPathFacade(targetProperty.getValue()).readStringValue(path), is(newName));
    }
View Full Code Here


        transfer.setSourcePathLanguage(PathLanguage.JSONPATH);
        transfer.setTargetPath(path);
        transfer.setTargetPathLanguage(PathLanguage.JSONPATH);
        transfer.transferProperties(submitContext);

        Object insertedValue = new JsonPathFacade(targetProperty.getValue()).readObjectValue(path);
        assertThat(insertedValue, is(aNumber()));
    }
View Full Code Here

        transfer.setSourcePathLanguage(PathLanguage.JSONPATH);
        transfer.setTargetPath(path);
        transfer.setTargetPathLanguage(PathLanguage.JSONPATH);
        transfer.transferProperties(submitContext);

        Object insertedValue = new JsonPathFacade(targetProperty.getValue()).readObjectValue(path);
        assertTrue("Expected a map object but got " + insertedValue, insertedValue instanceof Map);
    }
View Full Code Here

    public static String extractXPathPropertyValue(Object property, String pathExpression) {
        try {
            String value = property instanceof TestProperty ? ((TestProperty) property).getValue() : property
                    .toString();
            if (pathExpression.startsWith("$")) {
                return new JsonPathFacade(value).readStringValue(pathExpression);
            } else {
                XmlObject xmlObject = XmlUtils.createXmlObject(value);
                String ns = pathExpression.trim().startsWith("declare namespace") ? "" : XmlUtils.declareXPathNamespaces(xmlObject);
                Node domNode = XmlUtils.selectFirstDomNode(xmlObject, ns + pathExpression);
                return domNode == null ? null : XmlUtils.getValueForMatch(domNode, false);
View Full Code Here

    private Object readSourceValue(PropertyExpansionContext context) throws Exception {
        String sourceValue = getSourceProperty().getValue();
        if (!hasSourcePath()) {
            return sourceValue;
        } else if (getSourcePathLanguage() == PathLanguage.JSONPATH) {
            return new JsonPathFacade(sourceValue).readObjectValue(getSourcePath());
        } else {
            XmlObject sourceXml = XmlUtils.createXmlObject(sourceValue);
            XmlCursor sourceCursor = sourceXml.newCursor();

            try {
View Full Code Here

        if (!hasTargetPath()) {
            getTargetProperty().setValue(stringValue);
        } else {
            String targetPath = PropertyExpander.expandProperties(context, getTargetPath());
            if (getTargetPathLanguage() == PathLanguage.JSONPATH) {
                JsonPathFacade jsonPathFacade = new JsonPathFacade(getTargetProperty().getValue());
                jsonPathFacade.writeValue(targetPath, value);
                getTargetProperty().setValue(jsonPathFacade.getCurrentJson());
            } else {
                XmlObject targetXml = XmlObject.Factory.parse(getTargetProperty().getValue());
                XmlCursor targetCursor = targetXml.newCursor();

                try {
View Full Code Here

TOP

Related Classes of com.eviware.soapui.support.JsonPathFacade

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.