-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Remove SslBundles from KafkaProperties as it is no longer used #45727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,16 +27,13 @@ | |
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.IsolationLevel; | ||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Listener; | ||
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException; | ||
import org.springframework.boot.ssl.DefaultSslBundleRegistry; | ||
import org.springframework.boot.ssl.SslBundle; | ||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.kafka.core.CleanupConfig; | ||
import org.springframework.kafka.core.KafkaAdmin; | ||
import org.springframework.kafka.listener.ContainerProperties; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
import static org.mockito.Mockito.mock; | ||
|
||
/** | ||
* Tests for {@link KafkaProperties}. | ||
|
@@ -47,8 +44,6 @@ | |
*/ | ||
class KafkaPropertiesTests { | ||
|
||
private final SslBundle sslBundle = mock(SslBundle.class); | ||
|
||
@Test | ||
void isolationLevelEnumConsistentWithKafkaVersion() { | ||
org.apache.kafka.common.IsolationLevel[] original = org.apache.kafka.common.IsolationLevel.values(); | ||
|
@@ -101,15 +96,6 @@ void sslPemConfigurationWithEmptyBundle() { | |
"-----BEGINchain"); | ||
} | ||
|
||
@Test | ||
void sslBundleConfiguration() { | ||
KafkaProperties properties = new KafkaProperties(); | ||
properties.getSsl().setBundle("myBundle"); | ||
Map<String, Object> consumerProperties = properties | ||
.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle)); | ||
assertThat(consumerProperties).doesNotContainKey(SslConfigs.SSL_ENGINE_FACTORY_CLASS_CONFIG); | ||
} | ||
|
||
@Test | ||
void sslPropertiesWhenKeyStoreLocationAndKeySetShouldThrowException() { | ||
KafkaProperties properties = new KafkaProperties(); | ||
|
@@ -133,35 +119,35 @@ void sslPropertiesWhenKeyStoreLocationAndBundleSetShouldThrowException() { | |
KafkaProperties properties = new KafkaProperties(); | ||
properties.getSsl().setBundle("myBundle"); | ||
properties.getSsl().setKeyStoreLocation(new ClassPathResource("ksLoc")); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( | ||
() -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) | ||
.isThrownBy(properties::buildConsumerProperties); | ||
} | ||
|
||
@Test | ||
void sslPropertiesWhenKeyStoreKeyAndBundleSetShouldThrowException() { | ||
KafkaProperties properties = new KafkaProperties(); | ||
properties.getSsl().setBundle("myBundle"); | ||
properties.getSsl().setKeyStoreKey("-----BEGIN"); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( | ||
() -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) | ||
.isThrownBy(properties::buildConsumerProperties); | ||
} | ||
|
||
@Test | ||
void sslPropertiesWhenTrustStoreLocationAndBundleSetShouldThrowException() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should be kept but should call |
||
KafkaProperties properties = new KafkaProperties(); | ||
properties.getSsl().setBundle("myBundle"); | ||
properties.getSsl().setTrustStoreLocation(new ClassPathResource("tsLoc")); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( | ||
() -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) | ||
.isThrownBy(properties::buildConsumerProperties); | ||
} | ||
|
||
@Test | ||
void sslPropertiesWhenTrustStoreCertificatesAndBundleSetShouldThrowException() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should be kept but should call |
||
KafkaProperties properties = new KafkaProperties(); | ||
properties.getSsl().setBundle("myBundle"); | ||
properties.getSsl().setTrustStoreCertificates("-----BEGIN"); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class).isThrownBy( | ||
() -> properties.buildConsumerProperties(new DefaultSslBundleRegistry("myBundle", this.sslBundle))); | ||
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class) | ||
.isThrownBy(properties::buildConsumerProperties); | ||
} | ||
|
||
@Test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should be kept but should call
.isThrownBy(properties::buildConsumerProperties);
.