Allow KafkaProperties to build properties with empty bundle name

Update `KafkaProperties` so that properties can still be built when
the bundle name has no text.

Fixes gh-43561
This commit is contained in:
Phillip Webb
2024-12-18 10:30:59 -08:00
parent a5c2f0fc74
commit ba916cb66e
4 changed files with 77 additions and 42 deletions

View File

@@ -87,6 +87,20 @@ class KafkaPropertiesTests {
"-----BEGINchain");
}
@Test
void sslPemConfigurationWithEmptyBundle() {
KafkaProperties properties = new KafkaProperties();
properties.getSsl().setKeyStoreKey("-----BEGINkey");
properties.getSsl().setTrustStoreCertificates("-----BEGINtrust");
properties.getSsl().setKeyStoreCertificateChain("-----BEGINchain");
properties.getSsl().setBundle("");
Map<String, Object> consumerProperties = properties.buildConsumerProperties();
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_KEY_CONFIG, "-----BEGINkey");
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_TRUSTSTORE_CERTIFICATES_CONFIG, "-----BEGINtrust");
assertThat(consumerProperties).containsEntry(SslConfigs.SSL_KEYSTORE_CERTIFICATE_CHAIN_CONFIG,
"-----BEGINchain");
}
@Test
void sslBundleConfiguration() {
KafkaProperties properties = new KafkaProperties();