Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.JsonNode.findValue()


            try {
                ObjectMapper mapper = new ObjectMapper();
                JsonParser jp = mapper.getFactory().createParser(getBuiltQuery());
                JsonNode rootNode = mapper.readTree(jp);
                JsonNode timestampNode = rootNode.findValue("range").findValue("timestamp");
                String from = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("from").asText());
                String to = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("to").asText());
                boundaries = new AbsoluteRange(from, to);
            } catch (Exception ignored) {}
        }
View Full Code Here


                ObjectMapper mapper = new ObjectMapper();
                JsonParser jp = mapper.getFactory().createParser(getBuiltQuery());
                JsonNode rootNode = mapper.readTree(jp);
                JsonNode timestampNode = rootNode.findValue("range").findValue("timestamp");
                String from = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("from").asText());
                String to = Tools.elasticSearchTimeFormatToISO8601(timestampNode.findValue("to").asText());
                boundaries = new AbsoluteRange(from, to);
            } catch (Exception ignored) {}
        }

        return boundaries;
View Full Code Here

{
    public void testNonMatching() throws Exception
    {
        JsonNode root = _buildTree();

        assertNull(root.findValue("boogaboo"));
        assertNull(root.findParent("boogaboo"));
        JsonNode n = root.findPath("boogaboo");
        assertNotNull(n);
        assertTrue(n.isMissingNode());
View Full Code Here

        encoder.doEncode(event);
        closeQuietly(outputStream);
       
        JsonNode node = MAPPER.readTree(outputStream.toByteArray());
       
        assertJsonArray(node.findValue("tags"), "hoosh");
    }
   
    @Test
    public void markerReferencesAreIncludedAsTags() throws Exception {
        Marker marker = MarkerFactory.getMarker("bees");
View Full Code Here

        encoder.doEncode(event);
        closeQuietly(outputStream);
       
        JsonNode node = MAPPER.readTree(outputStream.toByteArray());
       
        assertJsonArray(node.findValue("tags"), "bees", "knees");
    }
   
    @Test
    public void nullMarkerIsIgnored() throws Exception {
        ILoggingEvent event = mockBasicILoggingEvent(Level.INFO);
View Full Code Here

        encoder.doEncode(event);
        closeQuietly(outputStream);
       
        JsonNode node = MAPPER.readTree(outputStream.toByteArray());
       
        assertThat(node.findValue("tags"), nullValue());
    }
   
    /**
     * Tests the old way of appending a json_message to the event.
     *
 
View Full Code Here

        ObjectMapper mapper = new ObjectMapper();
        JsonNode jsonResp = mapper.readTree(responseText.toString());
        if (jsonResp.findValuesAsText("errors").isEmpty()) {
            return jsonResp.findValuesAsText("translation").get(0);
        } else {
            throw new TikaException(jsonResp.findValue("errors").get(0).asText());
        }
    }

    @Override
    public String translate(String text, String targetLanguage)
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.