frankvicky commented on code in PR #19039: URL: https://github.com/apache/kafka/pull/19039#discussion_r1971633273
########## clients/src/test/java/org/apache/kafka/common/config/AbstractConfigTest.java: ########## @@ -450,6 +450,33 @@ public void testConfigProvidersPropsAsParam() { MockFileConfigProvider.assertClosed(id); } + @Test + public void testAutomaticConfigProvidersWithFullClassName() { + Properties props = new Properties(); + props.put("config.providers", "file"); + props.put("config.providers.file.class", MockFileConfigProvider.class.getName()); + String id = UUID.randomUUID().toString(); + props.put("config.providers.file.param.testId", id); + props.put("test.key", "${file:/path:key}"); + + System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, "file"); + assertThrows(ConfigException.class, () -> new TestIndirectConfigResolution(props, Collections.emptyMap())); + + System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, MockFileConfigProvider.class.getName()); + TestIndirectConfigResolution config = new TestIndirectConfigResolution(props, Collections.emptyMap()); + assertEquals("testKey", config.originals().get("test.key")); + MockFileConfigProvider.assertClosed(id); + + System.setProperty(AbstractConfig.AUTOMATIC_CONFIG_PROVIDERS_PROPERTY, + MockFileConfigProvider.class.getName() + "," + + "org.apache.kafka.common.config.provider.EnvVarConfigProvider"); Review Comment: `EnvVarConfigProvider.class.getName()` ########## clients/src/test/java/org/apache/kafka/common/config/AbstractConfigTest.java: ########## @@ -450,6 +450,33 @@ public void testConfigProvidersPropsAsParam() { MockFileConfigProvider.assertClosed(id); } + @Test + public void testAutomaticConfigProvidersWithFullClassName() { + Properties props = new Properties(); + props.put("config.providers", "file"); + props.put("config.providers.file.class", MockFileConfigProvider.class.getName()); + String id = UUID.randomUUID().toString(); Review Comment: We could use the UUID class defined by Kafka. ########## clients/src/test/java/org/apache/kafka/common/config/AbstractConfigTest.java: ########## @@ -450,6 +450,33 @@ public void testConfigProvidersPropsAsParam() { MockFileConfigProvider.assertClosed(id); } + @Test + public void testAutomaticConfigProvidersWithFullClassName() { + Properties props = new Properties(); + props.put("config.providers", "file"); Review Comment: We could use `AbstractConfig.CONFIG_PROVIDERS_CONFIG` instead of plaintext. -- 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