Examples of writeValueAsBytes()


Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

                .build();

        String routingKey = "topic";
        String index = "topic20141012";
        for (int i = 0; i < 100; ++i) {
            sink.writeTo(new DefaultMessageContainer(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();

        node.client().admin().indices().prepareRefresh(index).execute().actionGet();
        CountResponse response = node.client().prepareCount(index).execute().actionGet();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

        String routingKey = "topicrecover";
        String index = "topicrecover";
        List<Message> msgList = new ArrayList<Message>();
        int msgCount = 100;
        for (int i = 0; i < msgCount; ++i) {
            msgList.add(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)));
        }

        BulkRequest request = sink.createBulkRequest(msgList);
        for (int i = 0; i < msgCount; ++i) {
            sink.recover(i, request);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

    try {
      ObjectMapper objectMapper = new ObjectMapper();
      objectMapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false);
      objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
      objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
      return objectMapper.writeValueAsBytes(this);
    } catch (Exception e) {
      throw new ActivitiException("Could not convert report data to json", e);
    }
  }
 
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

                    res_status = STATUS_ACCEPTED;
                }

                rootNode.put("identifier", id);
                rootNode.put("status", res_status);
                bytes = mapper.writeValueAsBytes(rootNode);
            }
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
            status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
        }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

  public static byte[] toJsonBytes(Object object) throws IOException
  {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    return mapper.writeValueAsBytes(object);
  }

  private IntegrationTestHelper()
  {
    // prevent initialization
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

    private static final String CHARACTER = "a";

    public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        return mapper.writeValueAsBytes(object);
    }

    public static String createStringWithLength(int length) {
        StringBuilder builder = new StringBuilder();
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes()

    }


    private ProjectRequirements writeRequirementsJson(ProjectRequirements requirements, Profile profile, ProfileBuilder builder) throws IOException {
        ObjectMapper mapper = DtoHelper.getMapper();
        byte[] json = mapper.writeValueAsBytes(requirements);
        String fileName = DtoHelper.getRequirementsConfigFileName(requirements);

        // lets read the previous requirements if there are any
        ProfileRegistry profileRegistry = fabricService.get().adapt(ProfileRegistry.class);
        byte[] oldData = profile.getFileConfiguration(fileName);
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsBytes()

                ExternalMetrics metrics = _gatherMetrics(now, full);
                ObjectWriter w = _jsonWriter;
                if (_indent.get()) {
                  w = w.withDefaultPrettyPrinter();
                }
                final byte[] raw = w.writeValueAsBytes(metrics);
                ser = new SerializedMetrics(now, raw);
                _cachedMetrics.set(ser);
            }
            response = (ServletServiceResponse) response.ok()
                    .setContentTypeJson();
View Full Code Here

Examples of com.netflix.suro.jackson.DefaultObjectMapper.writeValueAsBytes()

                .put("f3", "v3")
                .put("ts", dt.getMillis())
                .build();

        for (int i = 0; i < 100; ++i) {
            sink.writeTo(new DefaultMessageContainer(new Message(index, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();
        return sink;
    }
View Full Code Here

Examples of com.netflix.suro.jackson.DefaultObjectMapper.writeValueAsBytes()

                .build();

        String routingKey = "topic";
        String index = "topic20141012";
        for (int i = 0; i < 100; ++i) {
            sink.writeTo(new DefaultMessageContainer(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)), jsonMapper));
        }
        sink.close();

        node.client().admin().indices().prepareRefresh(index).execute().actionGet();
        CountResponse response = node.client().prepareCount(index).execute().actionGet();
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.