Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.readTree()


    ResourceScheduler rms = mrCluster.getResourceManager()
                                                   .getResourceScheduler();
    RMNMInfo rmInfo = new RMNMInfo(rmc,rms);
    String liveNMs = rmInfo.getLiveNodeManagers();
    ObjectMapper mapper = new ObjectMapper();
    JsonNode jn = mapper.readTree(liveNMs);
    Assert.assertEquals("Unexpected number of live nodes:",
                                               NUMNODEMANAGERS, jn.size());
    Iterator<JsonNode> it = jn.iterator();
    while (it.hasNext()) {
      JsonNode n = it.next();
View Full Code Here


    when(rmc.getRMNodes()).thenReturn(map);
   
    RMNMInfo rmInfo = new RMNMInfo(rmc,rms);
    String liveNMs = rmInfo.getLiveNodeManagers();
    ObjectMapper mapper = new ObjectMapper();
    JsonNode jn = mapper.readTree(liveNMs);
    Assert.assertEquals("Unexpected number of live nodes:",
                                               1, jn.size());
    Iterator<JsonNode> it = jn.iterator();
    while (it.hasNext()) {
      JsonNode n = it.next();
View Full Code Here

    }

    @Override
    public DataDTO deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        ObjectMapper mapper = (ObjectMapper) jp.getCodec();
        ObjectNode root = (ObjectNode) mapper.readTree(jp);
        Iterator<Map.Entry<String, JsonNode>> elementsIterator =
                root.getFields();
        DataDTO dataDTO = new DataDTO();
        ExpressionDTO expressionDTO = new ExpressionDTO();
        boolean isExpression = false;
View Full Code Here

                throw new UserDetailsUnavailableException("User details cannot be retrieved.");
        }

        ObjectMapper mapper = new ObjectMapper();
        try {
            JsonNode root = mapper.readTree(scimResponse);
            List<CbUserRole> roles = new ArrayList<>();
            String account = null;
            JsonNode userNode = root;
            if (UserFilterField.USERNAME.equals(filterField)) {
                userNode = root.get("resources").get(0);
View Full Code Here

 
  void testJsonEquivalence(String actual, String expected)throws Exception{
    ObjectMapper mapper = new ObjectMapper();
    JsonFactory factory = mapper.getJsonFactory();
    JsonParser jp = factory.createJsonParser(actual);
    JsonNode actualObj = mapper.readTree(jp);
   
    jp = factory.createJsonParser(expected);
    JsonNode  expectedObj = mapper.readTree(jp);
    assertEquals(actualObj, expectedObj);
  }
View Full Code Here

    JsonFactory factory = mapper.getJsonFactory();
    JsonParser jp = factory.createJsonParser(actual);
    JsonNode actualObj = mapper.readTree(jp);
   
    jp = factory.createJsonParser(expected);
    JsonNode  expectedObj = mapper.readTree(jp);
    assertEquals(actualObj, expectedObj);
  }
}
View Full Code Here

     */
    @POST
    public Response addEvent(String content) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        LOGGER.info(String.format("JSON content: '%s'", content));
        JsonNode input = mapper.readTree(content);

        String eventType = getStringField(input, "eventType");
        String groupType = getStringField(input, "groupType");
        String groupName = getStringField(input, "groupName");
        String chaosTypeName = getStringField(input, "chaosType");
View Full Code Here

     */
    @POST
    public Response addEvent(String content) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        LOGGER.info(String.format("JSON content: '%s'", content));
        JsonNode input = mapper.readTree(content);

        String eventType = getStringField(input, "eventType");
        String resourceId = getStringField(input, "resourceId");

        Response.Status responseStatus;
View Full Code Here

   *     cannot be instantiated
   */
  public static KijiRowFilter toFilter(String json) {
    final ObjectMapper mapper = new ObjectMapper();
    try {
      final JsonNode root = mapper.readTree(json);
      return toFilter(root);
    } catch (IOException ioe) {
      throw new KijiIOException(ioe);
    }
  }
View Full Code Here

      final ObjectMapper mapper = new ObjectMapper();
      final JsonParser parser = new JsonFactory().createJsonParser(json)
          .enable(Feature.ALLOW_COMMENTS)
          .enable(Feature.ALLOW_SINGLE_QUOTES)
          .enable(Feature.ALLOW_UNQUOTED_FIELD_NAMES);
      final JsonNode node = mapper.readTree(parser);
      if (node.isArray()) {
        final Object[] components = new Object[node.size()];
        for (int i = 0; i < node.size(); ++i) {
          components[i] = getJsonStringOrIntValue(node.get(i));
        }
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.