Updating com.google.cloud:google-cloud-secretmanager to 1.7.2. Closes #2527

This commit is contained in:
Ryan Baxter
2024-09-12 10:19:17 -04:00
parent 2a035615ac
commit 8b3336f8ce
6 changed files with 89 additions and 86 deletions

View File

@@ -91,7 +91,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-secretmanager</artifactId>
<version>1.0.1</version>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>

View File

@@ -21,7 +21,6 @@ import java.util.Map;
import com.google.cloud.secretmanager.v1.Secret;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.cloud.config.environment.Environment;
@@ -32,6 +31,7 @@ import org.springframework.cloud.config.server.environment.secretmanager.GoogleS
import org.springframework.cloud.config.server.environment.secretmanager.GoogleSecretManagerAccessStrategyFactory;
import org.springframework.cloud.config.server.environment.secretmanager.HttpHeaderGoogleConfigProvider;
import org.springframework.core.Ordered;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
/**
@@ -64,10 +64,10 @@ public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepo
@Override
public Environment findOne(String application, String profile, String label) {
if (StringUtils.isEmpty(label)) {
if (!StringUtils.hasText(label)) {
label = "master";
}
if (StringUtils.isEmpty(profile)) {
if (!StringUtils.hasText(profile)) {
profile = "default";
}
if (!profile.startsWith("default")) {
@@ -110,9 +110,12 @@ public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepo
result.put(accessStrategy.getSecretName(secret),
accessStrategy.getSecretValue(secret, new GoogleSecretComparatorByVersion()));
}
else if (StringUtils.isNotBlank(prefix) && accessStrategy.getSecretName(secret).startsWith(prefix)) {
result.put(StringUtils.removeStart(accessStrategy.getSecretName(secret), prefix),
accessStrategy.getSecretValue(secret, new GoogleSecretComparatorByVersion()));
else if (StringUtils.hasText(prefix) && accessStrategy.getSecretName(secret).startsWith(prefix)) {
String secretName = accessStrategy.getSecretName(secret);
if (secretName.startsWith(prefix)) {
secretName = secretName.replaceFirst(prefix, "");
}
result.put(secretName, accessStrategy.getSecretValue(secret, new GoogleSecretComparatorByVersion()));
}
}
return result;

View File

@@ -45,7 +45,6 @@ import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings;
import com.google.cloud.secretmanager.v1.SecretName;
import com.google.cloud.secretmanager.v1.SecretVersion;
import com.google.cloud.secretmanager.v1.SecretVersionName;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,6 +52,7 @@ import org.springframework.cloud.config.server.environment.GoogleSecretManagerEn
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
public class GoogleSecretManagerV1AccessStrategy implements GoogleSecretManagerAccessStrategy {
@@ -71,7 +71,7 @@ public class GoogleSecretManagerV1AccessStrategy implements GoogleSecretManagerA
public GoogleSecretManagerV1AccessStrategy(RestTemplate rest, GoogleConfigProvider configProvider,
String serviceAccountFile) throws IOException {
if (StringUtils.isNotEmpty(serviceAccountFile)) {
if (StringUtils.hasText(serviceAccountFile)) {
GoogleCredentials creds = GoogleCredentials.fromStream(new FileInputStream(new File(serviceAccountFile)));
this.client = SecretManagerServiceClient.create(SecretManagerServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(creds))

View File

@@ -23,13 +23,13 @@ import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import org.apache.commons.lang3.RandomUtils;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.ssm.SsmClient;
import software.amazon.awssdk.services.ssm.model.GetParametersByPathRequest;
@@ -42,12 +42,12 @@ import org.springframework.cloud.config.environment.PropertySource;
import org.springframework.cloud.config.server.config.ConfigServerProperties;
import org.springframework.util.StringUtils;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentProperties.DEFAULT_PATH_SEPARATOR;
import static wiremock.org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
/**
* Unit test is must for testing paginated logic, since doing it with integration test is
@@ -192,7 +192,7 @@ public class AWSParameterStoreEnvironmentRepositoryUnitTest {
}
private String generateNextToken() {
String random = randomAlphabetic(RandomUtils.nextInt(3, 33));
String random = randomAlphabetic(new Random().nextInt(3, 33));
return Base64.getEncoder().encodeToString(random.getBytes(StandardCharsets.UTF_8));
}

View File

@@ -21,11 +21,11 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.RandomUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -48,10 +48,10 @@ import org.springframework.cloud.config.server.config.ConfigServerProperties;
import org.springframework.core.Ordered;
import org.springframework.util.StringUtils;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentProperties.DEFAULT_PATH_SEPARATOR;
import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SSM;
import static wiremock.org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
/**
* @author Iulian Antohe
@@ -147,7 +147,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
public void testFindOneWithNullApplicationAndNonExistentProfile() {
// Arrange
String application = null;
String profile = randomAlphabetic(RandomUtils.nextInt(3, 33));
String profile = randomAlphabetic(new Random().nextInt(3, 33));
String defaultApp = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -247,7 +247,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
public void testFindOneWithDefaultApplicationAndNonExistentProfile() {
// Arrange
String application = configServerProperties.getDefaultApplicationName();
String profile = randomAlphabetic(RandomUtils.nextInt(3, 33));
String profile = randomAlphabetic(new Random().nextInt(3, 33));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String name = "aws:ssm:parameter:/config/application/";
@@ -293,7 +293,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistentApplicationAndNullProfile() {
// Arrange
String application = randomAlphabetic(RandomUtils.nextInt(3, 33));
String application = randomAlphabetic(new Random().nextInt(3, 33));
String profile = null;
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -319,7 +319,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistentApplicationAndDefaultProfile() {
// Arrange
String application = randomAlphabetic(RandomUtils.nextInt(3, 33));
String application = randomAlphabetic(new Random().nextInt(3, 33));
String profile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -344,8 +344,8 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistentApplicationAndNonExistentProfile() {
// Arrange
String application = randomAlphabetic(RandomUtils.nextInt(3, 33));
String profile = randomAlphabetic(RandomUtils.nextInt(3, 33));
String application = randomAlphabetic(new Random().nextInt(3, 33));
String profile = randomAlphabetic(new Random().nextInt(3, 33));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String name = "aws:ssm:parameter:/config/application/";
@@ -366,7 +366,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistentApplicationAndExistentProfile() {
// Arrange
String application = randomAlphabetic(RandomUtils.nextInt(3, 33));
String application = randomAlphabetic(new Random().nextInt(3, 33));
String profile = "production";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -463,7 +463,7 @@ public class AwsParameterStoreEnvironmentRepositoryTests {
public void testFindOneWithExistentApplicationAndNonExistentProfile() {
// Arrange
String application = "service";
String profile = randomAlphabetic(RandomUtils.nextInt(3, 33));
String profile = randomAlphabetic(new Random().nextInt(3, 33));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String appSpecificParamsPsName = "aws:ssm:parameter:/config/service/";

View File

@@ -21,11 +21,11 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.AfterEach;
@@ -51,9 +51,9 @@ import org.springframework.cloud.config.server.config.ConfigServerProperties;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SECRETSMANAGER;
import static wiremock.org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
/**
* @author Tejas Pandilwar
@@ -264,7 +264,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNullApplicationAndNonExistingProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -398,7 +398,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithDefaultApplicationAndNonExistingProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -452,7 +452,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNullProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = null;
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -478,7 +478,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndDefaultProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -503,8 +503,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNonExistingProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -528,7 +528,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndExistingProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = "prod";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -624,7 +624,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -656,7 +656,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileAndNullLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -680,7 +680,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFooAndNullLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String defaultLabel = labeledEnvironmentProperties.getDefaultLabel();
@@ -866,7 +866,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithNullApplicationAndNullProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = null;
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -883,8 +883,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNullApplicationAndNonExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -901,7 +901,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithNullApplicationAndDefaultProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = configServerProperties.getDefaultProfile();
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -918,7 +918,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithNullApplicationAndExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = "prod";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -935,7 +935,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithDefaultApplicationAndNullProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = null;
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -952,7 +952,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithDefaultApplicationAndDefaultProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = configServerProperties.getDefaultProfile();
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -967,8 +967,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithDefaultApplicationAndNonExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -984,7 +984,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithDefaultApplicationAndExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = "prod";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -998,9 +998,9 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNullProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = null;
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -1015,9 +1015,9 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndDefaultProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = configServerProperties.getDefaultProfile();
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1031,9 +1031,9 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNonExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1047,9 +1047,9 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = "prod";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1065,7 +1065,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndNullProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = null;
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -1082,7 +1082,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndDefaultProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = configServerProperties.getDefaultProfile();
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1097,8 +1097,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1113,8 +1113,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1129,8 +1129,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFooAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1146,7 +1146,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = "prod";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1162,7 +1162,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndExistingProfileAndNoDefaultProfilesAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = "prod";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1178,7 +1178,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndMultipleExistingProfileAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = "prod,east";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1194,7 +1194,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
public void testFindOneWithExistingApplicationAndMultipleExistingProfileAndNoDefaultsAndNonExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = "prod,east";
String label = randomAlphabetic(RandomUtils.nextInt(3, 25));
String label = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
Environment expectedEnv = new Environment(application, profiles, label, null, null);
@@ -1236,7 +1236,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNullApplicationAndNonExistingProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = null;
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = "release";
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1370,7 +1370,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithDefaultApplicationAndNonExistingProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = configServerProperties.getDefaultApplicationName();
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1424,7 +1424,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNullProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = null;
String label = "release";
String defaultProfile = configServerProperties.getDefaultProfile();
@@ -1450,7 +1450,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndDefaultProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = configServerProperties.getDefaultProfile();
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1475,8 +1475,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNonExistingProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1500,7 +1500,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndExistingProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = "prod";
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1598,7 +1598,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1631,7 +1631,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileAndExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1655,7 +1655,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFooAndExistingLabelWhenDefaultLabelIsSet() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String label = "release";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -1935,7 +1935,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNullApplicationAndNonExistingProfile() {
String application = null;
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String defaultApplication = configServerProperties.getDefaultApplicationName();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -2064,7 +2064,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithDefaultApplicationAndNonExistingProfile() {
String application = configServerProperties.getDefaultApplicationName();
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
@@ -2116,7 +2116,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNullProfile() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = null;
String defaultProfile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(defaultProfile);
@@ -2141,7 +2141,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndDefaultProfile() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = configServerProperties.getDefaultProfile();
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -2165,8 +2165,8 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndNonExistingProfile() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String profile = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = randomAlphabetic(new Random().nextInt(3, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String applicationDefaultPropertiesName = "aws:secrets:/secret/application-default/";
@@ -2189,7 +2189,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithNonExistingApplicationAndExistingProfile() {
String application = randomAlphabetic(RandomUtils.nextInt(3, 25));
String application = randomAlphabetic(new Random().nextInt(3, 25));
String profile = "prod";
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
@@ -2282,7 +2282,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfile() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String fooPropertiesName = "aws:secrets:/secret/foo/";
@@ -2313,7 +2313,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfile() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String fooPropertiesName = "aws:secrets:/secret/foo/";
@@ -2336,7 +2336,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFoo() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String fooPropertiesName = "aws:secrets:/secret/foo/";
@@ -2589,7 +2589,7 @@ public class AwsSecretsManagerEnvironmentRepositoryTests {
@Test
public void testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFooMarkedForDeletion() {
String application = "foo";
String profile = randomAlphabetic(RandomUtils.nextInt(2, 25));
String profile = randomAlphabetic(new Random().nextInt(2, 25));
String[] profiles = StringUtils.commaDelimitedListToStringArray(profile);
String fooPropertiesName = "aws:secrets:/secret/foo/";