@Test public void testUriFromAttributes() throws Exception { Map<String, String> attributes = ImmutableMap .of("uri", "/submit/eng-workflow/hgpush/1/2c3a0767-d84a-4d02-8a92-fa54a3376049", "app_name", "Firefox", "sample_id", "18", "app_update_channel", "release"); ObjectNode uri = NestedMetadata.uriFromAttributes(attributes); ObjectNode expected = mapToObjectNode(ImmutableMap .of("uri", "/submit/eng-workflow/hgpush/1/2c3a0767-d84a-4d02-8a92-fa54a3376049", "app_name", "Firefox", "app_update_channel", "release")); assertEquals(expected, uri); }
static ObjectNode uriFromAttributes(Map<String, String> attributes) { ObjectNode uri = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> URI_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> uri.put(entry.getKey(), entry.getValue())); return uri; }
NestedMetadata { static ObjectNode uriFromAttributes(Map<String, String> attributes) { ObjectNode uri = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> URI_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> uri.put(entry.getKey(), entry.getValue())); return uri; } }
NestedMetadata { static ObjectNode uriFromAttributes(Map<String, String> attributes) { ObjectNode uri = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> URI_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> uri.put(entry.getKey(), entry.getValue())); return uri; } private  NestedMetadata(); }
NestedMetadata { static ObjectNode uriFromAttributes(Map<String, String> attributes) { ObjectNode uri = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> URI_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> uri.put(entry.getKey(), entry.getValue())); return uri; } 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 uriFromAttributes(Map<String, String> attributes) { ObjectNode uri = Json.createObjectNode(); attributes.entrySet().stream().filter(entry -> URI_ATTRIBUTES.contains(entry.getKey())) .forEach(entry -> uri.put(entry.getKey(), entry.getValue())); return uri; } 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);  }