kpatelatwork commented on a change in pull request #10841:
URL: https://github.com/apache/kafka/pull/10841#discussion_r651266585



##########
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/WorkerConfigTest.java
##########
@@ -56,6 +57,39 @@
             "set X-Frame-Options:DENY, add  :no-cache, no-store, 
must-revalidate "
     );
 
+    @Test
+    public void testListenersConfigAllowedValues() {
+        Map<String, String> props = baseProps();
+
+        // no value set for "listeners"
+        WorkerConfig config = new WorkerConfig(WorkerConfig.baseConfigDef(), 
props);
+        assertEquals(LISTENERS_DEFAULT, 
config.getList(WorkerConfig.LISTENERS_CONFIG));
+
+        props.put(WorkerConfig.LISTENERS_CONFIG, "http://a.b:9999";);
+        config = new WorkerConfig(WorkerConfig.baseConfigDef(), props);
+        assertEquals(config.getList(WorkerConfig.LISTENERS_CONFIG), 
Arrays.asList("http://a.b:9999";));
+
+        props.put(WorkerConfig.LISTENERS_CONFIG, "http://a.b:9999, 
https://a.b:7812";);
+        config = new WorkerConfig(WorkerConfig.baseConfigDef(), props);
+        assertEquals(config.getList(WorkerConfig.LISTENERS_CONFIG), 
Arrays.asList("http://a.b:9999";, "https://a.b:7812";));
+
+        new WorkerConfig(WorkerConfig.baseConfigDef(), props);
+    }
+
+    @Test
+    public void testListenersConfigNotAllowedValues() {
+        Map<String, String> props = baseProps();
+
+        props.put(WorkerConfig.LISTENERS_CONFIG, "");
+        assertThrows(ConfigException.class, () -> new 
WorkerConfig(WorkerConfig.baseConfigDef(), props)).printStackTrace();
+
+        props.put(WorkerConfig.LISTENERS_CONFIG, "http://a.b:9999,";);
+        assertThrows(ConfigException.class, () -> new 
WorkerConfig(WorkerConfig.baseConfigDef(), props));

Review comment:
       Fixed, I added "listeners" and "admin.listeners" to each message, Could 
you please check to see if it looks good now?




-- 
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:
us...@infra.apache.org


Reply via email to