Package org.codehaus.jackson.map

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


     
      String json_xml = getParameterFromPayload(body,"json_xml");
      String svg_xml = getParameterFromPayload(body,"svg_xml");
      String fileName = getParameterFromPayload(body,"fileName");
        ObjectMapper objectMapper = new ObjectMapper();
      JsonNode objectNode = objectMapper.readTree(json_xml);
      String resFilePath = getBasePath(this.request)+"temp"+File.separator+"node_template.bpmn";;
      String newFilePath = buildPath(body)+File.separator+fileName;
      String staticFilePath = getBasePath(this.request)+"template"+File.separator+"node_template.bpmn";
        //保存思想:因为save方法不一定保存成功,并且保存失败后会导致原有文件丢失,所以做了个临时保存,没问题再复制过去
        FileUtil.copyFile(staticFilePath, resFilePath);
View Full Code Here


     
      ObjectMapper objectMapper = new ObjectMapper();

      JsonNode objectConnectorNode = null;
      try {
        objectConnectorNode = objectMapper.readTree(connectorInstanceNode.getTextValue());
      } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        LOG.debug("ConnectorInstance节点JSON转BPMN模型失败,JsonProcessingException:{}", e.getMessage());
      } catch (IOException e) {
View Full Code Here

    public ObjectNode readFrom(Class<ObjectNode> clazz, Type type,
            Annotation[] annotations, MediaType mediaType,
            MultivaluedMap<String, String> params, InputStream inputStream)
            throws IOException, WebApplicationException {
        ObjectMapper m = new ObjectMapper();
        return (ObjectNode)m.readTree(inputStream);
    }

}
View Full Code Here


    @Test
    public void testFindPluginNames() throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode design = mapper.readTree("{  \"advanced\" : {  \"plugins\" : [ \"com.test.Alpha\" ]          }   }");
        App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null);

        List<String> results = app2.findPluginNamess(design);
        assertEquals(1, results.size());
        assertEquals("com.test.Alpha", results.get(0));
View Full Code Here

    }

    @Test
    public void testFindPluginNamesEmpty() throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode design = mapper.readTree("{  \"advanced\" : {  \"plugins\" : [  ]          }   }");
        App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null);

        List<String> results = app2.findPluginNamess(design);
        assertEquals(0, results.size());
View Full Code Here

    }
    @Test
    public void testFindPluginNamesNothing() throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode design = mapper.readTree("{  \"advanced\" : {          }   }");
        App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null);

        List<String> results = app2.findPluginNamess(design);
        assertEquals(0, results.size());
View Full Code Here

    }
    @Test
    public void testFindPluginNamesNoAdvanced() throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode design = mapper.readTree("{  \"pizza\" : {          }   }");
        App app2 = new App("App Name", "choose.iriscouch.com", "choose", 81, null);

        List<String> results = app2.findPluginNamess(design);
        assertEquals(0, results.size());
    }
View Full Code Here

        while(!replicationComplete) {
            // need to check the active tasks
            HttpResponse response = instance.getConnection().get("/_active_tasks");
            ObjectMapper mapper = new ObjectMapper();
            try {
                JsonNode results = mapper.readTree(response.getContent());
                replicationComplete = true;
                for (JsonNode element : results) {
                    if ("Replication".equals(element.get("type").getTextValue())) {
                        String task = element.get("task").getTextValue();
                        String repID = task.substring(0, 4);
View Full Code Here

    rootBody.setBody(body);

    if (body != null && body.length() != 0) {
      ObjectMapper mapper = new ObjectMapper();
      try {
        JsonNode root = mapper.readTree(ensureArrayFormat(body));

        Iterator<JsonNode> iterator = root.getElements();
        while (iterator.hasNext()) {
          JsonNode            node             = iterator.next();
          Map<String, Object> mapProperties    = new HashMap<String, Object>();
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

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.