Package org.codehaus.jackson.map

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


 
  private static String getWorkflowString(WorkflowContext sanitizedWC) {
    String sanitizedWCString = null;
    try {
      ObjectMapper om = new ObjectMapper();
      sanitizedWCString = om.writeValueAsString(sanitizedWC);
    } catch (IOException e) {
      e.printStackTrace();
      sanitizedWCString = "";
    }
    return sanitizedWCString;
View Full Code Here


        Operation step2 = new Operation("deploy", address);
        op.addStep(step2);

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(op);

        System.out.println(result);

        assert result.contains("http");
View Full Code Here

        cop.addStep(step3);
        cop.addStep(step4);

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(cop);
        System.out.println(result);
        System.out.flush();

        JsonNode node = mapper.readTree(result);
View Full Code Here

        Operation operation = new WriteAttribute(address, "socket-binding", "jndi");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);
        Operation op = mapper.readValue(result, Operation.class);
        assertNotSame(op, null);
        assertNotSame(op.getOperation(), null, "op.operation was null!");
        assertEquals(op.getOperation(), operation.getOperation(), "Operation is " + op.getOperation());
        assertNotSame(op.getName(), null, "op.getName is null");
View Full Code Here

        Operation operation = new Operation("add", address, props);
        operation.addAdditionalProperty("foo", "bar");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);

        assertFalse(result.contains("name"), "Result contains a name property but should not, " + result);
        assertFalse(result.contains("null"), "Result contains null values but should not, " + result);

        Operation op = mapper.readValue(result, Operation.class);
View Full Code Here

        Operation operation = new Operation("add", address, props);
        operation.addAdditionalProperty("foo", "bar");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);

        assertFalse(result.contains("operation-headers"),
            "Result contains a operation-headers property but should not, " + result);

        operation.allowResourceServiceRestart();
View Full Code Here

        assertFalse(result.contains("operation-headers"),
            "Result contains a operation-headers property but should not, " + result);

        operation.allowResourceServiceRestart();

        result = mapper.writeValueAsString(operation);

        assertTrue(result.contains("operation-headers"),
            "Result does not contain a operation-headers property but should, " + result);
    }
View Full Code Here

        Operation operation = new Operation("add", address);
        operation.addAdditionalProperty("foo", "bar");

        ObjectMapper mapper = new ObjectMapper();

        String result = mapper.writeValueAsString(operation);

        assertTrue(result.contains("\"foo\":\"bar\"".replace(" ", "")),
            "Result does not contain property \"foo\":\"bar\", " + result);
    }
View Full Code Here

    private void logFormatted(JsonNode operationResult) {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
        try {
            LOG.info(objectMapper.writeValueAsString(operationResult));
        } catch (IOException ignore) {
        }
    }

    private JsonNode deserializeResponseBody(Operation operation, StatusLine statusLine, String responseBody) {
View Full Code Here

  public static String jaxbToString(Object jaxbObj) throws JAXBException,
  JsonGenerationException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
    mapper.configure(SerializationConfig.Feature.USE_ANNOTATIONS, true);
    return mapper.writeValueAsString(jaxbObj);
  }
 
  public static ExecutionCommand stringToExecutionCommand(String json)
      throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
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.