Harmonize ssl properties for Kafka

Closes gh-13239
This commit is contained in:
Stephane Nicoll
2018-05-29 17:51:01 +02:00
parent 56dd53bfba
commit 3f001899b4
3 changed files with 66 additions and 66 deletions

View File

@@ -823,12 +823,12 @@ public class KafkaProperties {
/**
* Location of the key store file.
*/
private Resource keystoreLocation;
private Resource keyStoreLocation;
/**
* Store password for the key store file.
*/
private String keystorePassword;
private String keyStorePassword;
/**
* Type of the key store.
@@ -838,12 +838,12 @@ public class KafkaProperties {
/**
* Location of the trust store file.
*/
private Resource truststoreLocation;
private Resource trustStoreLocation;
/**
* Store password for the trust store file.
*/
private String truststorePassword;
private String trustStorePassword;
/**
* Type of the trust store.
@@ -863,20 +863,20 @@ public class KafkaProperties {
this.keyPassword = keyPassword;
}
public Resource getKeystoreLocation() {
return this.keystoreLocation;
public Resource getKeyStoreLocation() {
return this.keyStoreLocation;
}
public void setKeystoreLocation(Resource keystoreLocation) {
this.keystoreLocation = keystoreLocation;
public void setKeyStoreLocation(Resource keyStoreLocation) {
this.keyStoreLocation = keyStoreLocation;
}
public String getKeystorePassword() {
return this.keystorePassword;
public String getKeyStorePassword() {
return this.keyStorePassword;
}
public void setKeystorePassword(String keystorePassword) {
this.keystorePassword = keystorePassword;
public void setKeyStorePassword(String keyStorePassword) {
this.keyStorePassword = keyStorePassword;
}
public String getKeyStoreType() {
@@ -887,20 +887,20 @@ public class KafkaProperties {
this.keyStoreType = keyStoreType;
}
public Resource getTruststoreLocation() {
return this.truststoreLocation;
public Resource getTrustStoreLocation() {
return this.trustStoreLocation;
}
public void setTruststoreLocation(Resource truststoreLocation) {
this.truststoreLocation = truststoreLocation;
public void setTrustStoreLocation(Resource trustStoreLocation) {
this.trustStoreLocation = trustStoreLocation;
}
public String getTruststorePassword() {
return this.truststorePassword;
public String getTrustStorePassword() {
return this.trustStorePassword;
}
public void setTruststorePassword(String truststorePassword) {
this.truststorePassword = truststorePassword;
public void setTrustStorePassword(String trustStorePassword) {
this.trustStorePassword = trustStorePassword;
}
public String getTrustStoreType() {
@@ -924,15 +924,15 @@ public class KafkaProperties {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this::getKeyPassword)
.to(properties.in(SslConfigs.SSL_KEY_PASSWORD_CONFIG));
map.from(this::getKeystoreLocation).as(this::resourceToPath)
map.from(this::getKeyStoreLocation).as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG));
map.from(this::getKeystorePassword)
map.from(this::getKeyStorePassword)
.to(properties.in(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG));
map.from(this::getKeyStoreType)
.to(properties.in(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG));
map.from(this::getTruststoreLocation).as(this::resourceToPath)
map.from(this::getTrustStoreLocation).as(this::resourceToPath)
.to(properties.in(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
map.from(this::getTruststorePassword)
map.from(this::getTrustStorePassword)
.to(properties.in(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG));
map.from(this::getTrustStoreType)
.to(properties.in(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG));

View File

@@ -75,12 +75,12 @@ public class KafkaAutoConfigurationTests {
"spring.kafka.properties.baz=qux",
"spring.kafka.properties.foo.bar.baz=qux.fiz.buz",
"spring.kafka.ssl.key-password=p1",
"spring.kafka.ssl.keystore-location=classpath:ksLoc",
"spring.kafka.ssl.keystore-password=p2",
"spring.kafka.ssl.keystore-type=PKCS12",
"spring.kafka.ssl.truststore-location=classpath:tsLoc",
"spring.kafka.ssl.truststore-password=p3",
"spring.kafka.ssl.truststore-type=PKCS12",
"spring.kafka.ssl.key-store-location=classpath:ksLoc",
"spring.kafka.ssl.key-store-password=p2",
"spring.kafka.ssl.key-store-type=PKCS12",
"spring.kafka.ssl.trust-store-location=classpath:tsLoc",
"spring.kafka.ssl.trust-store-password=p3",
"spring.kafka.ssl.trust-store-type=PKCS12",
"spring.kafka.ssl.protocol=TLSv1.2",
"spring.kafka.consumer.auto-commit-interval=123",
"spring.kafka.consumer.max-poll-records=42",
@@ -166,12 +166,12 @@ public class KafkaAutoConfigurationTests {
"spring.kafka.producer.retries=2",
"spring.kafka.producer.properties.fiz.buz=fix.fox",
"spring.kafka.producer.ssl.key-password=p4",
"spring.kafka.producer.ssl.keystore-location=classpath:ksLocP",
"spring.kafka.producer.ssl.keystore-password=p5",
"spring.kafka.producer.ssl.keystore-type=PKCS12",
"spring.kafka.producer.ssl.truststore-location=classpath:tsLocP",
"spring.kafka.producer.ssl.truststore-password=p6",
"spring.kafka.producer.ssl.truststore-type=PKCS12",
"spring.kafka.producer.ssl.key-store-location=classpath:ksLocP",
"spring.kafka.producer.ssl.key-store-password=p5",
"spring.kafka.producer.ssl.key-store-type=PKCS12",
"spring.kafka.producer.ssl.trust-store-location=classpath:tsLocP",
"spring.kafka.producer.ssl.trust-store-password=p6",
"spring.kafka.producer.ssl.trust-store-type=PKCS12",
"spring.kafka.producer.ssl.protocol=TLSv1.2",
"spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.IntegerSerializer")
.run((context) -> {
@@ -232,12 +232,12 @@ public class KafkaAutoConfigurationTests {
"spring.kafka.admin.fail-fast=true",
"spring.kafka.admin.properties.fiz.buz=fix.fox",
"spring.kafka.admin.ssl.key-password=p4",
"spring.kafka.admin.ssl.keystore-location=classpath:ksLocP",
"spring.kafka.admin.ssl.keystore-password=p5",
"spring.kafka.admin.ssl.keystore-type=PKCS12",
"spring.kafka.admin.ssl.truststore-location=classpath:tsLocP",
"spring.kafka.admin.ssl.truststore-password=p6",
"spring.kafka.admin.ssl.truststore-type=PKCS12",
"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").run((context) -> {
KafkaAdmin admin = context.getBean(KafkaAdmin.class);
Map<String, Object> configs = admin.getConfig();