chia7712 commented on a change in pull request #8826:
URL: https://github.com/apache/kafka/pull/8826#discussion_r527352682
##########
File path:
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java
##########
@@ -2588,6 +2589,21 @@ public void deserializerShouldSeeGeneratedClientId() {
consumer.close();
}
+ @Test
+ public void testUnusedConfigs() {
+ Map<String, Object> props = new HashMap<>();
+ props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+ props.put(SslConfigs.SSL_PROTOCOL_CONFIG, "TLS");
+ ConsumerConfig config = new
ConsumerConfig(ConsumerConfig.appendDeserializerToConfig(props, new
StringDeserializer(), new StringDeserializer()));
+
+ assertTrue(new ConsumerConfig(config.originals(),
false).unused().contains(SslConfigs.SSL_PROTOCOL_CONFIG));
+ assertTrue(config.unused().contains(SslConfigs.SSL_PROTOCOL_CONFIG));
+
+ try (KafkaConsumer<byte[], byte[]> consumer = new
KafkaConsumer<>(config, null, null)) {
Review comment:
It tests the specify config is recorded when constructing
```KafkaConsumer```
##########
File path:
clients/src/test/java/org/apache/kafka/clients/producer/KafkaProducerTest.java
##########
@@ -1290,6 +1308,23 @@ public void serializerShouldSeeGeneratedClientId() {
producer.close();
}
+ @Test
+ public void testUnusedConfigs() {
+ Map<String, Object> props = new HashMap<>();
+ props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9999");
+ props.put(SslConfigs.SSL_PROTOCOL_CONFIG, "TLS");
+ ProducerConfig config = new
ProducerConfig(ProducerConfig.appendSerializerToConfig(props,
+ new StringSerializer(), new StringSerializer()));
+
+ assertTrue(new ProducerConfig(config.originals(),
false).unused().contains(SslConfigs.SSL_PROTOCOL_CONFIG));
+ assertTrue(config.unused().contains(SslConfigs.SSL_PROTOCOL_CONFIG));
+
+ try (KafkaProducer<byte[], byte[]> producer = new
KafkaProducer<>(config, null, null,
Review comment:
It tests the specify config is recorded when constructing
```KafkaProducer```
----------------------------------------------------------------
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]