Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode.asText()


    String json = IOUtils.toString(new FileInputStream(file));
    JsonNode jsonNode = mock(JsonNode.class);
    when(objectMapper.readTree(json.getBytes())).thenReturn(jsonNode);
    when(jsonNode.get("Blueprints")).thenReturn(jsonNode);
    when(jsonNode.get("blueprint_name")).thenReturn(jsonNode);
    when(jsonNode.asText()).thenReturn("blueprintName");

    String result = blueprintCommands.addBlueprint("url", file);

    verify(ambariClient).addBlueprint(json);
    verify(context).setHint(Hints.BUILD_CLUSTER);
View Full Code Here


        JsonNode jLemma = jMorpho.path("lemma");
        if(!jLemma.isTextual()){
            throw new IllegalStateException("Field 'lemma' MUST provide a String value (parsed JSON: "
                +jMorpho);
        }
        MorphoFeatures morpho = new MorphoFeatures(jLemma.asText());
        JsonNode node = jMorpho.path("case");
        if(node.isArray()){
            ArrayNode jCases = (ArrayNode)node;
            for(int i=0;i<jCases.size();i++){
                JsonNode member = jCases.get(i);
View Full Code Here

        while (iter.hasNext()) {
            Map.Entry<String, JsonNode> entry = iter.next();
            if (entry.getKey().equalsIgnoreCase("type")) {
                JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    return n.asText();
                }
            }
        }
        return name;
    }
View Full Code Here

        while (iter.hasNext()) {
            Map.Entry<String, JsonNode> entry = iter.next();
            if (!entry.getKey().equalsIgnoreCase("type")) {
                JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    attrs.put(entry.getKey(), n.asText());
                }
            }
        }
    }
View Full Code Here

        ObjectMapper mapper = new ObjectMapper();
        JsonNode node = mapper.readValue(json, JsonNode.class);

        JsonNode latitudeNode = notNull(node.get("latitude"), "latitude");
        JsonNode longitudeNode = notNull(node.get("longitude"), "longitude");
        String resLatlng = latitudeNode.asText() + "," + longitudeNode.asText();
        exchange.getIn().setHeader(GeoCoderConstants.LATLNG, resLatlng);

        JsonNode countryCode = node.get("country_code");
        JsonNode countryName = node.get("country_name");
        if (countryCode != null) {
View Full Code Here

        JsonNode countryName = node.get("country_name");
        if (countryCode != null) {
            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_SHORT, countryCode.asText());
        }
        if (countryName != null) {
            exchange.getIn().setHeader(GeoCoderConstants.COUNTRY_LONG, countryName.asText());
        }

        JsonNode regionCode = node.get("region_code");
        JsonNode regionName = node.get("region_name");
        if (regionCode != null) {
View Full Code Here

        JsonNode regionName = node.get("region_name");
        if (regionCode != null) {
            exchange.getIn().setHeader(GeoCoderConstants.REGION_CODE, regionCode.asText());
        }
        if (regionName != null) {
            exchange.getIn().setHeader(GeoCoderConstants.REGION_NAME, regionName.asText());
        }

        JsonNode city = node.get("city");
        if (city != null) {
            exchange.getIn().setHeader(GeoCoderConstants.CITY, city.asText());
View Full Code Here

            exchange.getIn().setHeader(GeoCoderConstants.REGION_NAME, regionName.asText());
        }

        JsonNode city = node.get("city");
        if (city != null) {
            exchange.getIn().setHeader(GeoCoderConstants.CITY, city.asText());
        }

        // should we include body
        if (!endpoint.isHeadersOnly()) {
            exchange.getIn().setBody(json);
View Full Code Here

        while (iter.hasNext()) {
            Map.Entry<String, JsonNode> entry = iter.next();
            if (entry.getKey().equalsIgnoreCase("type")) {
                JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    return n.asText();
                }
            }
        }
        return name;
    }
View Full Code Here

        while (iter.hasNext()) {
            Map.Entry<String, JsonNode> entry = iter.next();
            if (!entry.getKey().equalsIgnoreCase("type")) {
                JsonNode n = entry.getValue();
                if (n.isValueNode()) {
                    attrs.put(entry.getKey(), n.asText());
                }
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.