merrimanr commented on a change in pull request #1403: METRON-2109: Add option
to use Metron GUID as the id in Elasticsearch
URL: https://github.com/apache/metron/pull/1403#discussion_r285775407
##########
File path:
metron-platform/metron-common/src/test/java/org/apache/metron/common/configuration/IndexingConfigurationsTest.java
##########
@@ -0,0 +1,62 @@
+package org.apache.metron.common.configuration;
+
+import org.adrianwalker.multilinestring.Multiline;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class IndexingConfigurationsTest {
+
+ /**
+ * {
+ * "indexing.writer.metronId" : "true"
+ * }
+ */
+ @Multiline
+ private static String globalConfig;
+
+ /**
+ * {
+ * "writer" : {
+ * "metronId": true
+ * }
+ * }
+ */
+ @Multiline
+ private static String sensorConfig;
+
+ private IndexingConfigurations configurations;
+
+ @Before
+ public void setup() {
+ configurations = new IndexingConfigurations();
+ }
+
+ @Test
+ public void shouldReturnMetronId() throws Exception {
+ // verify false by default
+ assertFalse(configurations.isMetronId("sensor", "writer"));
+
+ {
+ // verify global config setting applies to any sensor
+
configurations.updateGlobalConfig(globalConfig.getBytes(StandardCharsets.UTF_8));
+
+ assertTrue(configurations.isMetronId("sensor", "writer"));
+ assertTrue(configurations.isMetronId("anySensor", "writer"));
+ }
Review comment:
Done.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services