chia7712 commented on code in PR #19039:
URL: https://github.com/apache/kafka/pull/19039#discussion_r1972690127


##########
clients/src/test/java/org/apache/kafka/common/config/AbstractConfigTest.java:
##########
@@ -450,6 +451,32 @@ public void testConfigProvidersPropsAsParam() {
         MockFileConfigProvider.assertClosed(id);
     }
 
+    @Test
+    public void testAutomaticConfigProvidersWithFullClassName() {
+        Properties props = new Properties();

Review Comment:
   Could you please do a bit refactor on this test?
   ```java
           // case0: MockFileConfigProvider is disallowed by 
org.apache.kafka.automatic.config.providers
           
System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, "file");
           assertThrows(ConfigException.class, () -> new 
TestIndirectConfigResolution(Map.of("config.providers", "file",
                   "config.providers.file.class", 
MockFileConfigProvider.class.getName()),
                   Collections.emptyMap()));
   
           // case1: MockFileConfigProvider is allowed by 
org.apache.kafka.automatic.config.providers
           
System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, 
MockFileConfigProvider.class.getName());
           var props = Map.of("config.providers", "file",
                   "config.providers.file.class", 
MockFileConfigProvider.class.getName(),
                   "config.providers.file.param.testId", 
UUID.randomUUID().toString(),
                   "test.key", "${file:/path:key}");
           assertEquals("testKey", new TestIndirectConfigResolution(props, 
Collections.emptyMap()).originals().get("test.key"));
   
           // case2: MockFileConfigProvider and EnvVarConfigProvider are 
allowed by org.apache.kafka.automatic.config.providers
           
System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, 
MockFileConfigProvider.class.getName()
                   + ", " + EnvVarConfigProvider.class.getName());
           assertEquals("testKey", new TestIndirectConfigResolution(props,
                   Collections.emptyMap()).originals().get("test.key"));
   ```



-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

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

Reply via email to