|
|
|
|
@@ -47,11 +47,9 @@ import static org.mockito.Mockito.when;
|
|
|
|
|
*/
|
|
|
|
|
public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
|
|
|
|
|
private static final Log log = LogFactory
|
|
|
|
|
.getLog(AwsSecretsManagerEnvironmentRepository.class);
|
|
|
|
|
private static final Log log = LogFactory.getLog(AwsSecretsManagerEnvironmentRepository.class);
|
|
|
|
|
|
|
|
|
|
private final AWSSecretsManager awsSmClientMock = mock(AWSSecretsManager.class,
|
|
|
|
|
"aws-sm-client-mock");
|
|
|
|
|
private final AWSSecretsManager awsSmClientMock = mock(AWSSecretsManager.class, "aws-sm-client-mock");
|
|
|
|
|
|
|
|
|
|
private final ConfigServerProperties configServerProperties = new ConfigServerProperties();
|
|
|
|
|
|
|
|
|
|
@@ -60,8 +58,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
private final AwsSecretsManagerEnvironmentRepository repository = new AwsSecretsManagerEnvironmentRepository(
|
|
|
|
|
awsSmClientMock, configServerProperties, environmentProperties);
|
|
|
|
|
|
|
|
|
|
private final ObjectMapper objectMapper = new ObjectMapper()
|
|
|
|
|
.configure(SerializationFeature.INDENT_OUTPUT, true);
|
|
|
|
|
private final ObjectMapper objectMapper = new ObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true);
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testFindOneWithNullApplicationAndNullProfile() {
|
|
|
|
|
@@ -72,24 +69,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null,
|
|
|
|
|
null, null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -100,24 +94,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null,
|
|
|
|
|
null, null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -128,24 +119,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null,
|
|
|
|
|
null, null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -156,28 +144,26 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null,
|
|
|
|
|
null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationProdProperties,
|
|
|
|
|
applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(defaultApplication, profiles, null, null, null);
|
|
|
|
|
expectedEnv
|
|
|
|
|
.addAll(Arrays.asList(applicationProdProperties, applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -188,24 +174,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -215,24 +198,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -242,24 +222,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -269,28 +246,26 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationProdProperties,
|
|
|
|
|
applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv
|
|
|
|
|
.addAll(Arrays.asList(applicationProdProperties, applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -301,24 +276,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -328,24 +300,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -355,24 +324,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -382,28 +348,26 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationProdProperties,
|
|
|
|
|
applicationDefaultProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv
|
|
|
|
|
.addAll(Arrays.asList(applicationProdProperties, applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -414,32 +378,28 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String fooDefaultPropertiesName = "aws:secrets:/secret/foo-default/";
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName,
|
|
|
|
|
getFooDefaultProperties());
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName, getFooDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties,
|
|
|
|
|
applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties, applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -449,32 +409,28 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String fooDefaultPropertiesName = "aws:secrets:/secret/foo-default/";
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName,
|
|
|
|
|
getFooDefaultProperties());
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName, getFooDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties,
|
|
|
|
|
applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties, applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -484,32 +440,28 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String fooDefaultPropertiesName = "aws:secrets:/secret/foo-default/";
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName,
|
|
|
|
|
getFooDefaultProperties());
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName, getFooDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties,
|
|
|
|
|
applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooDefaultProperties, applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -519,23 +471,20 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -545,28 +494,24 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -576,41 +521,35 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooProdPropertiesName = "aws:secrets:/secret/foo-prod/";
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName,
|
|
|
|
|
getFooProdProperties());
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName, getFooProdProperties());
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String fooDefaultPropertiesName = "aws:secrets:/secret/foo-default/";
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName,
|
|
|
|
|
getFooDefaultProperties());
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName, getFooDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties,
|
|
|
|
|
fooDefaultProperties, applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties, fooDefaultProperties,
|
|
|
|
|
applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -620,32 +559,28 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooProdPropertiesName = "aws:secrets:/secret/foo-prod/";
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName,
|
|
|
|
|
getFooProdProperties());
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName, getFooProdProperties());
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties,
|
|
|
|
|
fooProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(
|
|
|
|
|
Arrays.asList(fooProdProperties, applicationProdProperties, fooProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -655,49 +590,43 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooProdPropertiesName = "aws:secrets:/secret/foo-prod/";
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName,
|
|
|
|
|
getFooProdProperties());
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName, getFooProdProperties());
|
|
|
|
|
|
|
|
|
|
String fooEastPropertiesName = "aws:secrets:/secret/foo-east/";
|
|
|
|
|
PropertySource fooEastProperties = new PropertySource(fooEastPropertiesName,
|
|
|
|
|
getFooEastProperties());
|
|
|
|
|
PropertySource fooEastProperties = new PropertySource(fooEastPropertiesName, getFooEastProperties());
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String fooDefaultPropertiesName = "aws:secrets:/secret/foo-default/";
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName,
|
|
|
|
|
getFooDefaultProperties());
|
|
|
|
|
PropertySource fooDefaultProperties = new PropertySource(fooDefaultPropertiesName, getFooDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
String applicationEastPropertiesName = "aws:secrets:/secret/application-east/";
|
|
|
|
|
PropertySource applicationEastProperties = new PropertySource(
|
|
|
|
|
applicationEastPropertiesName, getApplicationEastProperties());
|
|
|
|
|
PropertySource applicationEastProperties = new PropertySource(applicationEastPropertiesName,
|
|
|
|
|
getApplicationEastProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties,
|
|
|
|
|
fooEastProperties, applicationEastProperties, fooDefaultProperties,
|
|
|
|
|
applicationDefaultProperties, fooProperties, applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties, fooEastProperties,
|
|
|
|
|
applicationEastProperties, fooDefaultProperties, applicationDefaultProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -707,41 +636,35 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
String fooProdPropertiesName = "aws:secrets:/secret/foo-prod/";
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName,
|
|
|
|
|
getFooProdProperties());
|
|
|
|
|
PropertySource fooProdProperties = new PropertySource(fooProdPropertiesName, getFooProdProperties());
|
|
|
|
|
|
|
|
|
|
String fooEastPropertiesName = "aws:secrets:/secret/foo-east/";
|
|
|
|
|
PropertySource fooEastProperties = new PropertySource(fooEastPropertiesName,
|
|
|
|
|
getFooEastProperties());
|
|
|
|
|
PropertySource fooEastProperties = new PropertySource(fooEastPropertiesName, getFooEastProperties());
|
|
|
|
|
|
|
|
|
|
String fooPropertiesName = "aws:secrets:/secret/foo/";
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName,
|
|
|
|
|
getFooProperties());
|
|
|
|
|
PropertySource fooProperties = new PropertySource(fooPropertiesName, getFooProperties());
|
|
|
|
|
|
|
|
|
|
String applicationProdPropertiesName = "aws:secrets:/secret/application-prod/";
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(
|
|
|
|
|
applicationProdPropertiesName, getApplicationProdProperties());
|
|
|
|
|
PropertySource applicationProdProperties = new PropertySource(applicationProdPropertiesName,
|
|
|
|
|
getApplicationProdProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
String applicationEastPropertiesName = "aws:secrets:/secret/application-east/";
|
|
|
|
|
PropertySource applicationEastProperties = new PropertySource(
|
|
|
|
|
applicationEastPropertiesName, getApplicationEastProperties());
|
|
|
|
|
PropertySource applicationEastProperties = new PropertySource(applicationEastPropertiesName,
|
|
|
|
|
getApplicationEastProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties,
|
|
|
|
|
fooEastProperties, applicationEastProperties, fooProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(fooProdProperties, applicationProdProperties, fooEastProperties,
|
|
|
|
|
applicationEastProperties, fooProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -761,24 +684,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
PropertySource overrideProperties = new PropertySource("overrides", overrides);
|
|
|
|
|
|
|
|
|
|
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(
|
|
|
|
|
applicationDefaultPropertiesName, getApplicationDefaultProperties());
|
|
|
|
|
PropertySource applicationDefaultProperties = new PropertySource(applicationDefaultPropertiesName,
|
|
|
|
|
getApplicationDefaultProperties());
|
|
|
|
|
|
|
|
|
|
String applicationPropertiesName = "aws:secrets:/secret/application/";
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(
|
|
|
|
|
applicationPropertiesName, getApplicationProperties());
|
|
|
|
|
PropertySource applicationProperties = new PropertySource(applicationPropertiesName,
|
|
|
|
|
getApplicationProperties());
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(overrideProperties, applicationDefaultProperties,
|
|
|
|
|
applicationProperties));
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
expectedEnv.addAll(Arrays.asList(overrideProperties, applicationDefaultProperties, applicationProperties));
|
|
|
|
|
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@@ -787,26 +707,21 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
String profile = configServerProperties.getDefaultProfile();
|
|
|
|
|
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
|
|
|
|
|
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null,
|
|
|
|
|
null);
|
|
|
|
|
Environment expectedEnv = new Environment(application, profiles, null, null, null);
|
|
|
|
|
setupAwsSmClientMocks(expectedEnv);
|
|
|
|
|
|
|
|
|
|
Environment resultEnv = repository.findOne(application, profile, null);
|
|
|
|
|
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking()
|
|
|
|
|
.isEqualTo(expectedEnv);
|
|
|
|
|
assertThat(resultEnv).usingRecursiveComparison().withStrictTypeChecking().isEqualTo(expectedEnv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setupAwsSmClientMocks(Environment environment) {
|
|
|
|
|
for (PropertySource ps : environment.getPropertySources()) {
|
|
|
|
|
String path = StringUtils.delete(ps.getName(),
|
|
|
|
|
environmentProperties.getOrigin());
|
|
|
|
|
GetSecretValueRequest request = new GetSecretValueRequest()
|
|
|
|
|
.withSecretId(path);
|
|
|
|
|
String path = StringUtils.delete(ps.getName(), environmentProperties.getOrigin());
|
|
|
|
|
GetSecretValueRequest request = new GetSecretValueRequest().withSecretId(path);
|
|
|
|
|
|
|
|
|
|
String secrets = getSecrets(ps);
|
|
|
|
|
GetSecretValueResult response = new GetSecretValueResult()
|
|
|
|
|
.withSecretString(secrets);
|
|
|
|
|
GetSecretValueResult response = new GetSecretValueResult().withSecretString(secrets);
|
|
|
|
|
|
|
|
|
|
when(awsSmClientMock.getSecretValue(eq(request))).thenReturn(response);
|
|
|
|
|
}
|
|
|
|
|
@@ -894,4 +809,5 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|