Package org.codehaus.jackson.map

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


    private void f_jackson() throws Exception {
        long startNano = System.nanoTime();
        for (int i = 0; i < COUNT; ++i) {
            ObjectMapper mapper = new ObjectMapper();
            ArrayNode node = (ArrayNode) mapper.readTree(text);
            JsonNode head = node.get(0);
            JsonNode body = node.get(1);
        }
        long nano = System.nanoTime() - startNano;
        System.out.println(NumberFormat.getInstance().format(nano));
View Full Code Here


        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send(endpointUri, JSON_REQUEST, null, TIMEOUT);
        assertThat(response, IsNull.<Object>notNullValue());
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, Is.is(expectedJsonNode));
    }

    public static final String MESSAGE = "some message";
View Full Code Here

        MuleMessage response = client.send(endpointUri, JSON_REQUEST, null, TIMEOUT);
        assertThat(response, IsNull.<Object>notNullValue());
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, Is.is(expectedJsonNode));
    }

    public static final String MESSAGE = "some message";
    public static final String MESSAGE_EXPECTED = "some message consumed successfully";
View Full Code Here

        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://in", JSON_REQUEST, null, 5000);
        assertThat(response, IsNull.<Object>notNullValue());
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    @Test
View Full Code Here

        MuleMessage response = client.send("vm://in", JSON_REQUEST, null, 5000);
        assertThat(response, IsNull.<Object>notNullValue());
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    @Test
    public void testFlowUsingConfiguredExceptionStrategy() throws Exception
View Full Code Here

    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://inExceptionBlock", JSON_REQUEST, null, TIMEOUT);
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    @Test
View Full Code Here

        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://inExceptionBlock", JSON_REQUEST, null, TIMEOUT);
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    @Test
    public void testFlowRefHandlingExceptionWithTransaction() throws Exception
View Full Code Here

    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://inTxWithException", JSON_REQUEST, null, TIMEOUT);
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    public static class VerifyTransactionNotResolvedProcessor implements MessageProcessor
View Full Code Here

        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://inTxWithException", JSON_REQUEST, null, TIMEOUT);
        // compare the structure and values but not the attributes' order
        ObjectMapper mapper = new ObjectMapper();
        JsonNode actualJsonNode = mapper.readTree(response.getPayloadAsString());
        JsonNode expectedJsonNode = mapper.readTree(JSON_RESPONSE);
        assertThat(actualJsonNode, is(expectedJsonNode));
    }

    public static class VerifyTransactionNotResolvedProcessor implements MessageProcessor
    {
View Full Code Here

    private String getCollectionConfigPath(String collectionName) {
        try {
            byte[] data = zk.getData("/collections/" + collectionName, false, null);
            ObjectMapper objectMapper = new ObjectMapper();
            JsonParser jsonParser = objectMapper.getJsonFactory().createJsonParser(data);
            JsonNode collectionNode = objectMapper.readTree(jsonParser);
            return ZkController.CONFIGS_ZKNODE + "/" + collectionNode.get(ZkController.CONFIGNAME_PROP).getValueAsText();
        } catch (Exception e) {
            // TODO Better exception handling here
            throw new RuntimeException(e);
        }
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.