|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
package org.springframework.boot.autoconfigure.kafka;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.time.Duration;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -209,14 +210,17 @@ class KafkaAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void adminProperties() {
|
|
|
|
|
this.contextRunner.withPropertyValues("spring.kafka.clientId=cid",
|
|
|
|
|
"spring.kafka.properties.foo.bar.baz=qux.fiz.buz", "spring.kafka.admin.fail-fast=true",
|
|
|
|
|
"spring.kafka.admin.properties.fiz.buz=fix.fox", "spring.kafka.admin.security.protocol=SSL",
|
|
|
|
|
"spring.kafka.admin.ssl.key-password=p4", "spring.kafka.admin.ssl.key-store-location=classpath:ksLocP",
|
|
|
|
|
"spring.kafka.admin.ssl.key-store-password=p5", "spring.kafka.admin.ssl.key-store-type=PKCS12",
|
|
|
|
|
"spring.kafka.admin.ssl.trust-store-location=classpath:tsLocP",
|
|
|
|
|
"spring.kafka.admin.ssl.trust-store-password=p6", "spring.kafka.admin.ssl.trust-store-type=PKCS12",
|
|
|
|
|
"spring.kafka.admin.ssl.protocol=TLSv1.2", "spring.kafka.admin.modify-topic-configs=true")
|
|
|
|
|
this.contextRunner
|
|
|
|
|
.withPropertyValues("spring.kafka.clientId=cid", "spring.kafka.properties.foo.bar.baz=qux.fiz.buz",
|
|
|
|
|
"spring.kafka.admin.fail-fast=true", "spring.kafka.admin.properties.fiz.buz=fix.fox",
|
|
|
|
|
"spring.kafka.admin.security.protocol=SSL", "spring.kafka.admin.ssl.key-password=p4",
|
|
|
|
|
"spring.kafka.admin.ssl.key-store-location=classpath:ksLocP",
|
|
|
|
|
"spring.kafka.admin.ssl.key-store-password=p5", "spring.kafka.admin.ssl.key-store-type=PKCS12",
|
|
|
|
|
"spring.kafka.admin.ssl.trust-store-location=classpath:tsLocP",
|
|
|
|
|
"spring.kafka.admin.ssl.trust-store-password=p6",
|
|
|
|
|
"spring.kafka.admin.ssl.trust-store-type=PKCS12", "spring.kafka.admin.ssl.protocol=TLSv1.2",
|
|
|
|
|
"spring.kafka.admin.close-timeout=35s", "spring.kafka.admin.operation-timeout=60s",
|
|
|
|
|
"spring.kafka.admin.modify-topic-configs=true", "spring.kafka.admin.auto-create=false")
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
KafkaAdmin admin = context.getBean(KafkaAdmin.class);
|
|
|
|
|
Map<String, Object> configs = admin.getConfigurationProperties();
|
|
|
|
@ -237,8 +241,11 @@ class KafkaAutoConfigurationTests {
|
|
|
|
|
assertThat(context.getBeansOfType(KafkaJaasLoginModuleInitializer.class)).isEmpty();
|
|
|
|
|
assertThat(configs).containsEntry("foo.bar.baz", "qux.fiz.buz");
|
|
|
|
|
assertThat(configs).containsEntry("fiz.buz", "fix.fox");
|
|
|
|
|
assertThat(admin).hasFieldOrPropertyWithValue("closeTimeout", Duration.ofSeconds(35));
|
|
|
|
|
assertThat(admin).hasFieldOrPropertyWithValue("operationTimeout", 60);
|
|
|
|
|
assertThat(admin).hasFieldOrPropertyWithValue("fatalIfBrokerNotAvailable", true);
|
|
|
|
|
assertThat(admin).hasFieldOrPropertyWithValue("modifyTopicConfigs", true);
|
|
|
|
|
assertThat(admin).hasFieldOrPropertyWithValue("autoCreate", false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|