@Test public void testHeadersFromAttributes() throws Exception { Map<String, String> attributes = ImmutableMap.of("dnt", "1", "sample_id", "18", "x_source_tags", "automation, perf", "x_debug_id", "mysession"); ObjectNode headers = NestedMetadata.headersFromAttributes(attributes); ObjectNode expected = mapToObjectNode(ImmutableMap.of("dnt", "1", "x_debug_id", "mysession", "x_source_tags", "automation, perf")); assertEquals(expected, headers); }
static ObjectNode headersFromAttributes(Map<String, String> attributes) { ObjectNode header = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> HEADER_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> header.put(entry.getKey(), entry.getValue())); return header; }
NestedMetadata { static ObjectNode headersFromAttributes(Map<String, String> attributes) { ObjectNode header = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> HEADER_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> header.put(entry.getKey(), entry.getValue())); return header; } }
NestedMetadata { static ObjectNode headersFromAttributes(Map<String, String> attributes) { ObjectNode header = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> HEADER_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> header.put(entry.getKey(), entry.getValue())); return header; } private  NestedMetadata(); }
NestedMetadata { static ObjectNode headersFromAttributes(Map<String, String> attributes) { ObjectNode header = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> HEADER_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> header.put(entry.getKey(), entry.getValue())); return header; } private  NestedMetadata(); static byte[] mergedPayload(byte[] payload, byte[] metadata); static ObjectNode attributesToMetadataPayload(Map<String, String> attributes); static void stripPayloadMetadataToAttributes(Map<String, String> attributes,
      ObjectNode payload); }
NestedMetadata { static ObjectNode headersFromAttributes(Map<String, String> attributes) { ObjectNode header = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> HEADER_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> header.put(entry.getKey(), entry.getValue())); return header; } private  NestedMetadata(); static byte[] mergedPayload(byte[] payload, byte[] metadata); static ObjectNode attributesToMetadataPayload(Map<String, String> attributes); static void stripPayloadMetadataToAttributes(Map<String, String> attributes,
      ObjectNode payload);  }