Package com.eviware.soapui.support

Examples of com.eviware.soapui.support.JsonUtil


        } else {
            String content = "<Not JSON content>";

            if (JsonUtil.seemsToBeJsonContentType(me.getResponseHeaders().get("Content-Type", ""))) {
                try {
                    JSON json = new JsonUtil().parseTrimmedText(me.getResponseContent());
                    if (json.isEmpty()) {
                        content = "<Empty JSON content>";
                    } else {
                        content = json.toString(3);
                    }
View Full Code Here


        } else {
            String content;

            if (JsonUtil.seemsToBeJsonContentType(httpResponse.getContentType())) {
                try {
                    JSON json = new JsonUtil().parseTrimmedText(httpResponse.getContentAsString());
                    if (json.isEmpty()) {
                        content = "<Empty JSON content>";
                    } else {
                        content = json.toString(3);
                    }
View Full Code Here

            String requestContent = request.getRequestContent();
            if (!StringUtils.hasContent(requestContent)) {
                return;
            }
            try {
                JSON oldJson = new JsonUtil().parseTrimmedText(requestContent);
                if (!(json instanceof JSONObject) || !(oldJson instanceof JSONObject)) {
                    return;
                }
                overwriteNullValues((JSONObject) json, (JSONObject) oldJson);
            } catch (Exception e) {
View Full Code Here

        serializer = new JsonXmlSerializer();
    }

    @Test
    public void serializesJsonWithVanillaNames() throws Exception {
        JSON parse = new JsonUtil().parseTrimmedText("{ name: 'Barack', surname: 'Obama', profession: 'president'}");

        assertThat(serializer.write(parse), is("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<o>" +
                "<name type=\"string\">Barack</name>" +
                "<profession type=\"string\">president</profession>" +
                "<surname type=\"string\">Obama</surname>" +
View Full Code Here

                "</o>\r\n"));
    }

    @Test
    public void serializesJsonWithDollarSign() throws Exception {
        JSON parse = new JsonUtil().parseTrimmedText("{ $: 'value' }");

        assertThat(serializer.write(parse), is("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<o>" +
                "<_ type=\"string\">value</_>" +
                "</o>\r\n"));
    }
View Full Code Here

            if (!StringUtils.hasContent(content)) {
                return null;
            }
            // remove nulls - workaround for bug in xmlserializer!?
            content = content.replaceAll("\\\\u0000", "");
            JSON json = new JsonUtil().parseTrimmedText(content);
            JsonXmlSerializer serializer = new JsonXmlSerializer();
            serializer.setTypeHintsEnabled(false);
            serializer.setRootName(HttpUtils.isErrorStatus(response.getStatusCode()) ? "Fault" : "Response");
            URL url = response.getURL();
            String originalUri = readOriginalUriFrom(response.getRequest());
View Full Code Here

            if (!StringUtils.hasContent(content)) {
                return null;
            }
            // remove nulls - workaround for bug in xmlserializer!?
            content = content.replaceAll("\\\\u0000", "");
            JSON json = new JsonUtil().parseTrimmedText(content);
            JsonXmlSerializer serializer = new JsonXmlSerializer();
            serializer.setTypeHintsEnabled(false);
            serializer.setRootName("Response");
            serializer.setNamespace("", "json");
            content = serializer.write(json);
View Full Code Here

TOP

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

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.