Polishing.
Closes gh-333. Original pull request: gh-334.
This commit is contained in:
@@ -39,9 +39,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class, properties = {
|
||||
"VaultConfigAwsBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.aws.role=foo" })
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class,
|
||||
properties = { "VaultConfigAwsBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.aws.role=foo" })
|
||||
public class VaultConfigAwsBootstrapConfigurationTests extends IntegrationTestSupport {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -50,9 +50,10 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigAwsTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.aws.enabled=true", "spring.cloud.vault.aws.role=readonly",
|
||||
"cloud.aws.region.auto=false", "cloud.aws.region.static=eu-west-1" })
|
||||
@SpringBootTest(classes = VaultConfigAwsTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.aws.enabled=true",
|
||||
"spring.cloud.vault.aws.role=readonly", "cloud.aws.region.auto=false",
|
||||
"cloud.aws.region.static=eu-west-1" })
|
||||
public class VaultConfigAwsTests {
|
||||
|
||||
private static final String AWS_REGION = "eu-west-1";
|
||||
|
||||
@@ -39,10 +39,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class, properties = {
|
||||
"VaultConfigConsulBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.consul.role=foo", "spring.cloud.vault.consul.enabled=true",
|
||||
"spring.cloud.consul.config.enabled=false" })
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class,
|
||||
properties = { "VaultConfigConsulBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.consul.role=foo",
|
||||
"spring.cloud.vault.consul.enabled=true",
|
||||
"spring.cloud.consul.config.enabled=false" })
|
||||
public class VaultConfigConsulBootstrapConfigurationTests extends IntegrationTestSupport {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -55,9 +55,9 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigConsulTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.consul.enabled=true",
|
||||
"spring.cloud.vault.consul.role=readonly" })
|
||||
@SpringBootTest(classes = VaultConfigConsulTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.consul.enabled=true",
|
||||
"spring.cloud.vault.consul.role=readonly" })
|
||||
public class VaultConfigConsulTests {
|
||||
|
||||
private static final String CONSUL_HOST = "localhost";
|
||||
|
||||
@@ -42,15 +42,15 @@ public class VaultMySqlProperties
|
||||
/**
|
||||
* Enable mysql backend usage.
|
||||
*/
|
||||
@Getter(onMethod_ = {
|
||||
@DeprecatedConfigurationProperty(reason = "Use spring.cloud.vault.database") })
|
||||
@Getter(onMethod_ = { @DeprecatedConfigurationProperty(
|
||||
reason = "Use spring.cloud.vault.database") })
|
||||
private boolean enabled = false;
|
||||
|
||||
/**
|
||||
* Role name for credentials.
|
||||
*/
|
||||
@Getter(onMethod_ = {
|
||||
@DeprecatedConfigurationProperty(reason = "Use spring.cloud.vault.database") })
|
||||
@Getter(onMethod_ = { @DeprecatedConfigurationProperty(
|
||||
reason = "Use spring.cloud.vault.database") })
|
||||
private String role;
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,15 +41,15 @@ public class VaultPostgreSqlProperties implements DatabaseSecretProperties {
|
||||
* Enable postgresql backend usage.
|
||||
*/
|
||||
@Deprecated
|
||||
@Getter(onMethod_ = {
|
||||
@DeprecatedConfigurationProperty(reason = "Use spring.cloud.vault.database") })
|
||||
@Getter(onMethod_ = { @DeprecatedConfigurationProperty(
|
||||
reason = "Use spring.cloud.vault.database") })
|
||||
private boolean enabled = false;
|
||||
|
||||
/**
|
||||
* Role name for credentials.
|
||||
*/
|
||||
@Getter(onMethod_ = {
|
||||
@DeprecatedConfigurationProperty(reason = "Use spring.cloud.vault.database") })
|
||||
@Getter(onMethod_ = { @DeprecatedConfigurationProperty(
|
||||
reason = "Use spring.cloud.vault.database") })
|
||||
private String role;
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,10 +49,10 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigCassandraTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.cassandra.enabled=true",
|
||||
"spring.cloud.vault.cassandra.role=readonly",
|
||||
"spring.data.cassandra.jmx-enabled=false" })
|
||||
@SpringBootTest(classes = VaultConfigCassandraTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.cassandra.enabled=true",
|
||||
"spring.cloud.vault.cassandra.role=readonly",
|
||||
"spring.data.cassandra.jmx-enabled=false" })
|
||||
public class VaultConfigCassandraTests {
|
||||
|
||||
private static final String CASSANDRA_HOST = "localhost";
|
||||
|
||||
@@ -52,11 +52,11 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigMongoTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.mongodb.enabled=true",
|
||||
"spring.cloud.vault.mongodb.role=readonly",
|
||||
"spring.data.mongodb.url=mongodb://localhost",
|
||||
"spring.data.mongodb.database=admin" })
|
||||
@SpringBootTest(classes = VaultConfigMongoTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.mongodb.enabled=true",
|
||||
"spring.cloud.vault.mongodb.role=readonly",
|
||||
"spring.data.mongodb.url=mongodb://localhost",
|
||||
"spring.data.mongodb.database=admin" })
|
||||
public class VaultConfigMongoTests {
|
||||
|
||||
private static final int MONGODB_PORT = 27017;
|
||||
|
||||
@@ -50,11 +50,11 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigMySqlDatabaseTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.database.enabled=true",
|
||||
"spring.cloud.vault.database.role=readonly",
|
||||
"spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false&serverTimezone=UTC",
|
||||
"spring.main.allow-bean-definition-overriding=true" })
|
||||
@SpringBootTest(classes = VaultConfigMySqlDatabaseTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.database.enabled=true",
|
||||
"spring.cloud.vault.database.role=readonly",
|
||||
"spring.datasource.url=jdbc:mysql://localhost:3306/mysql?useSSL=false&serverTimezone=UTC",
|
||||
"spring.main.allow-bean-definition-overriding=true" })
|
||||
public class VaultConfigMySqlDatabaseTests {
|
||||
|
||||
private static final int MYSQL_PORT = 3306;
|
||||
|
||||
@@ -39,9 +39,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class, properties = {
|
||||
"VaultConfigRabbitMqBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.rabbitmq.role=foo" })
|
||||
@SpringBootTest(classes = CustomBootstrapConfiguration.class,
|
||||
properties = {
|
||||
"VaultConfigRabbitMqBootstrapConfigurationTests.custom.config=true",
|
||||
"spring.cloud.vault.rabbitmq.role=foo" })
|
||||
public class VaultConfigRabbitMqBootstrapConfigurationTests
|
||||
extends IntegrationTestSupport {
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ import static org.junit.Assume.assumeTrue;
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = VaultConfigRabbitMqTests.TestApplication.class, properties = {
|
||||
"spring.cloud.vault.rabbitmq.enabled=true",
|
||||
"spring.cloud.vault.rabbitmq.role=readonly",
|
||||
"spring.rabbitmq.address=localhost" })
|
||||
@SpringBootTest(classes = VaultConfigRabbitMqTests.TestApplication.class,
|
||||
properties = { "spring.cloud.vault.rabbitmq.enabled=true",
|
||||
"spring.cloud.vault.rabbitmq.role=readonly",
|
||||
"spring.rabbitmq.address=localhost" })
|
||||
public class VaultConfigRabbitMqTests {
|
||||
|
||||
private static final int RABBITMQ_HTTP_MANAGEMENT_PORT = 15672;
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.vault.core.lease.SecretLeaseContainer;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Grenville Wilson
|
||||
* @author Mårten Svantesson
|
||||
* @since 1.1
|
||||
*/
|
||||
@Configuration
|
||||
|
||||
@@ -32,11 +32,14 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.vault.core.lease.LeaseEndpoints;
|
||||
|
||||
/**
|
||||
* Properties to configure Vault support.
|
||||
*
|
||||
* @author Spencer Gibb
|
||||
* @author Mark Paluch
|
||||
* @author Kevin Holditch
|
||||
* @author Michal Budzyn
|
||||
* @author Grenville Wilson
|
||||
* @author Mårten Svantesson
|
||||
*/
|
||||
@ConfigurationProperties("spring.cloud.vault")
|
||||
@Data
|
||||
@@ -502,15 +505,16 @@ public class VaultProperties implements EnvironmentAware {
|
||||
|
||||
/**
|
||||
* Set the {@link LeaseEndpoints} to delegate renewal/revocation calls to.
|
||||
* {@link LeaseEndpoints} encapsulates differences between Vault versions that affect
|
||||
* the location of renewal/revocation endpoints.
|
||||
* {@link LeaseEndpoints} encapsulates differences between Vault versions that
|
||||
* affect the location of renewal/revocation endpoints.
|
||||
*
|
||||
* Can be SysLeases for version 0.8 or above of vault or Legacy for older versions (the default)
|
||||
* Can be {@link LeaseEndpoints#SysLeases} for version 0.8 or above of Vault or
|
||||
* {@link LeaseEndpoints#Legacy} for older versions (the default).
|
||||
*
|
||||
* @since 2.3
|
||||
* @since 2.2
|
||||
*/
|
||||
|
||||
private LeaseEndpoints leaseEndpoints;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package org.springframework.cloud.vault.config;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
@@ -26,8 +29,6 @@ import org.springframework.vault.core.VaultOperations;
|
||||
import org.springframework.vault.core.lease.LeaseEndpoints;
|
||||
import org.springframework.vault.core.lease.SecretLeaseContainer;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@@ -35,6 +36,7 @@ import static org.mockito.Mockito.verify;
|
||||
* Unit tests for {@link VaultBootstrapPropertySourceConfiguration}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Mårten Svantesson
|
||||
*/
|
||||
public class VaultBootstrapPropertySourceConfigurationTests {
|
||||
|
||||
@@ -78,6 +80,7 @@ public class VaultBootstrapPropertySourceConfigurationTests {
|
||||
SecretLeaseContainer secretLeaseContainer() {
|
||||
return mock(SecretLeaseContainer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user