@Test public void convertSingleNonNumericToString() throws Exception { ImmutableMap<String, String> tags = ImmutableMap.of("myTagKey1", "myTagValue1"); ResultSerializer resultSerializer = new DefaultResultSerializer(ImmutableList.<String>of(), false, "rootPrefix", tags, ImmutableList.<String>of()); String message = resultSerializer.serialize(dummyServer(), dummyQuery(), stringResult()); assertThat(message).isNull(); }
@Override public String serialize(Server server, Query query, Result result) throws IOException { log.debug("Query result: [{}]", result); Object value = result.getValue(); if (!isNumeric(value)) { log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result); return null; } return createJsonMessage(server, query, result, result.getValuePath(), value); }
DefaultResultSerializer implements ResultSerializer { @Override public String serialize(Server server, Query query, Result result) throws IOException { log.debug("Query result: [{}]", result); Object value = result.getValue(); if (!isNumeric(value)) { log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result); return null; } return createJsonMessage(server, query, result, result.getValuePath(), value); } }
DefaultResultSerializer implements ResultSerializer { @Override public String serialize(Server server, Query query, Result result) throws IOException { log.debug("Query result: [{}]", result); Object value = result.getValue(); if (!isNumeric(value)) { log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result); return null; } return createJsonMessage(server, query, result, result.getValuePath(), value); } @JsonCreator  DefaultResultSerializer(@JsonProperty("typeNames") List<String> typeNames,
									@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
									@JsonProperty("rootPrefix") String rootPrefix,
									@JsonProperty("tags") Map<String, String> tags,
									@JsonProperty("resultTags") List<String> resultTags
									); }
DefaultResultSerializer implements ResultSerializer { @Override public String serialize(Server server, Query query, Result result) throws IOException { log.debug("Query result: [{}]", result); Object value = result.getValue(); if (!isNumeric(value)) { log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result); return null; } return createJsonMessage(server, query, result, result.getValuePath(), value); } @JsonCreator  DefaultResultSerializer(@JsonProperty("typeNames") List<String> typeNames,
									@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
									@JsonProperty("rootPrefix") String rootPrefix,
									@JsonProperty("tags") Map<String, String> tags,
									@JsonProperty("resultTags") List<String> resultTags
									); @Override String serialize(Server server, Query query, Result result); }
DefaultResultSerializer implements ResultSerializer { @Override public String serialize(Server server, Query query, Result result) throws IOException { log.debug("Query result: [{}]", result); Object value = result.getValue(); if (!isNumeric(value)) { log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result); return null; } return createJsonMessage(server, query, result, result.getValuePath(), value); } @JsonCreator  DefaultResultSerializer(@JsonProperty("typeNames") List<String> typeNames,
									@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
									@JsonProperty("rootPrefix") String rootPrefix,
									@JsonProperty("tags") Map<String, String> tags,
									@JsonProperty("resultTags") List<String> resultTags
									); @Override String serialize(Server server, Query query, Result result);  }