Skip to content

Commit

Permalink
Merge branch '3.3.x'
Browse files Browse the repository at this point in the history
Closes gh-43448
  • Loading branch information
philwebb committed Dec 9, 2024
2 parents 51c9925 + 3338c22 commit 565ec07
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ private Map<String, Object> buildCommonProperties(SslBundles sslBundles) {
return properties;
}

/**
* Create an initial map of consumer properties from the state of this instance.
* <p>
* This allows you to add additional properties, if necessary, and override the
* default {@code kafkaConsumerFactory} bean.
* @return the consumer properties initialized with the customizations defined on this
* instance
*/
public Map<String, Object> buildConsumerProperties() {
return buildConsumerProperties(null);
}

/**
* Create an initial map of consumer properties from the state of this instance.
* <p>
Expand All @@ -192,6 +204,18 @@ public Map<String, Object> buildConsumerProperties(SslBundles sslBundles) {
return properties;
}

/**
* Create an initial map of producer properties from the state of this instance.
* <p>
* This allows you to add additional properties, if necessary, and override the
* default {@code kafkaProducerFactory} bean.
* @return the producer properties initialized with the customizations defined on this
* instance
*/
public Map<String, Object> buildProducerProperties() {
return buildProducerProperties(null);
}

/**
* Create an initial map of producer properties from the state of this instance.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* @author Madhura Bhave
* @since 2.1.0
*/

public class ClientsConfiguredCondition extends SpringBootCondition {

private static final Bindable<Map<String, OAuth2ClientProperties.Registration>> STRING_REGISTRATION_MAP = Bindable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void sslPemConfiguration() {
properties.getSsl().setKeyStoreKey("-----BEGINkey");
properties.getSsl().setTrustStoreCertificates("-----BEGINtrust");
properties.getSsl().setKeyStoreCertificateChain("-----BEGINchain");
Map<String, Object> consumerProperties = properties.buildConsumerProperties(null);
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,
Expand All @@ -103,7 +103,7 @@ void sslPropertiesWhenKeyStoreLocationAndKeySetShouldThrowException() {
properties.getSsl().setKeyStoreKey("-----BEGIN");
properties.getSsl().setKeyStoreLocation(new ClassPathResource("ksLoc"));
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class)
.isThrownBy(() -> properties.buildConsumerProperties(null));
.isThrownBy(() -> properties.buildConsumerProperties());
}

@Test
Expand All @@ -112,7 +112,7 @@ void sslPropertiesWhenTrustStoreLocationAndCertificatesSetShouldThrowException()
properties.getSsl().setTrustStoreLocation(new ClassPathResource("tsLoc"));
properties.getSsl().setTrustStoreCertificates("-----BEGIN");
assertThatExceptionOfType(MutuallyExclusiveConfigurationPropertiesException.class)
.isThrownBy(() -> properties.buildConsumerProperties(null));
.isThrownBy(() -> properties.buildConsumerProperties());
}

@Test
Expand Down

0 comments on commit 565ec07

Please sign in to comment.