You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/10/03 15:31:48 UTC

[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #10463: adjustments to Kafka integration tests to allow running against Azure Event Hubs streams

abhishekagarwal87 commented on a change in pull request #10463:
URL: https://github.com/apache/druid/pull/10463#discussion_r499157477



##########
File path: integration-tests/src/main/java/org/apache/druid/testing/DockerConfigProvider.java
##########
@@ -260,4 +269,32 @@ public String getStreamEndpoint()
       }
     };
   }
+
+  // there is probably a better way to do this...
+  static class ArbitraryPropertiesJsonDeserializer extends JsonDeserializer<Map<String, String>>
+  {
+    @Override
+    public Map<String, String> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
+        throws IOException
+    {
+      // reading like this results in a map that has both nested objects and also flattened string pairs
+      // so the map looks something like this:
+
+      //    {
+      //      "a" : { "b": { "c" : "d" }}},
+      //      "a.b.c":"d"
+      //    }
+
+      // filtering out the top level keys which do not have string values produces what we want here that
+      // '-Ddruid.test.config.properites.some.property.key=foo' -> { "some.property.key":"foo"}
+      Map<String, Object> parsed = jsonParser.readValueAs(Map.class);
+      Map<String, String> flat = new HashMap<>();
+      for (Map.Entry<String, Object> entry : parsed.entrySet()) {
+        if (entry.getValue() instanceof String) {
+          flat.put(entry.getKey(), (String) entry.getValue());
+        }
+      }

Review comment:
       If its not been discussed before, its the `org.apache.druid.guice.JsonConfigurator#hieraricalPutValue` behind such kind of duplicate values. Its possible that passing properties such as below may work 
   `druid.test.config.properties={"kafka.test.property.security.protocol": "SASL_SSL", "kafka.test.property.sasl.mechanism":"PLAIN"}`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org