2727import org .springframework .boot .autoconfigure .kafka .KafkaProperties .IsolationLevel ;
2828import org .springframework .boot .autoconfigure .kafka .KafkaProperties .Listener ;
2929import org .springframework .boot .context .properties .source .MutuallyExclusiveConfigurationPropertiesException ;
30- import org .springframework .boot .ssl .DefaultSslBundleRegistry ;
31- import org .springframework .boot .ssl .SslBundle ;
3230import org .springframework .core .io .ClassPathResource ;
3331import org .springframework .kafka .core .CleanupConfig ;
3432import org .springframework .kafka .core .KafkaAdmin ;
3533import org .springframework .kafka .listener .ContainerProperties ;
3634
3735import static org .assertj .core .api .Assertions .assertThat ;
3836import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
39- import static org .mockito .Mockito .mock ;
4037
4138/**
4239 * Tests for {@link KafkaProperties}.
4744 */
4845class KafkaPropertiesTests {
4946
50- private final SslBundle sslBundle = mock (SslBundle .class );
51-
5247 @ Test
5348 void isolationLevelEnumConsistentWithKafkaVersion () {
5449 org .apache .kafka .common .IsolationLevel [] original = org .apache .kafka .common .IsolationLevel .values ();
@@ -101,15 +96,6 @@ void sslPemConfigurationWithEmptyBundle() {
10196 "-----BEGINchain" );
10297 }
10398
104- @ Test
105- void sslBundleConfiguration () {
106- KafkaProperties properties = new KafkaProperties ();
107- properties .getSsl ().setBundle ("myBundle" );
108- Map <String , Object > consumerProperties = properties
109- .buildConsumerProperties (new DefaultSslBundleRegistry ("myBundle" , this .sslBundle ));
110- assertThat (consumerProperties ).doesNotContainKey (SslConfigs .SSL_ENGINE_FACTORY_CLASS_CONFIG );
111- }
112-
11399 @ Test
114100 void sslPropertiesWhenKeyStoreLocationAndKeySetShouldThrowException () {
115101 KafkaProperties properties = new KafkaProperties ();
@@ -128,42 +114,6 @@ void sslPropertiesWhenTrustStoreLocationAndCertificatesSetShouldThrowException()
128114 .isThrownBy (properties ::buildConsumerProperties );
129115 }
130116
131- @ Test
132- void sslPropertiesWhenKeyStoreLocationAndBundleSetShouldThrowException () {
133- KafkaProperties properties = new KafkaProperties ();
134- properties .getSsl ().setBundle ("myBundle" );
135- properties .getSsl ().setKeyStoreLocation (new ClassPathResource ("ksLoc" ));
136- assertThatExceptionOfType (MutuallyExclusiveConfigurationPropertiesException .class ).isThrownBy (
137- () -> properties .buildConsumerProperties (new DefaultSslBundleRegistry ("myBundle" , this .sslBundle )));
138- }
139-
140- @ Test
141- void sslPropertiesWhenKeyStoreKeyAndBundleSetShouldThrowException () {
142- KafkaProperties properties = new KafkaProperties ();
143- properties .getSsl ().setBundle ("myBundle" );
144- properties .getSsl ().setKeyStoreKey ("-----BEGIN" );
145- assertThatExceptionOfType (MutuallyExclusiveConfigurationPropertiesException .class ).isThrownBy (
146- () -> properties .buildConsumerProperties (new DefaultSslBundleRegistry ("myBundle" , this .sslBundle )));
147- }
148-
149- @ Test
150- void sslPropertiesWhenTrustStoreLocationAndBundleSetShouldThrowException () {
151- KafkaProperties properties = new KafkaProperties ();
152- properties .getSsl ().setBundle ("myBundle" );
153- properties .getSsl ().setTrustStoreLocation (new ClassPathResource ("tsLoc" ));
154- assertThatExceptionOfType (MutuallyExclusiveConfigurationPropertiesException .class ).isThrownBy (
155- () -> properties .buildConsumerProperties (new DefaultSslBundleRegistry ("myBundle" , this .sslBundle )));
156- }
157-
158- @ Test
159- void sslPropertiesWhenTrustStoreCertificatesAndBundleSetShouldThrowException () {
160- KafkaProperties properties = new KafkaProperties ();
161- properties .getSsl ().setBundle ("myBundle" );
162- properties .getSsl ().setTrustStoreCertificates ("-----BEGIN" );
163- assertThatExceptionOfType (MutuallyExclusiveConfigurationPropertiesException .class ).isThrownBy (
164- () -> properties .buildConsumerProperties (new DefaultSslBundleRegistry ("myBundle" , this .sslBundle )));
165- }
166-
167117 @ Test
168118 void cleanupConfigDefaultValuesAreConsistent () {
169119 CleanupConfig cleanupConfig = new CleanupConfig ();
0 commit comments