Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

chore(style): remove var and inline qualified names from files no open PR touches (#6710)

TATSUNO “Taz” Yasuhiro33e74f77287f
diff --git a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
index 759bfec008..db92cf5860 100644
--- a/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
+++ b/compatibility-tests/sdk-test-java/src/main/java/com/floci/test/TestFixtures.java
@@ -175,6 +175,7 @@ import javax.net.ssl.X509TrustManager;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.net.InetAddress;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
@@ -196,6 +197,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import java.util.zip.ZipEntry;
@@ -876,7 +878,7 @@ public final class TestFixtures {
private static boolean isDnsResolvable(String hostname) {
try {
- java.net.InetAddress.getByName(hostname);
+ InetAddress.getByName(hostname);
return true;
} catch (Exception e) {
return false;
@@ -894,7 +896,7 @@ public final class TestFixtures {
.region(REGION)
.credentialsProvider(CREDENTIALS)
.endpointProvider((S3ControlEndpointProvider) params ->
- java.util.concurrent.CompletableFuture.completedFuture(
+ CompletableFuture.completedFuture(
Endpoint.builder().url(endpoint).build()))
.build();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java
index f8d3602495..2210b944f8 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AcmTest.java
@@ -13,6 +13,7 @@ import software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy;
import software.amazon.awssdk.core.waiters.WaiterResponse;
import software.amazon.awssdk.services.acm.AcmClient;
import software.amazon.awssdk.services.acm.model.*;
+import software.amazon.awssdk.services.acm.model.Tag;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
@@ -284,8 +285,8 @@ class AcmTest {
acm.addTagsToCertificate(b -> b
.certificateArn(tagTestCertArn)
.tags(
- software.amazon.awssdk.services.acm.model.Tag.builder().key("Environment").value("test").build(),
- software.amazon.awssdk.services.acm.model.Tag.builder().key("Project").value("floci").build()
+ Tag.builder().key("Environment").value("test").build(),
+ Tag.builder().key("Project").value("floci").build()
));
ListTagsForCertificateResponse tagsResp = acm.listTagsForCertificate(b -> b
@@ -306,7 +307,7 @@ class AcmTest {
acm.removeTagsFromCertificate(b -> b
.certificateArn(tagTestCertArn)
- .tags(software.amazon.awssdk.services.acm.model.Tag.builder().key("Project").value("floci").build()));
+ .tags(Tag.builder().key("Project").value("floci").build()));
ListTagsForCertificateResponse tagsResp = acm.listTagsForCertificate(b -> b
.certificateArn(tagTestCertArn));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ExecuteTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ExecuteTest.java
index 1a6901dddd..2e90a69b05 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ExecuteTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2ExecuteTest.java
@@ -36,6 +36,7 @@ import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
+import java.net.http.HttpTimeoutException;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
@@ -172,7 +173,7 @@ class ApiGatewayV2ExecuteTest {
JsonNode warmupBody = JSON.readTree(warmup.body());
lambdaDispatchAvailable = warmup.statusCode() == 200
&& warmupBody.path("statusCode").asInt() == 200;
- } catch (java.net.http.HttpTimeoutException | ConnectException e) {
+ } catch (HttpTimeoutException | ConnectException e) {
// Transport-level failure: endpoint unreachable or timed out
lambdaDispatchAvailable = false;
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
index 3a1689368c..cf3e3f8e3d 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApiGatewayV2WebSocketDataPlaneTest.java
@@ -11,6 +11,8 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.apigatewaymanagementapi.ApiGatewayManagementApiClient;
import software.amazon.awssdk.services.apigatewaymanagementapi.model.DeleteConnectionRequest;
@@ -251,8 +253,8 @@ class ApiGatewayV2WebSocketDataPlaneTest {
return ApiGatewayManagementApiClient.builder()
.endpointOverride(mgmtEndpoint)
.region(TestFixtures.region())
- .credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create("test", "test")))
.build();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApigwSfnJsonataCrudlTests.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApigwSfnJsonataCrudlTests.java
index 011214e877..65220f784d 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApigwSfnJsonataCrudlTests.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ApigwSfnJsonataCrudlTests.java
@@ -1,6 +1,8 @@
package com.floci.test;
import org.junit.jupiter.api.*;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.client.config.SdkAdvancedClientOption;
import software.amazon.awssdk.regions.Region;
@@ -89,14 +91,14 @@ class ApigwSfnJsonataCrudlTests {
ddb = DynamoDbClient.builder()
.endpointOverride(endpoint)
.region(region)
- .credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create("test", "test")))
.build();
sfn = SfnClient.builder()
.endpointOverride(endpoint)
.region(region)
- .credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create("test", "test")))
.overrideConfiguration(ClientOverrideConfiguration.builder()
.putAdvancedOption(SdkAdvancedClientOption.DISABLE_HOST_PREFIX_INJECTION, true)
.build())
@@ -104,8 +106,8 @@ class ApigwSfnJsonataCrudlTests {
apigw = ApiGatewayClient.builder()
.endpointOverride(endpoint)
.region(region)
- .credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create("test", "test")))
.build();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
index 777ba7cbd3..240b29826b 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppConfigTest.java
@@ -13,6 +13,7 @@ import software.amazon.awssdk.services.appconfigdata.model.StartConfigurationSes
import java.nio.charset.StandardCharsets;
import java.util.Collections;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -300,7 +301,7 @@ class AppConfigTest {
try {
appConfig.tagResource(TagResourceRequest.builder()
.resourceArn(arn)
- .tags(java.util.Map.of("env", "prod", "owner", "Alice"))
+ .tags(Map.of("env", "prod", "owner", "Alice"))
.build());
ListTagsForResourceResponse listed = appConfig.listTagsForResource(
@@ -346,7 +347,7 @@ class AppConfigTest {
appConfig.tagResource(TagResourceRequest.builder()
.resourceArn(arn)
- .tags(java.util.Map.of("env", "prod"))
+ .tags(Map.of("env", "prod"))
.build());
ListTagsForResourceResponse listed = appConfig.listTagsForResource(
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java
index 614e4c809b..1408419a34 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/AppSyncTest.java
@@ -15,6 +15,7 @@ import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import static org.assertj.core.api.Assertions.*;
@@ -779,7 +780,7 @@ class AppSyncTest {
@Order(100)
void createDomainName() {
// Use unique domain name to avoid conflicts
- String domainSuffix = java.util.UUID.randomUUID().toString().substring(0, 8);
+ String domainSuffix = UUID.randomUUID().toString().substring(0, 8);
CreateDomainNameResponse resp = client.createDomainName(
CreateDomainNameRequest.builder()
.domainName("sdk-" + domainSuffix + ".example.com")
@@ -1040,7 +1041,7 @@ class AppSyncTest {
void listDomainNames() {
CreateDomainNameResponse created = client.createDomainName(
CreateDomainNameRequest.builder()
- .domainName("list-test-" + java.util.UUID.randomUUID().toString().substring(0, 8) + ".example.com")
+ .domainName("list-test-" + UUID.randomUUID().toString().substring(0, 8) + ".example.com")
.certificateArn("arn:aws:acm:us-east-1:000000000000:certificate/test")
.build());
@@ -1170,7 +1171,7 @@ class AppSyncTest {
void listGraphqlApisWithMaxResults() {
for (int i = 0; i < 2; i++) {
client.createGraphqlApi(CreateGraphqlApiRequest.builder()
- .name("pg-sdk-api-" + i + "-" + java.util.UUID.randomUUID().toString().substring(0, 8))
+ .name("pg-sdk-api-" + i + "-" + UUID.randomUUID().toString().substring(0, 8))
.authenticationType("API_KEY")
.build());
}
@@ -1195,7 +1196,7 @@ class AppSyncTest {
for (int i = 0; i < 2; i++) {
client.createDataSource(CreateDataSourceRequest.builder()
.apiId(apiId)
- .name("pg-sdk-ds-" + i + "-" + java.util.UUID.randomUUID().toString().substring(0, 8))
+ .name("pg-sdk-ds-" + i + "-" + UUID.randomUUID().toString().substring(0, 8))
.type("NONE")
.build());
}
@@ -1222,7 +1223,7 @@ class AppSyncTest {
@Test
@Order(130)
void createDataSourceDuplicateThrowsBadRequestException() {
- String dsName = "sdk-conflict-ds-" + java.util.UUID.randomUUID().toString().substring(0, 8);
+ String dsName = "sdk-conflict-ds-" + UUID.randomUUID().toString().substring(0, 8);
client.createDataSource(CreateDataSourceRequest.builder()
.apiId(apiId)
.name(dsName)
@@ -1244,7 +1245,7 @@ class AppSyncTest {
@Order(131)
void createApiKeyExceedsLimitThrowsApiKeyLimitExceededException() {
CreateGraphqlApiResponse tempApi = client.createGraphqlApi(CreateGraphqlApiRequest.builder()
- .name("sdk-limit-test-" + java.util.UUID.randomUUID().toString().substring(0, 8))
+ .name("sdk-limit-test-" + UUID.randomUUID().toString().substring(0, 8))
.authenticationType("API_KEY")
.build());
String tempApiId = tempApi.graphqlApi().apiId();
@@ -1325,7 +1326,7 @@ class AppSyncTest {
@Order(137)
void createSourceApiAssociationDuplicateThrowsConcurrentModificationException() {
String sourceApiId = client.createGraphqlApi(CreateGraphqlApiRequest.builder()
- .name("sdk-dup-source-" + java.util.UUID.randomUUID().toString().substring(0, 8))
+ .name("sdk-dup-source-" + UUID.randomUUID().toString().substring(0, 8))
.authenticationType("API_KEY")
.build()).graphqlApi().apiId();
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/BudgetsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/BudgetsTest.java
index f55527838d..7480a59843 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/BudgetsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/BudgetsTest.java
@@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.budgets.BudgetsClient;
import software.amazon.awssdk.services.budgets.model.*;
+import java.math.BigDecimal;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -33,7 +34,7 @@ class BudgetsTest {
.budgetName(budgetName)
.budgetType(BudgetType.COST)
.timeUnit(TimeUnit.MONTHLY)
- .budgetLimit(Spend.builder().amount(new java.math.BigDecimal("100.00")).unit("USD").build())
+ .budgetLimit(Spend.builder().amount(new BigDecimal("100.00")).unit("USD").build())
.build())
.notificationsWithSubscribers(NotificationWithSubscribers.builder()
.notification(notification)
@@ -72,7 +73,7 @@ class BudgetsTest {
client.updateBudget(b -> b.accountId(ACCOUNT_ID).newBudget(Budget.builder()
.budgetName(budgetName).budgetType(BudgetType.COST).timeUnit(TimeUnit.MONTHLY)
- .budgetLimit(Spend.builder().amount(new java.math.BigDecimal("150.00")).unit("USD").build()).build()));
+ .budgetLimit(Spend.builder().amount(new BigDecimal("150.00")).unit("USD").build()).build()));
assertThat(client.describeBudgetPerformanceHistory(b -> b.accountId(ACCOUNT_ID).budgetName(budgetName)).budgetPerformanceHistory())
.isNotNull();
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java
index 4516304093..c47cfa42ef 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventBusTest.java
@@ -16,6 +16,7 @@ import software.amazon.awssdk.services.eventbridge.model.DescribeEventBusRequest
import software.amazon.awssdk.services.eventbridge.model.DescribeEventBusResponse;
import software.amazon.awssdk.services.eventbridge.model.ListTagsForResourceRequest;
import software.amazon.awssdk.services.eventbridge.model.ResourceNotFoundException;
+import software.amazon.awssdk.services.eventbridge.model.Tag;
import java.util.List;
import java.util.Map;
@@ -118,8 +119,8 @@ class CloudFormationEventBusTest {
.build())
.tags().stream()
.collect(Collectors.toMap(
- software.amazon.awssdk.services.eventbridge.model.Tag::key,
- software.amazon.awssdk.services.eventbridge.model.Tag::value));
+ Tag::key,
+ Tag::value));
}
private static String template(String description, String keepValue, String secondTagKey) {
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java
index 16f66f57b2..12c270a2ad 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationEventSourceMappingTest.java
@@ -6,6 +6,7 @@ import software.amazon.awssdk.services.cloudformation.model.*;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.GetEventSourceMappingResponse;
import software.amazon.awssdk.services.lambda.model.ListEventSourceMappingsResponse;
+import software.amazon.awssdk.services.lambda.model.ResourceNotFoundException;
import software.amazon.awssdk.services.sqs.SqsClient;
import java.util.List;
@@ -220,7 +221,7 @@ class CloudFormationEventSourceMappingTest {
waitForDeleted(STACK_NAME, 30);
assertThatThrownBy(() -> lambda.getEventSourceMapping(r -> r.uuid(esmUuid)))
- .isInstanceOf(software.amazon.awssdk.services.lambda.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
private static String sqsStackTemplate(String esmOptions) {
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationVirtualHostTests.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationVirtualHostTests.java
index d3da41d8d0..37a41498f2 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationVirtualHostTests.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudFormationVirtualHostTests.java
@@ -4,10 +4,13 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.core.interceptor.Context;
import software.amazon.awssdk.core.interceptor.ExecutionAttributes;
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
import software.amazon.awssdk.http.SdkHttpRequest;
+import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.cloudformation.CloudFormationClient;
import software.amazon.awssdk.services.cloudformation.model.ListStacksResponse;
@@ -34,9 +37,9 @@ class CloudFormationVirtualHostTests {
static void setup() {
cfn = CloudFormationClient.builder()
.endpointOverride(TestFixtures.endpoint())
- .region(software.amazon.awssdk.regions.Region.US_EAST_1)
- .credentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider.create(
- software.amazon.awssdk.auth.credentials.AwsBasicCredentials.create("test", "test")))
+ .region(Region.US_EAST_1)
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create("test", "test")))
.overrideConfiguration(c -> c.addExecutionInterceptor(new HostHeaderSpoofInterceptor(VIRTUAL_HOST)))
.build();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java
index 45b1e8fe1b..7f77189680 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CloudHsmV2Test.java
@@ -1,24 +1,35 @@
package com.floci.test;
import org.bouncycastle.asn1.x500.X500Name;
+import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openssl.PEMParser;
+import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
+import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemWriter;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.cloudhsmv2.CloudHsmV2Client;
import software.amazon.awssdk.services.cloudhsmv2.model.*;
+import java.io.StringReader;
import java.io.StringWriter;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -48,7 +59,7 @@ public class CloudHsmV2Test {
// 2. Initialize Cluster
DescribeClustersResponse initDescribe = client.describeClusters(r -> r
- .filters(java.util.Map.of("clusterIds", List.of(clusterId))));
+ .filters(Map.of("clusterIds", List.of(clusterId))));
String csr = initDescribe.clusters().get(0).certificates().clusterCsr();
String[] certs;
try { certs = generateCerts(csr); } catch (Exception e) { throw new RuntimeException(e); }
@@ -78,14 +89,14 @@ public class CloudHsmV2Test {
// 4. Describe Clusters
DescribeClustersResponse descClusters = client.describeClusters(r -> r
- .filters(java.util.Map.of("clusterIds", List.of(clusterId)))
+ .filters(Map.of("clusterIds", List.of(clusterId)))
);
assertThat(descClusters.clusters()).hasSize(1);
assertThat(descClusters.clusters().get(0).stateAsString()).isEqualTo("ACTIVE");
// 5. Describe Backups (auto-created on CreateHsm/CreateCluster)
DescribeBackupsResponse descBackups = client.describeBackups(r -> r
- .filters(java.util.Map.of("clusterIds", List.of(clusterId)))
+ .filters(Map.of("clusterIds", List.of(clusterId)))
);
assertThat(descBackups.backups()).isNotEmpty();
String backupId = descBackups.backups().get(0).backupId();
@@ -118,7 +129,7 @@ public class CloudHsmV2Test {
);
String clusterId = createClusterResponse.cluster().clusterId();
DescribeClustersResponse initDescribe = client.describeClusters(r -> r
- .filters(java.util.Map.of("clusterIds", List.of(clusterId))));
+ .filters(Map.of("clusterIds", List.of(clusterId))));
String csr = initDescribe.clusters().get(0).certificates().clusterCsr();
String[] certs;
try { certs = generateCerts(csr); } catch (Exception e) { throw new RuntimeException(e); }
@@ -146,35 +157,35 @@ public class CloudHsmV2Test {
}
private String[] generateCerts(String csrPem) throws Exception {
- java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
- java.security.KeyPairGenerator keyGen = java.security.KeyPairGenerator.getInstance("RSA", "BC");
- keyGen.initialize(2048, new java.security.SecureRandom());
- java.security.KeyPair caKeyPair = keyGen.generateKeyPair();
- org.bouncycastle.asn1.x500.X500Name caName = new org.bouncycastle.asn1.x500.X500Name("CN=Floci Test CA");
+ Security.addProvider(new BouncyCastleProvider());
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "BC");
+ keyGen.initialize(2048, new SecureRandom());
+ KeyPair caKeyPair = keyGen.generateKeyPair();
+ X500Name caName = new X500Name("CN=Floci Test CA");
long now = System.currentTimeMillis();
- java.util.Date startDate = new java.util.Date(now);
- java.util.Date endDate = new java.util.Date(now + 365L * 24 * 3600 * 1000);
- java.math.BigInteger serial = java.math.BigInteger.valueOf(now);
- org.bouncycastle.cert.X509v3CertificateBuilder caBuilder = new org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder(
+ Date startDate = new Date(now);
+ Date endDate = new Date(now + 365L * 24 * 3600 * 1000);
+ BigInteger serial = BigInteger.valueOf(now);
+ X509v3CertificateBuilder caBuilder = new JcaX509v3CertificateBuilder(
caName, serial, startDate, endDate, caName, caKeyPair.getPublic());
- org.bouncycastle.operator.ContentSigner caSigner = new org.bouncycastle.operator.jcajce.JcaContentSignerBuilder("SHA256WithRSA")
+ ContentSigner caSigner = new JcaContentSignerBuilder("SHA256WithRSA")
.setProvider("BC").build(caKeyPair.getPrivate());
- org.bouncycastle.cert.X509CertificateHolder caHolder = caBuilder.build(caSigner);
- java.io.StringWriter caSw = new java.io.StringWriter();
- try (org.bouncycastle.openssl.jcajce.JcaPEMWriter pw = new org.bouncycastle.openssl.jcajce.JcaPEMWriter(caSw)) {
+ X509CertificateHolder caHolder = caBuilder.build(caSigner);
+ StringWriter caSw = new StringWriter();
+ try (JcaPEMWriter pw = new JcaPEMWriter(caSw)) {
pw.writeObject(caHolder);
}
String trustAnchor = caSw.toString();
- org.bouncycastle.pkcs.PKCS10CertificationRequest csr;
- try (org.bouncycastle.openssl.PEMParser parser = new org.bouncycastle.openssl.PEMParser(new java.io.StringReader(csrPem))) {
- csr = (org.bouncycastle.pkcs.PKCS10CertificationRequest) parser.readObject();
+ PKCS10CertificationRequest csr;
+ try (PEMParser parser = new PEMParser(new StringReader(csrPem))) {
+ csr = (PKCS10CertificationRequest) parser.readObject();
}
- java.security.PublicKey csrPublicKey = new org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter().setProvider("BC").getPublicKey(csr.getSubjectPublicKeyInfo());
- org.bouncycastle.cert.X509v3CertificateBuilder certBuilder = new org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder(
- caName, serial.add(java.math.BigInteger.ONE), startDate, endDate, csr.getSubject(), csrPublicKey);
- org.bouncycastle.cert.X509CertificateHolder certHolder = certBuilder.build(caSigner);
- java.io.StringWriter certSw = new java.io.StringWriter();
- try (org.bouncycastle.openssl.jcajce.JcaPEMWriter pw = new org.bouncycastle.openssl.jcajce.JcaPEMWriter(certSw)) {
+ PublicKey csrPublicKey = new JcaPEMKeyConverter().setProvider("BC").getPublicKey(csr.getSubjectPublicKeyInfo());
+ X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(
+ caName, serial.add(BigInteger.ONE), startDate, endDate, csr.getSubject(), csrPublicKey);
+ X509CertificateHolder certHolder = certBuilder.build(caSigner);
+ StringWriter certSw = new StringWriter();
+ try (JcaPEMWriter pw = new JcaPEMWriter(certSw)) {
pw.writeObject(certHolder);
}
String signedCert = certSw.toString();
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployEcsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployEcsTest.java
index 8665956833..c449440d03 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployEcsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployEcsTest.java
@@ -158,7 +158,7 @@ class CodeDeployEcsTest {
.loadBalancerArn(lbArn)
.protocol(ProtocolEnum.HTTP)
.port(18090)
- .defaultActions(software.amazon.awssdk.services.elasticloadbalancingv2.model.Action.builder()
+ .defaultActions(Action.builder()
.type(ActionTypeEnum.FORWARD)
.targetGroupArn(blueTgArn)
.build()));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java
index f12dcda52b..0218ae5a82 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CodeDeployTest.java
@@ -27,6 +27,7 @@ import software.amazon.awssdk.services.codedeploy.model.GetApplicationResponse;
import software.amazon.awssdk.services.codedeploy.model.GetDeploymentConfigResponse;
import software.amazon.awssdk.services.codedeploy.model.GetDeploymentGroupResponse;
import software.amazon.awssdk.services.codedeploy.model.GetDeploymentResponse;
+import software.amazon.awssdk.services.codedeploy.model.InvalidDeploymentConfigNameException;
import software.amazon.awssdk.services.codedeploy.model.ListApplicationsResponse;
import software.amazon.awssdk.services.codedeploy.model.ListDeploymentConfigsResponse;
import software.amazon.awssdk.services.codedeploy.model.ListDeploymentGroupsResponse;
@@ -263,7 +264,7 @@ class CodeDeployTest {
void cannotDeleteBuiltInConfig() {
assertThatThrownBy(() ->
codedeploy.deleteDeploymentConfig(r -> r.deploymentConfigName("CodeDeployDefault.AllAtOnce")))
- .isInstanceOf(software.amazon.awssdk.services.codedeploy.model.InvalidDeploymentConfigNameException.class);
+ .isInstanceOf(InvalidDeploymentConfigNameException.class);
}
@Test
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CognitoFeaturesTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CognitoFeaturesTest.java
index 0c14a8eddf..beda7062c7 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CognitoFeaturesTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/CognitoFeaturesTest.java
@@ -474,7 +474,7 @@ class CognitoFeaturesTest {
@Test
@Order(60)
void adminRespondToAuthChallengeNewPasswordRequired() {
- String tempUser = "admin-challenge-user-" + java.util.UUID.randomUUID();
+ String tempUser = "admin-challenge-user-" + UUID.randomUUID();
String tempPassword = "TempPass1!";
String newPassword = "Permanent99!";
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataLakeTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataLakeTest.java
index 4fc03160c3..3632eb3af2 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataLakeTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataLakeTest.java
@@ -5,6 +5,9 @@ import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.athena.AthenaClient;
import software.amazon.awssdk.services.athena.model.*;
import software.amazon.awssdk.services.firehose.FirehoseClient;
+import software.amazon.awssdk.services.firehose.model.BufferingHints;
+import software.amazon.awssdk.services.firehose.model.CreateDeliveryStreamRequest;
+import software.amazon.awssdk.services.firehose.model.ExtendedS3DestinationConfiguration;
import software.amazon.awssdk.services.firehose.model.PutRecordRequest;
import software.amazon.awssdk.services.firehose.model.Record;
import software.amazon.awssdk.services.glue.GlueClient;
@@ -75,15 +78,15 @@ class DataLakeTest {
// 3. Firehose Stream delivering under the Glue table location. The static
// prefix gets yyyy/MM/dd/HH/ appended like real Firehose, which stays
// inside the table location since Athena reads it recursively.
- firehose.createDeliveryStream(software.amazon.awssdk.services.firehose.model.CreateDeliveryStreamRequest.builder()
+ firehose.createDeliveryStream(CreateDeliveryStreamRequest.builder()
.deliveryStreamName(STREAM_NAME)
- .extendedS3DestinationConfiguration(software.amazon.awssdk.services.firehose.model.ExtendedS3DestinationConfiguration.builder()
+ .extendedS3DestinationConfiguration(ExtendedS3DestinationConfiguration.builder()
.bucketARN("arn:aws:s3:::floci-firehose-results")
.roleARN("arn:aws:iam::000000000000:role/datalake-firehose-role")
.prefix(STREAM_NAME + "/")
// Floci does not enforce AWS's 60s minimum interval, which keeps
// the delivery wait short (would need 60+ against real AWS).
- .bufferingHints(software.amazon.awssdk.services.firehose.model.BufferingHints.builder()
+ .bufferingHints(BufferingHints.builder()
.sizeInMBs(1)
.intervalInSeconds(5)
.build())
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataSyncTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataSyncTest.java
index d19622dd92..d21e59e450 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataSyncTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DataSyncTest.java
@@ -21,6 +21,8 @@ import software.amazon.awssdk.services.datasync.model.TaskMode;
import software.amazon.awssdk.services.datasync.model.TaskStatus;
import software.amazon.awssdk.services.datasync.model.VerifyMode;
+import java.util.function.Consumer;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -55,7 +57,7 @@ class DataSyncTest {
datasync.close();
}
- private static void deleteQuietly(String kind, String arn, java.util.function.Consumer<String> delete) {
+ private static void deleteQuietly(String kind, String arn, Consumer<String> delete) {
if (arn == null) {
return;
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DetectiveOrganizationAdministrationTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DetectiveOrganizationAdministrationTest.java
index d17aff38a0..aa55db99a8 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DetectiveOrganizationAdministrationTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DetectiveOrganizationAdministrationTest.java
@@ -6,6 +6,7 @@ import software.amazon.awssdk.services.detective.DetectiveClient;
import software.amazon.awssdk.services.detective.model.Account;
import software.amazon.awssdk.services.detective.model.CreateMembersResponse;
import software.amazon.awssdk.services.organizations.OrganizationsClient;
+import software.amazon.awssdk.services.organizations.model.AwsOrganizationsNotInUseException;
import java.util.List;
@@ -28,7 +29,7 @@ class DetectiveOrganizationAdministrationTest {
DetectiveClient administrator = TestFixtures.detectiveClient(ADMIN_ACCOUNT)) {
try {
organizations.describeOrganization();
- } catch (software.amazon.awssdk.services.organizations.model.AwsOrganizationsNotInUseException e) {
+ } catch (AwsOrganizationsNotInUseException e) {
organizations.createOrganization();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbAccessPathValidationTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbAccessPathValidationTest.java
index 300660695b..d54ce87fe1 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbAccessPathValidationTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbAccessPathValidationTest.java
@@ -1,5 +1,6 @@
package com.floci.test;
+import org.assertj.core.api.ThrowableAssert;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -257,7 +258,7 @@ class DynamoDbAccessPathValidationTest {
"alternate", condition(ComparisonOperator.EQ, "a1")))));
}
- private static void assertValidationException(org.assertj.core.api.ThrowableAssert.ThrowingCallable call) {
+ private static void assertValidationException(ThrowableAssert.ThrowingCallable call) {
assertThatThrownBy(call)
.isInstanceOf(DynamoDbException.class)
.satisfies(error -> assertThat(((DynamoDbException) error)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbExportTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbExportTest.java
index 2a416444af..6f6f53bfd8 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbExportTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/DynamoDbExportTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.*;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.*;
+import software.amazon.awssdk.services.dynamodb.model.DynamoDbException;
import software.amazon.awssdk.services.dynamodb.waiters.DynamoDbWaiter;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.*;
@@ -207,7 +208,7 @@ class DynamoDbExportTest {
.s3Bucket(BUCKET_NAME)
.exportType(ExportType.INCREMENTAL_EXPORT)
.build()))
- .isInstanceOf(software.amazon.awssdk.services.dynamodb.model.DynamoDbException.class)
+ .isInstanceOf(DynamoDbException.class)
.hasMessageContaining("Incremental Export Specification expected when export type is set as Incremental Export");
}
@@ -218,7 +219,7 @@ class DynamoDbExportTest {
DescribeExportRequest.builder()
.exportArn("arn:aws:dynamodb:us-east-1:000000000000:table/T/export/doesnotexist")
.build()))
- .isInstanceOf(software.amazon.awssdk.services.dynamodb.model.DynamoDbException.class);
+ .isInstanceOf(DynamoDbException.class);
}
@Test
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java
index 98b7385e8c..977ba53c81 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/Ec2Tests.java
@@ -858,7 +858,7 @@ class Ec2Tests {
void createTags() {
ec2.createTags(CreateTagsRequest.builder()
.resources(instanceId)
- .tags(software.amazon.awssdk.services.ec2.model.Tag.builder().key("Name").value("sdk-test-instance").build())
+ .tags(Tag.builder().key("Name").value("sdk-test-instance").build())
.build());
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcsTests.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcsTests.java
index d2cf346fe8..c0cbe481af 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcsTests.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/EcsTests.java
@@ -4,6 +4,8 @@ import org.junit.jupiter.api.*;
import software.amazon.awssdk.core.waiters.WaiterResponse;
import software.amazon.awssdk.services.ecs.EcsClient;
import software.amazon.awssdk.services.ecs.model.*;
+import software.amazon.awssdk.services.ecs.model.Tag;
+import software.amazon.awssdk.services.ecs.model.TaskSet;
import java.time.Duration;
import java.util.List;
@@ -288,8 +290,8 @@ class EcsTests {
void tagResource() {
ecs.tagResource(TagResourceRequest.builder()
.resourceArn(cluster.clusterArn())
- .tags(software.amazon.awssdk.services.ecs.model.Tag.builder().key("env").value("test").build(),
- software.amazon.awssdk.services.ecs.model.Tag.builder().key("team").value("sdk").build())
+ .tags(Tag.builder().key("env").value("test").build(),
+ Tag.builder().key("team").value("sdk").build())
.build());
}
@@ -297,7 +299,7 @@ class EcsTests {
@Order(16)
@DisplayName("ListTagsForResource - verify tags")
void listTagsForResource() {
- List<software.amazon.awssdk.services.ecs.model.Tag> tags = ecs.listTagsForResource(ListTagsForResourceRequest.builder()
+ List<Tag> tags = ecs.listTagsForResource(ListTagsForResourceRequest.builder()
.resourceArn(cluster.clusterArn())
.build()).tags();
@@ -314,7 +316,7 @@ class EcsTests {
.tagKeys("team")
.build());
- List<software.amazon.awssdk.services.ecs.model.Tag> tags = ecs.listTagsForResource(ListTagsForResourceRequest.builder()
+ List<Tag> tags = ecs.listTagsForResource(ListTagsForResourceRequest.builder()
.resourceArn(cluster.clusterArn())
.build()).tags();
@@ -942,7 +944,7 @@ class EcsTests {
.launchType(LaunchType.FARGATE)
.build());
- software.amazon.awssdk.services.ecs.model.TaskSet ts =
+ TaskSet ts =
ecs.createTaskSet(CreateTaskSetRequest.builder()
.cluster(clusterName)
.service(externalService)
@@ -965,7 +967,7 @@ class EcsTests {
String taskSetArn = ts.taskSetArn();
// Describe task sets
- List<software.amazon.awssdk.services.ecs.model.TaskSet> sets =
+ List<TaskSet> sets =
ecs.describeTaskSets(DescribeTaskSetsRequest.builder()
.cluster(clusterName)
.service(externalService)
@@ -986,7 +988,7 @@ class EcsTests {
.satisfies(failure -> assertThat(failure.reason()).isEqualTo("MISSING"));
// Update task set
- software.amazon.awssdk.services.ecs.model.TaskSet updated =
+ TaskSet updated =
ecs.updateTaskSet(UpdateTaskSetRequest.builder()
.cluster(clusterName)
.service(externalService)
@@ -999,7 +1001,7 @@ class EcsTests {
assertThat(updated.computedDesiredCount()).isEqualTo(3);
// Update primary task set
- software.amazon.awssdk.services.ecs.model.TaskSet primary =
+ TaskSet primary =
ecs.updateServicePrimaryTaskSet(UpdateServicePrimaryTaskSetRequest.builder()
.cluster(clusterName)
.service(externalService)
@@ -1018,7 +1020,7 @@ class EcsTests {
.isInstanceOf(EcsException.class)
.hasMessageContaining("scaled down to zero");
- software.amazon.awssdk.services.ecs.model.TaskSet deleted =
+ TaskSet deleted =
ecs.deleteTaskSet(DeleteTaskSetRequest.builder()
.cluster(clusterName)
.service(externalService)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ElastiCacheTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ElastiCacheTest.java
index 7982e4eafa..e7f0817f2b 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ElastiCacheTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/ElastiCacheTest.java
@@ -11,6 +11,7 @@ import org.junit.jupiter.api.TestMethodOrder;
import software.amazon.awssdk.services.elasticache.ElastiCacheClient;
import software.amazon.awssdk.services.elasticache.model.AuthenticationMode;
import software.amazon.awssdk.services.elasticache.model.CreateReplicationGroupRequest;
+import software.amazon.awssdk.services.elasticache.model.CreateReplicationGroupResponse;
import software.amazon.awssdk.services.elasticache.model.CreateUserGroupRequest;
import software.amazon.awssdk.services.elasticache.model.CreateUserGroupResponse;
import software.amazon.awssdk.services.elasticache.model.CreateUserRequest;
@@ -18,6 +19,7 @@ import software.amazon.awssdk.services.elasticache.model.CreateUserResponse;
import software.amazon.awssdk.services.elasticache.model.DeleteReplicationGroupRequest;
import software.amazon.awssdk.services.elasticache.model.DeleteUserGroupRequest;
import software.amazon.awssdk.services.elasticache.model.DeleteUserRequest;
+import software.amazon.awssdk.services.elasticache.model.DeleteUserResponse;
import software.amazon.awssdk.services.elasticache.model.DescribeCacheClustersRequest;
import software.amazon.awssdk.services.elasticache.model.DescribeCacheClustersResponse;
import software.amazon.awssdk.services.elasticache.model.DescribeReplicationGroupsRequest;
@@ -25,6 +27,7 @@ import software.amazon.awssdk.services.elasticache.model.DescribeReplicationGrou
import software.amazon.awssdk.services.elasticache.model.DescribeUserGroupsRequest;
import software.amazon.awssdk.services.elasticache.model.DescribeUserGroupsResponse;
import software.amazon.awssdk.services.elasticache.model.DescribeUsersRequest;
+import software.amazon.awssdk.services.elasticache.model.DescribeUsersResponse;
import software.amazon.awssdk.services.elasticache.model.ElastiCacheException;
import software.amazon.awssdk.services.elasticache.model.Endpoint;
import software.amazon.awssdk.services.elasticache.model.InputAuthenticationType;
@@ -98,7 +101,7 @@ class ElastiCacheTest {
@Test
@Order(1)
void createReplicationGroup() {
- var response = elasticache.createReplicationGroup(CreateReplicationGroupRequest.builder()
+ CreateReplicationGroupResponse response = elasticache.createReplicationGroup(CreateReplicationGroupRequest.builder()
.replicationGroupId(groupId)
.replicationGroupDescription("compat test group")
.engine("redis")
@@ -122,7 +125,7 @@ class ElastiCacheTest {
void describeReplicationGroup() {
requireGroup();
- var response = elasticache.describeReplicationGroups(DescribeReplicationGroupsRequest.builder()
+ DescribeReplicationGroupsResponse response = elasticache.describeReplicationGroups(DescribeReplicationGroupsRequest.builder()
.replicationGroupId(groupId)
.build());
@@ -165,7 +168,7 @@ class ElastiCacheTest {
@Test
@Order(5)
void createUser() {
- var response = elasticache.createUser(CreateUserRequest.builder()
+ CreateUserResponse response = elasticache.createUser(CreateUserRequest.builder()
.userId(userId)
.userName(userName)
.engine("redis")
@@ -189,7 +192,7 @@ class ElastiCacheTest {
void describeUsersContainsCreatedUser() {
requireUser();
- var response = elasticache.describeUsers(DescribeUsersRequest.builder().build());
+ DescribeUsersResponse response = elasticache.describeUsers(DescribeUsersRequest.builder().build());
assertThat(response.users())
.anyMatch(user -> user.userId().equals(userId) && user.userName().equals(userName)
@@ -229,7 +232,7 @@ class ElastiCacheTest {
// Known deviation: an id that names no user group but names a user associates that
// user directly, which Floci accepted before it modelled user groups. Real AWS only
// accepts user group ids here; userGroupMembersAuthenticateThroughTheProxy covers that.
- var response = elasticache.modifyReplicationGroup(ModifyReplicationGroupRequest.builder()
+ ModifyReplicationGroupResponse response = elasticache.modifyReplicationGroup(ModifyReplicationGroupRequest.builder()
.replicationGroupId(groupId)
.userGroupIdsToAdd(userId)
.build());
@@ -251,7 +254,7 @@ class ElastiCacheTest {
void modifyUserRotatesPassword() throws Exception {
requireUser();
- var response = elasticache.modifyUser(ModifyUserRequest.builder()
+ ModifyUserResponse response = elasticache.modifyUser(ModifyUserRequest.builder()
.userId(userId)
.engine("redis")
.authenticationMode(AuthenticationMode.builder()
@@ -294,7 +297,7 @@ class ElastiCacheTest {
@Order(11)
void valkeyUserRoundTripEchoesEngine() {
String valkeyUserId = TestFixtures.uniqueName("ec-valkey-user");
- var created = elasticache.createUser(CreateUserRequest.builder()
+ CreateUserResponse created = elasticache.createUser(CreateUserRequest.builder()
.userId(valkeyUserId)
.userName(TestFixtures.uniqueName("ec-valkey-name"))
.engine("valkey")
@@ -305,7 +308,7 @@ class ElastiCacheTest {
.build());
assertThat(created.engine()).isEqualTo("valkey");
- var deleted = elasticache.deleteUser(DeleteUserRequest.builder()
+ DeleteUserResponse deleted = elasticache.deleteUser(DeleteUserRequest.builder()
.userId(valkeyUserId)
.build());
assertThat(deleted.engine()).isEqualTo("valkey");
@@ -454,7 +457,7 @@ class ElastiCacheTest {
.isInstanceOf(ElastiCacheException.class)
.hasMessageContaining("not found");
- var response = elasticache.createReplicationGroup(CreateReplicationGroupRequest.builder()
+ CreateReplicationGroupResponse response = elasticache.createReplicationGroup(CreateReplicationGroupRequest.builder()
.replicationGroupId(reusedGroupId)
.replicationGroupDescription("compat test group reuse")
.engine("redis")
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseParquetDeliveryTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseParquetDeliveryTest.java
index 94661811b0..04ec41ea31 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseParquetDeliveryTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseParquetDeliveryTest.java
@@ -54,6 +54,7 @@ import software.amazon.awssdk.services.s3.model.S3Object;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
+import java.util.Arrays;
import java.util.Base64;
import java.util.List;
@@ -276,10 +277,10 @@ class FirehoseParquetDeliveryTest {
byte[] body = s3.getObject(GetObjectRequest.builder().bucket(bucket).key(key).build())
.readAllBytes();
assertThat(body.length).isGreaterThan(PARQUET_MAGIC.length * 2);
- assertThat(java.util.Arrays.copyOfRange(body, 0, PARQUET_MAGIC.length))
+ assertThat(Arrays.copyOfRange(body, 0, PARQUET_MAGIC.length))
.as("delivered object must start with the Parquet magic")
.isEqualTo(PARQUET_MAGIC);
- assertThat(java.util.Arrays.copyOfRange(body, body.length - PARQUET_MAGIC.length, body.length))
+ assertThat(Arrays.copyOfRange(body, body.length - PARQUET_MAGIC.length, body.length))
.as("delivered object must end with the Parquet magic")
.isEqualTo(PARQUET_MAGIC);
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseTest.java
index 75dc42402f..c4111633f6 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/FirehoseTest.java
@@ -4,6 +4,7 @@ import org.junit.jupiter.api.*;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.firehose.FirehoseClient;
import software.amazon.awssdk.services.firehose.model.*;
+import software.amazon.awssdk.services.firehose.model.Record;
import java.nio.charset.StandardCharsets;
import java.util.List;
@@ -86,7 +87,7 @@ class FirehoseTest {
void putRecord() {
PutRecordResponse response = firehose.putRecord(PutRecordRequest.builder()
.deliveryStreamName(STREAM_NAME)
- .record(software.amazon.awssdk.services.firehose.model.Record.builder()
+ .record(Record.builder()
.data(SdkBytes.fromString("{\"event\":\"test\"}", StandardCharsets.UTF_8))
.build())
.build());
@@ -98,10 +99,10 @@ class FirehoseTest {
@Order(5)
@DisplayName("Put record batch")
void putRecordBatch() {
- List<software.amazon.awssdk.services.firehose.model.Record> records = List.of(
- software.amazon.awssdk.services.firehose.model.Record.builder().data(SdkBytes.fromString("{\"i\":1}", StandardCharsets.UTF_8)).build(),
- software.amazon.awssdk.services.firehose.model.Record.builder().data(SdkBytes.fromString("{\"i\":2}", StandardCharsets.UTF_8)).build(),
- software.amazon.awssdk.services.firehose.model.Record.builder().data(SdkBytes.fromString("{\"i\":3}", StandardCharsets.UTF_8)).build()
+ List<Record> records = List.of(
+ Record.builder().data(SdkBytes.fromString("{\"i\":1}", StandardCharsets.UTF_8)).build(),
+ Record.builder().data(SdkBytes.fromString("{\"i\":2}", StandardCharsets.UTF_8)).build(),
+ Record.builder().data(SdkBytes.fromString("{\"i\":3}", StandardCharsets.UTF_8)).build()
);
PutRecordBatchResponse response = firehose.putRecordBatch(PutRecordBatchRequest.builder()
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IamTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IamTest.java
index 27b297f93d..2ef7fba113 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IamTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IamTest.java
@@ -263,7 +263,7 @@ class IamTest {
void tagUser() {
iam.tagUser(TagUserRequest.builder()
.userName(USER_NAME)
- .tags(software.amazon.awssdk.services.iam.model.Tag.builder().key("env").value("sdk-test").build())
+ .tags(Tag.builder().key("env").value("sdk-test").build())
.build());
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java
index 1750362cd0..a9358931a9 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/IotTest.java
@@ -691,7 +691,7 @@ class IotTest {
assertThat(described.certificateDescription().status()).isEqualTo(CertificateStatus.ACTIVE);
assertThat(described.certificateDescription().certificateMode()).isEqualTo(CertificateMode.DEFAULT);
assertThat(described.certificateDescription().validity().notAfter())
- .isEqualTo(java.time.Instant.parse("2049-12-31T23:59:59Z"));
+ .isEqualTo(Instant.parse("2049-12-31T23:59:59Z"));
assertThat(cert.certificateId()).matches("[0-9a-f]{64}");
assertThat(cert.keyPair().privateKey()).startsWith("-----BEGIN RSA PRIVATE KEY-----");
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsFeaturesTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsFeaturesTest.java
index 3598636d37..20a55d8b70 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsFeaturesTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsFeaturesTest.java
@@ -22,6 +22,7 @@ import software.amazon.awssdk.services.kms.model.KeyState;
import software.amazon.awssdk.services.kms.model.KeyUsageType;
import software.amazon.awssdk.services.kms.model.KmsInvalidStateException;
import software.amazon.awssdk.services.kms.model.ListResourceTagsResponse;
+import software.amazon.awssdk.services.kms.model.MacAlgorithmSpec;
import software.amazon.awssdk.services.kms.model.OriginType;
import software.amazon.awssdk.services.kms.model.SignResponse;
import software.amazon.awssdk.services.kms.model.SigningAlgorithmSpec;
@@ -38,6 +39,7 @@ import java.security.spec.MGF1ParameterSpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Arrays;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.*;
@@ -83,7 +85,7 @@ class KmsFeaturesTest {
ListResourceTagsResponse tags = kms.listResourceTags(b -> b.keyId(keyId));
Map<String, String> tagMap = tags.tags().stream()
- .collect(java.util.stream.Collectors.toMap(
+ .collect(Collectors.toMap(
software.amazon.awssdk.services.kms.model.Tag::tagKey,
software.amazon.awssdk.services.kms.model.Tag::tagValue));
@@ -212,8 +214,8 @@ class KmsFeaturesTest {
String keyId = resp.keyMetadata().keyId();
assertThat(resp.keyMetadata().signingAlgorithms())
- .contains(software.amazon.awssdk.services.kms.model.SigningAlgorithmSpec.RSASSA_PKCS1_V1_5_SHA_256,
- software.amazon.awssdk.services.kms.model.SigningAlgorithmSpec.RSASSA_PSS_SHA_256);
+ .contains(SigningAlgorithmSpec.RSASSA_PKCS1_V1_5_SHA_256,
+ SigningAlgorithmSpec.RSASSA_PSS_SHA_256);
assertThat(resp.keyMetadata().encryptionAlgorithms()).isEmpty();
kms.scheduleKeyDeletion(b -> b.keyId(keyId).pendingWindowInDays(7));
@@ -229,7 +231,7 @@ class KmsFeaturesTest {
String keyId = resp.keyMetadata().keyId();
assertThat(resp.keyMetadata().macAlgorithms())
- .containsExactly(software.amazon.awssdk.services.kms.model.MacAlgorithmSpec.HMAC_SHA_256);
+ .containsExactly(MacAlgorithmSpec.HMAC_SHA_256);
assertThat(resp.keyMetadata().signingAlgorithms()).isEmpty();
assertThat(resp.keyMetadata().encryptionAlgorithms()).isEmpty();
@@ -483,11 +485,11 @@ class KmsFeaturesTest {
try {
byte[] publicKeyDer = kms.getPublicKey(b -> b.keyId(keyId)).publicKey().asByteArray();
PublicKey publicKey = KeyFactory.getInstance("RSA")
- .generatePublic(new java.security.spec.X509EncodedKeySpec(publicKeyDer));
+ .generatePublic(new X509EncodedKeySpec(publicKeyDer));
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPPadding");
- cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, publicKey, new javax.crypto.spec.OAEPParameterSpec(
- "SHA-256", "MGF1", java.security.spec.MGF1ParameterSpec.SHA256,
- javax.crypto.spec.PSource.PSpecified.DEFAULT));
+ cipher.init(Cipher.ENCRYPT_MODE, publicKey, new OAEPParameterSpec(
+ "SHA-256", "MGF1", MGF1ParameterSpec.SHA256,
+ PSource.PSpecified.DEFAULT));
byte[] localCiphertext = cipher.doFinal("secret payload".getBytes(StandardCharsets.UTF_8));
DecryptResponse decrypted = kms.decrypt(b -> b
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsTest.java
index d8f002b5ff..968397fe1c 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/KmsTest.java
@@ -6,6 +6,7 @@ import software.amazon.awssdk.services.kms.KmsClient;
import software.amazon.awssdk.services.kms.model.*;
import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
import static org.assertj.core.api.Assertions.*;
@@ -216,7 +217,7 @@ class KmsTest {
String asymmetricKeyId = createResponse.keyMetadata().keyId();
// SHA-256 hash of "hello"
- byte[] digest = java.security.MessageDigest.getInstance("SHA-256")
+ byte[] digest = MessageDigest.getInstance("SHA-256")
.digest("hello".getBytes(StandardCharsets.UTF_8));
SdkBytes msg = SdkBytes.fromByteArray(digest);
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java
index a65a0956c1..1333fb00f6 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/LambdaFunctionConfigTest.java
@@ -4,10 +4,14 @@ import org.junit.jupiter.api.*;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.services.lambda.LambdaClient;
import software.amazon.awssdk.services.lambda.model.*;
+import software.amazon.awssdk.services.lambda.model.ImageConfig;
+import software.amazon.awssdk.services.lambda.model.PackageType;
import software.amazon.awssdk.services.lambda.model.Runtime;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
+import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.*;
@@ -156,7 +160,7 @@ class LambdaFunctionConfigTest {
.runtime(Runtime.NODEJS20_X)
.role(ROLE)
.handler("index.handler")
- .architectures(java.util.List.of(Architecture.ARM64))
+ .architectures(List.of(Architecture.ARM64))
.code(FunctionCode.builder()
.zipFile(SdkBytes.fromByteArray(LambdaUtils.minimalZip()))
.build())
@@ -201,7 +205,7 @@ class LambdaFunctionConfigTest {
UpdateFunctionConfigurationRequest.builder()
.functionName(FN)
.environment(Environment.builder()
- .variables(java.util.Map.of("KEY_A", "value-a", "KEY_B", "value-b"))
+ .variables(Map.of("KEY_A", "value-a", "KEY_B", "value-b"))
.build())
.build());
@@ -237,12 +241,12 @@ class LambdaFunctionConfigTest {
try {
CreateFunctionResponse createResp = lambda.createFunction(CreateFunctionRequest.builder()
.functionName(imageFn)
- .packageType(software.amazon.awssdk.services.lambda.model.PackageType.IMAGE)
+ .packageType(PackageType.IMAGE)
.role(ROLE)
.code(FunctionCode.builder()
.imageUri("000000000000.dkr.ecr.us-east-1.amazonaws.com/fake-repo:latest")
.build())
- .imageConfig(software.amazon.awssdk.services.lambda.model.ImageConfig.builder()
+ .imageConfig(ImageConfig.builder()
.workingDirectory("/app")
.build())
.build());
@@ -261,7 +265,7 @@ class LambdaFunctionConfigTest {
UpdateFunctionConfigurationResponse updateResp = lambda.updateFunctionConfiguration(
UpdateFunctionConfigurationRequest.builder()
.functionName(imageFn)
- .imageConfig(software.amazon.awssdk.services.lambda.model.ImageConfig.builder()
+ .imageConfig(ImageConfig.builder()
.workingDirectory("/updated")
.build())
.build());
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java
index 2882758a04..5d5523f3f4 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MacieOrganizationAdministrationTest.java
@@ -5,6 +5,8 @@ import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.macie2.Macie2Client;
import software.amazon.awssdk.services.macie2.model.CreateMemberResponse;
+import java.util.Map;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -38,7 +40,7 @@ class MacieOrganizationAdministrationTest {
CreateMemberResponse member = administrator.createMember(request -> request
.account(account -> account.accountId(MEMBER_ACCOUNT).email("[email protected]"))
- .tags(java.util.Map.of("team", "security")));
+ .tags(Map.of("team", "security")));
assertThat(member.arn())
.isEqualTo(TestFixtures.arn("macie2", ADMIN_ACCOUNT, "member/" + MEMBER_ACCOUNT));
assertThat(administrator.listMembers(request -> request.onlyAssociated("true")).members())
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MarketplaceDeploymentTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MarketplaceDeploymentTest.java
index 532dbfe2ea..4be5b78986 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MarketplaceDeploymentTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/MarketplaceDeploymentTest.java
@@ -5,6 +5,7 @@ import software.amazon.awssdk.services.marketplacedeployment.MarketplaceDeployme
import software.amazon.awssdk.services.marketplacedeployment.model.PutDeploymentParameterResponse;
import java.util.List;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -24,7 +25,7 @@ class MarketplaceDeploymentTest {
.productId("prod-sdk-compat")
.agreementId("agr-sdk-compat")
.deploymentParameter(p -> p.name("ApiKey").secretString("local-secret"))
- .tags(java.util.Map.of("suite", "sdk-compat")));
+ .tags(Map.of("suite", "sdk-compat")));
assertNotNull(response.deploymentParameterId());
assertNotNull(response.resourceArn());
assertEquals("sdk-compat", response.tags().get("suite"));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PipesTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PipesTest.java
index 6d7c9438ee..8a93542394 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PipesTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/PipesTest.java
@@ -6,6 +6,9 @@ import software.amazon.awssdk.services.pipes.model.*;
import software.amazon.awssdk.services.sqs.SqsClient;
import software.amazon.awssdk.services.sqs.model.*;
+import java.util.HashSet;
+import java.util.Set;
+
import static org.assertj.core.api.Assertions.*;
@DisplayName("EventBridge Pipes")
@@ -284,7 +287,7 @@ class PipesTest {
.build());
}
- java.util.Set<String> foundMessages = new java.util.HashSet<>();
+ Set<String> foundMessages = new HashSet<>();
for (int i = 0; i < 20 && foundMessages.size() < 3; i++) {
Thread.sleep(1000);
ReceiveMessageResponse recv = sqs.receiveMessage(ReceiveMessageRequest.builder()
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RamOrganizationSharingTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RamOrganizationSharingTest.java
index 2e6d0f566c..9d3c50b505 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RamOrganizationSharingTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RamOrganizationSharingTest.java
@@ -4,6 +4,7 @@ import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.iam.IamClient;
import software.amazon.awssdk.services.organizations.OrganizationsClient;
+import software.amazon.awssdk.services.organizations.model.AwsOrganizationsNotInUseException;
import software.amazon.awssdk.services.ram.RamClient;
import static org.assertj.core.api.Assertions.assertThat;
@@ -23,7 +24,7 @@ class RamOrganizationSharingTest {
IamClient iam = TestFixtures.iamClient(MANAGEMENT_ACCOUNT)) {
try {
organizations.describeOrganization();
- } catch (software.amazon.awssdk.services.organizations.model.AwsOrganizationsNotInUseException e) {
+ } catch (AwsOrganizationsNotInUseException e) {
organizations.createOrganization(request -> request.featureSet("ALL"));
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java
index 3e9ccc2457..61e8c3137d 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java
@@ -1053,7 +1053,7 @@ class RdsControlPlaneTest {
.build();
}
- private static software.amazon.awssdk.services.rds.model.CreateDbInstanceResponse createDbInstance(
+ private static CreateDbInstanceResponse createDbInstance(
RdsClient client, String name, String password) {
return client.createDBInstance(b -> b
.dbInstanceIdentifier(name)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3AnnotationsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3AnnotationsTest.java
index 72b26501be..3c6498e15d 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3AnnotationsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3AnnotationsTest.java
@@ -7,6 +7,7 @@ import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.AnnotationDirective;
import software.amazon.awssdk.services.s3.model.AnnotationEntry;
import software.amazon.awssdk.services.s3.model.BucketVersioningStatus;
+import software.amazon.awssdk.services.s3.model.ChecksumAlgorithm;
import software.amazon.awssdk.services.s3.model.ChecksumMode;
import software.amazon.awssdk.services.s3.model.CreateBucketRequest;
import software.amazon.awssdk.services.s3.model.GetObjectAnnotationResponse;
@@ -117,7 +118,7 @@ class S3AnnotationsTest {
void putObjectAnnotationWithChecksum() {
PutObjectAnnotationResponse response = s3.putObjectAnnotation(PutObjectAnnotationRequest.builder()
.bucket(BUCKET).key(KEY).annotationName("hashed")
- .checksumAlgorithm(software.amazon.awssdk.services.s3.model.ChecksumAlgorithm.SHA256)
+ .checksumAlgorithm(ChecksumAlgorithm.SHA256)
.build(),
RequestBody.fromString("checksummed payload"));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3MultipartChecksumTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3MultipartChecksumTest.java
index 09cb3a9afa..41dccd90d2 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3MultipartChecksumTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/S3MultipartChecksumTest.java
@@ -35,6 +35,7 @@ import java.io.ByteArrayOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Base64;
import java.util.HexFormat;
import java.util.List;
@@ -298,7 +299,7 @@ class S3MultipartChecksumTest {
int offset = 0;
for (int i = 0; i < reported.size(); i++) {
int size = reported.get(i).size().intValue();
- parts[i] = java.util.Arrays.copyOfRange(whole, offset, offset + size);
+ parts[i] = Arrays.copyOfRange(whole, offset, offset + size);
offset += size;
}
assertThat(offset).isEqualTo(whole.length);
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SchedulerTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SchedulerTest.java
index 4a9f2123ce..c89625b004 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SchedulerTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SchedulerTest.java
@@ -3,6 +3,7 @@ package com.floci.test;
import org.junit.jupiter.api.*;
import software.amazon.awssdk.services.scheduler.SchedulerClient;
import software.amazon.awssdk.services.scheduler.model.*;
+import software.amazon.awssdk.services.scheduler.model.RetryPolicy;
import software.amazon.awssdk.services.scheduler.model.Tag;
import java.time.Instant;
@@ -311,7 +312,7 @@ class SchedulerTest {
.target(Target.builder()
.arn("arn:aws:lambda:us-east-1:000000000000:function:rp-func")
.roleArn("arn:aws:iam::000000000000:role/r")
- .retryPolicy(software.amazon.awssdk.services.scheduler.model.RetryPolicy.builder()
+ .retryPolicy(RetryPolicy.builder()
.maximumEventAgeInSeconds(3600)
.maximumRetryAttempts(5)
.build())
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java
index d0407dbd12..6d0cde4749 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SecretsManagerTest.java
@@ -46,14 +46,19 @@ import software.amazon.awssdk.services.secretsmanager.model.RotateSecretResponse
import software.amazon.awssdk.services.secretsmanager.model.RotationRulesType;
import software.amazon.awssdk.services.secretsmanager.model.SecretVersionsListEntry;
import software.amazon.awssdk.services.secretsmanager.model.SecretsManagerException;
+import software.amazon.awssdk.services.secretsmanager.model.Tag;
import software.amazon.awssdk.services.secretsmanager.model.TagResourceRequest;
import software.amazon.awssdk.services.secretsmanager.model.UntagResourceRequest;
import software.amazon.awssdk.services.secretsmanager.model.UpdateSecretRequest;
+import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -95,7 +100,7 @@ class SecretsManagerTest {
.name(secretName)
.secretString(SECRET_VALUE)
.description("Test secret")
- .tags(software.amazon.awssdk.services.secretsmanager.model.Tag.builder().key("env").value("test").build())
+ .tags(Tag.builder().key("env").value("test").build())
.build());
secretArn = response.arn();
@@ -191,7 +196,7 @@ class SecretsManagerTest {
void tagResource() {
sm.tagResource(TagResourceRequest.builder()
.secretId(secretName)
- .tags(software.amazon.awssdk.services.secretsmanager.model.Tag.builder().key("team").value("backend").build())
+ .tags(Tag.builder().key("team").value("backend").build())
.build());
DescribeSecretResponse response = sm.describeSecret(DescribeSecretRequest.builder()
@@ -241,10 +246,10 @@ class SecretsManagerTest {
void rotateSecretStub() throws Exception {
String lambdaName = "RotationLambda-" + System.currentTimeMillis();
try (LambdaClient lambda = TestFixtures.lambdaClient()) {
- java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
- try (java.util.zip.ZipOutputStream zos = new java.util.zip.ZipOutputStream(baos)) {
- zos.putNextEntry(new java.util.zip.ZipEntry("index.js"));
- zos.write("exports.handler = async (event) => { return 'ok'; };".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+ zos.putNextEntry(new ZipEntry("index.js"));
+ zos.write("exports.handler = async (event) => { return 'ok'; };".getBytes(StandardCharsets.UTF_8));
zos.closeEntry();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesAccountAttributesTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesAccountAttributesTest.java
index 8a540ad80c..1fd7754922 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesAccountAttributesTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesAccountAttributesTest.java
@@ -1,6 +1,7 @@
package com.floci.test;
import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.MethodOrderer;
@@ -215,7 +216,7 @@ class SesAccountAttributesTest {
// review status or case id. Skip it entirely on real AWS rather than risk changing a real
// caller's account; against Floci the in-memory store makes the round-trip safe and it still
// catches a mis-wired route there.
- org.junit.jupiter.api.Assumptions.assumeFalse(TestFixtures.isRealAws(),
+ Assumptions.assumeFalse(TestFixtures.isRealAws(),
"skipping on real AWS: PutAccountDetails cannot be reset and AWS owns ReviewDetails");
sesV2.putAccountDetails(PutAccountDetailsRequest.builder()
.mailType(MailType.TRANSACTIONAL)
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetEventDestinationTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetEventDestinationTest.java
index e0fcbd6d80..b4ab0e5e23 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetEventDestinationTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetEventDestinationTest.java
@@ -13,6 +13,12 @@ import org.junit.jupiter.params.provider.MethodSource;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.ses.SesClient;
+import software.amazon.awssdk.services.ses.model.ConfigurationSetAttribute;
+import software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest;
+import software.amazon.awssdk.services.ses.model.DescribeConfigurationSetResponse;
+import software.amazon.awssdk.services.ses.model.EventDestination;
+import software.amazon.awssdk.services.ses.model.KinesisFirehoseDestination;
+import software.amazon.awssdk.services.ses.model.SNSDestination;
import software.amazon.awssdk.services.sesv2.SesV2Client;
import software.amazon.awssdk.services.sesv2.model.BadRequestException;
import software.amazon.awssdk.services.sesv2.model.CreateConfigurationSetEventDestinationRequest;
@@ -323,13 +329,13 @@ class SesConfigurationSetEventDestinationTest {
sesV1.createConfigurationSetEventDestination(
software.amazon.awssdk.services.ses.model.CreateConfigurationSetEventDestinationRequest.builder()
.configurationSetName(v1CsName)
- .eventDestination(software.amazon.awssdk.services.ses.model.EventDestination.builder()
+ .eventDestination(EventDestination.builder()
.name(ED_NAME)
.enabled(true)
.matchingEventTypes(
software.amazon.awssdk.services.ses.model.EventType.SEND,
software.amazon.awssdk.services.ses.model.EventType.BOUNCE)
- .snsDestination(software.amazon.awssdk.services.ses.model.SNSDestination.builder()
+ .snsDestination(SNSDestination.builder()
.topicARN(TOPIC_ARN)
.build())
.build())
@@ -339,15 +345,15 @@ class SesConfigurationSetEventDestinationTest {
@Test
@Order(11)
void v1_describeConfigurationSet_withEventDestinationsAttribute_returnsRoundTrip() {
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetResponse resp =
+ DescribeConfigurationSetResponse resp =
sesV1.describeConfigurationSet(
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest.builder()
+ DescribeConfigurationSetRequest.builder()
.configurationSetName(v1CsName)
.configurationSetAttributeNames(
- software.amazon.awssdk.services.ses.model.ConfigurationSetAttribute.EVENT_DESTINATIONS)
+ ConfigurationSetAttribute.EVENT_DESTINATIONS)
.build());
assertThat(resp.eventDestinations()).hasSize(1);
- software.amazon.awssdk.services.ses.model.EventDestination ed = resp.eventDestinations().get(0);
+ EventDestination ed = resp.eventDestinations().get(0);
assertThat(ed.name()).isEqualTo(ED_NAME);
assertThat(ed.enabled()).isTrue();
assertThat(ed.matchingEventTypes()).contains(
@@ -360,9 +366,9 @@ class SesConfigurationSetEventDestinationTest {
@Test
@Order(12)
void v1_describeConfigurationSet_withoutEventDestinationsAttribute_returnsEmptyList() {
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetResponse resp =
+ DescribeConfigurationSetResponse resp =
sesV1.describeConfigurationSet(
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest.builder()
+ DescribeConfigurationSetRequest.builder()
.configurationSetName(v1CsName)
.build());
assertThat(resp.eventDestinations()).isEmpty();
@@ -374,11 +380,11 @@ class SesConfigurationSetEventDestinationTest {
assertThatThrownBy(() -> sesV1.createConfigurationSetEventDestination(
software.amazon.awssdk.services.ses.model.CreateConfigurationSetEventDestinationRequest.builder()
.configurationSetName(v1CsName)
- .eventDestination(software.amazon.awssdk.services.ses.model.EventDestination.builder()
+ .eventDestination(EventDestination.builder()
.name(ED_NAME)
.enabled(true)
.matchingEventTypes(software.amazon.awssdk.services.ses.model.EventType.SEND)
- .snsDestination(software.amazon.awssdk.services.ses.model.SNSDestination.builder()
+ .snsDestination(SNSDestination.builder()
.topicARN(TOPIC_ARN)
.build())
.build())
@@ -394,24 +400,24 @@ class SesConfigurationSetEventDestinationTest {
sesV1.updateConfigurationSetEventDestination(
software.amazon.awssdk.services.ses.model.UpdateConfigurationSetEventDestinationRequest.builder()
.configurationSetName(v1CsName)
- .eventDestination(software.amazon.awssdk.services.ses.model.EventDestination.builder()
+ .eventDestination(EventDestination.builder()
.name(ED_NAME)
.enabled(false)
.matchingEventTypes(software.amazon.awssdk.services.ses.model.EventType.COMPLAINT)
- .snsDestination(software.amazon.awssdk.services.ses.model.SNSDestination.builder()
+ .snsDestination(SNSDestination.builder()
.topicARN(TOPIC_ARN_2)
.build())
.build())
.build());
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetResponse resp =
+ DescribeConfigurationSetResponse resp =
sesV1.describeConfigurationSet(
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest.builder()
+ DescribeConfigurationSetRequest.builder()
.configurationSetName(v1CsName)
.configurationSetAttributeNames(
- software.amazon.awssdk.services.ses.model.ConfigurationSetAttribute.EVENT_DESTINATIONS)
+ ConfigurationSetAttribute.EVENT_DESTINATIONS)
.build());
- software.amazon.awssdk.services.ses.model.EventDestination ed = resp.eventDestinations().get(0);
+ EventDestination ed = resp.eventDestinations().get(0);
assertThat(ed.enabled()).isFalse();
assertThat(ed.matchingEventTypes())
.containsExactly(software.amazon.awssdk.services.ses.model.EventType.COMPLAINT);
@@ -424,11 +430,11 @@ class SesConfigurationSetEventDestinationTest {
assertThatThrownBy(() -> sesV1.updateConfigurationSetEventDestination(
software.amazon.awssdk.services.ses.model.UpdateConfigurationSetEventDestinationRequest.builder()
.configurationSetName(v1CsName)
- .eventDestination(software.amazon.awssdk.services.ses.model.EventDestination.builder()
+ .eventDestination(EventDestination.builder()
.name("ed-ghost")
.enabled(true)
.matchingEventTypes(software.amazon.awssdk.services.ses.model.EventType.SEND)
- .snsDestination(software.amazon.awssdk.services.ses.model.SNSDestination.builder()
+ .snsDestination(SNSDestination.builder()
.topicARN(TOPIC_ARN)
.build())
.build())
@@ -442,12 +448,12 @@ class SesConfigurationSetEventDestinationTest {
assertThatThrownBy(() -> sesV1.createConfigurationSetEventDestination(
software.amazon.awssdk.services.ses.model.CreateConfigurationSetEventDestinationRequest.builder()
.configurationSetName(v1CsName)
- .eventDestination(software.amazon.awssdk.services.ses.model.EventDestination.builder()
+ .eventDestination(EventDestination.builder()
.name("ed-firehose-bad")
.enabled(true)
.matchingEventTypes(software.amazon.awssdk.services.ses.model.EventType.SEND)
.kinesisFirehoseDestination(
- software.amazon.awssdk.services.ses.model.KinesisFirehoseDestination.builder()
+ KinesisFirehoseDestination.builder()
.iamRoleARN("arn:aws:iam::000000000000:role/ses-firehose")
.build())
.build())
@@ -465,12 +471,12 @@ class SesConfigurationSetEventDestinationTest {
.eventDestinationName(ED_NAME)
.build());
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetResponse resp =
+ DescribeConfigurationSetResponse resp =
sesV1.describeConfigurationSet(
- software.amazon.awssdk.services.ses.model.DescribeConfigurationSetRequest.builder()
+ DescribeConfigurationSetRequest.builder()
.configurationSetName(v1CsName)
.configurationSetAttributeNames(
- software.amazon.awssdk.services.ses.model.ConfigurationSetAttribute.EVENT_DESTINATIONS)
+ ConfigurationSetAttribute.EVENT_DESTINATIONS)
.build());
assertThat(resp.eventDestinations()).isEmpty();
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetTest.java
index fb444a4255..29460a7d26 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SesConfigurationSetTest.java
@@ -23,6 +23,8 @@ import software.amazon.awssdk.services.sesv2.model.PutConfigurationSetSuppressio
import software.amazon.awssdk.services.sesv2.model.SuppressionListReason;
import software.amazon.awssdk.services.sesv2.model.Tag;
+import java.util.Collections;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -266,7 +268,7 @@ class SesConfigurationSetTest {
// to disable suppression filtering for a configuration set.
sesV2.putConfigurationSetSuppressionOptions(PutConfigurationSetSuppressionOptionsRequest.builder()
.configurationSetName(suppressionCsName)
- .suppressedReasons(java.util.Collections.emptyList())
+ .suppressedReasons(Collections.emptyList())
.build());
GetConfigurationSetResponse after = sesV2.getConfigurationSet(GetConfigurationSetRequest.builder()
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SnsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SnsTest.java
index 38dc26f951..838a9bc69d 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SnsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SnsTest.java
@@ -42,6 +42,15 @@ import software.amazon.awssdk.services.sns.model.VerificationException;
import software.amazon.awssdk.services.sns.model.VerifySmsSandboxPhoneNumberRequest;
import software.amazon.awssdk.services.sqs.SqsClient;
import software.amazon.awssdk.services.sqs.model.*;
+import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
+import software.amazon.awssdk.services.sqs.model.DeleteMessageRequest;
+import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;
+import software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest;
+import software.amazon.awssdk.services.sqs.model.Message;
+import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName;
+import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
+import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
+import software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse;
import java.net.URI;
import java.net.URLEncoder;
@@ -52,6 +61,7 @@ import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -80,7 +90,7 @@ class SnsTest {
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(topicArn).build());
} catch (Exception ignored) {}
try {
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(queueUrl).build());
} catch (Exception ignored) {}
sns.close();
@@ -121,13 +131,13 @@ class SnsTest {
@Order(4)
void subscribeSqs() {
String queueName = "sns-test-queue-" + System.currentTimeMillis();
- queueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ queueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName(queueName).build()).queueUrl();
- queueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ queueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(queueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
SubscribeResponse response = sns.subscribe(SubscribeRequest.builder()
.topicArn(topicArn)
@@ -166,8 +176,8 @@ class SnsTest {
void verifySqsDelivery() throws InterruptedException {
Thread.sleep(500); // Allow async delivery
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse recv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse recv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(queueUrl)
.maxNumberOfMessages(1)
.waitTimeSeconds(2)
@@ -176,7 +186,7 @@ class SnsTest {
assertThat(recv.messages()).isNotEmpty();
assertThat(recv.messages().get(0).body()).contains("hello from sns");
- sqs.deleteMessage(software.amazon.awssdk.services.sqs.model.DeleteMessageRequest.builder()
+ sqs.deleteMessage(DeleteMessageRequest.builder()
.queueUrl(queueUrl)
.receiptHandle(recv.messages().get(0).receiptHandle())
.build());
@@ -196,8 +206,8 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse recv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse recv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(queueUrl)
.maxNumberOfMessages(1)
.waitTimeSeconds(2)
@@ -206,7 +216,7 @@ class SnsTest {
assertThat(recv.messages()).isNotEmpty();
assertThat(recv.messages().get(0).body()).contains("my-value");
- sqs.deleteMessage(software.amazon.awssdk.services.sqs.model.DeleteMessageRequest.builder()
+ sqs.deleteMessage(DeleteMessageRequest.builder()
.queueUrl(queueUrl)
.receiptHandle(recv.messages().get(0).receiptHandle())
.build());
@@ -216,13 +226,13 @@ class SnsTest {
@Order(9)
void rawMessageDelivery() throws InterruptedException {
String rawQueueName = "sns-raw-delivery-" + System.currentTimeMillis();
- String rawQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String rawQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName(rawQueueName).build()).queueUrl();
- String rawQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String rawQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(rawQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String rawSubArn = sns.subscribe(SubscribeRequest.builder()
.topicArn(topicArn)
@@ -249,8 +259,8 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse rawRecv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse rawRecv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(rawQueueUrl)
.maxNumberOfMessages(1)
.waitTimeSeconds(2)
@@ -270,7 +280,7 @@ class SnsTest {
// Cleanup
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(rawSubArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(rawQueueUrl).build());
}
@@ -291,15 +301,15 @@ class SnsTest {
@Order(12)
void fifoExplicitDedup() throws InterruptedException {
String fifoQueueName = "sns-fifo-explicit-" + System.currentTimeMillis() + ".fifo";
- String fifoQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String fifoQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName(fifoQueueName)
- .attributes(Map.of(software.amazon.awssdk.services.sqs.model.QueueAttributeName.FIFO_QUEUE, "true"))
+ .attributes(Map.of(QueueAttributeName.FIFO_QUEUE, "true"))
.build()).queueUrl();
- String fifoQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String fifoQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(fifoQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String fifoTopicName = "sns-fifo-explicit-" + System.currentTimeMillis() + ".fifo";
String fifoTopicArn = sns.createTopic(CreateTopicRequest.builder()
@@ -323,23 +333,23 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse fifoRecv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse fifoRecv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(fifoQueueUrl)
.maxNumberOfMessages(1)
.waitTimeSeconds(2)
- .messageSystemAttributeNames(software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID)
+ .messageSystemAttributeNames(MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID)
.build());
assertThat(fifoRecv.messages()).isNotEmpty();
String receivedDedupId = fifoRecv.messages().get(0).attributes()
- .get(software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID);
+ .get(MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID);
assertThat(receivedDedupId).isEqualTo(explicitDedupId);
// Cleanup
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(fifoSubArn).build());
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(fifoTopicArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(fifoQueueUrl).build());
}
@@ -347,15 +357,15 @@ class SnsTest {
@Order(13)
void fifoContentBasedDedup() throws InterruptedException {
String cbdQueueName = "sns-fifo-cbd-" + System.currentTimeMillis() + ".fifo";
- String cbdQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String cbdQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName(cbdQueueName)
- .attributes(Map.of(software.amazon.awssdk.services.sqs.model.QueueAttributeName.FIFO_QUEUE, "true"))
+ .attributes(Map.of(QueueAttributeName.FIFO_QUEUE, "true"))
.build()).queueUrl();
- String cbdQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String cbdQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(cbdQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String cbdTopicName = "sns-fifo-cbd-" + System.currentTimeMillis() + ".fifo";
String cbdTopicArn = sns.createTopic(CreateTopicRequest.builder()
@@ -380,23 +390,23 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse cbdRecv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse cbdRecv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(cbdQueueUrl)
.maxNumberOfMessages(1)
.waitTimeSeconds(2)
- .messageSystemAttributeNames(software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID)
+ .messageSystemAttributeNames(MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID)
.build());
assertThat(cbdRecv.messages()).isNotEmpty();
String receivedDedupId = cbdRecv.messages().get(0).attributes()
- .get(software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID);
+ .get(MessageSystemAttributeName.MESSAGE_DEDUPLICATION_ID);
assertThat(receivedDedupId).isNotEmpty();
// Cleanup
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(cbdSubArn).build());
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(cbdTopicArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(cbdQueueUrl).build());
}
@@ -404,13 +414,13 @@ class SnsTest {
@Order(14)
void filterPolicyScope_messageBody_topLevelMatch() throws InterruptedException {
long stamp = System.currentTimeMillis();
- String mbQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String mbQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName("sns-mb-filter-" + stamp).build()).queueUrl();
- String mbQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String mbQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(mbQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String mbTopicArn = sns.createTopic(CreateTopicRequest.builder()
.name("sns-mb-filter-" + stamp).build()).topicArn();
@@ -443,8 +453,8 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse recv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse recv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(mbQueueUrl)
.maxNumberOfMessages(10)
.waitTimeSeconds(2)
@@ -455,7 +465,7 @@ class SnsTest {
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(mbSubArn).build());
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(mbTopicArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(mbQueueUrl).build());
}
@@ -463,13 +473,13 @@ class SnsTest {
@Order(15)
void filterPolicyScope_messageBody_nestedKeyDescent() throws InterruptedException {
long stamp = System.currentTimeMillis();
- String nestedQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String nestedQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName("sns-mb-nested-" + stamp).build()).queueUrl();
- String nestedQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String nestedQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(nestedQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String nestedTopicArn = sns.createTopic(CreateTopicRequest.builder()
.name("sns-mb-nested-" + stamp).build()).topicArn();
@@ -502,8 +512,8 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse recv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse recv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(nestedQueueUrl)
.maxNumberOfMessages(10)
.waitTimeSeconds(2)
@@ -514,7 +524,7 @@ class SnsTest {
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(nestedSubArn).build());
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(nestedTopicArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(nestedQueueUrl).build());
}
@@ -522,13 +532,13 @@ class SnsTest {
@Order(16)
void publishBatchPreservesPerEntryMessageAttributes() throws InterruptedException {
long stamp = System.currentTimeMillis();
- String batchQueueUrl = sqs.createQueue(software.amazon.awssdk.services.sqs.model.CreateQueueRequest.builder()
+ String batchQueueUrl = sqs.createQueue(CreateQueueRequest.builder()
.queueName("sns-batch-attrs-" + stamp).build()).queueUrl();
- String batchQueueArn = sqs.getQueueAttributes(software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest.builder()
+ String batchQueueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
.queueUrl(batchQueueUrl)
- .attributeNames(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN)
+ .attributeNames(QueueAttributeName.QUEUE_ARN)
.build())
- .attributes().get(software.amazon.awssdk.services.sqs.model.QueueAttributeName.QUEUE_ARN);
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
String batchTopicArn = sns.createTopic(CreateTopicRequest.builder()
.name("sns-batch-attrs-" + stamp).build()).topicArn();
@@ -575,8 +585,8 @@ class SnsTest {
Thread.sleep(500);
- software.amazon.awssdk.services.sqs.model.ReceiveMessageResponse batchRecv = sqs.receiveMessage(
- software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest.builder()
+ ReceiveMessageResponse batchRecv = sqs.receiveMessage(
+ ReceiveMessageRequest.builder()
.queueUrl(batchQueueUrl)
.maxNumberOfMessages(10)
.waitTimeSeconds(2)
@@ -586,8 +596,8 @@ class SnsTest {
assertThat(batchRecv.messages()).hasSize(2);
Map<String, Message> byBody = batchRecv.messages().stream()
- .collect(java.util.stream.Collectors.toMap(
- software.amazon.awssdk.services.sqs.model.Message::body, m -> m));
+ .collect(Collectors.toMap(
+ Message::body, m -> m));
Message messageA = byBody.get("batch-msg-a");
assertThat(messageA.messageAttributes()).containsKeys("ce-type", "ce-id");
@@ -602,7 +612,7 @@ class SnsTest {
sns.unsubscribe(UnsubscribeRequest.builder().subscriptionArn(batchSubArn).build());
sns.deleteTopic(DeleteTopicRequest.builder().topicArn(batchTopicArn).build());
- sqs.deleteQueue(software.amazon.awssdk.services.sqs.model.DeleteQueueRequest.builder()
+ sqs.deleteQueue(DeleteQueueRequest.builder()
.queueUrl(batchQueueUrl).build());
}
@Test
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoAdminAccountAssignmentTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoAdminAccountAssignmentTest.java
index ebd96a0840..e288142bac 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoAdminAccountAssignmentTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoAdminAccountAssignmentTest.java
@@ -2,9 +2,11 @@ package com.floci.test;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.core.document.Document;
import software.amazon.awssdk.services.ssoadmin.SsoAdminClient;
import software.amazon.awssdk.services.ssoadmin.model.AddRegionResponse;
import software.amazon.awssdk.services.ssoadmin.model.AttachCustomerManagedPolicyReferenceToPermissionSetResponse;
+import software.amazon.awssdk.services.ssoadmin.model.ConflictException;
import software.amazon.awssdk.services.ssoadmin.model.CreateAccountAssignmentResponse;
import software.amazon.awssdk.services.ssoadmin.model.CreateApplicationAssignmentResponse;
import software.amazon.awssdk.services.ssoadmin.model.CreateApplicationResponse;
@@ -64,6 +66,8 @@ import software.amazon.awssdk.services.ssoadmin.model.PutApplicationGrantRespons
import software.amazon.awssdk.services.ssoadmin.model.PutApplicationSessionConfigurationResponse;
import software.amazon.awssdk.services.ssoadmin.model.PutPermissionsBoundaryToPermissionSetResponse;
import software.amazon.awssdk.services.ssoadmin.model.RemoveRegionResponse;
+import software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException;
+import software.amazon.awssdk.services.ssoadmin.model.ServiceQuotaExceededException;
import software.amazon.awssdk.services.ssoadmin.model.TagResourceResponse;
import software.amazon.awssdk.services.ssoadmin.model.TargetType;
import software.amazon.awssdk.services.ssoadmin.model.UntagResourceResponse;
@@ -119,13 +123,13 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.describeRegion(request -> request
.instanceArn(instanceArn)
.regionName("ap-southeast-3")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
sso.addRegion(request -> request.instanceArn(instanceArn).regionName("ap-southeast-3"));
assertThatThrownBy(() -> sso.addRegion(request -> request
.instanceArn(instanceArn)
.regionName("ap-southeast-3")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ConflictException.class);
+ .isInstanceOf(ConflictException.class);
}
}
@@ -164,7 +168,7 @@ class SsoAdminAccountAssignmentTest {
.customerManagedPolicyReference(reference -> reference
.name("platformpolicy")
.path("/platform/"))))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ConflictException.class);
+ .isInstanceOf(ConflictException.class);
DetachCustomerManagedPolicyReferenceFromPermissionSetResponse detached = sso.detachCustomerManagedPolicyReferenceFromPermissionSet(request -> request
.instanceArn(instanceArn)
@@ -179,7 +183,7 @@ class SsoAdminAccountAssignmentTest {
.customerManagedPolicyReference(reference -> reference
.name("PlatformPolicy")
.path("/platform/"))))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
@@ -384,7 +388,7 @@ class SsoAdminAccountAssignmentTest {
.applicationArn(applicationArn)
.principalId("11111111-2222-3333-4444-555555555555")
.principalType("USER")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ConflictException.class);
+ .isInstanceOf(ConflictException.class);
String groupId = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
sso.createApplicationAssignment(request -> request
@@ -430,7 +434,7 @@ class SsoAdminAccountAssignmentTest {
.applicationArn(applicationArn)
.principalId(principalId)
.principalType("GROUP")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
@@ -451,10 +455,10 @@ class SsoAdminAccountAssignmentTest {
.applicationArn(applicationArn)
.authenticationMethodType("IAM")
.authenticationMethod(method -> method.iam(iam -> iam.actorPolicy(
- software.amazon.awssdk.core.document.Document.mapBuilder()
+ Document.mapBuilder()
.putString("Version", "2012-10-17")
- .putDocument("Statement", software.amazon.awssdk.core.document.Document.fromList(
- java.util.List.of()))
+ .putDocument("Statement", Document.fromList(
+ List.of()))
.build()))));
assertThat(putMethod.sdkHttpResponse().isSuccessful()).isTrue();
GetApplicationAuthenticationMethodResponse fetchedMethod = sso.getApplicationAuthenticationMethod(request -> request
@@ -476,20 +480,20 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.getApplicationAuthenticationMethod(request -> request
.applicationArn(applicationArn)
.authenticationMethodType("IAM")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
assertThatThrownBy(() -> sso.getApplicationAuthenticationMethod(request -> request
.applicationArn(applicationArn)
.authenticationMethodType("SAML")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ValidationException.class);
+ .isInstanceOf(ValidationException.class);
assertThatThrownBy(() -> sso.deleteApplicationAuthenticationMethod(request -> request
.applicationArn(applicationArn)
.authenticationMethodType("IAM")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
assertThatThrownBy(() -> sso.deleteApplicationAuthenticationMethod(request -> request
.applicationArn(applicationArn)
.authenticationMethodType("SAML")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ValidationException.class);
+ .isInstanceOf(ValidationException.class);
}
}
@@ -539,20 +543,20 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.getApplicationGrant(request -> request
.applicationArn(applicationArn)
.grantType("authorization_code")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
assertThatThrownBy(() -> sso.getApplicationGrant(request -> request
.applicationArn(applicationArn)
.grantType("client_credentials")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ValidationException.class);
+ .isInstanceOf(ValidationException.class);
assertThatThrownBy(() -> sso.deleteApplicationGrant(request -> request
.applicationArn(applicationArn)
.grantType("authorization_code")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
assertThatThrownBy(() -> sso.deleteApplicationGrant(request -> request
.applicationArn(applicationArn)
.grantType("client_credentials")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ValidationException.class);
+ .isInstanceOf(ValidationException.class);
}
}
@@ -618,7 +622,7 @@ class SsoAdminAccountAssignmentTest {
assertThat(deleteResponse.sdkHttpResponse().isSuccessful()).isTrue();
assertThatThrownBy(() -> sso.deleteTrustedTokenIssuer(request -> request
.trustedTokenIssuerArn(created.trustedTokenIssuerArn())))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
@@ -652,7 +656,7 @@ class SsoAdminAccountAssignmentTest {
.accessControlAttributes(attribute -> attribute
.key("Department")
.value(value -> value.source("${path:enterprise.department}"))))))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ConflictException.class);
+ .isInstanceOf(ConflictException.class);
UpdateInstanceAccessControlAttributeConfigurationResponse updateResponse = sso.updateInstanceAccessControlAttributeConfiguration(request -> request
.instanceArn(instanceArn)
@@ -729,7 +733,7 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.createInstance(request -> request
.name("SecondInstance")
.clientToken("sdk-create-instance-quota")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ServiceQuotaExceededException.class);
+ .isInstanceOf(ServiceQuotaExceededException.class);
}
}
@@ -770,11 +774,11 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.deleteApplicationAccessScope(request -> request
.applicationArn(applicationArn)
.scope("api:read")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
assertThatThrownBy(() -> sso.deleteApplicationAccessScope(request -> request
.applicationArn(applicationArn)
.scope("bad scope")))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ValidationException.class);
+ .isInstanceOf(ValidationException.class);
}
}
@@ -794,7 +798,7 @@ class SsoAdminAccountAssignmentTest {
DeleteApplicationResponse response = sso.deleteApplication(request -> request.applicationArn(applicationArn));
assertThat(response.sdkHttpResponse().isSuccessful()).isTrue();
assertThatThrownBy(() -> sso.deleteApplication(request -> request.applicationArn(applicationArn)))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
@@ -806,7 +810,7 @@ class SsoAdminAccountAssignmentTest {
try (SsoAdminClient sso = TestFixtures.ssoAdminClient()) {
String instanceArn = sso.listInstances(request -> {}).instances().get(0).instanceArn();
String principalId = "bbbbbbbb-cccc-dddd-eeee-ffffffffffff";
- for (String name : java.util.List.of("PrincipalListSdkOne", "PrincipalListSdkTwo")) {
+ for (String name : List.of("PrincipalListSdkOne", "PrincipalListSdkTwo")) {
String permissionSetArn = sso.createPermissionSet(request -> request
.instanceArn(instanceArn)
.name(name))
@@ -981,7 +985,7 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.getPermissionsBoundaryForPermissionSet(request -> request
.instanceArn(instanceArn)
.permissionSetArn(permissionSetArn)))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
@@ -1003,7 +1007,7 @@ class SsoAdminAccountAssignmentTest {
assertThatThrownBy(() -> sso.describePermissionSet(request -> request
.instanceArn(instanceArn)
.permissionSetArn(permissionSetArn)))
- .isInstanceOf(software.amazon.awssdk.services.ssoadmin.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
}
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java
index 75ac98f6d0..85897fae65 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoOidcTest.java
@@ -10,10 +10,19 @@ import software.amazon.awssdk.services.ssooidc.model.CreateTokenWithIamResponse;
import software.amazon.awssdk.services.ssooidc.model.RegisterClientResponse;
import software.amazon.awssdk.services.ssooidc.model.StartDeviceAuthorizationResponse;
+import java.io.IOException;
import java.net.URI;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
@@ -71,9 +80,9 @@ class SsoOidcTest {
advertisedUri.getRawPath() + "?" + advertisedUri.getRawQuery());
HttpRequest request = HttpRequest.newBuilder(uri).GET().build();
HttpResponse<String> browserResponse = TestFixtures.emulatorHttpClient().send(
- request, java.net.http.HttpResponse.BodyHandlers.ofString());
+ request, HttpResponse.BodyHandlers.ofString());
assertThat(browserResponse.statusCode()).isEqualTo(200);
- } catch (java.io.IOException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -120,7 +129,7 @@ class SsoOidcTest {
.build();
Document actorPolicy = Document.mapBuilder()
.putString("Version", "2012-10-17")
- .putDocument("Statement", Document.fromList(java.util.List.of(statement)))
+ .putDocument("Statement", Document.fromList(List.of(statement)))
.build();
sso.putApplicationAuthenticationMethod(request -> request
.applicationArn(applicationArn)
@@ -140,25 +149,25 @@ class SsoOidcTest {
String challenge = pkceChallenge(verifier);
String authorizeUrl = TestFixtures.endpoint().toString()
+ "/authorize?response_type=code&client_id="
- + java.net.URLEncoder.encode(applicationArn, java.nio.charset.StandardCharsets.UTF_8)
- + "&redirect_uri=" + java.net.URLEncoder.encode(redirectUri, java.nio.charset.StandardCharsets.UTF_8)
- + "&code_challenge=" + java.net.URLEncoder.encode(challenge, java.nio.charset.StandardCharsets.UTF_8)
+ + URLEncoder.encode(applicationArn, StandardCharsets.UTF_8)
+ + "&redirect_uri=" + URLEncoder.encode(redirectUri, StandardCharsets.UTF_8)
+ + "&code_challenge=" + URLEncoder.encode(challenge, StandardCharsets.UTF_8)
+ "&code_challenge_method=S256";
String code;
try {
HttpResponse<String> browserResponse = HttpClient.newBuilder()
- .followRedirects(java.net.http.HttpClient.Redirect.NEVER)
+ .followRedirects(HttpClient.Redirect.NEVER)
.build()
- .send(java.net.http.HttpRequest.newBuilder(java.net.URI.create(authorizeUrl)).GET().build(),
- java.net.http.HttpResponse.BodyHandlers.ofString());
+ .send(HttpRequest.newBuilder(URI.create(authorizeUrl)).GET().build(),
+ HttpResponse.BodyHandlers.ofString());
assertThat(browserResponse.statusCode()).isEqualTo(303);
String[] params = URI.create(browserResponse.headers().firstValue("location").orElseThrow())
.getRawQuery().split("&");
- code = java.util.Arrays.stream(params)
+ code = Arrays.stream(params)
.filter(value -> value.startsWith("code="))
- .map(value -> java.net.URLDecoder.decode(value.substring(5), java.nio.charset.StandardCharsets.UTF_8))
+ .map(value -> URLDecoder.decode(value.substring(5), StandardCharsets.UTF_8))
.findFirst().orElseThrow();
- } catch (java.io.IOException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@@ -184,10 +193,10 @@ class SsoOidcTest {
private static String pkceChallenge(String verifier) {
try {
- byte[] digest = java.security.MessageDigest.getInstance("SHA-256")
- .digest(verifier.getBytes(java.nio.charset.StandardCharsets.US_ASCII));
- return java.util.Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
- } catch (java.security.NoSuchAlgorithmException e) {
+ byte[] digest = MessageDigest.getInstance("SHA-256")
+ .digest(verifier.getBytes(StandardCharsets.US_ASCII));
+ return Base64.getUrlEncoder().withoutPadding().encodeToString(digest);
+ } catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
}
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoPortalTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoPortalTest.java
index e5870d4fb1..7b39dd71ac 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoPortalTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsoPortalTest.java
@@ -6,9 +6,13 @@ import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sso.SsoClient;
+import software.amazon.awssdk.services.sso.model.AccountInfo;
import software.amazon.awssdk.services.sso.model.ListAccountRolesResponse;
import software.amazon.awssdk.services.sso.model.ListAccountsResponse;
+import software.amazon.awssdk.services.sso.model.ResourceNotFoundException;
import software.amazon.awssdk.services.sso.model.RoleCredentials;
+import software.amazon.awssdk.services.sso.model.RoleInfo;
+import software.amazon.awssdk.services.sso.model.UnauthorizedException;
import software.amazon.awssdk.services.ssoadmin.SsoAdminClient;
import software.amazon.awssdk.services.ssoadmin.model.InstanceMetadata;
import software.amazon.awssdk.services.ssoadmin.model.PrincipalType;
@@ -18,6 +22,7 @@ import software.amazon.awssdk.services.ssooidc.model.RegisterClientResponse;
import software.amazon.awssdk.services.ssooidc.model.StartDeviceAuthorizationResponse;
import software.amazon.awssdk.services.sts.StsClient;
+import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpRequest;
@@ -77,7 +82,7 @@ class SsoPortalTest {
.accessToken(accessToken)
.maxResults(100));
assertThat(response.accountList())
- .extracting(software.amazon.awssdk.services.sso.model.AccountInfo::accountId)
+ .extracting(AccountInfo::accountId)
.contains(accountId);
ListAccountRolesResponse roles = portal.listAccountRoles(request -> request
@@ -85,7 +90,7 @@ class SsoPortalTest {
.accountId(accountId)
.maxResults(100));
assertThat(roles.roleList())
- .extracting(software.amazon.awssdk.services.sso.model.RoleInfo::roleName)
+ .extracting(RoleInfo::roleName)
.contains("PortalSdk" + suffix);
RoleCredentials credentials = portal.getRoleCredentials(request -> request
@@ -111,11 +116,11 @@ class SsoPortalTest {
.accessToken(accessToken)
.accountId(accountId)
.roleName("NotAssigned")))
- .isInstanceOf(software.amazon.awssdk.services.sso.model.ResourceNotFoundException.class);
+ .isInstanceOf(ResourceNotFoundException.class);
portal.logout(request -> request.accessToken(accessToken));
assertThatThrownBy(() -> portal.listAccounts(request -> request.accessToken(accessToken)))
- .isInstanceOf(software.amazon.awssdk.services.sso.model.UnauthorizedException.class);
+ .isInstanceOf(UnauthorizedException.class);
try (StsClient sts = StsClient.builder()
.endpointOverride(TestFixtures.endpoint())
@@ -127,7 +132,7 @@ class SsoPortalTest {
}
assertThatThrownBy(() -> portal.listAccounts(request -> request.accessToken("invalid")))
- .isInstanceOf(software.amazon.awssdk.services.sso.model.UnauthorizedException.class);
+ .isInstanceOf(UnauthorizedException.class);
}
}
@@ -140,7 +145,7 @@ class SsoPortalTest {
HttpResponse<String> response = TestFixtures.emulatorHttpClient().send(
HttpRequest.newBuilder(uri).GET().build(), HttpResponse.BodyHandlers.ofString());
assertThat(response.statusCode()).isEqualTo(200);
- } catch (java.io.IOException e) {
+ } catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/StsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/StsTest.java
index 11343da9da..63a72178fb 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/StsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/StsTest.java
@@ -26,6 +26,7 @@ import javax.xml.crypto.dsig.SignedInfo;
import javax.xml.crypto.dsig.Transform;
import javax.xml.crypto.dsig.XMLSignatureFactory;
import javax.xml.crypto.dsig.dom.DOMSignContext;
+import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
import javax.xml.crypto.dsig.spec.TransformParameterSpec;
import javax.xml.crypto.dsig.spec.XPathFilter2ParameterSpec;
import javax.xml.crypto.dsig.spec.XPathFilterParameterSpec;
@@ -459,7 +460,7 @@ class StsTest {
transforms.apply(factory), null, null);
SignedInfo signedInfo = factory.newSignedInfo(
factory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#",
- (javax.xml.crypto.dsig.spec.C14NMethodParameterSpec) null),
+ (C14NMethodParameterSpec) null),
factory.newSignatureMethod(SignatureMethod.RSA_SHA256, null), List.of(reference));
factory.newXMLSignature(signedInfo, null)
.sign(new DOMSignContext(signingKeys.getPrivate(), assertion));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SwfTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SwfTest.java
index adcc4d2d85..bd023a2246 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SwfTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SwfTest.java
@@ -48,6 +48,7 @@ import software.amazon.awssdk.services.swf.model.WorkflowExecution;
import software.amazon.awssdk.services.swf.model.WorkflowExecutionAlreadyStartedException;
import software.amazon.awssdk.services.swf.model.WorkflowType;
+import java.time.Instant;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@@ -365,13 +366,13 @@ class SwfTest {
void countsAndListing() {
assertThat(swf.countClosedWorkflowExecutions(builder -> builder
.domain(DOMAIN)
- .startTimeFilter(filter -> filter.oldestDate(java.time.Instant.EPOCH)))
+ .startTimeFilter(filter -> filter.oldestDate(Instant.EPOCH)))
.count())
.isGreaterThanOrEqualTo(2);
assertThat(swf.listClosedWorkflowExecutions(builder -> builder
.domain(DOMAIN)
- .startTimeFilter(filter -> filter.oldestDate(java.time.Instant.EPOCH)))
+ .startTimeFilter(filter -> filter.oldestDate(Instant.EPOCH)))
.executionInfos())
.extracting(info -> info.execution().workflowId())
.contains("sdk-wf-1", "sdk-wf-2");
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/VerifiedPermissionsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/VerifiedPermissionsTest.java
index 1000db75f2..e2f2c13750 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/VerifiedPermissionsTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/VerifiedPermissionsTest.java
@@ -4,7 +4,9 @@ import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.services.verifiedpermissions.VerifiedPermissionsClient;
import software.amazon.awssdk.services.verifiedpermissions.model.ActionIdentifier;
+import software.amazon.awssdk.services.verifiedpermissions.model.ConflictException;
import software.amazon.awssdk.services.verifiedpermissions.model.Decision;
+import software.amazon.awssdk.services.verifiedpermissions.model.DeletionMode;
import software.amazon.awssdk.services.verifiedpermissions.model.EntitiesDefinition;
import software.amazon.awssdk.services.verifiedpermissions.model.EntityIdentifier;
import software.amazon.awssdk.services.verifiedpermissions.model.GetPolicyStoreResponse;
@@ -88,7 +90,7 @@ class VerifiedPermissionsTest {
avp.createPolicyStoreAlias(request -> request.aliasName(alias).policyStoreId(policyStoreId));
assertThat(avp.getPolicyStore(request -> request.policyStoreId(alias)).policyStoreId())
.isEqualTo(policyStoreId);
- avp.deletePolicyStoreAlias(request -> request.aliasName(alias).deletionMode(software.amazon.awssdk.services.verifiedpermissions.model.DeletionMode.HARD_DELETE));
+ avp.deletePolicyStoreAlias(request -> request.aliasName(alias).deletionMode(DeletionMode.HARD_DELETE));
String token = "sdk-idempotency-123";
String first = avp.createPolicyStore(request -> request.clientToken(token)
@@ -100,7 +102,7 @@ class VerifiedPermissionsTest {
assertThat(replay).isEqualTo(first);
assertThatThrownBy(() -> avp.createPolicyStore(request -> request.clientToken(token)
.validationSettings(ValidationSettings.builder().mode(ValidationMode.STRICT).build())))
- .isInstanceOf(software.amazon.awssdk.services.verifiedpermissions.model.ConflictException.class);
+ .isInstanceOf(ConflictException.class);
avp.deletePolicy(request -> request.policyStoreId(policyStoreId).policyId(policyId));
avp.deletePolicyStore(request -> request.policyStoreId(policyStoreId));
diff --git a/compatibility-tests/sdk-test-java/src/test/java/io/github/hectorvent/floci/compat/RedshiftTest.java b/compatibility-tests/sdk-test-java/src/test/java/io/github/hectorvent/floci/compat/RedshiftTest.java
index ba755c4241..759122ac59 100644
--- a/compatibility-tests/sdk-test-java/src/test/java/io/github/hectorvent/floci/compat/RedshiftTest.java
+++ b/compatibility-tests/sdk-test-java/src/test/java/io/github/hectorvent/floci/compat/RedshiftTest.java
@@ -110,8 +110,8 @@ public class RedshiftTest {
String address = cluster.endpoint().address();
int port = cluster.endpoint().port();
String jdbcUrl = "jdbc:postgresql://" + address + ":" + port + "/dev";
- try (java.sql.Connection conn =
- java.sql.DriverManager.getConnection(jdbcUrl, "admin", "Password123")) {
+ try (Connection conn =
+ DriverManager.getConnection(jdbcUrl, "admin", "Password123")) {
assertTrue(conn.isValid(5));
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/config/FlociCertificateAuthority.java b/src/main/java/io/github/hectorvent/floci/config/FlociCertificateAuthority.java
index a724a57171..c748a88a80 100644
--- a/src/main/java/io/github/hectorvent/floci/config/FlociCertificateAuthority.java
+++ b/src/main/java/io/github/hectorvent/floci/config/FlociCertificateAuthority.java
@@ -38,6 +38,7 @@ import java.security.SecureRandom;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.HexFormat;
import java.util.List;
import java.util.Set;
@@ -256,13 +257,13 @@ public final class FlociCertificateAuthority {
Instant caNotAfter = certificate.getNotAfter().toInstant();
Instant wanted = DEVICE_CERTIFICATE_NOT_AFTER.isAfter(now)
? DEVICE_CERTIFICATE_NOT_AFTER
- : now.plus(ONE_YEAR_IN_DAYS, java.time.temporal.ChronoUnit.DAYS);
+ : now.plus(ONE_YEAR_IN_DAYS, ChronoUnit.DAYS);
return caNotAfter.isBefore(wanted) ? caNotAfter : wanted;
}
/** A new CA ends in 2050, or ten years from now when that is later, so it is never born expired. */
static Instant caNotAfter(Instant now) {
- Instant tenYears = now.plus(TEN_YEARS_IN_DAYS, java.time.temporal.ChronoUnit.DAYS);
+ Instant tenYears = now.plus(TEN_YEARS_IN_DAYS, ChronoUnit.DAYS);
return tenYears.isAfter(CA_NOT_AFTER) ? tenYears : CA_NOT_AFTER;
}
diff --git a/src/main/java/io/github/hectorvent/floci/config/TlsProxyServer.java b/src/main/java/io/github/hectorvent/floci/config/TlsProxyServer.java
index b487a83d16..72e59c474b 100644
--- a/src/main/java/io/github/hectorvent/floci/config/TlsProxyServer.java
+++ b/src/main/java/io/github/hectorvent/floci/config/TlsProxyServer.java
@@ -20,6 +20,8 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.IntConsumer;
/**
* A TCP proxy server that enables HTTP and HTTPS on the same port (LocalStack parity).
@@ -79,10 +81,10 @@ public class TlsProxyServer {
* was still unresolved has no other way to learn the port came free, and would otherwise stay
* registered with nothing serving it.
*/
- private final List<java.util.function.IntConsumer> portReleasedHandlers = new java.util.concurrent.CopyOnWriteArrayList<>();
+ private final List<IntConsumer> portReleasedHandlers = new CopyOnWriteArrayList<>();
/** Registers a callback invoked when a bind fails and the port stops being reserved. */
- public void onPortReleased(java.util.function.IntConsumer handler) {
+ public void onPortReleased(IntConsumer handler) {
portReleasedHandlers.add(handler);
failedPorts.forEach(handler::accept);
}
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsJsonCborController.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsJsonCborController.java
index a5d0a9f19c..fd382dc77e 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/AwsJsonCborController.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsJsonCborController.java
@@ -25,12 +25,14 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.zip.GZIPInputStream;
@@ -366,7 +368,7 @@ public class AwsJsonCborController {
return false;
}
for (String header : contentEncodingHeaders) {
- if (header != null && header.toLowerCase(java.util.Locale.ROOT).contains("gzip")) {
+ if (header != null && header.toLowerCase(Locale.ROOT).contains("gzip")) {
return true;
}
}
@@ -460,7 +462,7 @@ public class AwsJsonCborController {
int totalRead = 0;
int maxRead = 10 * 1024 * 1024; // 10 MB limit max over all aws services, to avoid OOM. AWS services should not send more than 10 MB in a single request.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (GZIPInputStream gis = new GZIPInputStream(new java.io.ByteArrayInputStream(compressed))) {
+ try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressed))) {
int read;
while ((read = gis.read(buffer)) != -1) {
totalRead += read;
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
index 9a97044fbc..64594ce404 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryController.java
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -72,7 +73,7 @@ public class AwsQueryController {
private final DocDbService docDbService;
private final RdsService rdsService;
/** ARNs already reported as held by both services, so the warning is logged once each. */
- private final java.util.Set<String> reportedArnCollisions = java.util.concurrent.ConcurrentHashMap.newKeySet();
+ private final Set<String> reportedArnCollisions = ConcurrentHashMap.newKeySet();
private final SqsQueryHandler sqsQueryHandler;
private final SnsQueryHandler snsQueryHandler;
private final SesQueryHandler sesQueryHandler;
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/BackupWindows.java b/src/main/java/io/github/hectorvent/floci/core/common/BackupWindows.java
index 7468228c0d..01aa1dca74 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/BackupWindows.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/BackupWindows.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.core.common;
import java.util.List;
+import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -113,7 +114,7 @@ public final class BackupWindows {
+ minuteOfDay(dayAndTime.substring(colon + 1), () -> invalidMaintenanceTime(dayAndTime));
}
- private static int minuteOfDay(String time, java.util.function.Supplier<AwsException> invalid) {
+ private static int minuteOfDay(String time, Supplier<AwsException> invalid) {
Matcher m = TIME.matcher(time);
if (!m.matches()) {
throw invalid.get();
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/CidrCanonicalizer.java b/src/main/java/io/github/hectorvent/floci/core/common/CidrCanonicalizer.java
index b91e06dfb1..0b9e343e38 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/CidrCanonicalizer.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/CidrCanonicalizer.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.core.common;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
@@ -143,7 +144,7 @@ public final class CidrCanonicalizer {
InetAddress maskedAddress;
try {
maskedAddress = InetAddress.getByAddress(masked);
- } catch (java.net.UnknownHostException e) {
+ } catch (UnknownHostException e) {
// Only thrown for an address of the wrong byte length, which cannot
// happen here: `masked` is always copied from a real InetAddress.
throw new AssertionError("unreachable: masked address has invalid length", e);
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
index 08c3004005..cf48cfce21 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/ResolvedServiceCatalog.java
@@ -3,10 +3,13 @@ package io.github.hectorvent.floci.core.common;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.services.accessanalyzer.AccessAnalyzerController;
import io.github.hectorvent.floci.services.account.AccountController;
+import io.github.hectorvent.floci.services.amazonmq.AmazonMqController;
import io.github.hectorvent.floci.services.apigateway.ApiGatewayController;
import io.github.hectorvent.floci.services.appconfig.AppConfigController;
import io.github.hectorvent.floci.services.appconfig.AppConfigDataController;
+import io.github.hectorvent.floci.services.appintegrations.AppIntegrationsController;
import io.github.hectorvent.floci.services.appsync.AppSyncController;
+import io.github.hectorvent.floci.services.appsync.graphql.AppSyncExecutionController;
import io.github.hectorvent.floci.services.aps.ApsController;
import io.github.hectorvent.floci.services.backup.BackupController;
import io.github.hectorvent.floci.services.batch.BatchController;
@@ -22,10 +25,13 @@ import io.github.hectorvent.floci.services.bedrockagentcorecontrol.BedrockAgentC
import io.github.hectorvent.floci.services.bedrockruntime.BedrockRuntimeController;
import io.github.hectorvent.floci.services.cloudfront.CloudFrontController;
import io.github.hectorvent.floci.services.cloudfront.CloudFrontServingController;
+import io.github.hectorvent.floci.services.codeartifact.CodeArtifactController;
import io.github.hectorvent.floci.services.codeartifact.CodeArtifactMavenController;
import io.github.hectorvent.floci.services.codeartifact.CodeArtifactPypiController;
+import io.github.hectorvent.floci.services.codegurureviewer.CodeGuruReviewerController;
import io.github.hectorvent.floci.services.cognito.CognitoOAuthController;
import io.github.hectorvent.floci.services.cognito.CognitoWellKnownController;
+import io.github.hectorvent.floci.services.connect.ConnectController;
import io.github.hectorvent.floci.services.controlcatalog.ControlCatalogController;
import io.github.hectorvent.floci.services.controltower.ControlTowerControlController;
import io.github.hectorvent.floci.services.controltower.ControlTowerController;
@@ -34,6 +40,7 @@ import io.github.hectorvent.floci.services.dlm.DlmController;
import io.github.hectorvent.floci.services.dsql.DsqlController;
import io.github.hectorvent.floci.services.efs.EfsController;
import io.github.hectorvent.floci.services.eks.EksController;
+import io.github.hectorvent.floci.services.emrserverless.EmrServerlessController;
import io.github.hectorvent.floci.services.fis.FisController;
import io.github.hectorvent.floci.services.guardduty.GuardDutyController;
import io.github.hectorvent.floci.services.inspector2.Inspector2Controller;
@@ -42,6 +49,7 @@ import io.github.hectorvent.floci.services.iot.IotController;
import io.github.hectorvent.floci.services.iot.IotDataController;
import io.github.hectorvent.floci.services.iot.IotDomainConfigurationController;
import io.github.hectorvent.floci.services.iot.IotFleetIndexingController;
+import io.github.hectorvent.floci.services.lakeformation.LakeFormationController;
import io.github.hectorvent.floci.services.lambda.LambdaController;
import io.github.hectorvent.floci.services.lambda.durable.DurableExecutionController;
import io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsController;
@@ -52,11 +60,13 @@ import io.github.hectorvent.floci.services.marketplace.MarketplaceCatalogControl
import io.github.hectorvent.floci.services.marketplace.MarketplaceDeploymentController;
import io.github.hectorvent.floci.services.marketplace.MarketplaceDiscoveryController;
import io.github.hectorvent.floci.services.marketplace.MarketplaceReportingController;
+import io.github.hectorvent.floci.services.msk.MskController;
import io.github.hectorvent.floci.services.mwaa.MwaaController;
import io.github.hectorvent.floci.services.oam.OamController;
import io.github.hectorvent.floci.services.opensearch.ElasticsearchController;
import io.github.hectorvent.floci.services.opensearch.OpenSearchController;
import io.github.hectorvent.floci.services.pipes.PipesController;
+import io.github.hectorvent.floci.services.ram.RamController;
import io.github.hectorvent.floci.services.rdsdata.RdsDataController;
import io.github.hectorvent.floci.services.resourceexplorer2.ResourceExplorer2Controller;
import io.github.hectorvent.floci.services.resourcegroups.ResourceGroupsController;
@@ -84,6 +94,7 @@ import io.github.hectorvent.floci.services.ses.SesSuppressionController;
import io.github.hectorvent.floci.services.ses.SesTagController;
import io.github.hectorvent.floci.services.ses.SesTemplateController;
import io.github.hectorvent.floci.services.ses.SesTenantController;
+import io.github.hectorvent.floci.services.signin.SigninController;
import io.github.hectorvent.floci.services.ssooidc.SsoOidcController;
import io.github.hectorvent.floci.services.ssoportal.SsoPortalController;
import io.github.hectorvent.floci.services.swf.model.SwfConstants;
@@ -94,6 +105,7 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -107,8 +119,8 @@ public class ResolvedServiceCatalog {
* are {@code iot:} ({@code iot:DescribeJobExecution} and peers in the Service Authorization
* Reference). Keep this minimal: every entry suppresses a distinct IAM namespace.
*/
- private static final java.util.Map<String, String> CREDENTIAL_SCOPE_ALIASES =
- java.util.Map.of(
+ private static final Map<String, String> CREDENTIAL_SCOPE_ALIASES =
+ Map.of(
"s3express", "s3",
"iot-jobs-data", "iot",
"monitoring", "cloudwatch",
@@ -169,11 +181,11 @@ public class ResolvedServiceCatalog {
descriptor("kafka", "msk", config.services().msk().enabled(), true,
"msk", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
- Set.of(), Set.of("kafka"), Set.of(), Set.of(io.github.hectorvent.floci.services.msk.MskController.class)),
+ Set.of(), Set.of("kafka"), Set.of(), Set.of(MskController.class)),
descriptor("mq", "amazonmq", config.services().amazonmq().enabled(), true,
"amazonmq", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
- Set.of(), Set.of("mq"), Set.of(), Set.of(io.github.hectorvent.floci.services.amazonmq.AmazonMqController.class)),
+ Set.of(), Set.of("mq"), Set.of(), Set.of(AmazonMqController.class)),
descriptor("sts", "iam", config.services().iam().enabled(), false,
null, null, 5000L, AwsNamespaces.STS, ServiceProtocol.QUERY,
protocols(ServiceProtocol.QUERY),
@@ -182,7 +194,7 @@ public class ResolvedServiceCatalog {
null, null, 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("signin"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.signin.SigninController.class)),
+ Set.of(SigninController.class)),
descriptor("elasticache", "elasticache", config.services().elasticache().enabled(), true,
"elasticache", storageMode(config.storage().services().elasticache().mode(), config.storage().mode()),
config.storage().services().elasticache().flushIntervalMs(), AwsNamespaces.EC, ServiceProtocol.QUERY,
@@ -250,7 +262,7 @@ public class ResolvedServiceCatalog {
config.storage().services().emrserverless().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("emr-serverless"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.emrserverless.EmrServerlessController.class)),
+ Set.of(EmrServerlessController.class)),
descriptor("wafv2", "wafv2", config.services().wafv2().enabled(), true,
"wafv2", config.storage().mode(), 5000L, null, ServiceProtocol.JSON,
protocols(ServiceProtocol.JSON),
@@ -486,7 +498,7 @@ public class ResolvedServiceCatalog {
null, null, 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("ram"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.ram.RamController.class)),
+ Set.of(RamController.class)),
descriptor("config", "configservice", config.services().configservice().enabled(), true,
"config", storageMode(config.storage().services().config().mode(), config.storage().mode()),
config.storage().services().config().flushIntervalMs(), null, ServiceProtocol.JSON,
@@ -654,7 +666,7 @@ public class ResolvedServiceCatalog {
config.storage().services().appsync().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("appsync"), Set.of(), Set.of(AppSyncController.class,
- io.github.hectorvent.floci.services.appsync.graphql.AppSyncExecutionController.class)),
+ AppSyncExecutionController.class)),
descriptor("s3vectors", "s3vectors", config.services().s3vectors().enabled(), true,
"s3vectors", storageMode(config.storage().services().s3vectors().mode(), config.storage().mode()),
config.storage().services().s3vectors().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
@@ -705,13 +717,13 @@ public class ResolvedServiceCatalog {
"connect", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("connect"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.connect.ConnectController.class)),
+ Set.of(ConnectController.class)),
descriptor("app-integrations", "appintegrations",
config.services().appintegrations().enabled(), true,
"appintegrations", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("app-integrations"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.appintegrations.AppIntegrationsController.class)),
+ Set.of(AppIntegrationsController.class)),
descriptor("dlm", "dlm", config.services().dlm().enabled(), true,
"dlm", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
@@ -758,7 +770,7 @@ public class ResolvedServiceCatalog {
storageMode(config.storage().services().lakeformation().mode(), config.storage().mode()),
config.storage().services().lakeformation().flushIntervalMs(), null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
- Set.of(), Set.of("lakeformation"), Set.of(), Set.of(io.github.hectorvent.floci.services.lakeformation.LakeFormationController.class)),
+ Set.of(), Set.of("lakeformation"), Set.of(), Set.of(LakeFormationController.class)),
descriptor("efs", "efs", config.services().efs().enabled(), true,
"efs",
storageMode(config.storage().services().efs().mode(), config.storage().mode()),
@@ -770,12 +782,12 @@ public class ResolvedServiceCatalog {
"codegurureviewer", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("codeguru-reviewer"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.codegurureviewer.CodeGuruReviewerController.class)),
+ Set.of(CodeGuruReviewerController.class)),
descriptor("codeartifact", "codeartifact", config.services().codeartifact().enabled(), true,
"codeartifact", config.storage().mode(), 5000L, null, ServiceProtocol.REST_JSON,
protocols(ServiceProtocol.REST_JSON),
Set.of(), Set.of("codeartifact"), Set.of(),
- Set.of(io.github.hectorvent.floci.services.codeartifact.CodeArtifactController.class,
+ Set.of(CodeArtifactController.class,
CodeArtifactMavenController.class,
CodeArtifactPypiController.class)),
descriptor("verifiedpermissions", "verifiedpermissions", config.services().verifiedpermissions().enabled(), true,
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java b/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java
index 0676859277..ed6139b8da 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java
@@ -12,6 +12,7 @@ import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.Provider;
import java.util.Optional;
+import java.util.UUID;
@Provider
public class ServiceEnabledFilter implements ContainerRequestFilter {
@@ -112,7 +113,7 @@ public class ServiceEnabledFilter implements ContainerRequestFilter {
.elem("Code", "ServiceNotAvailableException")
.elem("Message", message)
.end("Error")
- .elem("RequestId", java.util.UUID.randomUUID().toString())
+ .elem("RequestId", UUID.randomUUID().toString())
.end("ErrorResponse")
.build();
return Response.status(400).entity(xml).type(MediaType.APPLICATION_XML).build();
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelper.java b/src/main/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelper.java
index 72bd41e1bd..8a1cd9aeb6 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelper.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelper.java
@@ -6,6 +6,7 @@ import org.jboss.logging.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -310,7 +311,7 @@ public final class ContainerStorageHelper {
if (path == null || path.isBlank()) {
return true;
}
- return !java.nio.file.Paths.get(path).isAbsolute() && !path.startsWith("/");
+ return !Paths.get(path).isAbsolute() && !path.startsWith("/");
}
/**
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/docker/DockerHostResolver.java b/src/main/java/io/github/hectorvent/floci/core/common/docker/DockerHostResolver.java
index 8750284d3e..1a1bc2b419 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/docker/DockerHostResolver.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/docker/DockerHostResolver.java
@@ -6,6 +6,7 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.net.InetAddress;
+import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@@ -39,7 +40,7 @@ public class DockerHostResolver {
}
public String resolve() {
- java.util.Optional<String> override = config.services().lambda().dockerHostOverride();
+ Optional<String> override = config.services().lambda().dockerHostOverride();
if (override.isPresent() && !override.get().isBlank()) {
LOG.debugv("Using configured docker host override: {0}", override.get());
return override.get();
@@ -47,7 +48,7 @@ public class DockerHostResolver {
if (containerDetector.isRunningInContainer()) {
if (currentContainerNetworkResolver != null) {
- java.util.Optional<String> currentNetworkIp = currentContainerNetworkResolver.resolveContainerIp();
+ Optional<String> currentNetworkIp = currentContainerNetworkResolver.resolveContainerIp();
if (currentNetworkIp.isPresent()) {
LOG.infov("Running in Docker — using current network IP for Runtime API: {0}",
currentNetworkIp.get());
diff --git a/src/main/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManager.java b/src/main/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManager.java
index 8e9ebb6219..295c391ebf 100644
--- a/src/main/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManager.java
@@ -168,7 +168,7 @@ public class RabbitMqManager {
"http://" + mgmt.host() + ":" + mgmt.port(),
List.of("amqp://" + amqp.host() + ":" + amqp.port()),
amqp.host());
- broker.setBrokerInstances(new java.util.ArrayList<>(List.of(instance)));
+ broker.setBrokerInstances(new ArrayList<>(List.of(instance)));
LOG.infov("RabbitMQ container {0} started for broker {1}: amqp={2} (host ports amqp={3}, console={4})",
info.containerId(), broker.getBrokerName(), instance.getEndpoints().get(0),
String.valueOf(ports.amqp()), String.valueOf(ports.console()));
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java
index d1be061e18..f398dd989f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java
@@ -13,6 +13,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
import io.github.hectorvent.floci.services.apigateway.ApiGatewayService.StoredMapping;
+import io.github.hectorvent.floci.services.apigateway.model.Account;
import io.github.hectorvent.floci.services.apigateway.model.ApiGatewayResource;
import io.github.hectorvent.floci.services.apigateway.model.ApiKey;
import io.github.hectorvent.floci.services.apigateway.model.BasePathMapping;
@@ -22,6 +23,7 @@ import io.github.hectorvent.floci.services.apigateway.model.EndpointType;
import io.github.hectorvent.floci.services.apigateway.model.GatewayResponse;
import io.github.hectorvent.floci.services.apigateway.model.MethodConfig;
import io.github.hectorvent.floci.services.apigateway.model.MethodResponse;
+import io.github.hectorvent.floci.services.apigateway.model.MethodSetting;
import io.github.hectorvent.floci.services.apigateway.model.RequestValidator;
import io.github.hectorvent.floci.services.apigateway.model.RestApi;
import io.github.hectorvent.floci.services.apigateway.model.UsagePlan;
@@ -57,6 +59,7 @@ import jakarta.ws.rs.core.Response;
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -346,13 +349,13 @@ public class ApiGatewayController {
if (body == null || body.isBlank()) {
throw new AwsException("BadRequestException", "Request body is required", 400);
}
- com.fasterxml.jackson.databind.JsonNode node = objectMapper.readTree(body).path("patchOperations");
+ JsonNode node = objectMapper.readTree(body).path("patchOperations");
if (!node.isArray()) {
throw new AwsException("BadRequestException", "patchOperations must be an array", 400);
}
List<Map<String, String>> patchOperations = new ArrayList<>();
- for (com.fasterxml.jackson.databind.JsonNode operationNode : node) {
+ for (JsonNode operationNode : node) {
if (operationNode == null || operationNode.isNull() || !operationNode.isObject()) {
throw new AwsException("BadRequestException", "Each patch operation must be an object", 400);
}
@@ -1423,7 +1426,7 @@ public class ApiGatewayController {
throw new AwsException("BadRequestException", "Body is required for OpenAPI import", 400);
}
try {
- com.fasterxml.jackson.databind.JsonNode root = objectMapper.readTree(payload);
+ JsonNode root = objectMapper.readTree(payload);
if (root.isObject() && root.hasNonNull("body") && root.get("body").isTextual()) {
return root.get("body").asText();
}
@@ -2212,7 +2215,7 @@ public class ApiGatewayController {
@PathParam("resourceArn") String resourceArn,
@QueryParam("tagKeys") List<String> tagKeys) {
v2Service.untagResource(resourceArn,
- tagKeys != null ? tagKeys : java.util.Collections.emptyList());
+ tagKeys != null ? tagKeys : Collections.emptyList());
return Response.noContent().build();
}
@@ -2451,7 +2454,7 @@ public class ApiGatewayController {
return node;
}
- private ObjectNode toMethodSettingNode(io.github.hectorvent.floci.services.apigateway.model.MethodSetting setting) {
+ private ObjectNode toMethodSettingNode(MethodSetting setting) {
ObjectNode node = objectMapper.createObjectNode();
node.put("metricsEnabled", setting.isMetricsEnabled());
node.put("loggingLevel", setting.getLoggingLevel());
@@ -2695,7 +2698,7 @@ public class ApiGatewayController {
return node;
}
- private ObjectNode toAccountNode(io.github.hectorvent.floci.services.apigateway.model.Account account) {
+ private ObjectNode toAccountNode(Account account) {
ObjectNode node = objectMapper.createObjectNode();
if (account.getApiKeyVersion() != null) {
node.put("apiKeyVersion", account.getApiKeyVersion());
@@ -2725,7 +2728,7 @@ public class ApiGatewayController {
node.put("name", api.getName());
node.put("protocolType", api.getProtocolType());
node.put("apiEndpoint", api.getApiEndpoint());
- node.put("createdDate", java.time.Instant.ofEpochMilli(api.getCreatedDate()).toString());
+ node.put("createdDate", Instant.ofEpochMilli(api.getCreatedDate()).toString());
node.put("disableExecuteApiEndpoint", api.isDisableExecuteApiEndpoint());
if (api.getRouteSelectionExpression() != null) node.put("routeSelectionExpression", api.getRouteSelectionExpression());
if (api.getDescription() != null) node.put("description", api.getDescription());
@@ -2850,8 +2853,8 @@ public class ApiGatewayController {
node.put("stageName", s.getStageName());
if (s.getDeploymentId() != null) node.put("deploymentId", s.getDeploymentId());
node.put("autoDeploy", s.isAutoDeploy());
- node.put("createdDate", java.time.Instant.ofEpochMilli(s.getCreatedDate()).toString());
- node.put("lastUpdatedDate", java.time.Instant.ofEpochMilli(s.getLastUpdatedDate()).toString());
+ node.put("createdDate", Instant.ofEpochMilli(s.getCreatedDate()).toString());
+ node.put("lastUpdatedDate", Instant.ofEpochMilli(s.getLastUpdatedDate()).toString());
if (s.getStageVariables() != null) {
ObjectNode stageVariables = node.putObject("stageVariables");
s.getStageVariables().forEach(stageVariables::put);
@@ -2907,7 +2910,7 @@ public class ApiGatewayController {
node.put("deploymentId", d.getDeploymentId());
node.put("deploymentStatus", d.getDeploymentStatus());
if (d.getDescription() != null) node.put("description", d.getDescription());
- node.put("createdDate", java.time.Instant.ofEpochMilli(d.getCreatedDate()).toString());
+ node.put("createdDate", Instant.ofEpochMilli(d.getCreatedDate()).toString());
return node;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayService.java b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayService.java
index 5047e735d3..54070aafa3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayService.java
@@ -53,6 +53,8 @@ import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
+import io.swagger.v3.oas.models.media.MediaType;
+import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
@@ -1359,7 +1361,7 @@ public class ApiGatewayService implements ResourceProvider {
if (column == null) {
continue;
}
- columns.putIfAbsent(column.trim().toLowerCase(java.util.Locale.ROOT), i);
+ columns.putIfAbsent(column.trim().toLowerCase(Locale.ROOT), i);
}
int nameIndex = columns.getOrDefault("name", -1);
int keyIndex = columns.containsKey("key") ? columns.get("key") : columns.getOrDefault("value", -1);
@@ -2251,7 +2253,7 @@ public class ApiGatewayService implements ResourceProvider {
// Nothing is provisioned behind the domain, so it is usable as soon as it exists.
domain.setDomainNameStatus("AVAILABLE");
if (request.get("tags") instanceof Map<?, ?> tags && !tags.isEmpty()) {
- Map<String, String> copied = new java.util.LinkedHashMap<>();
+ Map<String, String> copied = new LinkedHashMap<>();
tags.forEach((key, value) -> copied.put(String.valueOf(key), String.valueOf(value)));
domain.setTags(copied);
}
@@ -3324,7 +3326,7 @@ public class ApiGatewayService implements ResourceProvider {
private void recomputePaths(String region, String apiId) {
List<ApiGatewayResource> allResources = getResources(region, apiId);
- Map<String, ApiGatewayResource> resourceMap = new java.util.HashMap<>();
+ Map<String, ApiGatewayResource> resourceMap = new HashMap<>();
for (ApiGatewayResource r : allResources) {
resourceMap.put(r.getId(), r);
}
@@ -3978,7 +3980,7 @@ public class ApiGatewayService implements ResourceProvider {
private String importedAuthorizerType(Map<String, Object> authDef, String schemeName) {
String type = importedAuthorizerString(authDef, "type", schemeName);
if (type != null) {
- String normalizedType = type.toLowerCase(java.util.Locale.ROOT);
+ String normalizedType = type.toLowerCase(Locale.ROOT);
if ("token".equals(normalizedType)
|| "request".equals(normalizedType)
|| "cognito_user_pools".equals(normalizedType)) {
@@ -4114,16 +4116,16 @@ public class ApiGatewayService implements ResourceProvider {
private void applyOpenApiSpec(String region, String apiId, OpenAPI openAPI) {
// Import schemas as Models
if (openAPI.getComponents() != null && openAPI.getComponents().getSchemas() != null) {
- for (var schemaEntry : openAPI.getComponents().getSchemas().entrySet()) {
+ for (Map.Entry<String, Schema> schemaEntry : openAPI.getComponents().getSchemas().entrySet()) {
String schemaName = schemaEntry.getKey();
- var schema = schemaEntry.getValue();
+ Schema schema = schemaEntry.getValue();
Map<String, Object> modelReq = new HashMap<>();
modelReq.put("name", schemaName);
modelReq.put("contentType", "application/json");
try {
// Use swagger's own JSON serializer to produce clean JSON Schema
modelReq.put("schema", Json.mapper().writeValueAsString(schema));
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
modelReq.put("schema", "{}");
}
createModel(region, apiId, modelReq);
@@ -4153,7 +4155,7 @@ public class ApiGatewayService implements ResourceProvider {
Map<String, Object> validators = (Map<String, Object>) topExtensions
.get("x-amazon-apigateway-request-validators");
if (validators != null) {
- for (var entry : validators.entrySet()) {
+ for (Map.Entry<String, Object> entry : validators.entrySet()) {
String validatorName = entry.getKey();
Map<String, Object> validatorDef = (Map<String, Object>) entry.getValue();
Map<String, Object> valReq = new HashMap<>();
@@ -4198,7 +4200,7 @@ public class ApiGatewayService implements ResourceProvider {
}
}
if (openAPI.getComponents() != null && openAPI.getComponents().getSecuritySchemes() != null) {
- for (var schemeEntry : openAPI.getComponents().getSecuritySchemes().entrySet()) {
+ for (Map.Entry<String, SecurityScheme> schemeEntry : openAPI.getComponents().getSecuritySchemes().entrySet()) {
String schemeName = schemeEntry.getKey();
SecurityScheme scheme = schemeEntry.getValue();
String authtype = importedAuthorizationType(scheme, schemeName);
@@ -4297,9 +4299,9 @@ public class ApiGatewayService implements ResourceProvider {
String resourceId = ensureResourcePath(region, apiId, path, pathToResourceId);
// Create methods for each operation on this path
- var operations = pathItem.readOperationsMap();
+ Map<PathItem.HttpMethod, Operation> operations = pathItem.readOperationsMap();
if (operations != null) {
- for (var opEntry : operations.entrySet()) {
+ for (Map.Entry<PathItem.HttpMethod, Operation> opEntry : operations.entrySet()) {
String httpMethod = opEntry.getKey().name().toUpperCase();
try {
applyOperation(region, apiId, resourceId, httpMethod, opEntry.getValue(), openAPI,
@@ -4434,9 +4436,9 @@ public class ApiGatewayService implements ResourceProvider {
// Link request models from operation requestBody
if (operation.getRequestBody() != null && operation.getRequestBody().getContent() != null) {
Map<String, String> requestModels = new HashMap<>();
- for (var contentEntry : operation.getRequestBody().getContent().entrySet()) {
+ for (Map.Entry<String, MediaType> contentEntry : operation.getRequestBody().getContent().entrySet()) {
String contentType = contentEntry.getKey();
- var mediaType = contentEntry.getValue();
+ MediaType mediaType = contentEntry.getValue();
if (mediaType.getSchema() != null && mediaType.getSchema().get$ref() != null) {
String ref = mediaType.getSchema().get$ref();
// Extract model name from #/components/schemas/ModelName
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigateway/AwsServiceRouter.java b/src/main/java/io/github/hectorvent/floci/services/apigateway/AwsServiceRouter.java
index 2b5eca9664..60c0121e60 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigateway/AwsServiceRouter.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigateway/AwsServiceRouter.java
@@ -23,6 +23,7 @@ import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
+import java.util.Arrays;
import java.util.regex.Matcher;
/**
@@ -120,7 +121,7 @@ public class AwsServiceRouter {
// parts[5] is either "action/{ActionName}" or "path/{resourcePath}".
// A path may itself contain ':' (rare), so re-join the remainder.
String resourceSpec = parts.length > 6
- ? String.join(":", java.util.Arrays.copyOfRange(parts, 5, parts.length))
+ ? String.join(":", Arrays.copyOfRange(parts, 5, parts.length))
: parts[5];
if (resourceSpec.startsWith("action/")) {
String action = resourceSpec.substring("action/".length());
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandler.java
index 5903a961c8..920f74aa10 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandler.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -11,6 +12,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -483,14 +485,14 @@ public class ApiGatewayV2JsonHandler {
private Response handleTagResource(JsonNode request, String region) {
String resourceArn = request.path("ResourceArn").asText();
Map<String, String> tags = objectMapper.convertValue(
- request.path("Tags"), new com.fasterxml.jackson.core.type.TypeReference<Map<String, String>>() {});
+ request.path("Tags"), new TypeReference<Map<String, String>>() {});
service.tagResource(resourceArn, tags);
return Response.ok("{}").build();
}
private Response handleUntagResource(JsonNode request, String region) {
String resourceArn = request.path("ResourceArn").asText();
- List<String> tagKeys = new java.util.ArrayList<>();
+ List<String> tagKeys = new ArrayList<>();
request.path("TagKeys").forEach(n -> tagKeys.add(n.asText()));
service.untagResource(resourceArn, tagKeys);
return Response.noContent().build();
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2OpenApiImporter.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2OpenApiImporter.java
index 0e51db4882..82e6387e0c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2OpenApiImporter.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2OpenApiImporter.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.services.apigatewayv2.model.Api;
import io.github.hectorvent.floci.services.apigatewayv2.model.Authorizer;
import io.github.hectorvent.floci.services.apigatewayv2.model.Integration;
import io.github.hectorvent.floci.services.apigatewayv2.model.Route;
+import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
@@ -20,10 +21,13 @@ import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.function.BiConsumer;
+import java.util.stream.Collectors;
/**
* OpenAPI import for HTTP APIs (ImportApi / ReimportApi).
@@ -161,7 +165,7 @@ public class ApiGatewayV2OpenApiImporter {
"Invalid basepath '" + basePathMode + "'; valid values are ignore, prepend and split", 400);
}
- SwaggerParseResult result = new io.swagger.parser.OpenAPIParser().readContents(specBody, null, null);
+ SwaggerParseResult result = new OpenAPIParser().readContents(specBody, null, null);
if (result.getOpenAPI() == null) {
String errors = result.getMessages() != null ? String.join(", ", result.getMessages()) : "unknown error";
throw new AwsException("BadRequestException", "Failed to parse OpenAPI spec: " + errors, 400);
@@ -201,7 +205,7 @@ public class ApiGatewayV2OpenApiImporter {
Map<String, String> bindable = new LinkedHashMap<>();
specs.forEach(spec -> bindable.put(spec.schemeName(), spec.authorizationType()));
- java.util.Set<String> reported = new java.util.LinkedHashSet<>();
+ Set<String> reported = new LinkedHashSet<>();
BiConsumer<String, List<SecurityRequirement>> check = (routeKey, security) -> {
if (security == null || security.isEmpty()) {
return;
@@ -213,7 +217,7 @@ public class ApiGatewayV2OpenApiImporter {
String names = security.stream()
.flatMap(requirement -> requirement.keySet().stream())
.distinct()
- .collect(java.util.stream.Collectors.joining(", "));
+ .collect(Collectors.joining(", "));
reported.add("Security requirement (" + names + ") on " + routeKey
+ " does not resolve to a supported authorizer; the route is imported as NONE"
+ " and will accept unauthenticated requests");
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2Service.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2Service.java
index 41e29ae523..e72481416e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2Service.java
@@ -16,11 +16,17 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ApplicationScoped
@@ -330,7 +336,7 @@ public class ApiGatewayV2Service {
if (!(raw instanceof Map<?, ?> m) || m.isEmpty()) {
return null;
}
- Map<String, Stage.RouteSettings> settings = new java.util.LinkedHashMap<>();
+ Map<String, Stage.RouteSettings> settings = new LinkedHashMap<>();
m.forEach((key, value) -> {
Stage.RouteSettings parsed = toRouteSettings(value);
if (parsed != null) {
@@ -516,7 +522,7 @@ public class ApiGatewayV2Service {
/** Restores a route without treating any conflicting route as rollback-owned. */
public void restoreRoute(String region, String apiId, Route route) {
- restoreRoute(region, apiId, route, java.util.Set.of());
+ restoreRoute(region, apiId, route, Set.of());
}
/**
@@ -525,13 +531,13 @@ public class ApiGatewayV2Service {
* independently managed routes must never be deleted as a rollback side effect.
*/
public void restoreRoute(String region, String apiId, Route route,
- java.util.Collection<String> replaceableRouteIds) {
+ Collection<String> replaceableRouteIds) {
getApi(region, apiId);
// A failed cleanup can leave a replacement route behind. Remove that conflicting
// route only when the caller proves it belongs to that failed replacement.
for (Route existing : getRoutes(region, apiId)) {
- if (!java.util.Objects.equals(existing.getRouteId(), route.getRouteId())
- && java.util.Objects.equals(existing.getRouteKey(), route.getRouteKey())) {
+ if (!Objects.equals(existing.getRouteId(), route.getRouteId())
+ && Objects.equals(existing.getRouteKey(), route.getRouteKey())) {
if (replaceableRouteIds.contains(existing.getRouteId())) {
routeStore.delete(routeKey(region, apiId, existing.getRouteId()));
} else {
@@ -587,7 +593,7 @@ public class ApiGatewayV2Service {
return;
}
boolean duplicate = getRoutes(region, apiId).stream()
- .anyMatch(existing -> !java.util.Objects.equals(existing.getRouteId(), currentRouteId)
+ .anyMatch(existing -> !Objects.equals(existing.getRouteId(), currentRouteId)
&& requestedRouteKey.equals(existing.getRouteKey()));
if (duplicate) {
throw new AwsException("ConflictException",
@@ -609,7 +615,7 @@ public class ApiGatewayV2Service {
"authorizationScopes must be a list of strings", 400);
}
return list.stream()
- .filter(java.util.Objects::nonNull)
+ .filter(Objects::nonNull)
.map(String::valueOf)
.toList();
}
@@ -666,7 +672,7 @@ public class ApiGatewayV2Service {
// Build regex from path template: {proxy+} -> .+, {param} -> [^/]+
// Quote literal segments to avoid regex injection from path patterns
StringBuilder regex = new StringBuilder("^");
- java.util.regex.Matcher m = java.util.regex.Pattern.compile("\\{([^}]*)}").matcher(pattern);
+ Matcher m = Pattern.compile("\\{([^}]*)}").matcher(pattern);
int last = 0;
while (m.find()) {
regex.append(Pattern.quote(pattern.substring(last, m.start())));
@@ -1271,7 +1277,7 @@ public class ApiGatewayV2Service {
Stage stage = getStage(target.region(), target.apiId(), target.stageName());
if (tags != null && !tags.isEmpty()) {
if (stage.getTags() == null) {
- stage.setTags(new java.util.HashMap<>());
+ stage.setTags(new HashMap<>());
}
stage.getTags().putAll(tags);
}
@@ -1282,7 +1288,7 @@ public class ApiGatewayV2Service {
ReservedTags.rejectApiGatewayReservedTagsOnUpdate(tags, target.apiId());
if (tags != null && !tags.isEmpty()) {
if (api.getTags() == null) {
- api.setTags(new java.util.HashMap<>());
+ api.setTags(new HashMap<>());
}
api.getTags().putAll(ReservedTags.stripApiGatewayReservedTags(tags));
}
@@ -1324,7 +1330,7 @@ public class ApiGatewayV2Service {
} else {
tags = getApi(target.region(), target.apiId()).getTags();
}
- return (tags != null) ? new java.util.HashMap<>(tags) : java.util.Collections.emptyMap();
+ return (tags != null) ? new HashMap<>(tags) : Collections.emptyMap();
}
// ──────────────────────────── Key helpers ────────────────────────────
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/model/Route.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/model/Route.java
index 71c9875bfd..ff0e0f430e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/model/Route.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/model/Route.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.apigatewayv2.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
+import java.util.List;
+
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
public class Route {
@@ -10,7 +12,7 @@ public class Route {
private String routeKey;
private String authorizationType; // NONE, AWS_IAM, CUSTOM, JWT
private String authorizerId;
- private java.util.List<String> authorizationScopes;
+ private List<String> authorizationScopes;
private String target; // integrations/{integrationId}
private String routeResponseSelectionExpression;
@@ -28,8 +30,8 @@ public class Route {
public String getAuthorizerId() { return authorizerId; }
public void setAuthorizerId(String authorizerId) { this.authorizerId = authorizerId; }
- public java.util.List<String> getAuthorizationScopes() { return authorizationScopes; }
- public void setAuthorizationScopes(java.util.List<String> authorizationScopes) { this.authorizationScopes = authorizationScopes; }
+ public List<String> getAuthorizationScopes() { return authorizationScopes; }
+ public void setAuthorizationScopes(List<String> authorizationScopes) { this.authorizationScopes = authorizationScopes; }
public String getTarget() { return target; }
public void setTarget(String target) { this.target = target; }
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketHandler.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketHandler.java
index e8d5ac039f..39a6c8b77c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketHandler.java
@@ -12,18 +12,29 @@ import io.github.hectorvent.floci.services.apigatewayv2.model.Api;
import io.github.hectorvent.floci.services.apigatewayv2.model.Integration;
import io.github.hectorvent.floci.services.apigatewayv2.model.Route;
import io.github.hectorvent.floci.services.apigatewayv2.model.Stage;
+import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.ServerWebSocket;
+import io.vertx.core.net.HostAndPort;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Cookie;
+import jakarta.ws.rs.core.HttpHeaders;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.MultivaluedHashMap;
+import jakarta.ws.rs.core.MultivaluedMap;
import org.jboss.logging.Logger;
+import java.util.ArrayList;
+import java.util.Base64;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
@@ -51,7 +62,7 @@ public class WebSocketHandler {
private final RegionResolver regionResolver;
private final String baseHostname;
private final ObjectMapper objectMapper;
- private final io.vertx.core.Vertx vertx;
+ private final Vertx vertx;
@Inject
public WebSocketHandler(ApiGatewayV2Service apiGatewayV2Service,
@@ -63,7 +74,7 @@ public class WebSocketHandler {
RegionResolver regionResolver,
EmulatorConfig config,
ObjectMapper objectMapper,
- io.vertx.core.Vertx vertx) {
+ Vertx vertx) {
this.apiGatewayV2Service = apiGatewayV2Service;
this.connectionManager = connectionManager;
this.routeSelectionEvaluator = routeSelectionEvaluator;
@@ -141,7 +152,7 @@ public class WebSocketHandler {
if (host != null) {
return host;
}
- io.vertx.core.net.HostAndPort authority = ctx.request().authority();
+ HostAndPort authority = ctx.request().authority();
return authority != null ? authority.host() : null;
}
@@ -462,7 +473,7 @@ public class WebSocketHandler {
connectionManager.updateLastActiveAt(connectionId);
// Base64-encode the binary data for the proxy event body
- String base64Body = java.util.Base64.getEncoder().encodeToString(data);
+ String base64Body = Base64.getEncoder().encodeToString(data);
// Route using the base64 body (route selection won't match JSON fields in binary messages,
// so it will fall through to $default)
@@ -733,7 +744,7 @@ public class WebSocketHandler {
private Map<String, List<String>> extractHeaders(RoutingContext ctx) {
Map<String, List<String>> headers = new HashMap<>();
ctx.request().headers().forEach(entry ->
- headers.computeIfAbsent(entry.getKey(), k -> new java.util.ArrayList<>())
+ headers.computeIfAbsent(entry.getKey(), k -> new ArrayList<>())
.add(entry.getValue()));
return headers;
}
@@ -744,7 +755,7 @@ public class WebSocketHandler {
private Map<String, List<String>> extractQueryParams(RoutingContext ctx) {
Map<String, List<String>> params = new HashMap<>();
ctx.request().params().forEach(entry ->
- params.computeIfAbsent(entry.getKey(), k -> new java.util.ArrayList<>())
+ params.computeIfAbsent(entry.getKey(), k -> new ArrayList<>())
.add(entry.getValue()));
return params;
}
@@ -758,7 +769,7 @@ public class WebSocketHandler {
String authHeader = ctx.request().getHeader("Authorization");
if (authHeader != null && !authHeader.isEmpty()) {
// Use a simple JAX-RS HttpHeaders adapter to delegate to RegionResolver
- jakarta.ws.rs.core.HttpHeaders headers = new SimpleHttpHeaders(authHeader);
+ HttpHeaders headers = new SimpleHttpHeaders(authHeader);
return regionResolver.resolveRegion(headers);
}
// A WebSocket handshake carries no SigV4 Authorization header, so fall back to the
@@ -771,7 +782,7 @@ public class WebSocketHandler {
* Minimal HttpHeaders implementation that provides only the Authorization header.
* Used to bridge Vert.x request headers to the RegionResolver API.
*/
- private static class SimpleHttpHeaders implements jakarta.ws.rs.core.HttpHeaders {
+ private static class SimpleHttpHeaders implements HttpHeaders {
private final String authorizationHeader;
SimpleHttpHeaders(String authorizationHeader) {
@@ -787,45 +798,45 @@ public class WebSocketHandler {
}
@Override
- public java.util.List<String> getRequestHeader(String name) {
+ public List<String> getRequestHeader(String name) {
if ("Authorization".equalsIgnoreCase(name) && authorizationHeader != null) {
- return java.util.List.of(authorizationHeader);
+ return List.of(authorizationHeader);
}
- return java.util.Collections.emptyList();
+ return Collections.emptyList();
}
@Override
- public jakarta.ws.rs.core.MultivaluedMap<String, String> getRequestHeaders() {
- return new jakarta.ws.rs.core.MultivaluedHashMap<>();
+ public MultivaluedMap<String, String> getRequestHeaders() {
+ return new MultivaluedHashMap<>();
}
@Override
- public java.util.List<jakarta.ws.rs.core.MediaType> getAcceptableMediaTypes() {
- return java.util.Collections.emptyList();
+ public List<MediaType> getAcceptableMediaTypes() {
+ return Collections.emptyList();
}
@Override
- public java.util.List<java.util.Locale> getAcceptableLanguages() {
- return java.util.Collections.emptyList();
+ public List<Locale> getAcceptableLanguages() {
+ return Collections.emptyList();
}
@Override
- public jakarta.ws.rs.core.MediaType getMediaType() {
+ public MediaType getMediaType() {
return null;
}
@Override
- public java.util.Locale getLanguage() {
+ public Locale getLanguage() {
return null;
}
@Override
- public java.util.Map<String, jakarta.ws.rs.core.Cookie> getCookies() {
- return java.util.Collections.emptyMap();
+ public Map<String, Cookie> getCookies() {
+ return Collections.emptyMap();
}
@Override
- public java.util.Date getDate() {
+ public Date getDate() {
return null;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketProxyEventBuilder.java b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketProxyEventBuilder.java
index 4ac9510098..3b36c9fd78 100644
--- a/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketProxyEventBuilder.java
+++ b/src/main/java/io/github/hectorvent/floci/services/apigatewayv2/websocket/WebSocketProxyEventBuilder.java
@@ -10,6 +10,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
+import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
@@ -298,7 +299,7 @@ public class WebSocketProxyEventBuilder {
private String formatRequestTime(long epochMillis) {
ZonedDateTime time = ZonedDateTime.ofInstant(
- java.time.Instant.ofEpochMilli(epochMillis), ZoneOffset.UTC);
+ Instant.ofEpochMilli(epochMillis), ZoneOffset.UTC);
return REQUEST_TIME_FORMATTER.format(time);
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncController.java b/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncController.java
index 4927622ea7..ec5bfd7bf8 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncController.java
@@ -14,6 +14,8 @@ import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
import java.util.List;
import java.util.Map;
@@ -106,7 +108,7 @@ public class AppSyncController {
String definition = (String) request.get("definition");
if (definition != null) {
try {
- definition = new String(java.util.Base64.getDecoder().decode(definition), java.nio.charset.StandardCharsets.UTF_8);
+ definition = new String(Base64.getDecoder().decode(definition), StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
// Not base64, use as-is
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncService.java b/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncService.java
index 0b23f26725..4400309769 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appsync/AppSyncService.java
@@ -24,6 +24,8 @@ import org.jboss.logging.Logger;
import java.security.SecureRandom;
import java.time.Clock;
import java.time.Duration;
+import java.time.Instant;
+import java.time.format.DateTimeParseException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -1115,8 +1117,8 @@ public class AppSyncService {
return Long.parseLong(s);
} catch (NumberFormatException e) {
try {
- return java.time.Instant.parse(s).getEpochSecond();
- } catch (java.time.format.DateTimeParseException ex) {
+ return Instant.parse(s).getEpochSecond();
+ } catch (DateTimeParseException ex) {
throw new AwsException("BadRequestException",
"Invalid expires value: " + s + ". Expected epoch seconds or ISO 8601.", 400);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncDirective.java b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncDirective.java
index 2337b48a68..43bc0d5022 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncDirective.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncDirective.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.appsync.graphql;
+import java.util.HashSet;
import java.util.Set;
public enum AppSyncDirective {
@@ -16,14 +17,14 @@ public enum AppSyncDirective {
private static final Set<String> KNOWN_NAMES;
static {
- java.util.Set<String> names = new java.util.HashSet<>();
+ Set<String> names = new HashSet<>();
names.add("skip");
names.add("include");
names.add("deprecated");
for (AppSyncDirective d : values()) {
names.add(d.directiveName());
}
- KNOWN_NAMES = java.util.Set.copyOf(names);
+ KNOWN_NAMES = Set.copyOf(names);
}
private final String name;
diff --git a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/CognitoAuthValidator.java b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/CognitoAuthValidator.java
index 92f67b846f..c9b81ed02b 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/CognitoAuthValidator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/CognitoAuthValidator.java
@@ -15,6 +15,7 @@ import java.time.Clock;
import java.util.Base64;
import java.util.List;
import java.util.Map;
+import java.util.function.Predicate;
import java.util.regex.Pattern;
/**
@@ -172,7 +173,7 @@ public class CognitoAuthValidator {
return clientId != null && clientMatches(claims, clientId::equals);
}
- static boolean clientMatches(Map<String, Object> claims, java.util.function.Predicate<String> matcher) {
+ static boolean clientMatches(Map<String, Object> claims, Predicate<String> matcher) {
Object aud = claims.get("aud");
if (aud instanceof String s && matcher.test(s)) {
return true;
diff --git a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerValidator.java b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerValidator.java
index 389b526960..aa4c48f7c3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerValidator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerValidator.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.appsync.graphql.auth;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.services.lambda.LambdaService;
import io.github.hectorvent.floci.services.lambda.model.InvocationType;
@@ -158,7 +159,7 @@ public class LambdaAuthorizerValidator {
if (size > MAX_RESOLVER_CONTEXT_BYTES) {
throw AppSyncAuth.unauthorized();
}
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
throw AppSyncAuth.unauthorized();
}
return flat;
diff --git a/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsJsonHandler.java
index a247d5bd1b..a34604fda7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsJsonHandler.java
@@ -13,6 +13,7 @@ import io.github.hectorvent.floci.services.bcmdataexports.model.DestinationConfi
import io.github.hectorvent.floci.services.bcmdataexports.model.Export;
import io.github.hectorvent.floci.services.bcmdataexports.model.ExportExecution;
import io.github.hectorvent.floci.services.bcmdataexports.model.RefreshCadence;
+import io.github.hectorvent.floci.services.cur.CurEmissionScheduler;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
@@ -36,12 +37,12 @@ public class BcmDataExportsJsonHandler {
private final BcmDataExportsService service;
private final ObjectMapper objectMapper;
- private final io.github.hectorvent.floci.services.cur.CurEmissionScheduler scheduler;
+ private final CurEmissionScheduler scheduler;
@Inject
public BcmDataExportsJsonHandler(BcmDataExportsService service,
ObjectMapper objectMapper,
- io.github.hectorvent.floci.services.cur.CurEmissionScheduler scheduler) {
+ CurEmissionScheduler scheduler) {
this.service = service;
this.objectMapper = objectMapper;
this.scheduler = scheduler;
diff --git a/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsService.java b/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsService.java
index 6950999238..3913f3add7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bcmdataexports/BcmDataExportsService.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.S3DestinationValidation;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
+import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.bcmdataexports.model.DataQuery;
@@ -22,6 +23,7 @@ import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -129,15 +131,15 @@ public class BcmDataExportsService {
*/
public Map<String, List<Export>> listAllExportsByAccount() {
Collection<Export> all;
- if (exportStore instanceof io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<?> aware) {
+ if (exportStore instanceof AccountAwareStorageBackend<?> aware) {
@SuppressWarnings("unchecked")
- io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<Export> typed =
- (io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<Export>) aware;
+ AccountAwareStorageBackend<Export> typed =
+ (AccountAwareStorageBackend<Export>) aware;
all = typed.scanAllAccounts();
} else {
all = exportStore.scan(key -> true);
}
- Map<String, List<Export>> result = new java.util.LinkedHashMap<>();
+ Map<String, List<Export>> result = new LinkedHashMap<>();
for (Export export : all) {
String account = export.getOwnerAccountId();
if (account == null || account.isEmpty()) {
@@ -229,10 +231,10 @@ public class BcmDataExportsService {
exec.setCreatedBy(createdBy);
exec.setCreatedAt(System.currentTimeMillis());
String key = executionKey(exportArn, exec.getExecutionId());
- if (executionStore instanceof io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<?> aware) {
+ if (executionStore instanceof AccountAwareStorageBackend<?> aware) {
@SuppressWarnings("unchecked")
- io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ExportExecution> typed =
- (io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ExportExecution>) aware;
+ AccountAwareStorageBackend<ExportExecution> typed =
+ (AccountAwareStorageBackend<ExportExecution>) aware;
typed.putForAccount(accountId, key, exec);
} else {
executionStore.put(key, exec);
@@ -256,10 +258,10 @@ public class BcmDataExportsService {
exec.setStatusReason(reason);
}
String key = executionKey(exec.getExportArn(), exec.getExecutionId());
- if (executionStore instanceof io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<?> aware) {
+ if (executionStore instanceof AccountAwareStorageBackend<?> aware) {
@SuppressWarnings("unchecked")
- io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ExportExecution> typed =
- (io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ExportExecution>) aware;
+ AccountAwareStorageBackend<ExportExecution> typed =
+ (AccountAwareStorageBackend<ExportExecution>) aware;
typed.putForAccount(accountId, key, exec);
} else {
executionStore.put(key, exec);
diff --git a/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorJsonHandler.java
index 5f04c65a0e..319d209031 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorJsonHandler.java
@@ -12,6 +12,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -117,7 +118,7 @@ public class BcmPricingCalculatorJsonHandler {
return out;
}
- private static double epochSeconds(java.time.Instant instant) {
+ private static double epochSeconds(Instant instant) {
return instant.getEpochSecond() + instant.getNano() / 1_000_000_000.0;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorService.java b/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorService.java
index 887072168d..4e48beceb3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorService.java
@@ -17,6 +17,7 @@ import jakarta.inject.Inject;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -157,7 +158,7 @@ public class BcmPricingCalculatorService {
public List<WorkloadEstimateUsage> listUsage(String estimateId) {
get(estimateId);
return usages.scan(k -> k.startsWith(estimateId + "/")).stream()
- .sorted(java.util.Comparator.comparing(WorkloadEstimateUsage::getKey)).toList();
+ .sorted(Comparator.comparing(WorkloadEstimateUsage::getKey)).toList();
}
private void recompute(WorkloadEstimate estimate) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreControlController.java b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreControlController.java
index 8e6c4371db..ef969cc03f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreControlController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreControlController.java
@@ -27,6 +27,7 @@ import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.Map;
/**
@@ -401,7 +402,7 @@ public class BedrockAgentCoreControlController {
if (instant != null) {
// AgentCore models these as ISO-8601 strings; second precision stays within
// AWS's 20-char timestamp limit.
- node.put(field, instant.truncatedTo(java.time.temporal.ChronoUnit.SECONDS).toString());
+ node.put(field, instant.truncatedTo(ChronoUnit.SECONDS).toString());
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreCredentialProviderService.java b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreCredentialProviderService.java
index 730ecaf8fb..660e27078d 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreCredentialProviderService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreCredentialProviderService.java
@@ -18,6 +18,7 @@ import jakarta.inject.Inject;
import java.time.Instant;
import java.util.List;
import java.util.Map;
+import java.util.Set;
@ApplicationScoped
public class BedrockAgentCoreCredentialProviderService {
@@ -349,7 +350,7 @@ public class BedrockAgentCoreCredentialProviderService {
}
private static void validateOauthVendor(String vendor) {
- if (vendor == null || !java.util.Set.of(
+ if (vendor == null || !Set.of(
"GoogleOauth2", "GithubOauth2", "SlackOauth2", "SalesforceOauth2", "MicrosoftOauth2",
"CustomOauth2", "AtlassianOauth2", "LinkedinOauth2", "XOauth2", "OktaOauth2",
"OneLoginOauth2", "PingOneOauth2", "FacebookOauth2", "YandexOauth2", "RedditOauth2",
diff --git a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreGatewayController.java b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreGatewayController.java
index e7f813e222..ea16ee2b1c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreGatewayController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreGatewayController.java
@@ -26,6 +26,7 @@ import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.Map;
/** Standard-REST endpoints for AgentCore gateways and gateway targets. */
@@ -287,7 +288,7 @@ public class BedrockAgentCoreGatewayController {
private static void putInstant(ObjectNode node, String field, Instant instant) {
if (instant != null) {
- node.put(field, instant.truncatedTo(java.time.temporal.ChronoUnit.SECONDS).toString());
+ node.put(field, instant.truncatedTo(ChronoUnit.SECONDS).toString());
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreToolsService.java b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreToolsService.java
index 47b42ce4dd..08d393d402 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreToolsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bedrockagentcorecontrol/BedrockAgentCoreToolsService.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.bedrockagentcorecontrol;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
@@ -81,7 +82,7 @@ public class BedrockAgentCoreToolsService {
public ObjectNode getBrowser(String browserId, String region) {
if ("aws.browser.v1".equals(browserId)) {
- ObjectNode browser = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
+ ObjectNode browser = JsonNodeFactory.instance.objectNode();
browser.put("browserId", browserId);
browser.put("browserArn", regionResolver.buildArn("bedrock-agentcore", region, "browser/" + browserId));
browser.put("name", browserId);
@@ -175,7 +176,7 @@ public class BedrockAgentCoreToolsService {
public ObjectNode getCodeInterpreter(String codeInterpreterId, String region) {
if ("aws.codeinterpreter.v1".equals(codeInterpreterId)) {
- ObjectNode interpreter = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
+ ObjectNode interpreter = JsonNodeFactory.instance.objectNode();
interpreter.put("codeInterpreterId", codeInterpreterId);
interpreter.put("codeInterpreterArn", AwsArnUtils.Arn.of("bedrock-agentcore", region, "aws",
"code-interpreter/aws.codeinterpreter.v1").toString());
diff --git a/src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/BedrockOpenAiTranslator.java b/src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/BedrockOpenAiTranslator.java
index ba3d0b4cad..dafc5e0633 100644
--- a/src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/BedrockOpenAiTranslator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/BedrockOpenAiTranslator.java
@@ -457,7 +457,7 @@ final class BedrockOpenAiTranslator {
mapper.createObjectNode().put("contentBlockIndex", 0));
}
- var validToolCalls = collectValidToolCalls(mapper, toolCalls);
+ List<ToolCallAccumulator> validToolCalls = collectValidToolCalls(mapper, toolCalls);
int blockIndex = anyContentDeltaWritten ? 1 : 0;
for (ToolCallAccumulator acc : validToolCalls) {
writeToolCalls(mapper, out, acc, blockIndex);
diff --git a/src/main/java/io/github/hectorvent/floci/services/budgets/BudgetsService.java b/src/main/java/io/github/hectorvent/floci/services/budgets/BudgetsService.java
index 91f50fd9b3..b665fab4f0 100644
--- a/src/main/java/io/github/hectorvent/floci/services/budgets/BudgetsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/budgets/BudgetsService.java
@@ -22,6 +22,7 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -264,7 +265,7 @@ public class BudgetsService implements Resettable {
JsonNode incoming = request.get("ResourceTags");
validateTags(incoming);
ArrayNode merged = objectMapper.createArrayNode();
- Map<String, String> tags = new java.util.LinkedHashMap<>();
+ Map<String, String> tags = new LinkedHashMap<>();
JsonNode current = tagsFor(ref);
if (current != null && current.isArray()) {
current.forEach(tag -> tags.put(text(tag, "Key"), text(tag, "Value")));
diff --git a/src/main/java/io/github/hectorvent/floci/services/ce/GroupAggregator.java b/src/main/java/io/github/hectorvent/floci/services/ce/GroupAggregator.java
index 95e419cfd1..c6dd0fbaa1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ce/GroupAggregator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ce/GroupAggregator.java
@@ -7,10 +7,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.UsageLine;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -30,7 +33,7 @@ final class GroupAggregator {
* Builds a single {@code ResultByTime} entry covering {@code [bucketStart, bucketEnd)}
* from the provided lines (already filtered + costed).
*/
- ObjectNode buildResultByTime(java.time.Instant bucketStart, java.time.Instant bucketEnd,
+ ObjectNode buildResultByTime(Instant bucketStart, Instant bucketEnd,
List<UsageLine> lines, List<GroupBy> groupBys, Set<String> metrics,
CostSynthesizer synthesizer) {
ObjectNode result = objectMapper.createObjectNode();
@@ -123,7 +126,7 @@ final class GroupAggregator {
}
static Set<String> parseMetrics(JsonNode node) {
- Set<String> out = new java.util.LinkedHashSet<>();
+ Set<String> out = new LinkedHashSet<>();
if (node.isArray()) {
for (JsonNode v : node) {
if (!v.isNull() && !v.asText().isEmpty()) {
@@ -136,7 +139,7 @@ final class GroupAggregator {
static String formatAmount(double amount) {
// AWS returns amounts as decimal strings.
- return String.format(java.util.Locale.ROOT, "%.10f", amount);
+ return String.format(Locale.ROOT, "%.10f", amount);
}
record GroupBy(String type, String key) {}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ce/PricingRateLookup.java b/src/main/java/io/github/hectorvent/floci/services/ce/PricingRateLookup.java
index 412107a5d7..3485ccb0ae 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ce/PricingRateLookup.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ce/PricingRateLookup.java
@@ -9,6 +9,7 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -109,13 +110,13 @@ public class PricingRateLookup {
if (!onDemand.isObject()) {
return 0.0;
}
- java.util.Iterator<java.util.Map.Entry<String, JsonNode>> termIter = onDemand.fields();
+ Iterator<Map.Entry<String, JsonNode>> termIter = onDemand.fields();
while (termIter.hasNext()) {
JsonNode dimensions = termIter.next().getValue().path("priceDimensions");
if (!dimensions.isObject()) {
continue;
}
- java.util.Iterator<java.util.Map.Entry<String, JsonNode>> dimIter = dimensions.fields();
+ Iterator<Map.Entry<String, JsonNode>> dimIter = dimensions.fields();
while (dimIter.hasNext()) {
JsonNode dim = dimIter.next().getValue();
String usd = dim.path("pricePerUnit").path("USD").asText("0");
diff --git a/src/main/java/io/github/hectorvent/floci/services/ce/TimeBucketing.java b/src/main/java/io/github/hectorvent/floci/services/ce/TimeBucketing.java
index eda1efc563..2bb8de9dc1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ce/TimeBucketing.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ce/TimeBucketing.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ce;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
+import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -10,6 +11,7 @@ import java.time.OffsetDateTime;
import java.time.YearMonth;
import java.time.ZoneOffset;
import java.time.format.DateTimeParseException;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
@@ -83,8 +85,8 @@ final class TimeBucketing {
private static Instant floor(Instant instant, Granularity granularity) {
return switch (granularity) {
- case HOURLY -> instant.truncatedTo(java.time.temporal.ChronoUnit.HOURS);
- case DAILY -> instant.truncatedTo(java.time.temporal.ChronoUnit.DAYS);
+ case HOURLY -> instant.truncatedTo(ChronoUnit.HOURS);
+ case DAILY -> instant.truncatedTo(ChronoUnit.DAYS);
case MONTHLY -> YearMonth.from(instant.atOffset(ZoneOffset.UTC))
.atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant();
};
@@ -97,7 +99,7 @@ final class TimeBucketing {
}
return switch (granularity) {
case HOURLY -> floored.plusSeconds(3600);
- case DAILY -> floored.plus(java.time.Duration.ofDays(1));
+ case DAILY -> floored.plus(Duration.ofDays(1));
case MONTHLY -> YearMonth.from(floored.atOffset(ZoneOffset.UTC))
.plusMonths(1).atDay(1).atStartOfDay(ZoneOffset.UTC).toInstant();
};
@@ -118,7 +120,7 @@ final class TimeBucketing {
List<Bucket> out = new ArrayList<>();
Instant cursor = start;
while (cursor.isBefore(end)) {
- Instant next = cursor.plus(java.time.Duration.ofDays(1));
+ Instant next = cursor.plus(Duration.ofDays(1));
out.add(new Bucket(cursor, next.isAfter(end) ? end : next));
cursor = next;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessor.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessor.java
index 7e2db2cadc..8989b223ce 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessor.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessor.java
@@ -15,8 +15,11 @@ import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -293,7 +296,7 @@ class SamTransformProcessor {
// Auth.Authorizers -> one AWS::ApiGatewayV2::Authorizer per entry, keyed by SAM authorizer
// name so routes referencing Auth.DefaultAuthorizer (the only form handled here — per-route
// Auth overrides are not expanded) can resolve the logical id to Ref.
- Map<String, String> authorizerLogicalIdsByName = new java.util.LinkedHashMap<>();
+ Map<String, String> authorizerLogicalIdsByName = new LinkedHashMap<>();
JsonNode auth = properties.path("Auth");
JsonNode authorizers = auth.path("Authorizers");
if (authorizers.isObject()) {
@@ -582,7 +585,7 @@ class SamTransformProcessor {
private Map<String, String> expandImplicitRestApiAuthorizers(String apiId, JsonNode auth,
ObjectNode resources) {
- Map<String, String> logicalIds = new java.util.LinkedHashMap<>();
+ Map<String, String> logicalIds = new LinkedHashMap<>();
JsonNode authorizers = auth.path("Authorizers");
if (authorizers.isTextual()) {
if (!"AWS_IAM".equals(authorizers.asText())) {
@@ -755,10 +758,10 @@ class SamTransformProcessor {
"SAM Api authorizer '" + defaultAuthorizer + "' is not defined in Auth.Authorizers.", 400);
}
- Map<String, String> pathToResource = new java.util.LinkedHashMap<>();
+ Map<String, String> pathToResource = new LinkedHashMap<>();
List<String> methodIds = new ArrayList<>();
- java.util.Set<String> permissionFns = new java.util.LinkedHashSet<>();
- java.util.Set<String> seenRoutes = new java.util.LinkedHashSet<>();
+ Set<String> permissionFns = new LinkedHashSet<>();
+ Set<String> seenRoutes = new LinkedHashSet<>();
for (ApiRoute r : routes) {
String method = r.httpMethod().toUpperCase();
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java
index 37e147ce21..98c874dd81 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/StackSetService.java
@@ -26,6 +26,7 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@@ -374,7 +375,7 @@ public class StackSetService implements PassedRoleLookup {
getStackSetOrThrow(name);
String prefix = name + "::";
return autoDeploymentTargets.scan(key -> key.startsWith(prefix)).stream()
- .sorted(java.util.Comparator.comparing(StackSetAutoDeploymentTarget::getOrganizationalUnitId))
+ .sorted(Comparator.comparing(StackSetAutoDeploymentTarget::getOrganizationalUnitId))
.toList();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisioner.java
index fa30eb2cd8..28a51c206e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisioner.java
@@ -23,6 +23,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Consumer;
/**
* Provisions the AppSync resource types a GraphQL API is deployed from: the API itself, its schema,
@@ -366,7 +367,7 @@ public class AppSyncCfnProvisioner implements CfnResourceProvisioner {
* stack delete over a resource the emulator has no way to find.
*/
private void deleteChild(StackResource r, String apiId, String description, String childId,
- java.util.function.Consumer<String> delete) {
+ Consumer<String> delete) {
if (blank(apiId) || blank(childId)) {
LOG.warnv("Cannot delete AppSync {0} for {1}: no recorded api id/name, it is not removed",
description, r.getLogicalId());
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisioner.java
index 41fd4b026c..8d8eb8f68e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisioner.java
@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.codebuild.CodeBuildJsonHandler;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.util.Set;
@@ -75,7 +76,7 @@ public class CodeBuildCfnProvisioner implements CfnResourceProvisioner {
private JsonNode handle(String action, ObjectNode request, String region, String account) {
try {
- jakarta.ws.rs.core.Response response =
+ Response response =
codeBuildJsonHandler.handle(action, request, region, account);
try {
// The handler returns Response.ok(Map.of(...)) for every JSON action, never a
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisioner.java
index da46591ef5..f308f97b76 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisioner.java
@@ -13,6 +13,10 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Set;
/**
@@ -125,7 +129,7 @@ public class CodePipelineCfnProvisioner implements CfnResourceProvisioner {
response = codePipelineService.handle("UpdatePipeline", request, ctx.region(), ctx.accountId());
}
- java.util.Set<String> desiredDisabledStages = new java.util.LinkedHashSet<>();
+ Set<String> desiredDisabledStages = new LinkedHashSet<>();
if (transitions != null && transitions.isArray()) {
for (JsonNode transition : transitions) {
desiredDisabledStages.add(transition.path("stageName").asText());
@@ -141,13 +145,13 @@ public class CodePipelineCfnProvisioner implements CfnResourceProvisioner {
Iterable<String> candidateStages;
if (previouslyManaged != null) {
candidateStages = previouslyManaged.isBlank()
- ? java.util.List.of() : java.util.Arrays.asList(previouslyManaged.split(","));
+ ? List.of() : Arrays.asList(previouslyManaged.split(","));
} else {
// A resource stored before DISABLED_STAGES_ATTR existed has no record of what it
// previously disabled. Fall back to reconciling every declared stage rather than
// skipping reconciliation outright, which would leave a removed entry disabled
// forever after this one legacy update.
- java.util.List<String> declaredStages = new java.util.ArrayList<>();
+ List<String> declaredStages = new ArrayList<>();
if (declaration.path("stages").isArray()) {
for (JsonNode stage : declaration.path("stages")) {
declaredStages.add(stage.path("name").asText());
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java
index 17c39025e1..6079b757dd 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/RdsCfnProvisioner.java
@@ -30,6 +30,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
/**
* CloudFormation provisioning for RDS: the two parameter-group types, {@code DBSubnetGroup},
@@ -928,7 +930,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
}
}
- private io.github.hectorvent.floci.services.rds.model.DbProxy updateDbProxy(
+ private DbProxy updateDbProxy(
StackResource resource, String name, String engineFamily, String defaultAuthScheme,
boolean requireTls, int idleClientTimeout, boolean debugLogging, String roleArn,
List<String> subnetIds, List<String> securityGroupIds, List<DbProxyAuth> auth,
@@ -1161,7 +1163,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
}
private <T> T sameNameExistingResource(String priorPhysicalId, String name,
- java.util.function.Function<String, T> lookup) {
+ Function<String, T> lookup) {
if (priorPhysicalId == null || !priorPhysicalId.equals(name)) {
return null;
}
@@ -1176,7 +1178,7 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
}
private void deleteRenamedResource(String priorPhysicalId, String newName,
- java.util.function.Consumer<String> delete, String resourceKind) {
+ Consumer<String> delete, String resourceKind) {
if (priorPhysicalId == null || priorPhysicalId.equals(newName)) {
return;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontRequestRouter.java b/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontRequestRouter.java
index 8e169eb338..fe0ea085ae 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontRequestRouter.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontRequestRouter.java
@@ -10,6 +10,7 @@ import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Pattern;
@@ -331,7 +332,7 @@ public final class CloudFrontRequestRouter {
}
host = host.substring(0, colon);
}
- String lowerHost = host.toLowerCase(java.util.Locale.ROOT);
+ String lowerHost = host.toLowerCase(Locale.ROOT);
int endpointMarker = -1;
for (String marker : new String[] {".s3-website-", ".s3-website.", ".s3.", ".s3-"}) {
endpointMarker = Math.max(endpointMarker, lowerHost.lastIndexOf(marker));
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2Service.java b/src/main/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2Service.java
index 5a10012996..35cec40199 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2Service.java
@@ -33,11 +33,13 @@ import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
+import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -287,8 +289,8 @@ public class CloudHsmV2Service {
// Verify TrustAnchor is self-signed and SignedCert is issued by TrustAnchor
try {
JcaX509CertificateConverter converter = new JcaX509CertificateConverter();
- java.security.cert.X509Certificate trustAnchorCert = converter.getCertificate(trustAnchorHolder);
- java.security.cert.X509Certificate signedCertObj = converter.getCertificate(signedCertHolder);
+ X509Certificate trustAnchorCert = converter.getCertificate(trustAnchorHolder);
+ X509Certificate signedCertObj = converter.getCertificate(signedCertHolder);
if (!trustAnchorHolder.getIssuer().equals(trustAnchorHolder.getSubject())) {
throw new AwsException("CloudHsmInvalidRequestException",
@@ -657,9 +659,9 @@ public class CloudHsmV2Service {
}
if (Boolean.TRUE.equals(sortAscending)) {
- filtered.sort(java.util.Comparator.comparing(Backup::getCreateTimestamp));
+ filtered.sort(Comparator.comparing(Backup::getCreateTimestamp));
} else {
- filtered.sort(java.util.Comparator.comparing(Backup::getCreateTimestamp).reversed());
+ filtered.sort(Comparator.comparing(Backup::getCreateTimestamp).reversed());
}
return filtered;
@@ -679,7 +681,7 @@ public class CloudHsmV2Service {
throw new AwsException("CloudHsmInvalidRequestException", "Backup must be in PENDING_DELETION state", 400);
}
if (backup.getDeleteTimestamp() != null) {
- long daysSinceDeletion = java.time.Duration.between(backup.getDeleteTimestamp(), Instant.now()).toDays();
+ long daysSinceDeletion = Duration.between(backup.getDeleteTimestamp(), Instant.now()).toDays();
if (daysSinceDeletion > 7) {
throw new AwsException("CloudHsmInvalidRequestException", "Backup is past the 7-day deletion window", 400);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java b/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java
index 871565bdf7..af35d80ddf 100644
--- a/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/codebuild/CodeBuildRunner.java
@@ -47,6 +47,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -213,7 +214,7 @@ public class CodeBuildRunner implements ContainerTeardown {
|| (build.getEnvironment() != null
&& Boolean.TRUE.equals(build.getEnvironment().getPrivilegedMode()));
- Map<String, Object> logsMap = new java.util.HashMap<>();
+ Map<String, Object> logsMap = new HashMap<>();
logsMap.put("groupName", logGroup);
logsMap.put("streamName", logStream);
logsMap.put("cloudWatchLogsArn", AwsArnUtils.Arn.of("logs", region, regionResolver.getAccountId(), "log-group:" + logGroup + ":log-stream:" + logStream).toString());
diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoAuthFlowHandler.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoAuthFlowHandler.java
index 4cd8177ccb..3ff95a3ff0 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoAuthFlowHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoAuthFlowHandler.java
@@ -17,8 +17,12 @@ import io.github.hectorvent.floci.services.lambda.model.InvocationType;
import io.github.hectorvent.floci.services.lambda.model.InvokeResult;
import org.jboss.logging.Logger;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
+import java.security.SecureRandom;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
@@ -771,9 +775,9 @@ final class CognitoAuthFlowHandler {
}
String expected;
try {
- javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA256");
- mac.init(new javax.crypto.spec.SecretKeySpec(secret.getBytes(java.nio.charset.StandardCharsets.UTF_8), "HmacSHA256"));
- byte[] sig = mac.doFinal((username + client.getClientId()).getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ Mac mac = Mac.getInstance("HmacSHA256");
+ mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+ byte[] sig = mac.doFinal((username + client.getClientId()).getBytes(StandardCharsets.UTF_8));
expected = Base64.getEncoder().encodeToString(sig);
} catch (Exception e) {
throw new AwsException("InternalErrorException", "SECRET_HASH computation failed", 500);
@@ -821,7 +825,7 @@ final class CognitoAuthFlowHandler {
String sessionToken = buildSessionToken(pool.getId(), user.getUsername(), client.getClientId());
byte[] secretBlock = new byte[16];
- new java.security.SecureRandom().nextBytes(secretBlock);
+ new SecureRandom().nextBytes(secretBlock);
String secretBlockBase64 = Base64.getEncoder().encodeToString(secretBlock);
purgeExpired(srpSessions, SrpSession::expiresAt);
diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandler.java
index c0a59a4259..051172f04c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandler.java
@@ -191,7 +191,7 @@ public class CognitoJsonHandler {
private Response handleAddCustomAttributes(JsonNode request) {
String userPoolId = request.path("UserPoolId").asText();
- List<Map<String, Object>> customAttributes = new java.util.ArrayList<>();
+ List<Map<String, Object>> customAttributes = new ArrayList<>();
JsonNode attrsNode = request.path("CustomAttributes");
if (attrsNode.isArray()) {
for (JsonNode attrNode : attrsNode) {
@@ -1186,9 +1186,9 @@ public class CognitoJsonHandler {
node.put("DeletionProtection", p.getDeletionProtection() != null ? p.getDeletionProtection() : "INACTIVE");
node.set("LambdaConfig", objectMapper.valueToTree(p.getLambdaConfig() != null ? p.getLambdaConfig() : new HashMap<>()));
node.set("SchemaAttributes", objectMapper.valueToTree(CognitoStandardAttributes.merge(p.getSchemaAttributes())));
- node.set("AutoVerifiedAttributes", objectMapper.valueToTree(p.getAutoVerifiedAttributes() != null ? p.getAutoVerifiedAttributes() : new java.util.ArrayList<>()));
- node.set("AliasAttributes", objectMapper.valueToTree(p.getAliasAttributes() != null ? p.getAliasAttributes() : new java.util.ArrayList<>()));
- node.set("UsernameAttributes", objectMapper.valueToTree(p.getUsernameAttributes() != null ? p.getUsernameAttributes() : new java.util.ArrayList<>()));
+ node.set("AutoVerifiedAttributes", objectMapper.valueToTree(p.getAutoVerifiedAttributes() != null ? p.getAutoVerifiedAttributes() : new ArrayList<>()));
+ node.set("AliasAttributes", objectMapper.valueToTree(p.getAliasAttributes() != null ? p.getAliasAttributes() : new ArrayList<>()));
+ node.set("UsernameAttributes", objectMapper.valueToTree(p.getUsernameAttributes() != null ? p.getUsernameAttributes() : new ArrayList<>()));
if (p.getSmsVerificationMessage() != null) node.put("SmsVerificationMessage", p.getSmsVerificationMessage());
if (p.getEmailVerificationMessage() != null) node.put("EmailVerificationMessage", p.getEmailVerificationMessage());
@@ -1400,7 +1400,7 @@ public class CognitoJsonHandler {
return List.of();
}
- List<ResourceServerScope> scopes = new java.util.ArrayList<>();
+ List<ResourceServerScope> scopes = new ArrayList<>();
scopesNode.forEach(item -> {
ResourceServerScope scope = new ResourceServerScope();
scope.setScopeName(item.path("ScopeName").asText());
@@ -1415,7 +1415,7 @@ public class CognitoJsonHandler {
return List.of();
}
- List<String> values = new java.util.ArrayList<>();
+ List<String> values = new ArrayList<>();
node.forEach(item -> values.add(item.asText()));
return values;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
index e8cd713067..229fbe8c53 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
@@ -80,6 +80,8 @@ import java.security.spec.X509EncodedKeySpec;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@@ -1994,9 +1996,9 @@ public class CognitoService implements ResourceProvider {
}
private String generateDomainVersion() {
- return java.time.format.DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
- .withZone(java.time.ZoneOffset.UTC)
- .format(java.time.Instant.now());
+ return DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
+ .withZone(ZoneOffset.UTC)
+ .format(Instant.now());
}
// ──────────────────────────── Log Delivery ────────────────────────────
diff --git a/src/main/java/io/github/hectorvent/floci/services/configservice/ConfigServiceJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/configservice/ConfigServiceJsonHandler.java
index dd624ccf06..661d7640f7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/configservice/ConfigServiceJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/configservice/ConfigServiceJsonHandler.java
@@ -76,7 +76,7 @@ public class ConfigServiceJsonHandler {
case "TagResource" -> tagResource(request, region);
case "UntagResource" -> untagResource(request, region);
case "ListTagsForResource" -> listTagsForResource(request, region);
- default -> throw new io.github.hectorvent.floci.core.common.AwsException(
+ default -> throw new AwsException(
"InvalidAction", "Could not find operation " + action, 400);
};
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/connect/ConnectService.java b/src/main/java/io/github/hectorvent/floci/services/connect/ConnectService.java
index cb5010b891..2c7865da8e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/connect/ConnectService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/connect/ConnectService.java
@@ -19,6 +19,7 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -195,7 +196,7 @@ public class ConnectService implements TagHandler {
throw new AwsException("InvalidParameterException",
"Value must be 'true' or 'false' for attribute " + attributeType, 400);
}
- String canonical = value.toLowerCase(java.util.Locale.ROOT);
+ String canonical = value.toLowerCase(Locale.ROOT);
ConnectInstance instance = describeInstance(instanceId, region);
instance.getAttributes().put(attributeType, canonical);
if ("INBOUND_CALLS".equals(attributeType)) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/controlcatalog/ControlCatalogService.java b/src/main/java/io/github/hectorvent/floci/services/controlcatalog/ControlCatalogService.java
index 7219dee881..4f1f67b8f9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/controlcatalog/ControlCatalogService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/controlcatalog/ControlCatalogService.java
@@ -14,6 +14,7 @@ import io.github.hectorvent.floci.services.controlcatalog.model.ControlDefinitio
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -129,7 +130,7 @@ public class ControlCatalogService implements Resettable {
.filter(definition -> identifierFilter == null || definition.aliases().contains(identifierFilter))
.filter(definition -> providerFilter == null || "AWS".equals(providerFilter))
.distinct()
- .sorted(java.util.Comparator.comparing(ControlDefinition::globalIdentifier))
+ .sorted(Comparator.comparing(ControlDefinition::globalIdentifier))
.toList();
if (offset > definitions.size()) {
throw validation("nextToken is invalid.");
diff --git a/src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlService.java b/src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlService.java
index d40e379f68..19a2db38b7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlService.java
@@ -12,6 +12,7 @@ import jakarta.inject.Inject;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -226,7 +227,7 @@ public class ControlTowerControlService {
private static Set<String> stringSet(JsonNode node) {
if (node == null || node.isNull()) return Set.of();
if (!node.isArray() || node.size() == 0) throw validation("filter values must be non-empty arrays.");
- Set<String> result = new java.util.HashSet<>();
+ Set<String> result = new HashSet<>();
for (JsonNode item : node) {
if (!item.isTextual() || item.asText().isBlank()) throw validation("filter values must be strings.");
result.add(item.asText());
diff --git a/src/main/java/io/github/hectorvent/floci/services/cur/CurEmissionScheduler.java b/src/main/java/io/github/hectorvent/floci/services/cur/CurEmissionScheduler.java
index 283bcd0b93..def10d243a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cur/CurEmissionScheduler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cur/CurEmissionScheduler.java
@@ -17,10 +17,12 @@ import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
/**
* CUR / BCM Data Exports emission orchestrator.
@@ -125,7 +127,7 @@ public class CurEmissionScheduler {
private void runDaily() {
try {
if ("daily".equals(config.services().cur().emitMode())) {
- for (Map.Entry<String, java.util.List<ReportDefinition>> perAccount
+ for (Map.Entry<String, List<ReportDefinition>> perAccount
: curService.listAllReportsByAccount().entrySet()) {
String accountId = perAccount.getKey();
for (ReportDefinition def : perAccount.getValue()) {
@@ -140,7 +142,7 @@ public class CurEmissionScheduler {
}
}
if ("daily".equals(config.services().bcmDataExports().emitMode())) {
- for (Map.Entry<String, java.util.List<Export>> perAccount
+ for (Map.Entry<String, List<Export>> perAccount
: bcmService.listAllExportsByAccount().entrySet()) {
String accountId = perAccount.getKey();
for (Export export : perAccount.getValue()) {
@@ -175,7 +177,7 @@ public class CurEmissionScheduler {
* two sides would mismatch and DuckDB would 404 on the staging object.
* Activating a request scope here keeps both sides on the same account.
*/
- private void runUnderAccount(String accountId, java.util.function.Supplier<Void> body) {
+ private void runUnderAccount(String accountId, Supplier<Void> body) {
ManagedContext requestContext = Arc.container().requestContext();
boolean alreadyActive = requestContext.isActive();
if (!alreadyActive) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/cur/CurService.java b/src/main/java/io/github/hectorvent/floci/services/cur/CurService.java
index 7b60499560..a9fb2ea3fb 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cur/CurService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cur/CurService.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.S3DestinationValidation;
import io.github.hectorvent.floci.core.common.SmithyValidationErrors;
+import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.cur.model.ReportDefinition;
@@ -15,9 +16,11 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Pattern;
/**
* AWS CUR (Cost and Usage Report) management plane.
@@ -40,8 +43,8 @@ public class CurService {
/** AWS hard limit per account: 5 report definitions. */
private static final int MAX_REPORTS_PER_ACCOUNT = 5;
/** AWS allows the report name to contain alphanumerics, hyphens, and underscores. */
- private static final java.util.regex.Pattern REPORT_NAME_PATTERN =
- java.util.regex.Pattern.compile("[A-Za-z0-9_-]+");
+ private static final Pattern REPORT_NAME_PATTERN =
+ Pattern.compile("[A-Za-z0-9_-]+");
private static final Set<String> ALLOWED_TIME_UNITS = Set.of("HOURLY", "DAILY", "MONTHLY");
/**
@@ -140,15 +143,15 @@ public class CurService {
*/
public Map<String, List<ReportDefinition>> listAllReportsByAccount() {
Collection<ReportDefinition> all;
- if (store instanceof io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<?> aware) {
+ if (store instanceof AccountAwareStorageBackend<?> aware) {
@SuppressWarnings("unchecked")
- io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ReportDefinition> typed =
- (io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ReportDefinition>) aware;
+ AccountAwareStorageBackend<ReportDefinition> typed =
+ (AccountAwareStorageBackend<ReportDefinition>) aware;
all = typed.scanAllAccounts();
} else {
all = store.scan(key -> true);
}
- Map<String, List<ReportDefinition>> result = new java.util.LinkedHashMap<>();
+ Map<String, List<ReportDefinition>> result = new LinkedHashMap<>();
for (ReportDefinition def : all) {
String accountId = def.getOwnerAccountId();
if (accountId == null || accountId.isEmpty()) {
@@ -198,13 +201,13 @@ public class CurService {
if (accountId == null || reportName == null || region == null || status == null) {
return;
}
- if (!(store instanceof io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<?> aware)) {
+ if (!(store instanceof AccountAwareStorageBackend<?> aware)) {
markReportStatus(reportName, region, status);
return;
}
@SuppressWarnings("unchecked")
- io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ReportDefinition> typed =
- (io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend<ReportDefinition>) aware;
+ AccountAwareStorageBackend<ReportDefinition> typed =
+ (AccountAwareStorageBackend<ReportDefinition>) aware;
String key = compositeKey(region, reportName);
typed.getForAccount(accountId, key).ifPresent(def -> {
def.setReportStatus(status);
diff --git a/src/main/java/io/github/hectorvent/floci/services/cur/FocusRowProjector.java b/src/main/java/io/github/hectorvent/floci/services/cur/FocusRowProjector.java
index ca74f44dd9..0276193fdc 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cur/FocusRowProjector.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cur/FocusRowProjector.java
@@ -8,6 +8,7 @@ import jakarta.inject.Inject;
import java.time.Instant;
import java.time.YearMonth;
import java.time.ZoneOffset;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -48,7 +49,7 @@ public class FocusRowProjector {
public List<FocusRow> project(List<UsageLine> lines) {
// Cache per-(service, region) rate lookups for the request scope.
Map<String, Map<String, Double>> rateCache = new HashMap<>();
- List<FocusRow> rows = new java.util.ArrayList<>(lines.size());
+ List<FocusRow> rows = new ArrayList<>(lines.size());
for (UsageLine line : lines) {
rows.add(projectOne(line, rateCache));
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveController.java b/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveController.java
index ecc3953169..64e7280db6 100644
--- a/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveController.java
@@ -20,6 +20,7 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import java.util.ArrayList;
import java.util.List;
@Path("/")
@@ -134,7 +135,7 @@ public class DetectiveController {
if (accounts == null || !accounts.isArray() || accounts.isEmpty() || accounts.size() > 50) {
throw new AwsException("ValidationException", "Accounts must contain between 1 and 50 members.", 400);
}
- List<String> accountIds = new java.util.ArrayList<>(accounts.size());
+ List<String> accountIds = new ArrayList<>(accounts.size());
for (JsonNode account : accounts) {
accountIds.add(account.path("AccountId").asText(null));
}
@@ -170,7 +171,7 @@ public class DetectiveController {
return Response.ok().build();
}
- private com.fasterxml.jackson.databind.node.ObjectNode memberNode(String region, DetectiveMember member) {
+ private ObjectNode memberNode(String region, DetectiveMember member) {
ObjectNode node = objectMapper.createObjectNode();
node.put("AccountId", member.getAccountId());
node.put("EmailAddress", member.getEmailAddress());
diff --git a/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveService.java b/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveService.java
index c861878fa9..4a72945d7f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/detective/DetectiveService.java
@@ -14,8 +14,11 @@ import io.github.hectorvent.floci.services.organizations.model.Organization;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.util.Comparator;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
@ApplicationScoped
public class DetectiveService implements Resettable {
@@ -108,7 +111,7 @@ public class DetectiveService implements Resettable {
requireGraphArn(region, graphArn);
DetectiveState state = requireGraph(region);
int newMembers = 0;
- java.util.Set<String> seen = new java.util.HashSet<>();
+ Set<String> seen = new HashSet<>();
for (String accountId : accountIds) {
requireAccountId(accountId);
if (seen.add(accountId) && !state.getMembers().containsKey(accountId)) {
@@ -145,7 +148,7 @@ public class DetectiveService implements Resettable {
public List<DetectiveMember> listMembers(String region, String graphArn) {
requireGraphArn(region, graphArn);
return requireGraph(region).getMembers().values().stream()
- .sorted(java.util.Comparator.comparing(DetectiveMember::getAccountId))
+ .sorted(Comparator.comparing(DetectiveMember::getAccountId))
.toList();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java
index bd9b058cea..ed044d3eec 100644
--- a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbQueryHandler.java
@@ -265,7 +265,7 @@ public class DocDbQueryHandler {
}
private static List<String> memberList(MultivaluedMap<String, String> params, String prefix) {
- List<String> values = new java.util.ArrayList<>();
+ List<String> values = new ArrayList<>();
for (int i = 1; ; i++) {
String value = params.getFirst(prefix + i);
if (value == null) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java
index e4619de1e2..57f8af9f9c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/docdb/DocDbService.java
@@ -33,6 +33,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Consumer;
import java.util.function.Function;
@ApplicationScoped
@@ -813,7 +814,7 @@ public class DocDbService {
/** A resolved tag target: the record's key, its tags, and a sink that persists an update. */
private record TagTarget(String lockKey, Map<String, String> tags,
- java.util.function.Consumer<Map<String, String>> save) {}
+ Consumer<Map<String, String>> save) {}
public Map<String, String> listTagsForResource(String resourceName) {
return Map.copyOf(resolveTagTarget(resourceName).tags());
@@ -828,7 +829,7 @@ public class DocDbService {
updateTags(resourceName, current -> tagKeys.forEach(current::remove));
}
- private void updateTags(String resourceName, java.util.function.Consumer<Map<String, String>> change) {
+ private void updateTags(String resourceName, Consumer<Map<String, String>> change) {
// Resolve once to learn which record is meant, then do the read-modify-write under that
// record's monitor and resolve again inside it: the record can be deleted in between, and
// saving what the first read returned would put it back.
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
index 025f5a64cf..42591bdece 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbService.java
@@ -40,6 +40,7 @@ import io.github.hectorvent.floci.services.dynamodb.model.TableBackup;
import io.github.hectorvent.floci.services.dynamodb.model.TableDefinition;
import io.github.hectorvent.floci.services.dynamodb.model.VectorIndex;
import io.github.hectorvent.floci.services.s3.S3Service;
+import io.github.hectorvent.floci.services.s3.model.S3Object;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
@@ -409,7 +410,7 @@ public class DynamoDbService {
private void persistItems(String storageKey) {
if (itemStore == null) return;
- var items = currentItems(storageKey, false);
+ ConcurrentSkipListMap<String, JsonNode> items = currentItems(storageKey, false);
if (items != null) {
itemStore.put(storageKey, new HashMap<>(items));
} else {
@@ -819,7 +820,7 @@ public class DynamoDbService {
settleVectorIndexes(storageKey, table);
// Update dynamic counts
- var items = itemsByTable.get(scopedItemsKey(storageKey));
+ ConcurrentSkipListMap<String, JsonNode> items = itemsByTable.get(scopedItemsKey(storageKey));
if (items != null) {
table.setItemCount(items.size());
}
@@ -985,7 +986,7 @@ public class DynamoDbService {
public void deleteTable(String tableName, String region) {
String canonicalTableName = canonicalTableName(region, tableName);
String storageKey = regionKey(region, canonicalTableName);
- var table = tableStore.get(storageKey)
+ TableDefinition table = tableStore.get(storageKey)
.orElseThrow(() -> resourceNotFoundException(canonicalTableName));
requireNotCreating(table);
settleVectorIndexes(storageKey, table);
@@ -1127,7 +1128,7 @@ public class DynamoDbService {
validateIndexKeyTypes(table, normalizedItem, false);
return withItemLock(storageKey, itemKey, () -> {
- var tableItems = itemsFor(storageKey, stagedItems, true);
+ ConcurrentSkipListMap<String, JsonNode> tableItems = itemsFor(storageKey, stagedItems, true);
JsonNode existing = tableItems.get(itemKey);
@@ -1177,7 +1178,7 @@ public class DynamoDbService {
TableDefinition table = requireActiveTable(storageKey);
String itemKey = buildItemKey(table, key, true);
- var items = currentItems(storageKey, false);
+ ConcurrentSkipListMap<String, JsonNode> items = currentItems(storageKey, false);
if (items == null) {
LOG.tracev("Got item from {0}: key={1} item=<not found>", canonicalTableName, itemKey);
return null;
@@ -1246,7 +1247,7 @@ public class DynamoDbService {
String itemKey = buildItemKey(table, key, true);
return withItemLock(storageKey, itemKey, () -> {
- var items = itemsFor(storageKey, stagedItems, false);
+ ConcurrentSkipListMap<String, JsonNode> items = itemsFor(storageKey, stagedItems, false);
if (existingItemCheck != null) {
existingItemCheck.accept(items == null ? null : items.get(itemKey));
}
@@ -1381,7 +1382,7 @@ public class DynamoDbService {
String itemKey = buildItemKey(table, key, true);
return withItemLock(storageKey, itemKey, () -> {
- var items = itemsFor(storageKey, stagedItems, true);
+ ConcurrentSkipListMap<String, JsonNode> items = itemsFor(storageKey, stagedItems, true);
// Get existing item or create new one from key
JsonNode existing = items.get(itemKey);
@@ -1400,7 +1401,7 @@ public class DynamoDbService {
item = key.deepCopy();
}
- var touchedPaths = new ArrayList<String>();
+ ArrayList<String> touchedPaths = new ArrayList<String>();
// Apply UpdateExpression (modern format: "SET #n = :val, age = :age REMOVE attr")
if (updateExpression != null) {
applyUpdateExpression(item, updateExpression, expressionAttrNames, expressionAttrValues, touchedPaths);
@@ -1409,7 +1410,7 @@ public class DynamoDbService {
else if (attributeUpdates != null && attributeUpdates.isObject()) {
Iterator<Map.Entry<String, JsonNode>> fields = attributeUpdates.fields();
while (fields.hasNext()) {
- var entry = fields.next();
+ Map.Entry<String, JsonNode> entry = fields.next();
String attrName = entry.getKey();
touchedPaths.add(attrName);
JsonNode update = entry.getValue();
@@ -1451,7 +1452,7 @@ public class DynamoDbService {
BigDecimal delta = new BigDecimal(value.get("N").asText());
BigDecimal current = curAttr != null && curAttr.has("N")
? new BigDecimal(curAttr.get("N").asText()) : BigDecimal.ZERO;
- var sum = current.add(delta);
+ BigDecimal sum = current.add(delta);
DynamoDbNumberUtils.checkArithmeticResult(sum);
ObjectNode numNode = objectMapper.createObjectNode();
numNode.put("N", sum.stripTrailingZeros().toPlainString());
@@ -1564,7 +1565,7 @@ public class DynamoDbService {
String skName = accessPath.sortKeyName();
List<String> sortKeyNames = accessPath.sortKeyNames();
- var items = itemsByTable.get(scopedItemsKey(storageKey));
+ ConcurrentSkipListMap<String, JsonNode> items = itemsByTable.get(scopedItemsKey(storageKey));
if (items == null) return new QueryResult(List.of(), 0, 0, null, List.of());
List<JsonNode> results = new ArrayList<>();
@@ -1724,7 +1725,7 @@ public class DynamoDbService {
DynamoDbAccessPath accessPath = DynamoDbAccessPath.resolve(table, indexName);
- var items = itemsByTable.get(scopedItemsKey(storageKey));
+ ConcurrentSkipListMap<String, JsonNode> items = itemsByTable.get(scopedItemsKey(storageKey));
if (items == null) return new ScanResult(List.of(), 0, 0, null, List.of());
// ConcurrentSkipListMap keeps items sorted by base item key — no sort needed.
@@ -1743,7 +1744,7 @@ public class DynamoDbService {
lekSkName = accessPath.sortKeyName();
}
- var source = exclusiveStartKey != null
+ Collection<JsonNode> source = exclusiveStartKey != null
? items.tailMap(buildItemKeyFromNode(exclusiveStartKey, pkName, skName), false).values()
: items.values();
@@ -1838,7 +1839,7 @@ public class DynamoDbService {
private boolean matchesScanFilter(JsonNode item, JsonNode scanFilter) {
Iterator<Map.Entry<String, JsonNode>> fields = scanFilter.fields();
while (fields.hasNext()) {
- var entry = fields.next();
+ Map.Entry<String, JsonNode> entry = fields.next();
String attrName = entry.getKey();
JsonNode condition = entry.getValue();
JsonNode attrValue = item.get(attrName);
@@ -2317,7 +2318,7 @@ public class DynamoDbService {
TableDefinition table = requireActiveTable(storageKey);
String itemKey = buildItemKey(table, key);
- var tableItems = itemsFor(storageKey, stagedItems, false);
+ ConcurrentSkipListMap<String, JsonNode> tableItems = itemsFor(storageKey, stagedItems, false);
JsonNode existing = tableItems != null ? tableItems.get(itemKey) : null;
try {
@@ -2397,7 +2398,7 @@ public class DynamoDbService {
throw new AwsException("ValidationException", "Key is required for Update", 400);
}
String itemKey = buildItemKey(table, key, true);
- var items = itemsFor(storageKey, stagedItems, false);
+ ConcurrentSkipListMap<String, JsonNode> items = itemsFor(storageKey, stagedItems, false);
JsonNode existing = items != null ? items.get(itemKey) : null;
ObjectNode item = existing != null ? existing.deepCopy() : key.deepCopy();
@@ -3119,7 +3120,7 @@ public class DynamoDbService {
if (!table.isTtlEnabled() || table.getTtlAttributeName() == null) {
continue;
}
- var items = itemsByTable.get(rawKey);
+ ConcurrentSkipListMap<String, JsonNode> items = itemsByTable.get(rawKey);
if (items == null) {
continue;
}
@@ -3676,7 +3677,7 @@ public class DynamoDbService {
try {
BigDecimal existingNum = new BigDecimal(existingNumStr);
BigDecimal addNum = new BigDecimal(addNumStr);
- var sum = existingNum.add(addNum);
+ BigDecimal sum = existingNum.add(addNum);
DynamoDbNumberUtils.checkArithmeticResult(sum);
result.put("N", sum.toPlainString());
return result;
@@ -3694,7 +3695,7 @@ public class DynamoDbService {
Set<String> combined = new LinkedHashSet<>();
existingValue.get("SS").forEach(n -> combined.add(n.asText()));
addValue.get("SS").forEach(n -> combined.add(n.asText()));
- var arrayNode = result.putArray("SS");
+ ArrayNode arrayNode = result.putArray("SS");
combined.forEach(arrayNode::add);
return result;
}
@@ -3707,7 +3708,7 @@ public class DynamoDbService {
Set<String> combined = new LinkedHashSet<>();
existingValue.get("NS").forEach(n -> combined.add(n.asText()));
addValue.get("NS").forEach(n -> combined.add(n.asText()));
- var arrayNode = result.putArray("NS");
+ ArrayNode arrayNode = result.putArray("NS");
combined.forEach(arrayNode::add);
return result;
}
@@ -3720,7 +3721,7 @@ public class DynamoDbService {
Set<String> combined = new LinkedHashSet<>();
existingValue.get("BS").forEach(n -> combined.add(n.asText()));
addValue.get("BS").forEach(n -> combined.add(n.asText()));
- var arrayNode = result.putArray("BS");
+ ArrayNode arrayNode = result.putArray("BS");
combined.forEach(arrayNode::add);
return result;
}
@@ -3841,7 +3842,7 @@ public class DynamoDbService {
if (!toRemove.contains(n.asText())) remaining.add(n.asText());
});
if (remaining.isEmpty()) return null;
- var arrayNode = result.putArray("SS");
+ ArrayNode arrayNode = result.putArray("SS");
remaining.forEach(arrayNode::add);
return result;
}
@@ -3854,7 +3855,7 @@ public class DynamoDbService {
if (!toRemove.contains(n.asText())) remaining.add(n.asText());
});
if (remaining.isEmpty()) return null;
- var arrayNode = result.putArray("NS");
+ ArrayNode arrayNode = result.putArray("NS");
remaining.forEach(arrayNode::add);
return result;
}
@@ -3867,7 +3868,7 @@ public class DynamoDbService {
if (!toRemove.contains(n.asText())) remaining.add(n.asText());
});
if (remaining.isEmpty()) return null;
- var arrayNode = result.putArray("BS");
+ ArrayNode arrayNode = result.putArray("BS");
remaining.forEach(arrayNode::add);
return result;
}
@@ -5098,8 +5099,8 @@ public class DynamoDbService {
// The worker gets its own copy so the object serialized into this response never
// changes underneath the handler, and the request account so its writes land there.
- var accountId = regionResolver.getAccountId();
- var worker = objectMapper.convertValue(desc, ExportDescription.class);
+ String accountId = regionResolver.getAccountId();
+ ExportDescription worker = objectMapper.convertValue(desc, ExportDescription.class);
exportExecutor.execute(() -> RequestScopes.runAs(accountId, () -> runExport(worker, snapshot, exportArn)));
return desc;
@@ -5313,12 +5314,12 @@ public class DynamoDbService {
if (exportStore == null) {
return new ListExportsResult(List.of(), null);
}
- var all = exportStore.scan(k -> true).stream()
+ List<ExportDescription> all = exportStore.scan(k -> true).stream()
.filter(d -> inRequestRegion(d.getExportArn()))
.filter(d -> tableArn == null || tableArn.equals(d.getTableArn()))
.toList();
requirePageSize(maxResults, "maxResults");
- var page = pageByArn(all, ExportDescription::getExportArn, maxResults, nextToken);
+ Page<ExportDescription> page = pageByArn(all, ExportDescription::getExportArn, maxResults, nextToken);
return new ListExportsResult(page.items().stream().map(ExportSummary::new).toList(), page.nextToken());
}
@@ -5344,19 +5345,19 @@ public class DynamoDbService {
}
private static <T> Page<T> pageByArn(List<T> all, Function<T, String> arnOf, Integer pageSize, String nextToken) {
- var limit = pageSize != null ? pageSize : MAX_JOB_PAGE_SIZE;
- var sorted = all.stream().sorted(Comparator.comparing(arnOf).reversed()).toList();
- var startIdx = 0;
+ int limit = pageSize != null ? pageSize : MAX_JOB_PAGE_SIZE;
+ List<T> sorted = all.stream().sorted(Comparator.comparing(arnOf).reversed()).toList();
+ int startIdx = 0;
if (nextToken != null) {
- for (var i = 0; i < sorted.size(); i++) {
+ for (int i = 0; i < sorted.size(); i++) {
if (nextToken.equals(arnOf.apply(sorted.get(i)))) {
startIdx = i + 1;
break;
}
}
}
- var end = Math.min(startIdx + limit, sorted.size());
- var newNextToken = end < sorted.size() ? arnOf.apply(sorted.get(end - 1)) : null;
+ int end = Math.min(startIdx + limit, sorted.size());
+ String newNextToken = end < sorted.size() ? arnOf.apply(sorted.get(end - 1)) : null;
return new Page<>(sorted.subList(startIdx, end), newNextToken);
}
@@ -5593,7 +5594,7 @@ public class DynamoDbService {
if (request.path("S3BucketSource").path("S3Bucket").asText("").isBlank()) {
throw new AwsException("ValidationException", "S3BucketSource.S3Bucket is required", 400);
}
- var inputFormat = request.path("InputFormat").asText("");
+ String inputFormat = request.path("InputFormat").asText("");
switch (inputFormat) {
case "DYNAMODB_JSON" -> { }
case "" -> throw new AwsException("ValidationException", "InputFormat is required", 400);
@@ -5603,7 +5604,7 @@ public class DynamoDbService {
"Value '" + inputFormat
+ "' at 'inputFormat' failed to satisfy constraint: Member must satisfy enum value set: [ION, CSV, DYNAMODB_JSON]");
}
- var compression = request.path("InputCompressionType").asText("NONE");
+ String compression = request.path("InputCompressionType").asText("NONE");
switch (compression) {
case "NONE", "GZIP" -> { }
case "ZSTD" -> throw new AwsException("ValidationException",
@@ -5614,7 +5615,7 @@ public class DynamoDbService {
}
DynamoDbTableNames.requireShortName(request.path("TableCreationParameters").path("TableName").asText(null));
validateBillingMode(request.path("TableCreationParameters"), "tableCreationParameters.");
- var clientToken = request.path("ClientToken").asText(null);
+ String clientToken = request.path("ClientToken").asText(null);
if (clientToken != null && clientToken.isBlank()) {
throw SmithyValidationErrors.validationException(
SmithyValidationErrors.lengthTooShort("clientToken", clientToken, 1));
@@ -5622,7 +5623,7 @@ public class DynamoDbService {
if (clientToken == null || importStore == null) {
return null;
}
- var existing = importStore.scan(k -> true).stream()
+ ImportTableDescription existing = importStore.scan(k -> true).stream()
.filter(d -> inRequestRegion(d.getImportArn()))
.filter(d -> clientToken.equals(d.getClientToken()))
.findFirst()
@@ -5636,7 +5637,7 @@ public class DynamoDbService {
}
private static boolean sameImportParameters(ImportTableDescription existing, JsonNode request) {
- var options = request.hasNonNull("InputFormatOptions") ? request.get("InputFormatOptions") : null;
+ JsonNode options = request.hasNonNull("InputFormatOptions") ? request.get("InputFormatOptions") : null;
return Objects.equals(existing.getS3BucketSource(), request.get("S3BucketSource"))
&& Objects.equals(existing.getInputFormat(), request.path("InputFormat").asText())
&& Objects.equals(existing.getInputFormatOptions(), options)
@@ -5645,12 +5646,12 @@ public class DynamoDbService {
}
public ImportTableDescription startImport(JsonNode request, TableDefinition table, String region) {
- var tableName = table.getTableName();
- var accountId = regionResolver.getAccountId();
- var importArn = AwsArnUtils.Arn.of("dynamodb", region, accountId,
+ String tableName = table.getTableName();
+ String accountId = regionResolver.getAccountId();
+ String importArn = AwsArnUtils.Arn.of("dynamodb", region, accountId,
"table/" + tableName + "/import/" + newJobId()).toString();
- var desc = new ImportTableDescription();
+ ImportTableDescription desc = new ImportTableDescription();
desc.setImportArn(importArn);
desc.setImportStatus("IN_PROGRESS");
desc.setTableArn(table.getTableArn());
@@ -5672,27 +5673,27 @@ public class DynamoDbService {
// The worker gets its own copy so the object serialized into this response never
// changes underneath the handler, and the request account so its writes land there.
- var worker = objectMapper.convertValue(desc, ImportTableDescription.class);
+ ImportTableDescription worker = objectMapper.convertValue(desc, ImportTableDescription.class);
Thread.ofVirtual().start(() -> RequestScopes.runAs(accountId, () -> runImport(worker, tableName, region)));
return desc;
}
void runImport(ImportTableDescription desc, String tableName, String region) {
- var source = desc.getS3BucketSource();
- var bucket = source.path("S3Bucket").asText();
- var prefix = source.path("S3KeyPrefix").asText("");
- var bucketOwner = source.path("S3BucketOwner").asText(null);
+ JsonNode source = desc.getS3BucketSource();
+ String bucket = source.path("S3Bucket").asText();
+ String prefix = source.path("S3KeyPrefix").asText("");
+ String bucketOwner = source.path("S3BucketOwner").asText(null);
try {
// AWS reads another account's bucket only when its policy grants it. floci has no bucket policies.
if (bucketOwner != null && !bucketOwner.equals(regionResolver.getAccountId())) {
throw new AwsException("AccessDenied",
"Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied)", 403);
}
- var objects = s3Service.listObjects(bucket, prefix, null, Integer.MAX_VALUE);
+ List<S3Object> objects = s3Service.listObjects(bucket, prefix, null, Integer.MAX_VALUE);
if (objects.isEmpty()) {
failImport(desc, "S3NoSuchKey", "No objects found under s3://" + bucket + "/" + prefix);
} else {
- for (var object : objects) {
+ for (S3Object object : objects) {
try {
importObject(desc, tableName, region, bucket, object.getKey());
} catch (IOException | RuntimeException e) {
@@ -5727,10 +5728,10 @@ public class DynamoDbService {
private void importObject(ImportTableDescription desc, String tableName, String region,
String bucket, String key) throws IOException {
- var size = s3Service.getObjectMetadata(bucket, key, null).getSize();
+ long size = s3Service.getObjectMetadata(bucket, key, null).getSize();
desc.setProcessedSizeBytes(desc.getProcessedSizeBytes() + size);
- try (var raw = s3Service.openObjectStream(bucket, key, null);
- var reader = new BufferedReader(new InputStreamReader(decompress(desc, raw), StandardCharsets.UTF_8))) {
+ try (InputStream raw = s3Service.openObjectStream(bucket, key, null);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(decompress(desc, raw), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.isBlank()) {
@@ -5738,7 +5739,7 @@ public class DynamoDbService {
}
desc.setProcessedItemCount(desc.getProcessedItemCount() + 1);
try {
- var item = objectMapper.readTree(line).path("Item");
+ JsonNode item = objectMapper.readTree(line).path("Item");
if (!item.isObject()) {
throw new IOException("line has no Item object");
}
@@ -5771,7 +5772,7 @@ public class DynamoDbService {
}
private void activateTable(String tableName, String region) {
- var storageKey = regionKey(region, tableName);
+ String storageKey = regionKey(region, tableName);
tableStore.get(storageKey).ifPresent(table -> {
if ("CREATING".equals(table.getTableStatus())) {
table.setTableStatus("ACTIVE");
@@ -5785,10 +5786,10 @@ public class DynamoDbService {
* worker survives the process. An import also leaves its table stuck in CREATING.
*/
private void recoverInterruptedJobs() {
- var now = Instant.now().getEpochSecond();
+ long now = Instant.now().getEpochSecond();
if (exportStore instanceof AccountAwareStorageBackend<ExportDescription> exports) {
- for (var entry : exports.scanAllAccountEntries(k -> true)) {
- var desc = entry.value();
+ for (AccountAwareStorageBackend.AccountEntry<ExportDescription> entry : exports.scanAllAccountEntries(k -> true)) {
+ ExportDescription desc = entry.value();
if (!"IN_PROGRESS".equals(desc.getExportStatus())) {
continue;
}
@@ -5800,8 +5801,8 @@ public class DynamoDbService {
}
}
if (importStore instanceof AccountAwareStorageBackend<ImportTableDescription> imports) {
- for (var entry : imports.scanAllAccountEntries(k -> true)) {
- var desc = entry.value();
+ for (AccountAwareStorageBackend.AccountEntry<ImportTableDescription> entry : imports.scanAllAccountEntries(k -> true)) {
+ ImportTableDescription desc = entry.value();
if (!"IN_PROGRESS".equals(desc.getImportStatus())) {
continue;
}
@@ -5811,8 +5812,8 @@ public class DynamoDbService {
}
}
if (tableStore instanceof AccountAwareStorageBackend<TableDefinition> tables) {
- for (var entry : tables.scanAllAccountEntries(k -> true)) {
- var table = entry.value();
+ for (AccountAwareStorageBackend.AccountEntry<TableDefinition> entry : tables.scanAllAccountEntries(k -> true)) {
+ TableDefinition table = entry.value();
if ("CREATING".equals(table.getTableStatus())) {
table.setTableStatus("ACTIVE");
tables.putForAccount(entry.accountId(), entry.key(), table);
@@ -5835,12 +5836,12 @@ public class DynamoDbService {
if (importStore == null) {
return new ListImportsResult(List.of(), null);
}
- var all = importStore.scan(k -> true).stream()
+ List<ImportTableDescription> all = importStore.scan(k -> true).stream()
.filter(d -> inRequestRegion(d.getImportArn()))
.filter(d -> tableArn == null || tableArn.equals(d.getTableArn()))
.toList();
requirePageSize(pageSize, "pageSize");
- var page = pageByArn(all, ImportTableDescription::getImportArn, pageSize, nextToken);
+ Page<ImportTableDescription> page = pageByArn(all, ImportTableDescription::getImportArn, pageSize, nextToken);
return new ListImportsResult(page.items().stream().map(ImportSummary::new).toList(), page.nextToken());
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java
index 8357301661..21641b8a68 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/NativeDynamoDbJsonHandler.java
@@ -19,7 +19,10 @@ import io.github.hectorvent.floci.services.dynamodb.NativeDynamoDbTableService.T
import io.github.hectorvent.floci.services.dynamodb.NativeDynamoDbTableService.UpdateTableRequest;
import io.github.hectorvent.floci.services.dynamodb.model.AttributeDefinition;
import io.github.hectorvent.floci.services.dynamodb.model.ConditionalCheckFailedException;
+import io.github.hectorvent.floci.services.dynamodb.model.ExportDescription;
+import io.github.hectorvent.floci.services.dynamodb.model.ExportSummary;
import io.github.hectorvent.floci.services.dynamodb.model.GlobalSecondaryIndex;
+import io.github.hectorvent.floci.services.dynamodb.model.ImportSummary;
import io.github.hectorvent.floci.services.dynamodb.model.ImportTableDescription;
import io.github.hectorvent.floci.services.dynamodb.model.KeySchemaElement;
import io.github.hectorvent.floci.services.dynamodb.model.KinesisStreamingDestination;
@@ -147,9 +150,9 @@ public class NativeDynamoDbJsonHandler {
}
private Response handleCreateTable(JsonNode request, String region) {
- var table = createTableFromSpec(request, "", region, "ACTIVE");
+ TableDefinition table = createTableFromSpec(request, "", region, "ACTIVE");
- var response = objectMapper.createObjectNode();
+ ObjectNode response = objectMapper.createObjectNode();
response.set("TableDescription", tableToNode(table));
return Response.ok(response).build();
}
@@ -185,7 +188,7 @@ public class NativeDynamoDbJsonHandler {
List<GlobalSecondaryIndex> gsis = new ArrayList<>();
JsonNode gsiArray = request.path("GlobalSecondaryIndexes");
if (!gsiArray.isMissingNode() && gsiArray.isArray()) {
- var gsiPosition = 0;
+ int gsiPosition = 0;
for (JsonNode gsiNode : gsiArray) {
gsiPosition++;
String indexName = requireIndexName(gsiNode,
@@ -227,7 +230,7 @@ public class NativeDynamoDbJsonHandler {
List<LocalSecondaryIndex> lsis = new ArrayList<>();
JsonNode lsiArray = request.path("LocalSecondaryIndexes");
if (!lsiArray.isMissingNode() && lsiArray.isArray()) {
- var lsiPosition = 0;
+ int lsiPosition = 0;
for (JsonNode lsiNode : lsiArray) {
lsiPosition++;
String indexName = requireIndexName(lsiNode,
@@ -781,7 +784,7 @@ public class NativeDynamoDbJsonHandler {
DynamoDbExpressionSize.checkWrite(conditionExpression, "ConditionExpression");
DynamoDbAttributeValueValidator.requireNestingWithinLimit(exprAttrValues);
DynamoDbNumberUtils.requireStorable(exprAttrValues, true);
- var attributeUpdateValues = legacyValues(attributeUpdates);
+ ObjectNode attributeUpdateValues = legacyValues(attributeUpdates);
DynamoDbAttributeValueValidator.requireNestingWithinLimit(attributeUpdateValues);
DynamoDbNumberUtils.requireStorable(attributeUpdateValues, true);
DynamoDbAttributeValueValidator.requireNestingWithinLimit(
@@ -857,7 +860,7 @@ public class NativeDynamoDbJsonHandler {
} else if ("ALL_OLD" .equals(returnValues) && result.oldItem() != null) {
response.set("Attributes", result.oldItem());
} else if ("UPDATED_NEW".equals(returnValues) || "UPDATED_OLD".equals(returnValues)) {
- var updated = DynamoDbUpdatedAttributes.collect(result.touched(), "UPDATED_NEW".equals(returnValues));
+ ObjectNode updated = DynamoDbUpdatedAttributes.collect(result.touched(), "UPDATED_NEW".equals(returnValues));
// AWS omits Attributes when no touched path has a value on that side.
if (!updated.isEmpty()) {
response.set("Attributes", updated);
@@ -890,9 +893,9 @@ public class NativeDynamoDbJsonHandler {
String returnValuesOnConditionCheckFailure) {
boolean useOr = "OR".equals(conditionalOperator);
boolean overall = !useOr;
- var fields = expected.fields();
+ Iterator<Map.Entry<String, JsonNode>> fields = expected.fields();
while (fields.hasNext()) {
- var entry = fields.next();
+ Map.Entry<String, JsonNode> entry = fields.next();
String attrName = entry.getKey();
JsonNode condition = entry.getValue();
JsonNode attrValue = existing != null ? existing.get(attrName) : null;
@@ -933,9 +936,9 @@ public class NativeDynamoDbJsonHandler {
* DynamoDB reports only the first offending entry, so validation stops at the first error.
*/
private void validateLegacyExpected(JsonNode expected) {
- var fields = expected.fields();
+ Iterator<Map.Entry<String, JsonNode>> fields = expected.fields();
while (fields.hasNext()) {
- var entry = fields.next();
+ Map.Entry<String, JsonNode> entry = fields.next();
String attrName = entry.getKey();
JsonNode condition = entry.getValue();
boolean hasComparisonOperator = condition.has("ComparisonOperator");
@@ -1007,13 +1010,13 @@ public class NativeDynamoDbJsonHandler {
if (!condition.has("Value") || condition.has("AttributeValueList")) {
return condition;
}
- com.fasterxml.jackson.databind.node.ObjectNode normalized = objectMapper.createObjectNode();
+ ObjectNode normalized = objectMapper.createObjectNode();
condition.fields().forEachRemaining(e -> {
if (!"Value".equals(e.getKey())) {
normalized.set(e.getKey(), e.getValue());
}
});
- com.fasterxml.jackson.databind.node.ArrayNode avl = objectMapper.createArrayNode();
+ ArrayNode avl = objectMapper.createArrayNode();
avl.add(condition.get("Value"));
normalized.set("AttributeValueList", avl);
return normalized;
@@ -1046,16 +1049,16 @@ public class NativeDynamoDbJsonHandler {
// The AttributeValues inside a legacy container. AttributeUpdates, Expected,
// KeyConditions and QueryFilter carry them under Value or AttributeValueList.
private ObjectNode legacyValues(JsonNode container) {
- var values = objectMapper.createObjectNode();
+ ObjectNode values = objectMapper.createObjectNode();
if (container == null || !container.isObject()) {
return values;
}
- var i = 0;
- for (var spec : container) {
+ int i = 0;
+ for (JsonNode spec : container) {
if (spec.has("Value")) {
values.set("v" + i++, spec.get("Value"));
}
- for (var value : spec.path("AttributeValueList")) {
+ for (JsonNode value : spec.path("AttributeValueList")) {
values.set("v" + i++, value);
}
}
@@ -1479,7 +1482,7 @@ public class NativeDynamoDbJsonHandler {
Map<String, List<JsonNode>> items = new HashMap<>();
Iterator<Map.Entry<String, JsonNode>> tables = requestItems.fields();
while (tables.hasNext()) {
- var entry = tables.next();
+ Map.Entry<String, JsonNode> entry = tables.next();
List<JsonNode> writes = new ArrayList<>();
for (JsonNode writeReq : entry.getValue()) {
DynamoDbAttributeValueValidator.requireNestingWithinLimit(
@@ -1524,22 +1527,22 @@ public class NativeDynamoDbJsonHandler {
}
// The per-table write cost needs the stored images from before the batch runs.
- var returnCCBatch = request.path("ReturnConsumedCapacity").asText("NONE");
+ String returnCCBatch = request.path("ReturnConsumedCapacity").asText("NONE");
requireValidReturnConsumedCapacity(request);
Map<String, DynamoDbWriteCapacity.Cost> costs = null;
if (!"NONE".equals(returnCCBatch)) {
costs = new LinkedHashMap<>();
- for (var entry : items.entrySet()) {
+ for (Map.Entry<String, List<JsonNode>> entry : items.entrySet()) {
TableDefinition costTable = dynamoDbService.requireTableForItemCall(entry.getKey(), region);
- var cost = DynamoDbWriteCapacity.Cost.zero();
- for (var writeReq : entry.getValue()) {
- var newItem = writeReq.has("PutRequest")
+ DynamoDbWriteCapacity.Cost cost = DynamoDbWriteCapacity.Cost.zero();
+ for (JsonNode writeReq : entry.getValue()) {
+ ObjectNode newItem = writeReq.has("PutRequest")
? DynamoDbNumberUtils.normalizeNumbersInItem(writeReq.get("PutRequest").get("Item"))
: null;
- var keyNode = writeReq.has("PutRequest")
+ JsonNode keyNode = writeReq.has("PutRequest")
? writeReq.get("PutRequest").get("Item")
: writeReq.get("DeleteRequest").get("Key");
- var previous = dynamoDbService.getItem(entry.getKey(), keyNode, region);
+ JsonNode previous = dynamoDbService.getItem(entry.getKey(), keyNode, region);
cost = cost.plus(DynamoDbWriteCapacity.forWrite(costTable, previous, newItem));
}
costs.put(entry.getKey(), cost);
@@ -1551,8 +1554,8 @@ public class NativeDynamoDbJsonHandler {
ObjectNode response = objectMapper.createObjectNode();
response.set("UnprocessedItems", objectMapper.createObjectNode());
if (costs != null) {
- var ccArray = objectMapper.createArrayNode();
- for (var entry : costs.entrySet()) {
+ ArrayNode ccArray = objectMapper.createArrayNode();
+ for (Map.Entry<String, DynamoDbWriteCapacity.Cost> entry : costs.entrySet()) {
ccArray.add(writeCapacityNode(entry.getKey(), entry.getValue(),
"INDEXES".equals(returnCCBatch)));
}
@@ -1577,7 +1580,7 @@ public class NativeDynamoDbJsonHandler {
Map<String, JsonNode> items = new HashMap<>();
Iterator<Map.Entry<String, JsonNode>> tables = requestItems.fields();
while (tables.hasNext()) {
- var entry = tables.next();
+ Map.Entry<String, JsonNode> entry = tables.next();
items.put(entry.getKey(), entry.getValue());
}
@@ -1598,7 +1601,7 @@ public class NativeDynamoDbJsonHandler {
// Per-table check: max 100 keys
for (Map.Entry<String, JsonNode> entry : items.entrySet()) {
- var projection = entry.getValue().path("ProjectionExpression");
+ JsonNode projection = entry.getValue().path("ProjectionExpression");
if (projection.isTextual()) {
DynamoDbExpressionSize.checkRead(projection.asText(), "ProjectionExpression");
ProjectionEvaluator.validateExpression(projection.asText(),
@@ -1728,7 +1731,7 @@ public class NativeDynamoDbJsonHandler {
List<GsiThroughputUpdate> gsiThroughputUpdates = new ArrayList<>();
JsonNode gsiUpdates = request.path("GlobalSecondaryIndexUpdates");
if (!gsiUpdates.isMissingNode() && gsiUpdates.isArray()) {
- var updatePosition = 0;
+ int updatePosition = 0;
for (JsonNode update : gsiUpdates) {
updatePosition++;
JsonNode createNode = update.path("Create");
@@ -2612,8 +2615,8 @@ public class NativeDynamoDbJsonHandler {
* so this shape is the emulator's own. Widening the partition keeps it from rejecting a legal
* GovCloud or China table ARN.
*/
- private static final java.util.regex.Pattern DYNAMODB_TABLE_ARN_PATTERN =
- java.util.regex.Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX
+ private static final Pattern DYNAMODB_TABLE_ARN_PATTERN =
+ Pattern.compile("^arn:" + AwsArnUtils.PARTITION_REGEX
+ ":dynamodb:[a-z0-9-]+:\\d{12}:table/[a-zA-Z0-9._-]+$");
private static boolean isValidDynamoDbTableArn(String arn) {
@@ -3002,7 +3005,7 @@ public class NativeDynamoDbJsonHandler {
* half-unit minimum DynamoDB charges even when nothing is found.
*/
static double readCapacityUnits(long bytes, boolean consistentRead) {
- var units = Math.max(1, (bytes + 4095) / 4096) * 0.5;
+ double units = Math.max(1, (bytes + 4095) / 4096) * 0.5;
return consistentRead ? units * 2 : units;
}
@@ -3017,7 +3020,7 @@ public class NativeDynamoDbJsonHandler {
String returnCC = request.path("ReturnConsumedCapacity").asText("NONE");
if ("NONE".equals(returnCC)) return;
TableDefinition table = dynamoDbService.requireTableForItemCall(tableName, region);
- var cost = DynamoDbWriteCapacity.forWrite(table, oldItem,
+ DynamoDbWriteCapacity.Cost cost = DynamoDbWriteCapacity.forWrite(table, oldItem,
newItem != null ? DynamoDbNumberUtils.normalizeNumbersInItem(newItem) : null);
response.set("ConsumedCapacity",
writeCapacityNode(tableName, cost, "INDEXES".equals(returnCC)));
@@ -3210,7 +3213,7 @@ public class NativeDynamoDbJsonHandler {
}
ArrayNode keySchemaArray = objectMapper.createArrayNode();
- for (var ks : table.getKeySchema()) {
+ for (KeySchemaElement ks : table.getKeySchema()) {
ObjectNode ksNode = objectMapper.createObjectNode();
ksNode.put("AttributeName", ks.getAttributeName());
ksNode.put("KeyType", ks.getKeyType());
@@ -3219,7 +3222,7 @@ public class NativeDynamoDbJsonHandler {
node.set("KeySchema", keySchemaArray);
ArrayNode attrDefsArray = objectMapper.createArrayNode();
- for (var ad : table.getAttributeDefinitions()) {
+ for (AttributeDefinition ad : table.getAttributeDefinitions()) {
ObjectNode adNode = objectMapper.createObjectNode();
adNode.put("AttributeName", ad.getAttributeName());
adNode.put("AttributeType", ad.getAttributeType());
@@ -3257,7 +3260,7 @@ public class NativeDynamoDbJsonHandler {
gsiNode.put("IndexStatus", "ACTIVE");
ArrayNode gsiKeySchema = objectMapper.createArrayNode();
- for (var ks : gsi.getKeySchema()) {
+ for (KeySchemaElement ks : gsi.getKeySchema()) {
ObjectNode ksNode = objectMapper.createObjectNode();
ksNode.put("AttributeName", ks.getAttributeName());
ksNode.put("KeyType", ks.getKeyType());
@@ -3270,7 +3273,7 @@ public class NativeDynamoDbJsonHandler {
gsi.getProjectionType() != null ? gsi.getProjectionType() : "ALL");
if ("INCLUDE".equals(gsi.getProjectionType())){
ArrayNode nonKeyAttributes = objectMapper.createArrayNode();
- for (var attr : gsi.getNonKeyAttributes()){
+ for (String attr : gsi.getNonKeyAttributes()){
nonKeyAttributes.add(attr);
}
projection.put("NonKeyAttributes", nonKeyAttributes);
@@ -3311,7 +3314,7 @@ public class NativeDynamoDbJsonHandler {
lsiNode.put("IndexArn", lsi.getIndexArn());
ArrayNode lsiKeySchema = objectMapper.createArrayNode();
- for (var ks : lsi.getKeySchema()) {
+ for (KeySchemaElement ks : lsi.getKeySchema()) {
ObjectNode ksNode = objectMapper.createObjectNode();
ksNode.put("AttributeName", ks.getAttributeName());
ksNode.put("KeyType", ks.getKeyType());
@@ -3424,7 +3427,7 @@ public class NativeDynamoDbJsonHandler {
}
private Response handleExportTable(JsonNode request, String region) {
- Map<String, Object> params = new java.util.HashMap<>();
+ Map<String, Object> params = new HashMap<>();
request.fields().forEachRemaining(e -> params.put(e.getKey(), e.getValue().isTextual()
? e.getValue().asText() : e.getValue()));
@@ -3433,7 +3436,7 @@ public class NativeDynamoDbJsonHandler {
? new DynamoDbService.IncrementalExportRequest(timestampOrNull(spec, "ExportFromTime"),
timestampOrNull(spec, "ExportToTime"), spec.path("ExportViewType").textValue())
: null;
- io.github.hectorvent.floci.services.dynamodb.model.ExportDescription desc =
+ ExportDescription desc =
dynamoDbService.exportTable(params, timestampOrNull(request, "ExportTime"), incremental, region);
ObjectNode response = objectMapper.createObjectNode();
@@ -3443,7 +3446,7 @@ public class NativeDynamoDbJsonHandler {
private Response handleDescribeExport(JsonNode request, String region) {
String exportArn = request.path("ExportArn").asText();
- io.github.hectorvent.floci.services.dynamodb.model.ExportDescription desc =
+ ExportDescription desc =
dynamoDbService.describeExport(exportArn);
ObjectNode response = objectMapper.createObjectNode();
@@ -3461,7 +3464,7 @@ public class NativeDynamoDbJsonHandler {
ObjectNode response = objectMapper.createObjectNode();
ArrayNode summaries = objectMapper.createArrayNode();
- for (io.github.hectorvent.floci.services.dynamodb.model.ExportSummary s : result.exportSummaries()) {
+ for (ExportSummary s : result.exportSummaries()) {
summaries.add(objectMapper.valueToTree(s));
}
response.set("ExportSummaries", summaries);
@@ -3472,7 +3475,7 @@ public class NativeDynamoDbJsonHandler {
}
private Response handleImportTable(JsonNode request, String region) {
- var response = objectMapper.createObjectNode();
+ ObjectNode response = objectMapper.createObjectNode();
response.set("ImportTableDescription", objectMapper.valueToTree(findOrStartImport(request, region)));
return Response.ok(response).build();
}
@@ -3480,7 +3483,7 @@ public class NativeDynamoDbJsonHandler {
/** Held across the ClientToken lookup and the table creation so identical concurrent requests share one import. */
private ImportTableDescription findOrStartImport(JsonNode request, String region) {
synchronized (importLock) {
- var existing = dynamoDbService.validateImportRequest(request);
+ ImportTableDescription existing = dynamoDbService.validateImportRequest(request);
if (existing != null) {
return existing;
}
@@ -3491,23 +3494,23 @@ public class NativeDynamoDbJsonHandler {
}
private Response handleDescribeImport(JsonNode request, String region) {
- var desc = dynamoDbService.describeImport(request.path("ImportArn").asText());
+ ImportTableDescription desc = dynamoDbService.describeImport(request.path("ImportArn").asText());
- var response = objectMapper.createObjectNode();
+ ObjectNode response = objectMapper.createObjectNode();
response.set("ImportTableDescription", objectMapper.valueToTree(desc));
return Response.ok(response).build();
}
private Response handleListImports(JsonNode request, String region) {
- var tableArn = request.hasNonNull("TableArn") ? request.get("TableArn").asText() : null;
- var pageSize = request.hasNonNull("PageSize") ? request.get("PageSize").asInt() : null;
- var nextToken = request.hasNonNull("NextToken") ? request.get("NextToken").asText() : null;
+ String tableArn = request.hasNonNull("TableArn") ? request.get("TableArn").asText() : null;
+ Integer pageSize = request.hasNonNull("PageSize") ? request.get("PageSize").asInt() : null;
+ String nextToken = request.hasNonNull("NextToken") ? request.get("NextToken").asText() : null;
- var result = dynamoDbService.listImports(tableArn, pageSize, nextToken);
+ DynamoDbService.ListImportsResult result = dynamoDbService.listImports(tableArn, pageSize, nextToken);
- var response = objectMapper.createObjectNode();
- var summaries = objectMapper.createArrayNode();
- for (var summary : result.importSummaryList()) {
+ ObjectNode response = objectMapper.createObjectNode();
+ ArrayNode summaries = objectMapper.createArrayNode();
+ for (ImportSummary summary : result.importSummaryList()) {
summaries.add(objectMapper.valueToTree(summary));
}
response.set("ImportSummaryList", summaries);
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/ConditionalCheckFailedException.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/ConditionalCheckFailedException.java
index ab846c0ce6..4ea33a1e94 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/ConditionalCheckFailedException.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/ConditionalCheckFailedException.java
@@ -1,9 +1,10 @@
package io.github.hectorvent.floci.services.dynamodb.model;
import com.fasterxml.jackson.databind.JsonNode;
+import io.github.hectorvent.floci.core.common.AwsException;
-public class ConditionalCheckFailedException extends io.github.hectorvent.floci.core.common.AwsException {
+public class ConditionalCheckFailedException extends AwsException {
private final JsonNode item;
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/LocalSecondaryIndex.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/LocalSecondaryIndex.java
index 7f8888717c..46e51a0e45 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/LocalSecondaryIndex.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/LocalSecondaryIndex.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -24,7 +25,7 @@ public class LocalSecondaryIndex {
private long itemCount;
public LocalSecondaryIndex() {
- this.nonKeyAttributes = new java.util.ArrayList<>();
+ this.nonKeyAttributes = new ArrayList<>();
}
public LocalSecondaryIndex(String indexName, List<KeySchemaElement> keySchema,
@@ -39,7 +40,7 @@ public class LocalSecondaryIndex {
this.indexArn = indexArn;
this.projectionType = projectionType != null ? projectionType : "ALL";
this.nonKeyAttributes = "INCLUDE".equals(this.projectionType) && nonKeyAttributes != null
- ? nonKeyAttributes : new java.util.ArrayList<>();
+ ? nonKeyAttributes : new ArrayList<>();
}
public String getIndexName() { return indexName; }
diff --git a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/TableDefinition.java b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/TableDefinition.java
index 4f88c55466..813f9f539d 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/TableDefinition.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dynamodb/model/TableDefinition.java
@@ -11,6 +11,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.UUID;
/**
* Represents a DynamoDB table definition (metadata, not items).
@@ -90,7 +91,7 @@ public class TableDefinition {
this.itemCount = 0;
this.tableSizeBytes = 0;
this.tableArn = AwsArnUtils.Arn.of("dynamodb", region, accountId, "table/" + tableName).toString();
- this.tableId = java.util.UUID.randomUUID().toString();
+ this.tableId = UUID.randomUUID().toString();
this.provisionedThroughput = new ProvisionedThroughput(5, 5);
this.tags = new HashMap<>();
this.globalSecondaryIndexes = new ArrayList<>();
@@ -211,7 +212,7 @@ public class TableDefinition {
/** Returns the partition key attribute name. */
public String getTableId() {
- if (tableId == null) tableId = java.util.UUID.randomUUID().toString();
+ if (tableId == null) tableId = UUID.randomUUID().toString();
return tableId;
}
public void setTableId(String tableId) { this.tableId = tableId; }
diff --git a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2KeyMaterial.java b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2KeyMaterial.java
index f5fb53bf00..5d436e6e2e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2KeyMaterial.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ec2/Ec2KeyMaterial.java
@@ -20,6 +20,7 @@ import java.io.UncheckedIOException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
+import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@@ -85,7 +86,7 @@ public final class Ec2KeyMaterial {
try {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(RSA_KEY_SIZE);
- java.security.KeyPair pair = generator.generateKeyPair();
+ KeyPair pair = generator.generateKeyPair();
StringWriter out = new StringWriter();
try (JcaPEMWriter pem = new JcaPEMWriter(out)) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ec2/FlowLogService.java b/src/main/java/io/github/hectorvent/floci/services/ec2/FlowLogService.java
index 9c2a339616..5d2229c297 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ec2/FlowLogService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ec2/FlowLogService.java
@@ -27,6 +27,7 @@ import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -269,7 +270,7 @@ public class FlowLogService {
// endpoint — which is how traffic to an AWS service over PrivateLink shows
// up in flow logs. The endpoint's service is recorded in pkt-dst-aws-service.
List<String> endpointIps = new ArrayList<>();
- Map<String, String> endpointService = new java.util.HashMap<>(); // ip -> service short name (e.g. S3)
+ Map<String, String> endpointService = new HashMap<>(); // ip -> service short name (e.g. S3)
String resourceVpc = vpcOfFlowLogResource(fl);
for (NetworkInterface ni : ec2Service.endpointNetworkInterfaces(fl.getRegion())) {
if (ni.getPrivateIpAddress() == null || ni.getPrivateIpAddress().isBlank()) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ec2/net/VpcNetworkManager.java b/src/main/java/io/github/hectorvent/floci/services/ec2/net/VpcNetworkManager.java
index 34da2337cb..a9e813e87f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ec2/net/VpcNetworkManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ec2/net/VpcNetworkManager.java
@@ -16,6 +16,7 @@ import org.jboss.logging.Logger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -25,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiPredicate;
/**
@@ -137,8 +139,8 @@ public class VpcNetworkManager {
private final Object planLock = new Object();
/** So a misconfigured fallback prefix is reported once, not once per VPC. */
- private final java.util.concurrent.atomic.AtomicBoolean warnedPrefixClamp =
- new java.util.concurrent.atomic.AtomicBoolean();
+ private final AtomicBoolean warnedPrefixClamp =
+ new AtomicBoolean();
private final ScheduledExecutorService retries = Executors.newSingleThreadScheduledExecutor(r -> {
Thread t = new Thread(r, "ec2-vpc-network-teardown");
@@ -1005,7 +1007,7 @@ public class VpcNetworkManager {
* so the network must be for that VPC in the same Region
*/
private Set<Cidr4> dockerNetworkSubnets(String ownRegion, String ownVpcId) {
- Set<Cidr4> taken = new java.util.LinkedHashSet<>();
+ Set<Cidr4> taken = new LinkedHashSet<>();
try {
for (Network network : dockerClient.listNetworksCmd().exec()) {
Map<String, String> labels = network.getLabels() == null ? Map.of() : network.getLabels();
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecr/registry/EcrRegistryManager.java b/src/main/java/io/github/hectorvent/floci/services/ecr/registry/EcrRegistryManager.java
index 0501429a92..2e6a905531 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecr/registry/EcrRegistryManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecr/registry/EcrRegistryManager.java
@@ -36,6 +36,7 @@ import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -88,7 +89,7 @@ public class EcrRegistryManager {
private volatile int hostPort;
private volatile String containerId;
private volatile Closeable logStream;
- private volatile java.util.function.Consumer<List<String>> reconcileHook;
+ private volatile Consumer<List<String>> reconcileHook;
@Inject
public EcrRegistryManager(ContainerBuilder containerBuilder,
@@ -261,7 +262,7 @@ public class EcrRegistryManager {
* list of repository names known to the backing registry. EcrService uses this
* to recreate metadata entries for blobs whose metadata is missing (FR-013).
*/
- public void setReconcileHook(java.util.function.Consumer<List<String>> hook) {
+ public void setReconcileHook(Consumer<List<String>> hook) {
this.reconcileHook = hook;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
index 02f18ae8a3..54bd7359eb 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
@@ -243,7 +243,7 @@ public class EcsService implements ContainerTeardown, ResourceProvider, Resettab
// is how AWS describes it: "the account settings for the root user or the default setting".
private Map<String, String> accountSettings = new ConcurrentHashMap<>();
// deploymentIds for which SERVICE_DEPLOYMENT_IN_PROGRESS has already been emitted this process.
- private final Set<String> inProgressEmitted = java.util.concurrent.ConcurrentHashMap.newKeySet();
+ private final Set<String> inProgressEmitted = ConcurrentHashMap.newKeySet();
// serviceArn → why the reconciler's last attempt to launch one of its tasks failed, and for which
// deployment. Memory-only.
private final Map<String, LaunchFailure> launchFailures = new ConcurrentHashMap<>();
@@ -4240,7 +4240,7 @@ public class EcsService implements ContainerTeardown, ResourceProvider, Resettab
}
private static String newDeploymentId() {
- return "ecs-svc/" + java.util.UUID.randomUUID().toString().replace("-", "");
+ return "ecs-svc/" + UUID.randomUUID().toString().replace("-", "");
}
/**
diff --git a/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2DataPlane.java b/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2DataPlane.java
index 03bfec22a1..c69c083cf1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2DataPlane.java
+++ b/src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2DataPlane.java
@@ -182,8 +182,8 @@ public class ElbV2DataPlane {
}
}
- private final java.util.concurrent.atomic.AtomicBoolean releaseHandlerRegistered =
- new java.util.concurrent.atomic.AtomicBoolean();
+ private final AtomicBoolean releaseHandlerRegistered =
+ new AtomicBoolean();
private final Map<Integer, Map<String, String>> listenersByHostAndPort = new ConcurrentHashMap<>();
private final ConcurrentMap<String, ListenerBinding> listenerBindings;
private final Map<String, AtomicReference<List<CompiledRule>>> ruleChains = new ConcurrentHashMap<>();
@@ -855,7 +855,7 @@ public class ElbV2DataPlane {
return normalized;
}
- private void executeAction(io.vertx.core.http.HttpServerRequest req, Action action, String region, String listenerArn) {
+ private void executeAction(HttpServerRequest req, Action action, String region, String listenerArn) {
if (action == null) {
req.response().setStatusCode(502).end("No action");
return;
@@ -868,7 +868,7 @@ public class ElbV2DataPlane {
}
}
- private void executeForward(io.vertx.core.http.HttpServerRequest req, Action action, String region, String listenerArn) {
+ private void executeForward(HttpServerRequest req, Action action, String region, String listenerArn) {
String tgArn = resolveTgArn(action);
if (tgArn == null) {
req.response().setStatusCode(502).end("No target group");
@@ -950,7 +950,7 @@ public class ElbV2DataPlane {
return Math.max(1, seconds) * 1000;
}
- private void invokeLambdaTarget(io.vertx.core.http.HttpServerRequest req, String functionArn, String region) {
+ private void invokeLambdaTarget(HttpServerRequest req, String functionArn, String region) {
if (req.isEnded()) {
invokeLambdaWithBody(req, functionArn, region, Buffer.buffer());
return;
@@ -981,7 +981,7 @@ public class ElbV2DataPlane {
});
}
- private void invokeLambdaWithBody(io.vertx.core.http.HttpServerRequest req, String functionArn,
+ private void invokeLambdaWithBody(HttpServerRequest req, String functionArn,
String region, Buffer body) {
Map<String, Object> event = buildAlbEvent(req, body);
// Lambda invocation is synchronous and may take seconds while a cold container
@@ -1005,7 +1005,7 @@ public class ElbV2DataPlane {
});
}
- private void writeLambdaResponse(io.vertx.core.http.HttpServerRequest req, InvokeResult result) throws java.io.IOException {
+ private void writeLambdaResponse(HttpServerRequest req, InvokeResult result) throws IOException {
if (result.getFunctionError() != null) {
req.response().setStatusCode(502).end("Lambda function error: " + result.getFunctionError());
return;
@@ -1072,7 +1072,7 @@ public class ElbV2DataPlane {
}
}
- private Map<String, Object> buildAlbEvent(io.vertx.core.http.HttpServerRequest req, Buffer body) {
+ private Map<String, Object> buildAlbEvent(HttpServerRequest req, Buffer body) {
Map<String, Object> event = new HashMap<>();
event.put("requestContext", Map.of("elb", Map.of("targetGroupArn", "")));
event.put("httpMethod", req.method().name());
@@ -1141,7 +1141,7 @@ public class ElbV2DataPlane {
return tuples.get(tuples.size() - 1).getTargetGroupArn();
}
- private void proxyRequest(io.vertx.core.http.HttpServerRequest req, String host, int port,
+ private void proxyRequest(HttpServerRequest req, String host, int port,
boolean preserveHostHeader, List<String> cookies) {
req.pause();
if (ElbV2TargetResolver.isIpLiteral(host)) {
@@ -1386,7 +1386,7 @@ public class ElbV2DataPlane {
source.exceptionHandler(err -> close.run());
}
- private void executeRedirect(io.vertx.core.http.HttpServerRequest req, Action action) {
+ private void executeRedirect(HttpServerRequest req, Action action) {
String reqHost = req.host();
String reqPort = "";
if (reqHost != null && reqHost.contains(":")) {
@@ -1446,7 +1446,7 @@ public class ElbV2DataPlane {
return result;
}
- private void executeFixedResponse(io.vertx.core.http.HttpServerRequest req, Action action) {
+ private void executeFixedResponse(HttpServerRequest req, Action action) {
int statusCode = 200;
try {
if (action.getFixedResponseStatusCode() != null) {
@@ -1537,7 +1537,7 @@ public class ElbV2DataPlane {
return hostHeaderPatterns.stream().anyMatch(p -> globMatches(p, host));
}
- boolean matches(io.vertx.core.http.HttpServerRequest req) {
+ boolean matches(HttpServerRequest req) {
if (rule.isDefault()) {
return true;
}
@@ -1549,7 +1549,7 @@ public class ElbV2DataPlane {
return true;
}
- private boolean matchesCondition(RuleCondition condition, io.vertx.core.http.HttpServerRequest req) {
+ private boolean matchesCondition(RuleCondition condition, HttpServerRequest req) {
String field = condition.getField();
if (field == null) {
return true;
@@ -1605,7 +1605,7 @@ public class ElbV2DataPlane {
}
private Map<String, String> parseQueryString(String query) {
- Map<String, String> params = new java.util.LinkedHashMap<>();
+ Map<String, String> params = new LinkedHashMap<>();
if (query == null || query.isEmpty()) {
return params;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/emr/EmrService.java b/src/main/java/io/github/hectorvent/floci/services/emr/EmrService.java
index 773cc021a6..75470e50fd 100644
--- a/src/main/java/io/github/hectorvent/floci/services/emr/EmrService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/emr/EmrService.java
@@ -53,6 +53,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -1034,7 +1035,7 @@ public class EmrService implements Resettable {
.map(this::settle);
}
- private void mutateClusters(List<String> ids, java.util.function.Consumer<EmrCluster> mutation) {
+ private void mutateClusters(List<String> ids, Consumer<EmrCluster> mutation) {
for (String id : ids) {
findCluster(id).ifPresent(c -> {
mutation.accept(c);
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeInvoker.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeInvoker.java
index 81971287c7..33d5359335 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeInvoker.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeInvoker.java
@@ -376,7 +376,7 @@ public class EventBridgeInvoker {
return eventJson;
}
Map<String, JsonNode> resolved = new LinkedHashMap<>();
- for (var e : transformer.getInputPathsMap().entrySet()) {
+ for (Map.Entry<String, String> e : transformer.getInputPathsMap().entrySet()) {
resolved.put(e.getKey(), extractNode(e.getValue(), eventJson));
}
StringBuilder out = new StringBuilder(template.length() + 32);
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
index be947c7612..d2b5be84d7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
@@ -53,12 +53,14 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
+import java.util.function.Predicate;
import java.util.regex.Pattern;
@ApplicationScoped
@@ -1149,9 +1151,9 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
}
JsonNode resourcesPattern = pattern.get("resources");
if (resourcesPattern != null && resourcesPattern.isArray()) {
- var resources = ((ArrayNode) event.get("Resources")).elements();
+ Iterator<JsonNode> resources = ((ArrayNode) event.get("Resources")).elements();
while (resources.hasNext()) {
- var resource = resources.next().asText(null);
+ String resource = resources.next().asText(null);
if (matchesArrayField(resourcesPattern, resource)) {
return true;
}
@@ -1179,9 +1181,9 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
return false;
}
}
- var fields = pattern.fields();
+ Iterator<Map.Entry<String, JsonNode>> fields = pattern.fields();
while (fields.hasNext()) {
- var field = fields.next();
+ Map.Entry<String, JsonNode> field = fields.next();
if ("$or".equals(field.getKey())) {
continue;
}
@@ -2165,7 +2167,7 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
}
}
- private <V> java.util.Optional<V> accountGet(StorageBackend<String, V> store, String accountId, String key) {
+ private <V> Optional<V> accountGet(StorageBackend<String, V> store, String accountId, String key) {
if (accountId != null && store instanceof AccountAwareStorageBackend<V> aware) {
return aware.getForAccount(accountId, key);
}
@@ -2173,7 +2175,7 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
}
private <V> List<V> accountScan(StorageBackend<String, V> store, String accountId,
- java.util.function.Predicate<String> filter) {
+ Predicate<String> filter) {
if (accountId != null && store instanceof AccountAwareStorageBackend<V> aware) {
return aware.scanForAccount(accountId, filter);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/ScheduleExpressionParser.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/ScheduleExpressionParser.java
index ad787594a0..7afcc02d27 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/ScheduleExpressionParser.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/ScheduleExpressionParser.java
@@ -6,6 +6,7 @@ import com.cronutils.parser.CronParser;
import io.github.hectorvent.floci.core.common.AwsCronDefinitions;
import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -80,7 +81,7 @@ public final class ScheduleExpressionParser {
if (next == null) {
throw new IllegalStateException("No next fire time found for cron expression: " + expression);
}
- long millis = java.time.temporal.ChronoUnit.MILLIS.between(from, next);
+ long millis = ChronoUnit.MILLIS.between(from, next);
return Math.max(millis, 1000);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseJsonHandler.java
index 803d5be111..7419583c4b 100644
--- a/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/firehose/FirehoseJsonHandler.java
@@ -15,6 +15,7 @@ import jakarta.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
@ApplicationScoped
@@ -66,11 +67,11 @@ public class FirehoseJsonHandler {
dropExtendedOnlyMembersFromLegacyShape(redshift.getS3Backup());
RedshiftDestinationValidator.validateConfiguration(redshift, "redshiftDestinationConfiguration");
}
- List<io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Tag> tags = new ArrayList<>();
+ List<DeliveryStreamDescription.Tag> tags = new ArrayList<>();
if (request.has("Tags")) {
requireListSize(request.get("Tags"), "Tags", 1, 50);
for (JsonNode tNode : request.get("Tags")) {
- tags.add(mapper.treeToValue(tNode, io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Tag.class));
+ tags.add(mapper.treeToValue(tNode, DeliveryStreamDescription.Tag.class));
}
}
String deliveryStreamType = request.has("DeliveryStreamType")
@@ -192,10 +193,10 @@ public class FirehoseJsonHandler {
}
case "TagDeliveryStream" -> {
String name = getDeliveryStreamName(request);
- List<io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Tag> tags = new ArrayList<>();
+ List<DeliveryStreamDescription.Tag> tags = new ArrayList<>();
requireListSize(request.get("Tags"), "Tags", 1, 50);
for (JsonNode tNode : request.get("Tags")) {
- tags.add(mapper.treeToValue(tNode, io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Tag.class));
+ tags.add(mapper.treeToValue(tNode, DeliveryStreamDescription.Tag.class));
}
firehoseService.tagDeliveryStream(name, tags);
yield Response.ok(Map.of()).build();
@@ -215,7 +216,7 @@ public class FirehoseJsonHandler {
String exclusiveStartTagKey = request.has("ExclusiveStartTagKey") ? request.get("ExclusiveStartTagKey").asText() : null;
Integer limit = request.has("Limit") ? request.get("Limit").asInt() : null;
- List<io.github.hectorvent.floci.services.firehose.model.DeliveryStreamDescription.Tag> tags = firehoseService.listTagsForDeliveryStream(name, exclusiveStartTagKey, limit);
+ List<DeliveryStreamDescription.Tag> tags = firehoseService.listTagsForDeliveryStream(name, exclusiveStartTagKey, limit);
boolean hasMore = false;
List<DeliveryStreamDescription.Tag> allTags = firehoseService.describeDeliveryStream(name).getTags();
if (!tags.isEmpty() && !allTags.isEmpty()) {
@@ -287,7 +288,7 @@ public class FirehoseJsonHandler {
}
/** DeliveryStreamType values the 2015-08-04 model enumerates. */
- private static final java.util.Set<String> DELIVERY_STREAM_TYPES = java.util.Set.of(
+ private static final Set<String> DELIVERY_STREAM_TYPES = Set.of(
"DirectPut", "KinesisStreamAsSource", "MSKAsSource", "DatabaseAsSource");
/**
diff --git a/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java b/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java
index 5978456c2c..14f133d1b9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManager.java
@@ -27,7 +27,9 @@ import org.jboss.logging.Logger;
import java.io.Closeable;
import java.io.InputStream;
import java.net.HttpURLConnection;
+import java.net.SocketException;
import java.net.URI;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -876,7 +878,7 @@ public class FlociUiManager {
for (Throwable t = e; t != null; t = t.getCause()) {
// BindException and ConnectException both extend SocketException; the docker-java
// Apache transport surfaces a refused/denied Unix-socket connect this way.
- if (t instanceof java.net.SocketException || t instanceof java.net.UnknownHostException) {
+ if (t instanceof SocketException || t instanceof UnknownHostException) {
return true;
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/glue/GlueService.java b/src/main/java/io/github/hectorvent/floci/services/glue/GlueService.java
index 3c0180e66a..560ff36668 100644
--- a/src/main/java/io/github/hectorvent/floci/services/glue/GlueService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/glue/GlueService.java
@@ -54,6 +54,7 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.Instant;
+import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Comparator;
@@ -604,7 +605,7 @@ public class GlueService {
}
try {
return Instant.parse(value.trim());
- } catch (java.time.format.DateTimeParseException e) {
+ } catch (DateTimeParseException e) {
throw new AwsException("InvalidInputException", "Invalid time value: " + value, 400);
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryService.java b/src/main/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryService.java
index 0c956fa533..00d5dbc324 100644
--- a/src/main/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryService.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.core.common.RegionResolver;
+import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.glue.schemaregistry.model.MetadataInfo;
@@ -20,10 +21,15 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
+import java.util.Objects;
import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
@@ -71,9 +77,9 @@ public class GlueSchemaRegistryService {
GlueSchemaRegistryService(StorageBackend<String, Registry> registryStore,
RegionResolver regionResolver) {
this(registryStore,
- new io.github.hectorvent.floci.core.storage.InMemoryStorage<>(),
- new io.github.hectorvent.floci.core.storage.InMemoryStorage<>(),
- new io.github.hectorvent.floci.core.storage.InMemoryStorage<>(),
+ new InMemoryStorage<>(),
+ new InMemoryStorage<>(),
+ new InMemoryStorage<>(),
regionResolver);
}
@@ -473,7 +479,7 @@ public class GlueSchemaRegistryService {
.orElseThrow(() -> new AwsException("EntityNotFoundException",
"Schema version not found: " + schemaVersionId, 400));
- Map<String, MetadataInfo> metadata = metadataStore.get(schemaVersionId).orElseGet(java.util.LinkedHashMap::new);
+ Map<String, MetadataInfo> metadata = metadataStore.get(schemaVersionId).orElseGet(LinkedHashMap::new);
MetadataInfo info = metadata.get(key);
Instant now = Instant.now();
if (info == null) {
@@ -567,7 +573,7 @@ public class GlueSchemaRegistryService {
if (metadataList == null || metadataList.isEmpty()) {
return stored;
}
- Map<String, MetadataInfo> filtered = new java.util.LinkedHashMap<>();
+ Map<String, MetadataInfo> filtered = new LinkedHashMap<>();
for (MetadataKeyValueFilter f : metadataList) {
MetadataInfo info = stored.get(f.metadataKey());
if (info == null) continue;
@@ -596,9 +602,9 @@ public class GlueSchemaRegistryService {
TaggedResource resource = resolveTaggedResource(resourceArn);
Map<String, String> tags = resource.getTags();
if (tags == null) {
- tags = new java.util.LinkedHashMap<>();
+ tags = new LinkedHashMap<>();
} else {
- tags = new java.util.LinkedHashMap<>(tags);
+ tags = new LinkedHashMap<>(tags);
}
tags.putAll(tagsToAdd);
resource.setTags(tags);
@@ -614,7 +620,7 @@ public class GlueSchemaRegistryService {
if (tags == null || tags.isEmpty()) {
return;
}
- Map<String, String> updated = new java.util.LinkedHashMap<>(tags);
+ Map<String, String> updated = new LinkedHashMap<>(tags);
for (String key : tagKeysToRemove) {
updated.remove(key);
}
@@ -732,7 +738,7 @@ public class GlueSchemaRegistryService {
}
private static List<Long> parseVersionsExpression(String expr) {
- java.util.SortedSet<Long> versions = new java.util.TreeSet<>();
+ SortedSet<Long> versions = new TreeSet<>();
for (String token : expr.split(",")) {
token = token.trim();
if (token.isEmpty()) continue;
@@ -772,14 +778,14 @@ public class GlueSchemaRegistryService {
}
private static String simpleUnifiedDiff(String labelA, String a, String labelB, String b) {
- if (java.util.Objects.equals(a, b)) {
+ if (Objects.equals(a, b)) {
return "";
}
StringBuilder sb = new StringBuilder();
sb.append("--- ").append(labelA).append('\n');
sb.append("+++ ").append(labelB).append('\n');
- java.util.List<String> linesA = a == null ? List.of() : List.of(a.split("\n", -1));
- java.util.List<String> linesB = b == null ? List.of() : List.of(b.split("\n", -1));
+ List<String> linesA = a == null ? List.of() : List.of(a.split("\n", -1));
+ List<String> linesB = b == null ? List.of() : List.of(b.split("\n", -1));
int n = linesA.size();
int m = linesB.size();
// Compute LCS lengths.
@@ -959,7 +965,7 @@ public class GlueSchemaRegistryService {
private void rebuildVersionIndexes() {
versionByNumber.clear();
versionByDefinitionHash.clear();
- Map<String, String> arnToSchemaKey = new java.util.HashMap<>();
+ Map<String, String> arnToSchemaKey = new HashMap<>();
for (Schema s : schemaStore.scan(k -> true)) {
arnToSchemaKey.put(s.getSchemaArn(), schemaKey(s.getRegistryName(), s.getSchemaName()));
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java b/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
index 4aca01967c..a58d812acc 100644
--- a/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
@@ -27,6 +27,7 @@ import jakarta.inject.Inject;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Comparator;
@@ -36,6 +37,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
/**
* GuardDuty detector lifecycle and organization configuration backed by the configured
@@ -220,7 +222,7 @@ public class GuardDutyService {
int maxResults = parseMaxResults(maxResultsValue);
List<Detector> detectors = detectorStore.scan(key -> key.startsWith(region + "::")).stream()
.filter(detector -> accountId.equals(accountIdFromServiceRole(detector.getServiceRole())))
- .collect(java.util.stream.Collectors.toCollection(ArrayList::new));
+ .collect(Collectors.toCollection(ArrayList::new));
detectors.sort(Comparator.comparing(Detector::getId));
List<String> ids = detectors.stream().map(Detector::getId).toList();
@@ -1029,7 +1031,7 @@ public class GuardDutyService {
}
private static String isoTimestamp() {
- return Instant.now().truncatedTo(java.time.temporal.ChronoUnit.MILLIS).toString();
+ return Instant.now().truncatedTo(ChronoUnit.MILLIS).toString();
}
private static void requireObject(JsonNode value, String field) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamPolicyEvaluator.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamPolicyEvaluator.java
index 2137730f54..6657d1e0d8 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/IamPolicyEvaluator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamPolicyEvaluator.java
@@ -25,7 +25,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
@@ -806,9 +808,9 @@ public class IamPolicyEvaluator {
continue;
}
List<String> values = entry.getValue().stream()
- .filter(java.util.Objects::nonNull)
+ .filter(Objects::nonNull)
.toList();
- normalized.putIfAbsent(entry.getKey().toLowerCase(java.util.Locale.ROOT), values);
+ normalized.putIfAbsent(entry.getKey().toLowerCase(Locale.ROOT), values);
}
return normalized;
}
@@ -1391,7 +1393,7 @@ public class IamPolicyEvaluator {
boolean substitute = policyVariables && VARIABLE_CONDITION_OPERATORS.contains(baseOp);
for (Map.Entry<String, List<String>> entry : keyValueMap.entrySet()) {
- String condKey = entry.getKey().toLowerCase(java.util.Locale.ROOT);
+ String condKey = entry.getKey().toLowerCase(Locale.ROOT);
List<String> condValues = entry.getValue();
List<String> ctxValues = ctx.get(condKey);
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLAssertionVerifier.java b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLAssertionVerifier.java
index dc0f6a7ccc..4f46faebf4 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLAssertionVerifier.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLAssertionVerifier.java
@@ -6,9 +6,11 @@ import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.services.iam.model.SAMLProvider;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.xml.crypto.dsig.CanonicalizationMethod;
+import javax.xml.crypto.dsig.Reference;
import javax.xml.crypto.dsig.Transform;
import javax.xml.crypto.dsig.XMLSignature;
import javax.xml.crypto.dsig.XMLSignatureFactory;
@@ -79,7 +81,7 @@ final class SAMLAssertionVerifier {
context.setProperty("org.jcp.xml.dsig.secureValidation", Boolean.TRUE);
XMLSignature xmlSignature = XMLSignatureFactory.getInstance("DOM").unmarshalXMLSignature(context);
if (xmlSignature.getSignedInfo().getReferences().size() != 1
- || !(xmlSignature.getSignedInfo().getReferences().get(0) instanceof javax.xml.crypto.dsig.Reference reference)
+ || !(xmlSignature.getSignedInfo().getReferences().get(0) instanceof Reference reference)
|| !("#" + assertionId).equals(reference.getURI())) {
throw invalid("signature reference");
}
@@ -167,7 +169,7 @@ final class SAMLAssertionVerifier {
if (roles.isEmpty()) {
throw invalid("role pair missing");
}
- String nameQualifier = java.util.Base64.getEncoder().encodeToString(
+ String nameQualifier = Base64.getEncoder().encodeToString(
Digests.sha1((issuer + provider.getArn()).getBytes(StandardCharsets.UTF_8)));
return new Verified(issuer, name, subjectType, nameQualifier, notOnOrAfter, roles);
} catch (InvalidAssertionException e) {
@@ -182,19 +184,19 @@ final class SAMLAssertionVerifier {
return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(der));
}
- private static Element first(org.w3c.dom.Node parent, String namespace, String local) {
+ private static Element first(Node parent, String namespace, String local) {
if (parent == null) {
return null;
}
NodeList list = ((Element) parent).getElementsByTagNameNS(namespace, local);
return list.getLength() == 0 ? null : (Element) list.item(0);
}
- private static String childText(org.w3c.dom.Node parent, String namespace, String local) {
+ private static String childText(Node parent, String namespace, String local) {
Element e = first(parent, namespace, local);
return e == null ? null : e.getTextContent().trim();
}
- private static boolean hasText(org.w3c.dom.Node parent, String namespace, String local, String expected) {
+ private static boolean hasText(Node parent, String namespace, String local, String expected) {
NodeList list = ((Element) parent).getElementsByTagNameNS(namespace, local);
for (int i = 0; i < list.getLength(); i++) {
if (expected.equals(list.item(i).getTextContent().trim())) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLTrustPolicyEvaluator.java b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLTrustPolicyEvaluator.java
index 9114cf584e..44baa6f543 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLTrustPolicyEvaluator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLTrustPolicyEvaluator.java
@@ -8,6 +8,7 @@ import jakarta.inject.Inject;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.stream.StreamSupport;
/** Evaluates the federated principal and SAML action in a role trust policy. */
@ApplicationScoped
@@ -69,7 +70,7 @@ public class SAMLTrustPolicyEvaluator {
String claimName = colon < 0 ? key : key.substring(colon + 1);
List<String> actual = claims.getOrDefault(claimName, List.of());
List<String> expected = entry.getValue().isArray()
- ? java.util.stream.StreamSupport.stream(entry.getValue().spliterator(), false)
+ ? StreamSupport.stream(entry.getValue().spliterator(), false)
.filter(JsonNode::isTextual).map(JsonNode::asText).toList()
: entry.getValue().isTextual() ? List.of(entry.getValue().asText()) : List.of();
if (expected.isEmpty() || actual.isEmpty()) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLXml.java b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLXml.java
index 073c75ce3c..b7e2b252fc 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/SAMLXml.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/SAMLXml.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.iam;
import io.github.hectorvent.floci.core.common.XmlParser;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -22,7 +23,7 @@ final class SAMLXml {
}
static String text(Node parent, String namespace, String localName) {
- NodeList nodes = ((org.w3c.dom.Element) parent).getElementsByTagNameNS(namespace, localName);
+ NodeList nodes = ((Element) parent).getElementsByTagNameNS(namespace, localName);
return nodes.getLength() == 0 ? null : nodes.item(0).getTextContent().trim();
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/WebIdentityTrustPolicyEvaluator.java b/src/main/java/io/github/hectorvent/floci/services/iam/WebIdentityTrustPolicyEvaluator.java
index 62345c59eb..9b056fb3d6 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iam/WebIdentityTrustPolicyEvaluator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iam/WebIdentityTrustPolicyEvaluator.java
@@ -10,6 +10,7 @@ import org.jboss.logging.Logger;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.stream.StreamSupport;
/**
* Evaluates a role's trust policy for {@code sts:AssumeRoleWithWebIdentity}, matching the
@@ -248,7 +249,7 @@ public class WebIdentityTrustPolicyEvaluator {
return List.of(node.asText());
}
if (node.isArray()) {
- return java.util.stream.StreamSupport
+ return StreamSupport
.stream(node.spliterator(), false)
.filter(JsonNode::isTextual)
.map(JsonNode::asText)
diff --git a/src/main/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreService.java b/src/main/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreService.java
index 9972b41f78..2135cc1606 100644
--- a/src/main/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreService.java
@@ -23,6 +23,8 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
@ApplicationScoped
public class IdentityStoreService implements Resettable {
@@ -331,14 +333,14 @@ public class IdentityStoreService implements Resettable {
return listMembershipsAll(storeId).stream()
.filter(membership -> finalUserId.equals(membership.userId()))
.map(Membership::groupId)
- .collect(java.util.stream.Collectors.toUnmodifiableSet());
+ .collect(Collectors.toUnmodifiableSet());
}
public List<String> validateGroupIds(JsonNode groupIds) {
if (groupIds == null || !groupIds.isArray() || groupIds.size() < 1 || groupIds.size() > 100) {
throw validation("GroupIds must contain between 1 and 100 identifiers.");
}
- return java.util.stream.StreamSupport.stream(groupIds.spliterator(), false)
+ return StreamSupport.stream(groupIds.spliterator(), false)
.map(node -> {
if (!node.isTextual()) {
throw validation("GroupIds must contain strings.");
diff --git a/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java b/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
index 3851fea18a..81dc58b740 100644
--- a/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
@@ -34,9 +34,12 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
@ApplicationScoped
@Path("/{tenantId}/scim/v2")
@@ -470,7 +473,7 @@ public class ScimController {
if (request.has("groups")) {
throw validation("groups cannot be specified when creating a user.");
}
- for (String unsupported : java.util.List.of("ims", "photos", "x509Certificates", "entitlements", "password")) {
+ for (String unsupported : List.of("ims", "photos", "x509Certificates", "entitlements", "password")) {
if (request.has(unsupported)) {
throw validation(unsupported + " is not supported.");
}
@@ -682,9 +685,9 @@ public class ScimController {
String identityStoreId;
Matcher prefixed = PREFIXED_TENANT.matcher(tenantId);
if (prefixed.matches()) {
- identityStoreId = "d-" + prefixed.group(1).toLowerCase(java.util.Locale.ROOT);
+ identityStoreId = "d-" + prefixed.group(1).toLowerCase(Locale.ROOT);
} else if (LEGACY_TENANT.matcher(tenantId).matches()) {
- identityStoreId = tenantId.toLowerCase(java.util.Locale.ROOT);
+ identityStoreId = tenantId.toLowerCase(Locale.ROOT);
} else {
throw unauthorized("Authorization header is invalid or tenant ID is incorrect.");
}
@@ -1270,10 +1273,10 @@ public class ScimController {
}
private List<User> usersForGroup(String identityStoreId, List<User> users, String groupId) {
- java.util.Set<String> userIds = identityStoreService.listMembershipsForScim(identityStoreId).stream()
+ Set<String> userIds = identityStoreService.listMembershipsForScim(identityStoreId).stream()
.filter(membership -> groupId.equals(membership.groupId()))
.map(Membership::userId)
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
return users.stream().filter(user -> userIds.contains(user.userId())).toList();
}
@@ -1332,10 +1335,10 @@ public class ScimController {
private List<Group> groupsForMember(String identityStoreId, List<Group> groups, String memberId) {
requireScimUser(identityStoreId, memberId);
- java.util.Set<String> groupIds = identityStoreService.listMembershipsForScim(identityStoreId).stream()
+ Set<String> groupIds = identityStoreService.listMembershipsForScim(identityStoreId).stream()
.filter(membership -> memberId.equals(membership.userId()))
.map(Membership::groupId)
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
return groups.stream().filter(group -> groupIds.contains(group.groupId())).toList();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Controller.java b/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Controller.java
index 9708478e8e..0ebc41ea32 100644
--- a/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Controller.java
+++ b/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Controller.java
@@ -20,6 +20,8 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
@Path("/")
@@ -93,7 +95,7 @@ public class Inspector2Controller {
throw new AwsException("ValidationException",
"accountIds must contain at most 100 account IDs.", 400);
}
- java.util.List<String> requestedAccounts = requestedAccounts(accountIds);
+ List<String> requestedAccounts = requestedAccounts(accountIds);
ObjectNode response = objectMapper.createObjectNode();
ArrayNode accounts = response.putArray("accounts");
for (String accountId : requestedAccounts) {
@@ -140,7 +142,7 @@ public class Inspector2Controller {
return Response.ok(organizationConfigurationResponse(state)).build();
}
- private com.fasterxml.jackson.databind.node.ObjectNode organizationConfigurationResponse(InspectorState state) {
+ private ObjectNode organizationConfigurationResponse(InspectorState state) {
ObjectNode response = objectMapper.createObjectNode();
ObjectNode autoEnable = response.putObject("autoEnable");
autoEnable.put("ec2", state.isAutoEnableEc2());
@@ -152,11 +154,11 @@ public class Inspector2Controller {
return response;
}
- private java.util.List<String> requestedAccounts(JsonNode accountIds) {
+ private List<String> requestedAccounts(JsonNode accountIds) {
if (accountIds == null || accountIds.isEmpty()) {
- return java.util.List.of(requestContext.getAccountId());
+ return List.of(requestContext.getAccountId());
}
- java.util.List<String> result = new java.util.ArrayList<>(accountIds.size());
+ List<String> result = new ArrayList<>(accountIds.size());
for (JsonNode accountId : accountIds) {
Inspector2Service.requireAccountId(accountId.asText(null));
result.add(accountId.asText());
@@ -164,7 +166,7 @@ public class Inspector2Controller {
return result;
}
- private com.fasterxml.jackson.databind.node.ObjectNode resourceState(InspectorState state) {
+ private ObjectNode resourceState(InspectorState state) {
ObjectNode resources = objectMapper.createObjectNode();
resources.set("ec2", stateNode(state.getEc2Status()));
resources.set("ecr", stateNode(state.getEcrStatus()));
@@ -174,7 +176,7 @@ public class Inspector2Controller {
return resources;
}
- private com.fasterxml.jackson.databind.node.ObjectNode resourceStatus(InspectorState state) {
+ private ObjectNode resourceStatus(InspectorState state) {
ObjectNode resources = objectMapper.createObjectNode();
resources.put("ec2", state.getEc2Status());
resources.put("ecr", state.getEcrStatus());
@@ -184,7 +186,7 @@ public class Inspector2Controller {
return resources;
}
- private com.fasterxml.jackson.databind.node.ObjectNode stateNode(String status) {
+ private ObjectNode stateNode(String status) {
ObjectNode state = objectMapper.createObjectNode();
state.put("status", status);
return state;
diff --git a/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Service.java b/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Service.java
index b8a6d8a8d8..e27b22f999 100644
--- a/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/inspector2/Inspector2Service.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
@ApplicationScoped
@@ -207,7 +208,7 @@ public class Inspector2Service implements Resettable {
}
}
- private java.util.Optional<String> managementAccountFor(String accountId) {
+ private Optional<String> managementAccountFor(String accountId) {
return organizationsService.findManagementAccountForResource(accountId);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/iot/IotService.java b/src/main/java/io/github/hectorvent/floci/services/iot/IotService.java
index 01284f3ef7..bab54aaa32 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iot/IotService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iot/IotService.java
@@ -71,9 +71,11 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
+import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Pattern;
@@ -254,7 +256,7 @@ public class IotService {
Thing existing = thingStore.get(key).orElse(null);
if (existing != null) {
if (existing.getAttributes().equals(attributes)
- && java.util.Objects.equals(existing.getThingTypeName(), blankToNull(thingTypeName))) {
+ && Objects.equals(existing.getThingTypeName(), blankToNull(thingTypeName))) {
return existing;
}
throw new AwsException("ResourceAlreadyExistsException", "Thing already exists: " + thingName, 409);
@@ -860,12 +862,12 @@ public class IotService {
public Set<String> listThingPrincipals(String thingName, String region) {
describeThing(thingName, region);
- return new java.util.TreeSet<>(thingPrincipalStore.get(thingPrincipalKey(region, thingName)).orElse(Set.of()));
+ return new TreeSet<>(thingPrincipalStore.get(thingPrincipalKey(region, thingName)).orElse(Set.of()));
}
public Set<String> listPrincipalThings(String principal, String region) {
String prefix = "thing-principal:" + region + ":";
- Set<String> things = new java.util.TreeSet<>();
+ Set<String> things = new TreeSet<>();
for (String key : thingPrincipalStore.keys()) {
if (key.startsWith(prefix) && thingPrincipalStore.get(key).orElse(Set.of()).contains(principal)) {
things.add(key.substring(prefix.length()));
@@ -920,7 +922,7 @@ public class IotService {
public Set<String> listTargetsForPolicy(String policyName, String region) {
getPolicy(policyName, region);
- return new java.util.TreeSet<>(policyAttachmentStore.get(policyAttachmentKey(region, policyName)).orElse(Set.of()));
+ return new TreeSet<>(policyAttachmentStore.get(policyAttachmentKey(region, policyName)).orElse(Set.of()));
}
/**
@@ -1251,7 +1253,7 @@ public class IotService {
String key = thingTypeKey(region, thingTypeName);
IotThingType existing = thingTypeStore.get(key).orElse(null);
if (existing != null) {
- if (java.util.Objects.equals(existing.getDescription(), properties.path("thingTypeDescription").asText(null))
+ if (Objects.equals(existing.getDescription(), properties.path("thingTypeDescription").asText(null))
&& existing.getSearchableAttributes().equals(stringList(properties.path("searchableAttributes")))) {
return existing;
}
@@ -1305,7 +1307,7 @@ public class IotService {
String key = thingGroupKey(region, thingGroupName);
IotThingGroup existing = thingGroupStore.get(key).orElse(null);
if (existing != null) {
- if (java.util.Objects.equals(existing.getDescription(), properties.path("thingGroupDescription").asText(null))
+ if (Objects.equals(existing.getDescription(), properties.path("thingGroupDescription").asText(null))
&& existing.getAttributes().equals(parseAttributePayload(properties.path("attributePayload")))) {
return existing;
}
@@ -1366,7 +1368,7 @@ public class IotService {
public Set<String> listThingsInThingGroup(String thingGroupName, String region) {
describeThingGroup(thingGroupName, region);
- return new java.util.TreeSet<>(thingGroupMembershipStore.get(thingGroupMembershipKey(region, thingGroupName)).orElse(Set.of()));
+ return new TreeSet<>(thingGroupMembershipStore.get(thingGroupMembershipKey(region, thingGroupName)).orElse(Set.of()));
}
public List<IotThingGroup> listThingGroupsForThing(String thingName, String region) {
@@ -1402,8 +1404,8 @@ public class IotService {
job.setCreatedAt(now);
job.setLastUpdatedAt(now);
- List<String> targets = new java.util.ArrayList<>();
- Set<String> thingNames = new java.util.TreeSet<>();
+ List<String> targets = new ArrayList<>();
+ Set<String> thingNames = new TreeSet<>();
targetsNode.forEach(target -> {
String value = target.asText();
if (value != null && !value.isBlank()) {
@@ -2284,7 +2286,7 @@ public class IotService {
}
private List<String> stringList(JsonNode node) {
- List<String> values = new java.util.ArrayList<>();
+ List<String> values = new ArrayList<>();
if (node != null && node.isArray()) {
node.forEach(item -> values.add(item.asText()));
}
@@ -2369,6 +2371,6 @@ public class IotService {
private record ShadowUpdate(ObjectNode accepted, ObjectNode documents, ObjectNode delta) {
}
- private record TaggableResource(Map<String, String> tags, java.util.function.Consumer<Map<String, String>> updateTags) {
+ private record TaggableResource(Map<String, String> tags, Consumer<Map<String, String>> updateTags) {
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java
index 26bda9561b..4fa2ce8ad1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/kms/KmsJsonHandler.java
@@ -20,6 +20,8 @@ import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import static io.github.hectorvent.floci.core.common.ReservedTags.rejectUnknownReservedTags;
@@ -286,7 +288,7 @@ public class KmsJsonHandler {
private Response handleCreateGrant(JsonNode request, String region) {
String keyId = request.path("KeyId").asText(null);
String granteePrincipal = request.path("GranteePrincipal").asText(null);
- List<String> operations = new java.util.ArrayList<>();
+ List<String> operations = new ArrayList<>();
request.path("Operations").forEach(operation -> operations.add(operation.asText()));
String retiringPrincipal = request.path("RetiringPrincipal").isMissingNode()
? null : request.path("RetiringPrincipal").asText(null);
@@ -617,7 +619,7 @@ public class KmsJsonHandler {
private Response handleUntagResource(JsonNode request, String region) {
String keyId = request.path("KeyId").asText();
- java.util.List<String> keys = new java.util.ArrayList<>();
+ List<String> keys = new ArrayList<>();
request.path("TagKeys").forEach(k -> keys.add(k.asText()));
service.untagResource(keyId, keys, region);
return Response.ok().build();
diff --git a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
index 8e40419d35..bacfdc4b74 100644
--- a/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/kms/KmsService.java
@@ -398,15 +398,15 @@ public class KmsService implements ResourceProvider {
"GenerateMac", "VerifyMac", "DeriveSharedSecret"));
/** GrantNameType pattern/length from the KMS model (kms/2014-11-01/service-2.json). */
- private static final java.util.regex.Pattern GRANT_NAME_PATTERN =
- java.util.regex.Pattern.compile("^[a-zA-Z0-9:/_-]+$");
+ private static final Pattern GRANT_NAME_PATTERN =
+ Pattern.compile("^[a-zA-Z0-9:/_-]+$");
/**
* GrantConstraintSourceArnType pattern from the KMS model (kms/2014-11-01/service-2.json),
* quoted verbatim in AWS's validation message; it already accepts every partition.
*/
- private static final java.util.regex.Pattern GRANT_CONSTRAINT_SOURCE_ARN_PATTERN =
- java.util.regex.Pattern.compile("^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$"); // partition-literal: model pattern quoted in AWS's message
+ private static final Pattern GRANT_CONSTRAINT_SOURCE_ARN_PATTERN =
+ Pattern.compile("^arn:aws[a-z0-9-]*:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:.+$"); // partition-literal: model pattern quoted in AWS's message
private static final Set<String> GRANT_CONSTRAINT_MEMBERS =
Set.of("EncryptionContextSubset", "EncryptionContextEquals", "SourceArn");
diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java
index 46fe57b21a..794672b26d 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/LakeFormationService.java
@@ -148,7 +148,7 @@ public class LakeFormationService {
String catalogId = request.getCatalogId() != null ? request.getCatalogId() : regionResolver.getAccountId();
if (request.getPermissionsWithGrantOption() != null) {
- java.util.List<String> perms = request.getPermissions() != null ? request.getPermissions() : java.util.List.of();
+ List<String> perms = request.getPermissions() != null ? request.getPermissions() : List.of();
for (String grantOption : request.getPermissionsWithGrantOption()) {
if (!perms.contains(grantOption)) {
throw new AwsException("InvalidInputException", "PermissionsWithGrantOption must be a subset of Permissions", 400);
diff --git a/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java b/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java
index 7be43431e8..f04467cbcd 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lakeformation/MemoryLakeFormationStorage.java
@@ -1,12 +1,15 @@
package io.github.hectorvent.floci.services.lakeformation;
import com.fasterxml.jackson.core.type.TypeReference;
+import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
import io.github.hectorvent.floci.core.storage.StorageFactory;
import io.github.hectorvent.floci.services.lakeformation.model.*;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -56,7 +59,7 @@ public class MemoryLakeFormationStorage implements LakeFormationStorage {
Boolean hybridAccessEnabled, Boolean withFederation) {
String resourceKey = region + ":" + resourceArn;
ResourceInfo existing = resourcesStorage.get(resourceKey)
- .orElseThrow(() -> new io.github.hectorvent.floci.core.common.AwsException(
+ .orElseThrow(() -> new AwsException(
"EntityNotFoundException", "Resource not found", 400));
// Work on a defensive copy so concurrent readers (DescribeResource, ListResources)
// never observe a partially-mutated ResourceInfo: they see either the old complete
@@ -112,7 +115,7 @@ public class MemoryLakeFormationStorage implements LakeFormationStorage {
} else if ("BEGINS_WITH".equals(op)) {
if (values.stream().noneMatch(arn::startsWith)) return false;
} else {
- throw new io.github.hectorvent.floci.core.common.AwsException("InvalidInputException", "Unsupported ComparisonOperator: " + op, 400);
+ throw new AwsException("InvalidInputException", "Unsupported ComparisonOperator: " + op, 400);
}
}
}
@@ -325,11 +328,11 @@ public class MemoryLakeFormationStorage implements LakeFormationStorage {
String cat = r.getTableWithColumns().getCatalogId() != null ? "catalog:" + r.getTableWithColumns().getCatalogId() + ":" : "";
StringBuilder sb = new StringBuilder(cat + "tableWithColumns:" + r.getTableWithColumns().getDatabaseName() + ":" + r.getTableWithColumns().getName());
if (r.getTableWithColumns().getColumnNames() != null && !r.getTableWithColumns().getColumnNames().isEmpty()) {
- sb.append(":cols:").append(r.getTableWithColumns().getColumnNames().stream().map(c -> java.net.URLEncoder.encode(c, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
+ sb.append(":cols:").append(r.getTableWithColumns().getColumnNames().stream().map(c -> URLEncoder.encode(c, StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
} else if (r.getTableWithColumns().getColumnWildcard() != null) {
sb.append(":wildcard");
if (r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames() != null && !r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames().isEmpty()) {
- sb.append(":excl:").append(r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames().stream().map(c -> java.net.URLEncoder.encode(c, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
+ sb.append(":excl:").append(r.getTableWithColumns().getColumnWildcard().getExcludedColumnNames().stream().map(c -> URLEncoder.encode(c, StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
}
}
return sb.toString();
@@ -344,9 +347,9 @@ public class MemoryLakeFormationStorage implements LakeFormationStorage {
}
if (r.getLfTag() != null) {
String cat = r.getLfTag().getCatalogId() != null ? "catalog:" + r.getLfTag().getCatalogId() + ":" : "";
- StringBuilder sb = new StringBuilder(cat + "lfTag:" + java.net.URLEncoder.encode(r.getLfTag().getTagKey(), java.nio.charset.StandardCharsets.UTF_8));
+ StringBuilder sb = new StringBuilder(cat + "lfTag:" + URLEncoder.encode(r.getLfTag().getTagKey(), StandardCharsets.UTF_8));
if (r.getLfTag().getTagValues() != null) {
- sb.append("=").append(r.getLfTag().getTagValues().stream().map(v -> java.net.URLEncoder.encode(v, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
+ sb.append("=").append(r.getLfTag().getTagValues().stream().map(v -> URLEncoder.encode(v, StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")));
}
return sb.toString();
}
@@ -362,7 +365,7 @@ public class MemoryLakeFormationStorage implements LakeFormationStorage {
}
if (r.getLfTagPolicy().getExpression() != null) {
sb.append(":expr:").append(r.getLfTagPolicy().getExpression().stream()
- .map(e -> java.net.URLEncoder.encode(e.getTagKey(), java.nio.charset.StandardCharsets.UTF_8) + "=" + e.getTagValues().stream().map(v -> java.net.URLEncoder.encode(v, java.nio.charset.StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")))
+ .map(e -> URLEncoder.encode(e.getTagKey(), StandardCharsets.UTF_8) + "=" + e.getTagValues().stream().map(v -> URLEncoder.encode(v, StandardCharsets.UTF_8)).sorted().collect(Collectors.joining(",")))
.sorted().collect(Collectors.joining(";")));
}
return sb.toString();
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/ApiGatewayController.java b/src/main/java/io/github/hectorvent/floci/services/lambda/ApiGatewayController.java
index b9f3ebe265..c808de9832 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/ApiGatewayController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/ApiGatewayController.java
@@ -166,7 +166,7 @@ public class ApiGatewayController {
// Headers
ObjectNode headersNode = event.putObject("headers");
MultivaluedMap<String, String> reqHeaders = headers.getRequestHeaders();
- for (Map.Entry<String, java.util.List<String>> entry : reqHeaders.entrySet()) {
+ for (Map.Entry<String, List<String>> entry : reqHeaders.entrySet()) {
if (!entry.getValue().isEmpty()) {
headersNode.put(entry.getKey(), entry.getValue().get(0));
}
@@ -176,7 +176,7 @@ public class ApiGatewayController {
MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
if (!queryParams.isEmpty()) {
ObjectNode qspNode = event.putObject("queryStringParameters");
- for (Map.Entry<String, java.util.List<String>> entry : queryParams.entrySet()) {
+ for (Map.Entry<String, List<String>> entry : queryParams.entrySet()) {
if (!entry.getValue().isEmpty()) {
qspNode.put(entry.getKey(), entry.getValue().get(0));
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java
index 8a785cfdc0..8ca9401127 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaController.java
@@ -38,8 +38,10 @@ import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Base64;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
/**
* AWS Lambda API REST endpoints.
@@ -704,7 +706,7 @@ public class LambdaController {
if (!(weights instanceof Map)) return null;
Map<String, Object> raw = (Map<String, Object>) weights;
if (raw.isEmpty()) return null;
- java.util.Map<String, Double> result = new java.util.HashMap<>();
+ Map<String, Double> result = new HashMap<>();
raw.forEach((k, v) -> result.put(k, ((Number) v).doubleValue()));
return result;
}
@@ -915,6 +917,6 @@ public class LambdaController {
if (config == null || !(config.get(key) instanceof List<?> values)) {
return List.of();
}
- return values.stream().filter(java.util.Objects::nonNull).map(Object::toString).toList();
+ return values.stream().filter(Objects::nonNull).map(Object::toString).toList();
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerStore.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerStore.java
index 5c4bbe43ff..39774bc802 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerStore.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaLayerStore.java
@@ -9,9 +9,11 @@ import io.github.hectorvent.floci.services.lambda.model.LambdaLayerVersion;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.stream.Collectors;
/**
* Wraps the storage backend for Lambda Layer Versions.
@@ -79,7 +81,7 @@ public class LambdaLayerStore {
public List<LambdaLayerVersion> listAllVersions(String region) {
String prefix = "layer::" + region + "::";
return backend.scan(k -> k.startsWith(prefix)).stream()
- .sorted(java.util.Comparator.comparing(LambdaLayerVersion::getLayerName)
+ .sorted(Comparator.comparing(LambdaLayerVersion::getLayerName)
.thenComparingLong(LambdaLayerVersion::getVersion))
.toList();
}
@@ -92,7 +94,7 @@ public class LambdaLayerStore {
List<LambdaLayerVersion> all = backend.scan(k -> k.startsWith(prefix));
// Group by layer name and return the latest version of each
return all.stream()
- .collect(java.util.stream.Collectors.groupingBy(LambdaLayerVersion::getLayerName))
+ .collect(Collectors.groupingBy(LambdaLayerVersion::getLayerName))
.values().stream()
.map(versions -> versions.stream()
.max((a, b) -> Long.compare(a.getVersion(), b.getVersion()))
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
index 96aff16fc4..b9c75049f7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaService.java
@@ -51,6 +51,7 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.io.IOException;
+import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
@@ -60,6 +61,7 @@ import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -904,7 +906,7 @@ public class LambdaService implements ResourceProvider {
Map<String, Object> requestedVpcConfig = fn.getVpcConfig();
if (requestedVpcConfigUpdate != null) {
- requestedVpcConfig = new java.util.HashMap<>(requestedVpcConfigUpdate);
+ requestedVpcConfig = new HashMap<>(requestedVpcConfigUpdate);
}
List<LambdaFileSystemConfig> requestedFileSystemConfigs = fn.getFileSystemConfigs();
if (request.containsKey("FileSystemConfigs")) {
@@ -937,7 +939,7 @@ public class LambdaService implements ResourceProvider {
}
if (request.containsKey("Environment")) {
if (environment != null && environment.containsKey("Variables")) {
- fn.setEnvironment(environmentVariables != null ? environmentVariables : new java.util.HashMap<>());
+ fn.setEnvironment(environmentVariables != null ? environmentVariables : new HashMap<>());
}
}
@@ -2307,11 +2309,11 @@ public class LambdaService implements ResourceProvider {
}
/** The highest-numbered published version of a function, if any. */
- private java.util.Optional<LambdaFunction> newestVersion(String region, String functionName) {
+ private Optional<LambdaFunction> newestVersion(String region, String functionName) {
return functionStore.listVersions(region, functionName).stream()
.filter(v -> v.getVersion() != null && !"$LATEST".equals(v.getVersion()))
.filter(v -> v.getVersion().chars().allMatch(Character::isDigit))
- .max(java.util.Comparator.comparingLong(v -> Long.parseLong(v.getVersion())));
+ .max(Comparator.comparingLong(v -> Long.parseLong(v.getVersion())));
}
/** Publishes an owned code snapshot; a failed copy must not reference mutable {@code $LATEST}. */
@@ -2435,7 +2437,7 @@ public class LambdaService implements ResourceProvider {
snapshot.setEnvironment(fn.getEnvironment());
snapshot.setVpcConfig(fn.getVpcConfig() == null
? null
- : new java.util.HashMap<>(fn.getVpcConfig()));
+ : new HashMap<>(fn.getVpcConfig()));
snapshot.setVpcId(fn.getVpcId());
snapshot.setSnapStartApplyOn(fn.getSnapStartApplyOn());
snapshot.setLogFormat(fn.getLogFormat());
@@ -3022,7 +3024,7 @@ public class LambdaService implements ResourceProvider {
public LambdaAlias createAlias(String region, String functionName, String aliasName,
String functionVersion, String description,
- java.util.Map<String, Double> routingConfig) {
+ Map<String, Double> routingConfig) {
validateAliasName(aliasName);
validateAliasMembers(functionVersion, description);
LambdaFunction fn = getFunction(region, functionName);
@@ -3064,7 +3066,7 @@ public class LambdaService implements ResourceProvider {
public LambdaAlias updateAlias(String region, String functionName, String aliasName,
String functionVersion, String description,
- java.util.Map<String, Double> routingConfig) {
+ Map<String, Double> routingConfig) {
validateAliasName(aliasName);
validateAliasMembers(functionVersion, description);
LambdaFunction fn = getFunction(region, functionName);
@@ -3440,18 +3442,18 @@ public class LambdaService implements ResourceProvider {
/** Stable, account-scoped S3 key for a published layer version's archive. */
public static String layerObjectKey(String accountId, String layerName, long version) {
- var account = accountId != null ? accountId : "000000000000";
+ String account = accountId != null ? accountId : "000000000000";
return "layers/" + account + "/" + layerName + "/" + version;
}
/** Percent-encodes each path segment of a bucket path or object key for use in a URL. */
public static String encodeObjectPath(String path) {
- var encoded = new StringBuilder();
- for (var segment : path.split("/", -1)) {
+ StringBuilder encoded = new StringBuilder();
+ for (String segment : path.split("/", -1)) {
if (!encoded.isEmpty()) {
encoded.append('/');
}
- encoded.append(java.net.URLEncoder.encode(segment, java.nio.charset.StandardCharsets.UTF_8)
+ encoded.append(URLEncoder.encode(segment, StandardCharsets.UTF_8)
.replace("+", "%20"));
}
return encoded.toString();
@@ -3808,13 +3810,13 @@ public class LambdaService implements ResourceProvider {
String resourceArn = policyResourceArn(fn, ref.qualifier());
List<Map<String, Object>> statements = fn.getPolicies().stream()
.filter(statement -> scopedTo(statement, resourceArn))
- .<Map<String, Object>>map(java.util.LinkedHashMap::new)
+ .<Map<String, Object>>map(LinkedHashMap::new)
.toList();
if (statements.isEmpty()) {
throw new AwsException("ResourceNotFoundException",
"The resource you requested does not exist.", 404);
}
- Map<String, Object> policy = new java.util.LinkedHashMap<>();
+ Map<String, Object> policy = new LinkedHashMap<>();
policy.put("Version", "2012-10-17");
policy.put("Id", "default");
policy.put("Statement", statements);
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaTagController.java b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaTagController.java
index e9d9e07a8f..1bcf577537 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaTagController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/LambdaTagController.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.lambda;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
@@ -31,12 +32,12 @@ import java.util.Map;
public class LambdaTagController {
private final LambdaService lambdaService;
- private final io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService microvmsService;
+ private final LambdaMicrovmsService microvmsService;
private final ObjectMapper objectMapper;
@Inject
public LambdaTagController(LambdaService lambdaService,
- io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService microvmsService,
+ LambdaMicrovmsService microvmsService,
ObjectMapper objectMapper) {
this.lambdaService = lambdaService;
this.microvmsService = microvmsService;
@@ -56,7 +57,7 @@ public class LambdaTagController {
@GET
@Path("/tags/{arn}")
public Response listTags(@PathParam("arn") String arn) {
- if (io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService.ownsArn(arn)) {
+ if (LambdaMicrovmsService.ownsArn(arn)) {
ObjectNode mvRoot = objectMapper.createObjectNode();
ObjectNode mvTags = mvRoot.putObject("Tags");
microvmsService.listTags(arnRegion(arn), arn).forEach(mvTags::put);
@@ -79,7 +80,7 @@ public class LambdaTagController {
if (tags == null) {
throw new AwsException("InvalidParameterValueException", "Tags is required", 400);
}
- if (io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService.ownsArn(arn)) {
+ if (LambdaMicrovmsService.ownsArn(arn)) {
microvmsService.tagResource(arnRegion(arn), arn, tags);
} else {
lambdaService.tagResource(arn, tags);
@@ -96,7 +97,7 @@ public class LambdaTagController {
@Path("/tags/{arn}")
public Response untagResource(@PathParam("arn") String arn,
@QueryParam("tagKeys") List<String> tagKeys) {
- if (io.github.hectorvent.floci.services.lambdamicrovms.LambdaMicrovmsService.ownsArn(arn)) {
+ if (LambdaMicrovmsService.ownsArn(arn)) {
microvmsService.untagResource(arnRegion(arn), arn, tagKeys);
} else {
lambdaService.untagResource(arn, tagKeys);
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/SqsEventSourcePoller.java b/src/main/java/io/github/hectorvent/floci/services/lambda/SqsEventSourcePoller.java
index 9430fcc469..d71e81a461 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/SqsEventSourcePoller.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/SqsEventSourcePoller.java
@@ -22,6 +22,7 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
@@ -463,7 +464,7 @@ public class SqsEventSourcePoller implements Resettable {
attrNode.put("dataType", val.getDataType() != null ? val.getDataType() : "String");
if (val.getBinaryValue() != null) {
attrNode.put("binaryValue",
- java.util.Base64.getEncoder().encodeToString(val.getBinaryValue()));
+ Base64.getEncoder().encodeToString(val.getBinaryValue()));
} else if (val.getStringValue() != null) {
attrNode.put("stringValue", val.getStringValue());
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncher.java b/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncher.java
index 89e7eb0490..26cdf11b61 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncher.java
@@ -40,19 +40,29 @@ import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.AtomicMoveNotSupportedException;
import java.nio.file.Files;
+import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
import java.util.concurrent.CancellationException;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
@@ -78,8 +88,8 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
*/
static final String DEFAULT_NAME_PREFIX = ContainerStorageHelper.NAME_PREFIX;
/** A prefix must be a legal Docker name on its own: names must start alphanumeric. */
- private static final java.util.regex.Pattern SAFE_NAME_PREFIX =
- java.util.regex.Pattern.compile("^[A-Za-z0-9][A-Za-z0-9_.-]*$");
+ private static final Pattern SAFE_NAME_PREFIX =
+ Pattern.compile("^[A-Za-z0-9][A-Za-z0-9_.-]*$");
/**
* The base name prefix for Lambda containers and code volumes:
@@ -138,7 +148,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
this.layerService = layerService;
this.awsEnv = awsEnv;
this.executionRoleCredentials = executionRoleCredentials;
- this.populateSemaphore = new java.util.concurrent.Semaphore(resolvePopulateConcurrency(config));
+ this.populateSemaphore = new Semaphore(resolvePopulateConcurrency(config));
}
@PostConstruct
@@ -224,7 +234,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
String runtimeApiEndpoint = hostAddress + ":" + runtimeApiServer.getPort();
// Give the container a human-readable name (needed for log stream name below)
- String shortId = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 8);
+ String shortId = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
String containerName = ContainerStorageHelper.prefixedDockerName(config,
resolveContainerNamePrefix(config), fn.getFunctionName() + "-" + shortId);
@@ -681,7 +691,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
* Docker and Kubernetes launchers append the function's Environment after the same baseline
* and must apply this rule identically.
*/
- public static boolean definesFullCredentialTriad(java.util.Map<String, String> environment) {
+ public static boolean definesFullCredentialTriad(Map<String, String> environment) {
return environment.containsKey("AWS_ACCESS_KEY_ID")
&& environment.containsKey("AWS_SECRET_ACCESS_KEY")
&& environment.containsKey("AWS_SESSION_TOKEN");
@@ -706,7 +716,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
//
// Per-instance rather than static so the permit count can come from configuration; Floci runs a
// single @ApplicationScoped launcher, so this is still one gate for the whole emulator.
- private final java.util.concurrent.Semaphore populateSemaphore;
+ private final Semaphore populateSemaphore;
/**
* Permits for {@link #populateSemaphore}: the configured value when set and positive,
@@ -756,7 +766,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
// ensureCodeVolume re-checks lifecycleManager.volumeExists() rather than trusting this alone.
private static final String CODE_VOLUME_MARKER_DIR = "lambda-codevol-markers";
private static final String NAMESPACE_LABEL = "floci_namespace";
- private final java.util.Set<String> populatedCodeVolumes = java.util.concurrent.ConcurrentHashMap.newKeySet();
+ private final Set<String> populatedCodeVolumes = ConcurrentHashMap.newKeySet();
// Deliberately never pruned: removing an entry while a caller elsewhere still held a reference
// to its lock object let a third caller's computeIfAbsent create a replacement lock for the same
// volume name, so the waiter (once granted the old lock) and the new caller (holding the new
@@ -764,12 +774,12 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
// exists to prevent. Bounded in practice by the number of distinct function+code-version
// combinations ever launched, each entry a single Object; negligible next to the disk space the
// rest of this fix reclaims.
- private final java.util.concurrent.ConcurrentHashMap<String, Object> codeVolumeLocks = new java.util.concurrent.ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Object> codeVolumeLocks = new ConcurrentHashMap<>();
private final Object codeVolumeMarkerIoLock = new Object();
/** Each function's current code volume, so a redeploy can queue the superseded one for cleanup. */
- private final java.util.concurrent.ConcurrentHashMap<String, String> functionCurrentVolume =
- new java.util.concurrent.ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, String> functionCurrentVolume =
+ new ConcurrentHashMap<>();
/**
* Serializes the functionCurrentVolume/volumesPendingCleanup transition below, keyed by function
@@ -782,8 +792,8 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
* the same lock-identity reason as codeVolumeLocks, and bounded the same way (one entry per
* distinct function name ever launched).
*/
- private final java.util.concurrent.ConcurrentHashMap<String, Object> functionVolumeTransitionLocks =
- new java.util.concurrent.ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Object> functionVolumeTransitionLocks =
+ new ConcurrentHashMap<>();
/**
* Superseded code volumes queued for cleanup, mapped to the time they were superseded (millis
@@ -794,8 +804,8 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
* out a grace period comfortably longer than a single container launch takes crosses that
* window safely; removeVolume() also no-ops if the volume is still genuinely in use by then.
*/
- private final java.util.concurrent.ConcurrentHashMap<String, Long> volumesPendingCleanup =
- new java.util.concurrent.ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Long> volumesPendingCleanup =
+ new ConcurrentHashMap<>();
/**
* Counts launches that hold a resolved volume name but haven't yet handed it to Docker via
@@ -808,13 +818,13 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
* time. Entries are removed once their count returns to zero, so this stays bounded like the
* other per-volume maps.
*/
- private final java.util.concurrent.ConcurrentHashMap<String, java.util.concurrent.atomic.AtomicInteger> volumesInFlight =
- new java.util.concurrent.ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, AtomicInteger> volumesInFlight =
+ new ConcurrentHashMap<>();
/** Non-final and package-private, like {@link #CODE_VOLUME_MIN_BYTES}, so tests can shrink it
* instead of waiting out a real 60s window (restore it in a finally). */
static long VOLUME_CLEANUP_GRACE_MS = 60_000L;
- private final java.util.concurrent.ScheduledExecutorService volumeCleanupScheduler =
- java.util.concurrent.Executors.newSingleThreadScheduledExecutor(
+ private final ScheduledExecutorService volumeCleanupScheduler =
+ Executors.newSingleThreadScheduledExecutor(
r -> { Thread t = new Thread(r, "floci-code-volume-cleanup"); t.setDaemon(true); return t; });
/**
@@ -880,7 +890,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
// caller now holds this name but hasn't handed it to Docker yet, so a sweep that acquires
// this same lock next must see the increment and skip deleting it. The caller releases
// this via releaseCodeVolumeReference once create() succeeds (or the launch fails).
- volumesInFlight.computeIfAbsent(volName, k -> new java.util.concurrent.atomic.AtomicInteger())
+ volumesInFlight.computeIfAbsent(volName, k -> new AtomicInteger())
.incrementAndGet();
}
return volName;
@@ -921,7 +931,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
*/
void cleanupSupersededVolumes() {
long cutoff = System.currentTimeMillis() - VOLUME_CLEANUP_GRACE_MS;
- for (String volName : new java.util.ArrayList<>(volumesPendingCleanup.keySet())) {
+ for (String volName : new ArrayList<>(volumesPendingCleanup.keySet())) {
Long queuedAt = volumesPendingCleanup.get(volName);
if (queuedAt == null || queuedAt > cutoff) {
continue;
@@ -937,7 +947,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
if (stillQueuedAt == null || stillQueuedAt > cutoff) {
continue;
}
- java.util.concurrent.atomic.AtomicInteger inFlight = volumesInFlight.get(volName);
+ AtomicInteger inFlight = volumesInFlight.get(volName);
if (inFlight != null && inFlight.get() > 0) {
// A launch has resolved this volume but hasn't handed it to Docker yet, so no
// real container-to-volume reference exists for removeVolume's own in-use check
@@ -985,21 +995,21 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
/** Test-only: the current in-flight reference count for this volume name (0 if none). */
int inFlightCount(String volName) {
- java.util.concurrent.atomic.AtomicInteger count = volumesInFlight.get(volName);
+ AtomicInteger count = volumesInFlight.get(volName);
return count == null ? 0 : count.get();
}
void populateCodeVolume(String volName, LambdaFunction fn, String image) {
lifecycleManager.ensureVolume(volName);
- String shortId = java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 8);
+ String shortId = UUID.randomUUID().toString().replace("-", "").substring(0, 8);
// A minimal helper container (sleep) with the volume mounted read-write at /var/task; we
// tar-copy the code into it, then discard it — the data persists in the volume.
ContainerBuilder.Builder helperBuilder = containerBuilder.newContainer(image)
.withName(ContainerStorageHelper.prefixedDockerName(config, resolveContainerNamePrefix(config),
"codevol-" + fn.getFunctionName() + "-" + shortId))
- .withEnv(java.util.List.of())
- .withEntrypoint(java.util.List.of("sleep"))
- .withCmd(java.util.List.of("3600"))
+ .withEnv(List.of())
+ .withEntrypoint(List.of("sleep"))
+ .withCmd(List.of("3600"))
.withNamedVolume(volName, TASK_DIR, false);
ContainerSpec helperSpec = helperBuilder.build();
// Gate the heavy work (helper create + ~90MB tar copy) so a burst of first-time populates
@@ -1040,10 +1050,10 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
private boolean reusePersistedCodeVolumeOrRemoveStaleMarker(String volName) {
synchronized (codeVolumeMarkerIoLock) {
Path marker = codeVolumeMarkerPath(volName);
- if (!Files.isRegularFile(marker, java.nio.file.LinkOption.NOFOLLOW_LINKS)) {
+ if (!Files.isRegularFile(marker, LinkOption.NOFOLLOW_LINKS)) {
return false;
}
- java.util.Optional<java.util.Set<String>> volumeNames = lifecycleManager.tryListVolumeNames();
+ Optional<Set<String>> volumeNames = lifecycleManager.tryListVolumeNames();
boolean inventoryUnavailable = volumeNames.isEmpty();
if (!inventoryUnavailable && volumeNames.get().contains(volName)) {
return true;
@@ -1095,7 +1105,7 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
}
private void pruneOrphanCodeVolumeMarkers(Path markerDir) {
- java.util.Optional<java.util.Set<String>> volumeNames = lifecycleManager.tryListVolumeNames();
+ Optional<Set<String>> volumeNames = lifecycleManager.tryListVolumeNames();
if (volumeNames.isEmpty() || !Files.isDirectory(markerDir)) {
return;
}
@@ -1105,8 +1115,8 @@ public class ContainerLauncher implements LambdaRuntimeLauncher {
// only what this configuration could have written can never delete a concurrent
// process's live markers.
String markerPrefix = codeVolumeNamePrefix(config);
- try (java.util.stream.Stream<Path> markers = Files.list(markerDir)) {
- markers.filter(path -> Files.isRegularFile(path, java.nio.file.LinkOption.NOFOLLOW_LINKS))
+ try (Stream<Path> markers = Files.list(markerDir)) {
+ markers.filter(path -> Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS))
.filter(path -> path.getFileName().toString().startsWith(markerPrefix))
.filter(path -> !volumeNames.get().contains(path.getFileName().toString()))
.forEach(path -> {
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ImageCacheService.java b/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ImageCacheService.java
index d345072329..9080284e88 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ImageCacheService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/launcher/ImageCacheService.java
@@ -6,6 +6,7 @@ import com.github.dockerjava.api.command.PullImageCmd;
import com.github.dockerjava.api.command.PullImageResultCallback;
import com.github.dockerjava.api.exception.DockerClientException;
import com.github.dockerjava.api.exception.InternalServerErrorException;
+import com.github.dockerjava.api.exception.NotFoundException;
import com.github.dockerjava.api.model.AuthConfig;
import com.github.dockerjava.api.model.Info;
import com.github.dockerjava.api.model.PullResponseItem;
@@ -314,7 +315,7 @@ public class ImageCacheService {
private InspectImageResponse inspectLocalImage(String imageUri) {
try {
return dockerClient.inspectImageCmd(imageUri).exec();
- } catch (com.github.dockerjava.api.exception.NotFoundException e) {
+ } catch (NotFoundException e) {
return null;
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServer.java b/src/main/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServer.java
index 62bfc3dc8b..5885a60f90 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServer.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServer.java
@@ -15,6 +15,7 @@ import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.BodyHandler;
import org.jboss.logging.Logger;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
@@ -370,7 +371,7 @@ public class RuntimeApiServer {
if (latch == null) {
return true;
}
- return latch.await(timeoutMs, java.util.concurrent.TimeUnit.MILLISECONDS);
+ return latch.await(timeoutMs, TimeUnit.MILLISECONDS);
}
/**
@@ -1125,7 +1126,7 @@ public class RuntimeApiServer {
.put("errorType", "Runtime.ExitError")
.put("errorMessage", message)
.encode()
- .getBytes(java.nio.charset.StandardCharsets.UTF_8);
+ .getBytes(StandardCharsets.UTF_8);
}
private void handleExtensionFatalError(RoutingContext ctx, String phase) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaMicrovmsController.java b/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaMicrovmsController.java
index f48e1ef31d..d8c23f5b28 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaMicrovmsController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaMicrovmsController.java
@@ -26,6 +26,10 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+
/**
* AWS Lambda MicroVMs control plane ("Lambda Microvms", apiVersion 2025-09-09,
* rest-json, signs as {@code lambda}). Images with a converging version/build
@@ -513,10 +517,10 @@ public class LambdaMicrovmsController {
return node;
}
- private ObjectNode catalogNode(java.util.List<java.util.Map<String, Object>> entries) {
+ private ObjectNode catalogNode(List<Map<String, Object>> entries) {
ObjectNode root = objectMapper.createObjectNode();
ArrayNode items = root.putArray("items");
- for (java.util.Map<String, Object> entry : entries) {
+ for (Map<String, Object> entry : entries) {
ObjectNode node = items.addObject();
entry.forEach((k, v) -> {
if (v instanceof Double d) {
@@ -530,7 +534,7 @@ public class LambdaMicrovmsController {
return root;
}
- private double epoch(java.time.Instant instant) {
+ private double epoch(Instant instant) {
return instant.toEpochMilli() / 1000.0;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaNetworkConnectorsController.java b/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaNetworkConnectorsController.java
index a8a7dd8ce1..2446c30f44 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaNetworkConnectorsController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambdamicrovms/LambdaNetworkConnectorsController.java
@@ -24,6 +24,9 @@ import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
+import java.time.Instant;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
@@ -251,10 +254,10 @@ public class LambdaNetworkConnectorsController {
return node;
}
- private static String iso(java.time.Instant when) {
- return java.time.format.DateTimeFormatter.ISO_INSTANT
- .format((when == null ? java.time.Instant.now() : when)
- .truncatedTo(java.time.temporal.ChronoUnit.SECONDS));
+ private static String iso(Instant when) {
+ return DateTimeFormatter.ISO_INSTANT
+ .format((when == null ? Instant.now() : when)
+ .truncatedTo(ChronoUnit.SECONDS));
}
private JsonNode parse(String body) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentService.java b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentService.java
index 5bb9c9d0ce..fe7302f6cb 100644
--- a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentService.java
@@ -16,6 +16,7 @@ import jakarta.inject.Inject;
import java.time.Instant;
import java.time.format.DateTimeParseException;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Pattern;
@@ -174,7 +175,7 @@ public class MarketplaceDeploymentService implements Resettable {
saveRecord(record);
}
- public synchronized void untagResource(String resourceArn, java.util.List<String> tagKeys, String region) {
+ public synchronized void untagResource(String resourceArn, List<String> tagKeys, String region) {
validateRegion(region);
ObjectNode record = requireByArn(resourceArn);
if (tagKeys == null || tagKeys.isEmpty()) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDiscoveryService.java b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDiscoveryService.java
index 2b67b1eea8..b33b37a559 100644
--- a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDiscoveryService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDiscoveryService.java
@@ -13,6 +13,7 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -198,7 +199,7 @@ public class MarketplaceDiscoveryService implements Resettable {
String sortOrder = request.path("sortOrder").asText(
"AVERAGE_CUSTOMER_RATING".equals(sortBy) ? "DESCENDING" : "ASCENDING");
if ("DESCENDING".equals(sortOrder)) {
- java.util.Collections.reverse(list);
+ Collections.reverse(list);
}
return list;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceService.java b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceService.java
index 82d34a1592..167575ffed 100644
--- a/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/marketplace/MarketplaceService.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -673,7 +674,7 @@ public class MarketplaceService implements Resettable {
}
}
ArrayNode entityIds = out.putArray("EntityIdList");
- Set<String> unique = new java.util.LinkedHashSet<>();
+ Set<String> unique = new LinkedHashSet<>();
changeSet.path("ChangeSet").forEach(change -> unique.add(change.path("Entity").path("Identifier").asText()));
unique.forEach(entityIds::add);
return out;
diff --git a/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbHandler.java b/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbHandler.java
index 6d730d8a3b..9df77ed904 100644
--- a/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbHandler.java
@@ -16,6 +16,7 @@ import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -181,7 +182,7 @@ public class MemoryDbHandler {
}
private Response handleUntagResource(JsonNode request) {
- List<String> keys = new java.util.ArrayList<>();
+ List<String> keys = new ArrayList<>();
request.path("TagKeys").forEach(k -> keys.add(k.asText()));
Map<String, String> tags = service.untagResource(text(request, "ResourceArn"), keys);
return Response.ok(tagListResponse(tags)).build();
@@ -282,7 +283,7 @@ public class MemoryDbHandler {
}
private List<String> parseStringList(JsonNode node) {
- List<String> values = new java.util.ArrayList<>();
+ List<String> values = new ArrayList<>();
if (node != null && node.isArray()) {
node.forEach(n -> {
String value = n.asText(null);
diff --git a/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbService.java b/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbService.java
index c60055e12d..2481ed8c85 100644
--- a/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/memorydb/MemoryDbService.java
@@ -25,11 +25,14 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
/**
* Core MemoryDB business logic — clusters, ACLs and users.
@@ -56,8 +59,8 @@ public class MemoryDbService {
// Per the MemoryDB API: a user name must start with a letter and contain only
// letters, digits and hyphens.
- private static final java.util.regex.Pattern USER_NAME_PATTERN =
- java.util.regex.Pattern.compile("[a-zA-Z][a-zA-Z0-9\\-]*");
+ private static final Pattern USER_NAME_PATTERN =
+ Pattern.compile("[a-zA-Z][a-zA-Z0-9\\-]*");
private final StorageBackend<String, Cluster> clusters;
private final StorageBackend<String, User> users;
@@ -268,8 +271,8 @@ public class MemoryDbService {
return resourceGet(users, filterName, region)
.map(List::of)
.or(() -> DEFAULT_USER.equals(filterName)
- ? java.util.Optional.of(List.of(builtinDefaultUser(region)))
- : java.util.Optional.empty())
+ ? Optional.of(List.of(builtinDefaultUser(region)))
+ : Optional.empty())
.orElseThrow(() -> new AwsException("UserNotFoundFault", "User not found.", 404));
}
migrateLegacyUsers(region);
@@ -312,7 +315,7 @@ public class MemoryDbService {
throw new AwsException("DefaultUserRequired",
"A default user is required and must be specified.", 400);
}
- java.util.Set<String> seen = new java.util.HashSet<>();
+ Set<String> seen = new HashSet<>();
for (String userName : spec.getUserNames()) {
if (!seen.add(userName)) {
throw new AwsException("DuplicateUserNameFault",
@@ -343,8 +346,8 @@ public class MemoryDbService {
return resourceGet(acls, filterName, region)
.map(List::of)
.or(() -> DEFAULT_ACL.equals(filterName)
- ? java.util.Optional.of(List.of(builtinOpenAccessAcl(region)))
- : java.util.Optional.empty())
+ ? Optional.of(List.of(builtinOpenAccessAcl(region)))
+ : Optional.empty())
.orElseThrow(() -> new AwsException("ACLNotFoundFault", "ACL not found.", 404));
}
migrateLegacyAcls(region);
@@ -477,7 +480,7 @@ public class MemoryDbService {
}
return acl.getUserNames().stream()
.map(name -> resolveUser(name, region))
- .filter(java.util.Objects::nonNull)
+ .filter(Objects::nonNull)
.anyMatch(u -> u.getAuthMode() != AuthMode.NO_PASSWORD);
}
@@ -631,24 +634,24 @@ public class MemoryDbService {
private String identityName(String accountId, String region, String name) {
String defaultAccount = regionResolver.getDefaultAccountId();
String defaultRegion = regionResolver.getDefaultRegion();
- if ((defaultAccount == null || java.util.Objects.equals(defaultAccount, accountId))
- && (defaultRegion == null || java.util.Objects.equals(defaultRegion, region))) {
+ if ((defaultAccount == null || Objects.equals(defaultAccount, accountId))
+ && (defaultRegion == null || Objects.equals(defaultRegion, region))) {
return name;
}
return accountId + "-" + region + "-" + name;
}
- private <V> java.util.Optional<V> legacyGet(StorageBackend<String, V> store, String name, String region) {
+ private <V> Optional<V> legacyGet(StorageBackend<String, V> store, String name, String region) {
String defaultAccount = regionResolver.getDefaultAccountId();
String defaultRegion = regionResolver.getDefaultRegion();
- if ((defaultAccount != null && !java.util.Objects.equals(defaultAccount, regionResolver.getAccountId()))
- || (defaultRegion != null && !java.util.Objects.equals(defaultRegion, region))) {
- return java.util.Optional.empty();
+ if ((defaultAccount != null && !Objects.equals(defaultAccount, regionResolver.getAccountId()))
+ || (defaultRegion != null && !Objects.equals(defaultRegion, region))) {
+ return Optional.empty();
}
return store.get(name);
}
- private <V> java.util.Optional<V> resourceGet(StorageBackend<String, V> store, String name, String region) {
+ private <V> Optional<V> resourceGet(StorageBackend<String, V> store, String name, String region) {
Optional<V> result = store.get(key(region, name));
if (result.isPresent()) {
return result;
@@ -723,8 +726,8 @@ public class MemoryDbService {
private boolean isDefaultOwner(String region) {
String defaultAccount = regionResolver.getDefaultAccountId();
String defaultRegion = regionResolver.getDefaultRegion();
- return (defaultAccount == null || java.util.Objects.equals(defaultAccount, regionResolver.getAccountId()))
- && (defaultRegion == null || java.util.Objects.equals(defaultRegion, region));
+ return (defaultAccount == null || Objects.equals(defaultAccount, regionResolver.getAccountId()))
+ && (defaultRegion == null || Objects.equals(defaultRegion, region));
}
private void setOwner(Object resource, String region) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java b/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
index 108d85d187..8849655a67 100644
--- a/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/msk/MskService.java
@@ -40,6 +40,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.TreeSet;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -127,7 +128,7 @@ public class MskService implements ResourceProvider {
String accountId = regionResolver.getAccountId();
String clusterArn = AwsArnUtils.Arn.of("kafka", regionResolver.getRegion(), accountId,
- "cluster/" + clusterName + "/" + java.util.UUID.randomUUID()).toString();
+ "cluster/" + clusterName + "/" + UUID.randomUUID()).toString();
String kafkaVersion = request.getKafkaVersion();
String resolvedKafkaVersion = (kafkaVersion == null || kafkaVersion.isBlank()) ? DEFAULT_KAFKA_VERSION : kafkaVersion;
@@ -291,7 +292,7 @@ public class MskService implements ResourceProvider {
private void validateEnum(String field, String value, Set<String> allowed) {
if (value != null && !allowed.contains(value)) {
throw badRequest(field,
- field + " must be one of " + String.join(", ", new java.util.TreeSet<>(allowed)) + ".");
+ field + " must be one of " + String.join(", ", new TreeSet<>(allowed)) + ".");
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java
index d74aea6f99..366278178e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/neptune/NeptuneService.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -528,7 +529,7 @@ public class NeptuneService {
String region = currentRegion();
String key = clusterKey(region, id);
if (clusters instanceof AccountAwareStorageBackend<NeptuneCluster> aware) {
- return aware.getForAccountMigratingLegacyKeys(account, key, java.util.List.of(id),
+ return aware.getForAccountMigratingLegacyKeys(account, key, List.of(id),
value -> belongsTo(value.getDbClusterArn(), account, region));
}
return clusters.get(key);
@@ -539,7 +540,7 @@ public class NeptuneService {
String region = currentRegion();
String key = instanceKey(region, id);
if (instances instanceof AccountAwareStorageBackend<NeptuneInstance> aware) {
- return aware.getForAccountMigratingLegacyKeys(account, key, java.util.List.of(id),
+ return aware.getForAccountMigratingLegacyKeys(account, key, List.of(id),
value -> belongsTo(value.getDbInstanceArn(), account, region));
}
return instances.get(key);
@@ -605,7 +606,7 @@ public class NeptuneService {
String account, String region, NeptuneCluster cluster) {
String key = clusterKey(region, cluster.getDbClusterIdentifier());
aware.getForAccountMigratingLegacyKeys(account, key,
- java.util.List.of(cluster.getDbClusterIdentifier()),
+ List.of(cluster.getDbClusterIdentifier()),
value -> belongsTo(value.getDbClusterArn(), account, region))
.ifPresent(value -> aware.putForAccount(account, key, value));
}
@@ -614,7 +615,7 @@ public class NeptuneService {
String account, String region, NeptuneInstance instance) {
String key = instanceKey(region, instance.getDbInstanceIdentifier());
aware.getForAccountMigratingLegacyKeys(account, key,
- java.util.List.of(instance.getDbInstanceIdentifier()),
+ List.of(instance.getDbInstanceIdentifier()),
value -> belongsTo(value.getDbInstanceArn(), account, region))
.ifPresent(value -> aware.putForAccount(account, key, value));
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/networkfirewall/NetworkFirewallService.java b/src/main/java/io/github/hectorvent/floci/services/networkfirewall/NetworkFirewallService.java
index 23f1c8bc63..856737275e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/networkfirewall/NetworkFirewallService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/networkfirewall/NetworkFirewallService.java
@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.stream.StreamSupport;
@ApplicationScoped
public class NetworkFirewallService {
@@ -439,7 +440,7 @@ public class NetworkFirewallService {
ObjectNode response = objectMapper.createObjectNode();
ArrayNode result = response.putArray("Firewalls");
List<String> vpcIds = request != null && request.path("VpcIds").isArray()
- ? java.util.stream.StreamSupport.stream(request.path("VpcIds").spliterator(), false)
+ ? StreamSupport.stream(request.path("VpcIds").spliterator(), false)
.map(JsonNode::asText).toList()
: List.of();
firewalls.scan(key -> true).stream()
diff --git a/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java b/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
index 21f0d998de..99c8fd7bb0 100644
--- a/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
@@ -17,6 +17,7 @@ import jakarta.inject.Inject;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -81,7 +82,7 @@ public class OamService {
public List<OamSink> listSinks(String region) {
return sinks.scan(_ -> true).stream()
.filter(s -> region.equals(s.getRegion()))
- .sorted(java.util.Comparator.comparing(OamSink::getArn)).toList();
+ .sorted(Comparator.comparing(OamSink::getArn)).toList();
}
public void putSinkPolicy(String sinkIdentifier, String policy) {
@@ -138,7 +139,7 @@ public class OamService {
public List<OamLink> listLinks(String region) {
return links.scan(_ -> true).stream().filter(l -> region.equals(l.getRegion()))
- .sorted(java.util.Comparator.comparing(OamLink::getArn)).toList();
+ .sorted(Comparator.comparing(OamLink::getArn)).toList();
}
public List<OamLink> listAttachedLinks(String sinkIdentifier) {
@@ -152,7 +153,7 @@ public class OamService {
all = links.scan(_ -> true);
}
return all.stream().filter(l -> sink.getArn().equals(l.getSinkArn()))
- .sorted(java.util.Comparator.comparing(OamLink::getArn)).toList();
+ .sorted(Comparator.comparing(OamLink::getArn)).toList();
}
public OamLink updateLink(String identifier, List<String> resourceTypes,
diff --git a/src/main/java/io/github/hectorvent/floci/services/organizations/OrganizationsService.java b/src/main/java/io/github/hectorvent/floci/services/organizations/OrganizationsService.java
index 38b8f10e3d..03f5ec1177 100644
--- a/src/main/java/io/github/hectorvent/floci/services/organizations/OrganizationsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/organizations/OrganizationsService.java
@@ -35,6 +35,7 @@ import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -674,9 +675,9 @@ public class OrganizationsService implements ScpProvider, RootAccessOrganization
return requireAccount(requireOrganizationForCaller(callerAccountId), accountId);
}
- public java.util.Optional<OrganizationAccount> findAccountForPortal(String accountId) {
+ public Optional<OrganizationAccount> findAccountForPortal(String accountId) {
if (accountId == null || !ACCOUNT_ID_PATTERN.matcher(accountId).matches()) {
- return java.util.Optional.empty();
+ return Optional.empty();
}
return accounts.scanAllAccounts().stream()
.filter(account -> accountId.equals(account.getId()))
@@ -1023,7 +1024,7 @@ public class OrganizationsService implements ScpProvider, RootAccessOrganization
} catch (AwsException e) {
return;
}
- Set<String> targetIds = new java.util.LinkedHashSet<>(registeredOuIds);
+ Set<String> targetIds = new LinkedHashSet<>(registeredOuIds);
organizationalUnitsIn(organization).stream()
.filter(ou -> "Security".equals(ou.getName()))
.map(OrganizationalUnit::getId)
@@ -1882,7 +1883,7 @@ public class OrganizationsService implements ScpProvider, RootAccessOrganization
handshake.setExpirationTimestamp(now.plus(HANDSHAKE_TTL_DAYS, ChronoUnit.DAYS));
handshake.setOrganizationId(organization.getId());
handshake.setArn(arn(organization.getMasterAccountId(),
- "handshake/" + organization.getId() + "/" + action.toLowerCase(java.util.Locale.ROOT)
+ "handshake/" + organization.getId() + "/" + action.toLowerCase(Locale.ROOT)
+ "/" + handshake.getId()));
return handshake;
}
@@ -2008,7 +2009,7 @@ public class OrganizationsService implements ScpProvider, RootAccessOrganization
private String policyArn(Organization organization, String policyId, String type) {
return arn(organization.getMasterAccountId(),
- "policy/" + organization.getId() + "/" + type.toLowerCase(java.util.Locale.ROOT) + "/" + policyId);
+ "policy/" + organization.getId() + "/" + type.toLowerCase(Locale.ROOT) + "/" + policyId);
}
/** Organizations ARNs carry no region; they take the request's partition. */
diff --git a/src/main/java/io/github/hectorvent/floci/services/pipes/model/Pipe.java b/src/main/java/io/github/hectorvent/floci/services/pipes/model/Pipe.java
index f27512e2b8..82e799524f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/pipes/model/Pipe.java
+++ b/src/main/java/io/github/hectorvent/floci/services/pipes/model/Pipe.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.pipes.model;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -65,7 +66,7 @@ public class Pipe {
@JsonProperty("StateReason")
private String stateReason;
- @com.fasterxml.jackson.annotation.JsonIgnore
+ @JsonIgnore
private String accountId;
public Pipe() {}
diff --git a/src/main/java/io/github/hectorvent/floci/services/pricing/PricingService.java b/src/main/java/io/github/hectorvent/floci/services/pricing/PricingService.java
index 16b81a22a7..5bdfca7040 100644
--- a/src/main/java/io/github/hectorvent/floci/services/pricing/PricingService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/pricing/PricingService.java
@@ -15,13 +15,23 @@ import org.jboss.logging.Logger;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* AWS Pricing API emulation backed by a bundled static snapshot.
@@ -234,7 +244,7 @@ public class PricingService {
// Group entries per (region, currency) and keep the one whose
// effective window covers `effectiveDate`. AWS returns one price list
// per service/region/currency pair, matched by effective date.
- Map<String, JsonNode> winningByKey = new java.util.LinkedHashMap<>();
+ Map<String, JsonNode> winningByKey = new LinkedHashMap<>();
Map<String, Instant> winningEffective = new HashMap<>();
if (node != null && node.isArray()) {
for (JsonNode entry : node) {
@@ -292,7 +302,7 @@ public class PricingService {
ObjectNode response = objectMapper.createObjectNode();
response.put("Url", "https://pricing-snapshot.floci.local/"
- + java.net.URLEncoder.encode(priceListArn, java.nio.charset.StandardCharsets.UTF_8)
+ + URLEncoder.encode(priceListArn, StandardCharsets.UTF_8)
+ "/" + fileFormat.toLowerCase());
return response;
}
@@ -412,35 +422,35 @@ public class PricingService {
JsonNode effective = entry.path("EffectiveDate");
if (!effective.isMissingNode() && !effective.isNull() && !effective.asText().isEmpty()) {
try {
- return java.time.OffsetDateTime.parse(effective.asText()).toInstant();
- } catch (java.time.format.DateTimeParseException ignored) {
+ return OffsetDateTime.parse(effective.asText()).toInstant();
+ } catch (DateTimeParseException ignored) {
try {
return Instant.parse(effective.asText());
- } catch (java.time.format.DateTimeParseException ignored2) {
+ } catch (DateTimeParseException ignored2) {
// fall through to ARN parsing
}
}
}
String arn = entry.path("PriceListArn").asText("");
- java.util.regex.Matcher m = ARN_TIMESTAMP.matcher(arn);
+ Matcher m = ARN_TIMESTAMP.matcher(arn);
if (m.find()) {
String ts = m.group(1);
try {
- return java.time.LocalDateTime.parse(ts, ARN_TIMESTAMP_FMT)
- .toInstant(java.time.ZoneOffset.UTC);
- } catch (java.time.format.DateTimeParseException ignored) {
+ return LocalDateTime.parse(ts, ARN_TIMESTAMP_FMT)
+ .toInstant(ZoneOffset.UTC);
+ } catch (DateTimeParseException ignored) {
// fall through
}
}
return null;
}
- private static final java.util.regex.Pattern SAFE_PATH_SEGMENT =
- java.util.regex.Pattern.compile("[A-Za-z0-9._-]+");
- private static final java.util.regex.Pattern ARN_TIMESTAMP =
- java.util.regex.Pattern.compile("/(\\d{14})(?:/|$)");
- private static final java.time.format.DateTimeFormatter ARN_TIMESTAMP_FMT =
- java.time.format.DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+ private static final Pattern SAFE_PATH_SEGMENT =
+ Pattern.compile("[A-Za-z0-9._-]+");
+ private static final Pattern ARN_TIMESTAMP =
+ Pattern.compile("/(\\d{14})(?:/|$)");
+ private static final DateTimeFormatter ARN_TIMESTAMP_FMT =
+ DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
record ServiceEntry(String serviceCode, List<String> attributeNames) {
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java
index eb8fd452d7..3d860b3e24 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsQueryHandler.java
@@ -47,11 +47,13 @@ import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
import java.time.Instant;
+import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.function.BiFunction;
@@ -686,8 +688,8 @@ public class RdsQueryHandler {
if (maxRecords != null && (maxRecords < 20 || maxRecords > 100)) {
throw new AwsException("InvalidParameterValue", "MaxRecords must be between 20 and 100.", 400);
}
- java.time.Instant start = parseOptionalInstant(params.getFirst("StartTime"));
- java.time.Instant end = parseOptionalInstant(params.getFirst("EndTime"));
+ Instant start = parseOptionalInstant(params.getFirst("StartTime"));
+ Instant end = parseOptionalInstant(params.getFirst("EndTime"));
if (start != null && end != null && start.isAfter(end)) {
throw new AwsException("InvalidParameterCombination", "StartTime must be before EndTime.", 400);
}
@@ -737,13 +739,13 @@ public class RdsQueryHandler {
}
}
- private static java.time.Instant parseOptionalInstant(String value) {
+ private static Instant parseOptionalInstant(String value) {
if (value == null || value.isBlank()) {
return null;
}
try {
- return java.time.Instant.parse(value);
- } catch (java.time.format.DateTimeParseException e) {
+ return Instant.parse(value);
+ } catch (DateTimeParseException e) {
throw new AwsException("InvalidParameterValue", "Invalid timestamp.", 400);
}
}
@@ -1899,7 +1901,7 @@ public class RdsQueryHandler {
*/
private static List<OptionGroupOption> parseOptionConfigurations(
MultivaluedMap<String, String> params) {
- List<OptionGroupOption> options = new java.util.ArrayList<>();
+ List<OptionGroupOption> options = new ArrayList<>();
for (String prefix : List.of("OptionsToInclude.OptionConfiguration",
"OptionsToInclude.member")) {
for (int n = 1; ; n++) {
@@ -1956,7 +1958,7 @@ public class RdsQueryHandler {
return AwsQueryResponse.error("InvalidParameterValue", "DBInstanceIdentifier is required.", AwsNamespaces.RDS, 400);
}
try {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
service.createDbSnapshot(snapshotId, instanceId, parseTags(params), region);
String result = dbSnapshotXml(snapshot);
return Response.ok(AwsQueryResponse.envelope("CreateDBSnapshot", AwsNamespaces.RDS, result)).build();
@@ -2135,10 +2137,10 @@ public class RdsQueryHandler {
String snapshotId = params.getFirst("DBSnapshotIdentifier");
String instanceId = params.getFirst("DBInstanceIdentifier");
try {
- Collection<io.github.hectorvent.floci.services.rds.model.DbSnapshot> result =
+ Collection<DbSnapshot> result =
service.describeDbSnapshots(snapshotId, instanceId, region);
XmlBuilder xml = new XmlBuilder().start("DBSnapshots");
- for (io.github.hectorvent.floci.services.rds.model.DbSnapshot s : result) {
+ for (DbSnapshot s : result) {
xml.raw(dbSnapshotXml(s));
}
xml.end("DBSnapshots");
@@ -2151,7 +2153,7 @@ public class RdsQueryHandler {
private Response handleDescribeDbSnapshotAttributes(MultivaluedMap<String, String> params, String region) {
String snapshotId = params.getFirst("DBSnapshotIdentifier");
try {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
service.describeDbSnapshotAttributes(snapshotId, region);
String result = dbSnapshotAttributesResultXml(snapshot);
return Response.ok(AwsQueryResponse.envelope(
@@ -2165,7 +2167,7 @@ public class RdsQueryHandler {
String snapshotId = params.getFirst("DBSnapshotIdentifier");
String attributeName = params.getFirst("AttributeName");
try {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot = service.modifyDbSnapshotAttribute(
+ DbSnapshot snapshot = service.modifyDbSnapshotAttribute(
snapshotId, attributeName, memberList(params, "ValuesToAdd"), memberList(params, "ValuesToRemove"), region);
String result = dbSnapshotAttributesResultXml(snapshot);
return Response.ok(AwsQueryResponse.envelope(
@@ -2973,7 +2975,7 @@ public class RdsQueryHandler {
return xml.end("DBClusterSnapshotAttributesResult").build();
}
- private String dbSnapshotAttributesResultXml(io.github.hectorvent.floci.services.rds.model.DbSnapshot s) {
+ private String dbSnapshotAttributesResultXml(DbSnapshot s) {
XmlBuilder xml = new XmlBuilder().start("DBSnapshotAttributesResult")
.elem("DBSnapshotIdentifier", s.getDbSnapshotIdentifier());
xml.start("DBSnapshotAttributes").start("DBSnapshotAttribute")
@@ -3537,7 +3539,7 @@ public class RdsQueryHandler {
* answers an empty list for a known engine it holds nothing of — including ones Floci cannot
* create.
*/
- private static final java.util.Set<String> KNOWN_ENGINES = java.util.Set.of(
+ private static final Set<String> KNOWN_ENGINES = Set.of(
"aurora", "aurora-mysql", "aurora-postgresql", "mysql", "mariadb", "postgres",
"custom-oracle-ee", "custom-oracle-ee-cdb", "custom-oracle-se2", "custom-oracle-se2-cdb",
"custom-sqlserver-dev", "custom-sqlserver-ee", "custom-sqlserver-se", "custom-sqlserver-web",
@@ -3590,7 +3592,7 @@ public class RdsQueryHandler {
break;
}
if (filterName.equals(name)) {
- java.util.ArrayList<String> values = new java.util.ArrayList<>();
+ ArrayList<String> values = new ArrayList<>();
for (int valueIndex = 1; ; valueIndex++) {
String value = params.getFirst("Filters.Filter." + i + ".Values.Value." + valueIndex);
if (value == null) {
@@ -3637,7 +3639,7 @@ public class RdsQueryHandler {
}
private static List<DbProxyAuth> parseProxyAuth(MultivaluedMap<String, String> params) {
- List<DbProxyAuth> auth = new java.util.ArrayList<>();
+ List<DbProxyAuth> auth = new ArrayList<>();
for (int index = 1; ; index++) {
String prefix = "Auth.member." + index + ".";
String authScheme = params.getFirst(prefix + "AuthScheme");
diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
index 0077b5ed4e..cad5c6d272 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
@@ -94,6 +94,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
/**
* Core RDS business logic — DB instances, clusters, and parameter groups.
@@ -421,10 +422,10 @@ public class RdsService implements Resettable, ResourceProvider {
this.proxyTargetGroups = proxyTargetGroups;
this.taggingService = taggingService;
this.metricsService = null;
- this.globalClusters = new io.github.hectorvent.floci.core.storage.InMemoryStorage<>();
- this.snapshots = new io.github.hectorvent.floci.core.storage.InMemoryStorage<>();
+ this.globalClusters = new InMemoryStorage<>();
+ this.snapshots = new InMemoryStorage<>();
this.clusterSnapshots = new InMemoryStorage<>();
- this.snapshotData = new io.github.hectorvent.floci.core.storage.InMemoryStorage<>();
+ this.snapshotData = new InMemoryStorage<>();
this.eventSubscriptions = new InMemoryStorage<>();
this.certificateOverrides = new InMemoryStorage<>();
this.clusterEndpoints = new InMemoryStorage<>();
@@ -705,7 +706,7 @@ public class RdsService implements Resettable, ResourceProvider {
Boolean publiclyAccessible, Integer requestedPort,
Boolean deletionProtection) {
String effectiveRegion = effectiveRegion(region);
- String dbiResourceId = "db-" + java.util.UUID.randomUUID().toString()
+ String dbiResourceId = "db-" + UUID.randomUUID().toString()
.replace("-", "").substring(0, 24).toUpperCase();
String dbInstanceArn = regionResolver.buildArn("rds", effectiveRegion, "db:" + id);
if (findInstanceForScope(currentAccountId(), effectiveRegion, id) != null
@@ -990,7 +991,7 @@ public class RdsService implements Resettable, ResourceProvider {
snapshot.setOptionGroupName(instance.getOptionGroupName());
snapshot.setStorageEncrypted(instance.isStorageEncrypted());
snapshot.setKmsKeyId(instance.getKmsKeyId());
- snapshot.setTags(tags != null ? new java.util.LinkedHashMap<>(tags) : new java.util.LinkedHashMap<>());
+ snapshot.setTags(tags != null ? new LinkedHashMap<>(tags) : new LinkedHashMap<>());
snapshot.setDbSnapshotArn(regionResolver.buildArn("rds", effectiveRegion, "snapshot:" + snapshotId));
String sqlDump = "";
@@ -1880,7 +1881,7 @@ public class RdsService implements Resettable, ResourceProvider {
throw new AwsException("InvalidParameterValue",
"AttributeName must be restore.", 400);
}
- List<String> updated = new java.util.ArrayList<>(snapshot.getRestoreAccountIds());
+ List<String> updated = new ArrayList<>(snapshot.getRestoreAccountIds());
if (valuesToAdd != null) {
valuesToAdd.stream().filter(v -> !updated.contains(v)).forEach(updated::add);
}
@@ -2434,7 +2435,7 @@ public class RdsService implements Resettable, ResourceProvider {
public synchronized void addTagsToResource(
String resourceName, Map<String, String> tags, String region) {
TagHandle handle = resolveTagHandle(resourceName, region);
- Map<String, String> updated = new java.util.LinkedHashMap<>(handle.tags());
+ Map<String, String> updated = new LinkedHashMap<>(handle.tags());
updated.putAll(tags);
handle.save().accept(updated);
}
@@ -2446,13 +2447,13 @@ public class RdsService implements Resettable, ResourceProvider {
public synchronized void removeTagsFromResource(
String resourceName, Collection<String> tagKeys, String region) {
TagHandle handle = resolveTagHandle(resourceName, region);
- Map<String, String> updated = new java.util.LinkedHashMap<>(handle.tags());
+ Map<String, String> updated = new LinkedHashMap<>(handle.tags());
tagKeys.forEach(updated::remove);
handle.save().accept(updated);
}
/** A resolved tag target: its current tags plus a sink that persists an updated map. */
- private record TagHandle(Map<String, String> tags, java.util.function.Consumer<Map<String, String>> save) {}
+ private record TagHandle(Map<String, String> tags, Consumer<Map<String, String>> save) {}
/**
* Resolves a tagging ResourceName to its backing resource.
@@ -2913,7 +2914,7 @@ public class RdsService implements Resettable, ResourceProvider {
}
private static String generatedMasterPassword() {
- return "floci-" + java.util.UUID.randomUUID().toString().replace("-", "");
+ return "floci-" + UUID.randomUUID().toString().replace("-", "");
}
public DbInstance getDbInstance(String id) {
@@ -3020,7 +3021,7 @@ public class RdsService implements Resettable, ResourceProvider {
.filter(event -> sourceIdentifier == null || sourceIdentifier.equals(event.sourceIdentifier()))
.filter(event -> sourceType == null || sourceType.equals(event.sourceType()))
.filter(event -> !event.date().isBefore(effectiveStart) && !event.date().isAfter(effectiveEnd))
- .sorted(java.util.Comparator.comparing(RdsEvent::date))
+ .sorted(Comparator.comparing(RdsEvent::date))
.toList();
}
@@ -4575,7 +4576,7 @@ public class RdsService implements Resettable, ResourceProvider {
boolean manageMasterUserPassword, String masterUserSecretKmsKeyId,
String engineMode, boolean storageEncrypted, Integer requestedPort) {
String effectiveRegion = effectiveRegion(region);
- String clusterResourceId = "cluster-" + java.util.UUID.randomUUID().toString()
+ String clusterResourceId = "cluster-" + UUID.randomUUID().toString()
.replace("-", "").substring(0, 24).toUpperCase();
String clusterArn = regionResolver.buildArn("rds", effectiveRegion, "cluster:" + id);
if (findClusterForScope(currentAccountId(), effectiveRegion, id) != null
@@ -5269,7 +5270,7 @@ public class RdsService implements Resettable, ResourceProvider {
}
GlobalCluster global = new GlobalCluster();
global.setGlobalClusterIdentifier(id.toLowerCase(Locale.ROOT));
- global.setGlobalClusterResourceId("cluster-" + java.util.UUID.randomUUID().toString()
+ global.setGlobalClusterResourceId("cluster-" + UUID.randomUUID().toString()
.replace("-", "").substring(0, 24).toUpperCase());
global.setGlobalClusterArn(globalClusterArn(regionResolver.getPartition(), accountId, global.getGlobalClusterIdentifier()));
global.setStatus("available");
@@ -7060,13 +7061,13 @@ public class RdsService implements Resettable, ResourceProvider {
}
public DbParameterGroup modifyDbParameterGroup(String name,
- java.util.Map<String, String> parameters) {
+ Map<String, String> parameters) {
return modifyDbParameterGroup(
name, parameters, regionResolver.getDefaultRegion());
}
public DbParameterGroup modifyDbParameterGroup(
- String name, java.util.Map<String, String> parameters, String region) {
+ String name, Map<String, String> parameters, String region) {
String effectiveRegion = effectiveRegion(region);
DbParameterGroup group = getDbParameterGroup(name, effectiveRegion);
if (parameters != null) {
@@ -7334,13 +7335,13 @@ public class RdsService implements Resettable, ResourceProvider {
}
public DbClusterParameterGroup modifyDbClusterParameterGroup(String name,
- java.util.Map<String, String> parameters) {
+ Map<String, String> parameters) {
return modifyDbClusterParameterGroup(
name, parameters, regionResolver.getDefaultRegion());
}
public DbClusterParameterGroup modifyDbClusterParameterGroup(
- String name, java.util.Map<String, String> parameters, String region) {
+ String name, Map<String, String> parameters, String region) {
String effectiveRegion = effectiveRegion(region);
if (managedClusterParameterGroup(name) != null) {
throw new AwsException("InvalidDBParameterGroupState",
@@ -8089,7 +8090,7 @@ public class RdsService implements Resettable, ResourceProvider {
String key = dbProxyKey(region, dbProxyName);
String accountId = currentAccountId();
Optional<DbProxy> ownerProxy = findDbProxy(dbProxyName, region);
- java.util.function.Predicate<DbProxyTargetGroup> owner = candidate ->
+ Predicate<DbProxyTargetGroup> owner = candidate ->
ownerProxy.isPresent()
&& targetGroupBelongsTo(candidate, accountId, region)
&& targetGroupMatchesProxy(candidate, ownerProxy.get());
@@ -8579,7 +8580,7 @@ public class RdsService implements Resettable, ResourceProvider {
}
private String randomResourceSuffix() {
- return java.util.UUID.randomUUID().toString().replace("-", "").substring(0, 17);
+ return UUID.randomUUID().toString().replace("-", "").substring(0, 17);
}
/** The preferred listener port, used when no other proxy has reserved it. */
@@ -9006,7 +9007,7 @@ public class RdsService implements Resettable, ResourceProvider {
String accountId = AwsArnUtils.accountOrDefault(proxy.getDbProxyArn(), defaultAccountId);
String region = regionFromArn(proxy.getDbProxyArn());
String proxyKey = dbProxyKey(region, proxy.getDbProxyName());
- java.util.function.Predicate<DbProxyTargetGroup> legacyOwner = candidate ->
+ Predicate<DbProxyTargetGroup> legacyOwner = candidate ->
targetGroupCanMigrateToProxy(candidate, proxy);
DbProxyTargetGroup targetGroup;
if (proxyTargetGroups instanceof AccountAwareStorageBackend<DbProxyTargetGroup> aware) {
@@ -9191,7 +9192,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveAccountId = accountId != null ? accountId : currentAccountId();
String effectiveRegion = effectiveRegion(region);
String key = dbResourceKey(effectiveRegion, clusterId);
- java.util.function.Predicate<DbCluster> owner = cluster -> hasRdsResourceIdentity(
+ Predicate<DbCluster> owner = cluster -> hasRdsResourceIdentity(
cluster.getDbClusterArn(), effectiveAccountId, effectiveRegion,
"cluster", clusterId);
if (clusters instanceof AccountAwareStorageBackend<DbCluster> aware) {
@@ -9222,7 +9223,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveAccountId = accountId != null ? accountId : currentAccountId();
String effectiveRegion = effectiveRegion(region);
String key = dbResourceKey(effectiveRegion, instanceId);
- java.util.function.Predicate<DbInstance> owner = instance -> hasRdsResourceIdentity(
+ Predicate<DbInstance> owner = instance -> hasRdsResourceIdentity(
instance.getDbInstanceArn(), effectiveAccountId, effectiveRegion,
"db", instanceId);
if (instances instanceof AccountAwareStorageBackend<DbInstance> aware) {
@@ -9290,7 +9291,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveAccountId = accountId != null ? accountId : currentAccountId();
String effectiveRegion = effectiveRegion(region);
String key = dbResourceKey(effectiveRegion, snapshotId);
- java.util.function.Predicate<DbSnapshot> owner = snapshot -> hasRdsResourceIdentity(
+ Predicate<DbSnapshot> owner = snapshot -> hasRdsResourceIdentity(
snapshot.getDbSnapshotArn(), effectiveAccountId, effectiveRegion, "snapshot", snapshotId);
if (snapshots instanceof AccountAwareStorageBackend<DbSnapshot> aware) {
return aware.getForAccountMigratingLegacyKeys(
@@ -9334,7 +9335,7 @@ public class RdsService implements Resettable, ResourceProvider {
String accountId, String region, String groupName) {
String effectiveRegion = effectiveRegion(region);
String key = dbResourceKey(effectiveRegion, groupName);
- java.util.function.Predicate<DbSubnetGroup> owner = group ->
+ Predicate<DbSubnetGroup> owner = group ->
Objects.equals(groupName, group.getDbSubnetGroupName())
&& hasRdsResourceIdentity(
group.getDbSubnetGroupArn(), accountId, effectiveRegion,
@@ -9447,7 +9448,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveRegion = effectiveRegion(region);
String accountId = currentAccountId();
String key = dbResourceKey(effectiveRegion, groupName);
- java.util.function.Predicate<DbParameterGroup> owner = group ->
+ Predicate<DbParameterGroup> owner = group ->
Objects.equals(groupName, group.getDbParameterGroupName())
&& parameterGroupBelongsToRegion(group, effectiveRegion);
Optional<DbParameterGroup> resolved;
@@ -9528,7 +9529,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveRegion = effectiveRegion(region);
String accountId = currentAccountId();
String key = dbResourceKey(effectiveRegion, groupName);
- java.util.function.Predicate<DbClusterParameterGroup> owner = group ->
+ Predicate<DbClusterParameterGroup> owner = group ->
Objects.equals(groupName, group.getDbClusterParameterGroupName())
&& clusterParameterGroupBelongsToRegion(group, effectiveRegion);
Optional<DbClusterParameterGroup> resolved;
@@ -9611,7 +9612,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveRegion = effectiveRegion(region);
String accountId = currentAccountId();
String key = dbResourceKey(effectiveRegion, groupName);
- java.util.function.Predicate<OptionGroup> owner = group ->
+ Predicate<OptionGroup> owner = group ->
Objects.equals(groupName, group.getOptionGroupName())
&& optionGroupBelongsToRegion(group, effectiveRegion);
Optional<OptionGroup> resolved;
@@ -9995,7 +9996,7 @@ public class RdsService implements Resettable, ResourceProvider {
Set<String> resolvedIds = resolvedSubnets.stream()
.map(Subnet::getSubnetId)
.filter(Objects::nonNull)
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
if (!resolvedIds.equals(requestedIds)) {
throw new AwsException("InvalidSubnet",
"One or more VpcSubnetIds do not exist in region " + region + ".", 400);
@@ -10004,7 +10005,7 @@ public class RdsService implements Resettable, ResourceProvider {
Set<String> vpcIds = resolvedSubnets.stream()
.map(Subnet::getVpcId)
.filter(id -> id != null && !id.isBlank())
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
if (vpcIds.size() != 1) {
throw new AwsException("InvalidSubnet",
"VpcSubnetIds must belong to one VPC.", 400);
@@ -10060,7 +10061,7 @@ public class RdsService implements Resettable, ResourceProvider {
if (resolvedSubnets.size() != subnetIds.size()) {
Set<String> found = resolvedSubnets.stream()
.map(Subnet::getSubnetId)
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
List<String> missing = subnetIds.stream()
.filter(id -> !found.contains(id))
.distinct()
diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManager.java b/src/main/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManager.java
index a0e3af6ec8..3999fb1e20 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManager.java
@@ -24,6 +24,7 @@ import io.github.hectorvent.floci.services.rds.model.DatabaseEngine;
import jakarta.annotation.PreDestroy;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.jboss.logging.Logger;
@@ -1193,11 +1194,11 @@ public class RdsContainerManager implements RdsBackendGate, RdsBackendEndpointRe
}
private static void addTarEntry(
- org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tar,
- String name, String content) throws java.io.IOException {
- byte[] bytes = content.getBytes(java.nio.charset.StandardCharsets.UTF_8);
- org.apache.commons.compress.archivers.tar.TarArchiveEntry entry =
- new org.apache.commons.compress.archivers.tar.TarArchiveEntry(name);
+ TarArchiveOutputStream tar,
+ String name, String content) throws IOException {
+ byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
+ TarArchiveEntry entry =
+ new TarArchiveEntry(name);
entry.setSize(bytes.length);
entry.setMode(0755);
tar.putArchiveEntry(entry);
diff --git a/src/main/java/io/github/hectorvent/floci/services/rdsdata/RdsDataFieldMapper.java b/src/main/java/io/github/hectorvent/floci/services/rdsdata/RdsDataFieldMapper.java
index f6f05bade2..3b61b3946f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rdsdata/RdsDataFieldMapper.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rdsdata/RdsDataFieldMapper.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Date;
@@ -47,7 +48,7 @@ final class RdsDataFieldMapper {
} else if (value instanceof Blob blob) {
field.put("blobValue", blob.getBytes(1, Math.toIntExact(blob.length())));
} else {
- field.put("blobValue", value.toString().getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ field.put("blobValue", value.toString().getBytes(StandardCharsets.UTF_8));
}
}
case Types.BOOLEAN, Types.BIT -> {
diff --git a/src/main/java/io/github/hectorvent/floci/services/route53/Route53Service.java b/src/main/java/io/github/hectorvent/floci/services/route53/Route53Service.java
index d565229bd9..c14df9e678 100644
--- a/src/main/java/io/github/hectorvent/floci/services/route53/Route53Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/route53/Route53Service.java
@@ -829,9 +829,9 @@ public class Route53Service implements Resettable {
return regionResolver != null ? regionResolver.getAccountId() : defaultAccountId;
}
- private java.util.Optional<String> resolveVpcOwnerAccount(VpcAssociation vpc) {
+ private Optional<String> resolveVpcOwnerAccount(VpcAssociation vpc) {
if (vpc == null || ec2Service == null) {
- return java.util.Optional.empty();
+ return Optional.empty();
}
return ec2Service.findVpcOwnerAccount(vpc.getVpcRegion(), vpc.getVpcId());
}
@@ -840,7 +840,7 @@ public class Route53Service implements Resettable {
if (vpc == null) {
return;
}
- java.util.Optional<String> owner = resolveVpcOwnerAccount(vpc);
+ Optional<String> owner = resolveVpcOwnerAccount(vpc);
if (owner.isPresent() && !owner.get().equals(callerAccountId)) {
throw new AwsException("InvalidVPCId",
"The VPC ID that you specified either isn't a valid ID or the current account is not authorized to access this VPC.",
diff --git a/src/main/java/io/github/hectorvent/floci/services/s3/model/ObjectAnnotation.java b/src/main/java/io/github/hectorvent/floci/services/s3/model/ObjectAnnotation.java
index fb3b149c98..6be5ba58e2 100644
--- a/src/main/java/io/github/hectorvent/floci/services/s3/model/ObjectAnnotation.java
+++ b/src/main/java/io/github/hectorvent/floci/services/s3/model/ObjectAnnotation.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.s3.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
+import java.nio.ByteBuffer;
+import java.nio.charset.CodingErrorAction;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -91,9 +93,9 @@ public class ObjectAnnotation {
public static boolean isValidUtf8(byte[] data) {
try {
StandardCharsets.UTF_8.newDecoder()
- .onMalformedInput(java.nio.charset.CodingErrorAction.REPORT)
- .onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPORT)
- .decode(java.nio.ByteBuffer.wrap(data));
+ .onMalformedInput(CodingErrorAction.REPORT)
+ .onUnmappableCharacter(CodingErrorAction.REPORT)
+ .decode(ByteBuffer.wrap(data));
return true;
} catch (Exception e) {
return false;
diff --git a/src/main/java/io/github/hectorvent/floci/services/s3/model/S3Object.java b/src/main/java/io/github/hectorvent/floci/services/s3/model/S3Object.java
index ead3881717..760a13a76a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/s3/model/S3Object.java
+++ b/src/main/java/io/github/hectorvent/floci/services/s3/model/S3Object.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
@@ -185,7 +186,7 @@ public class S3Object {
}
sb.append("\"");
return sb.toString();
- } catch (java.security.NoSuchAlgorithmException e) {
+ } catch (NoSuchAlgorithmException e) {
return "\"\"";
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/sagemaker/SageMakerTrainingRunner.java b/src/main/java/io/github/hectorvent/floci/services/sagemaker/SageMakerTrainingRunner.java
index d719a4fe85..2b5eb6ad3e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/sagemaker/SageMakerTrainingRunner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/sagemaker/SageMakerTrainingRunner.java
@@ -41,6 +41,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
@ApplicationScoped
public class SageMakerTrainingRunner implements ContainerTeardown, Resettable {
@@ -398,7 +399,7 @@ public class SageMakerTrainingRunner implements ContainerTeardown, Resettable {
public void onNext(Frame item) {
sb.append(new String(item.getPayload(), StandardCharsets.UTF_8));
}
- }).awaitCompletion(Duration.ofSeconds(2).toMillis(), java.util.concurrent.TimeUnit.MILLISECONDS);
+ }).awaitCompletion(Duration.ofSeconds(2).toMillis(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
LOG.warnv("Interrupted while reading SageMaker training failure log for container {0}: {1}", containerId, e.getMessage());
Thread.currentThread().interrupt();
diff --git a/src/main/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerService.java b/src/main/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerService.java
index 974d8de370..beb1a9ecdc 100644
--- a/src/main/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerService.java
@@ -29,6 +29,7 @@ import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
+import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
@@ -1698,7 +1699,7 @@ public class SecretsManagerService implements ResourceProvider {
String payloadStr = objectMapper.writeValueAsString(payload);
- InvokeResult result = lambdaService.invoke(region, lambdaArn, payloadStr.getBytes(java.nio.charset.StandardCharsets.UTF_8), InvocationType.RequestResponse);
+ InvokeResult result = lambdaService.invoke(region, lambdaArn, payloadStr.getBytes(StandardCharsets.UTF_8), InvocationType.RequestResponse);
if (result.getFunctionError() != null) {
throw new AwsException("InternalServiceError",
"Rotation lambda returned an error during " + step + ": " + result.getFunctionError(), 500);
diff --git a/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubController.java b/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubController.java
index a84c4d4b08..f322b9613f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubController.java
@@ -27,6 +27,7 @@ import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import java.time.Instant;
+import java.util.Map;
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
@@ -183,7 +184,7 @@ public class SecurityHubController {
@QueryParam("NextToken") String nextToken) {
String region = region(headers);
Integer maxResults = Pagination.parseMaxResults(maxResultsValue, "InvalidInputException");
- PaginatedResult<java.util.Map.Entry<String, JsonNode>> page =
+ PaginatedResult<Map.Entry<String, JsonNode>> page =
securityHubService.policyPage(region, maxResults, nextToken);
ObjectNode response = objectMapper.createObjectNode();
ArrayNode items = response.putArray("ConfigurationPolicySummaries");
diff --git a/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java b/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java
index f908906faf..3043a0d82c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/securityhub/SecurityHubService.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.securityhub;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.node.TextNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.PaginatedResult;
@@ -17,6 +18,7 @@ import io.github.hectorvent.floci.services.securityhub.model.SecurityHubState;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -247,7 +249,7 @@ public class SecurityHubService implements Resettable {
validateTags(request.get("Tags"));
String id = UUID.randomUUID().toString();
ObjectNode stored = (ObjectNode) request.deepCopy();
- String now = java.time.Instant.now().toString();
+ String now = Instant.now().toString();
stored.put("CreatedAt", now);
stored.put("UpdatedAt", now);
state.getPolicies().put(id, stored);
@@ -292,7 +294,7 @@ public class SecurityHubService implements Resettable {
validateConfigurationPolicy(request.get("ConfigurationPolicy"));
merged.set("ConfigurationPolicy", request.get("ConfigurationPolicy").deepCopy());
}
- merged.put("UpdatedAt", java.time.Instant.now().toString());
+ merged.put("UpdatedAt", Instant.now().toString());
state.getPolicies().put(id, merged);
save(region, state);
return merged;
@@ -338,7 +340,7 @@ public class SecurityHubService implements Resettable {
throw notFound("The configuration policy association was not found.");
}
association.setStatus("SUCCESS");
- association.setUpdatedAt(java.time.Instant.now().toString());
+ association.setUpdatedAt(Instant.now().toString());
applyPolicyToAccountTarget(region, state, association);
save(region, state);
}
@@ -358,7 +360,7 @@ public class SecurityHubService implements Resettable {
throw conflict("The configuration policy association is already being removed.");
}
association.setStatus("PENDING");
- association.setUpdatedAt(java.time.Instant.now().toString());
+ association.setUpdatedAt(Instant.now().toString());
association.setPendingPollsRemaining(1);
association.setDisassociating(true);
save(region, state);
@@ -581,7 +583,7 @@ public class SecurityHubService implements Resettable {
throw invalid("Tags must contain at most 50 entries.");
}
tags.forEach((key, value) -> validateTag(
- key, value == null ? null : new com.fasterxml.jackson.databind.node.TextNode(value)));
+ key, value == null ? null : new TextNode(value)));
}
private static void validateTag(String key, JsonNode value) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/securityhub/model/SecurityHubAssociation.java b/src/main/java/io/github/hectorvent/floci/services/securityhub/model/SecurityHubAssociation.java
index f77081a76c..83c4985e45 100644
--- a/src/main/java/io/github/hectorvent/floci/services/securityhub/model/SecurityHubAssociation.java
+++ b/src/main/java/io/github/hectorvent/floci/services/securityhub/model/SecurityHubAssociation.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.securityhub.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.quarkus.runtime.annotations.RegisterForReflection;
+import java.time.Instant;
+
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
public class SecurityHubAssociation {
@@ -24,7 +26,7 @@ public class SecurityHubAssociation {
this.targetType = targetType;
this.policyId = policyId;
this.status = status;
- this.updatedAt = java.time.Instant.now().toString();
+ this.updatedAt = Instant.now().toString();
this.pendingPollsRemaining = pendingPollsRemaining;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogService.java b/src/main/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogService.java
index afa32f70ec..7f09b732b3 100644
--- a/src/main/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogService.java
@@ -17,10 +17,14 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.time.Instant;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
+import java.util.regex.Pattern;
+import java.util.stream.StreamSupport;
@ApplicationScoped
public class ServiceCatalogService implements PassedRoleLookup {
@@ -191,7 +195,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
JsonNode terms = request.path("Filters").path("FullTextSearch");
return productStore.scan(key -> true).stream()
.filter(product -> !terms.isArray() || terms.isEmpty()
- || java.util.stream.StreamSupport.stream(terms.spliterator(), false)
+ || StreamSupport.stream(terms.spliterator(), false)
.allMatch(term -> (text(product, "Name") + " " + text(product, "Owner"))
.toLowerCase().contains(term.asText().toLowerCase())))
.map(ObjectNode::deepCopy).toList();
@@ -235,7 +239,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
* requested OU, and returns its account id.
*/
private String accountFactoryAccountId(JsonNode request, String name, String accountId) {
- Map<String, String> parameters = new java.util.HashMap<>();
+ Map<String, String> parameters = new HashMap<>();
request.path("ProvisioningParameters").forEach(parameter ->
parameters.put(text(parameter, "Key"), text(parameter, "Value")));
String email = parameters.get("AccountEmail");
@@ -495,7 +499,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
return true;
}
JsonNode ids = product.path("ProvisioningArtifactIds");
- return ids.isArray() && java.util.stream.StreamSupport.stream(ids.spliterator(), false)
+ return ids.isArray() && StreamSupport.stream(ids.spliterator(), false)
.anyMatch(id -> identifier.equals(id.asText()));
}
@@ -523,8 +527,8 @@ public class ServiceCatalogService implements PassedRoleLookup {
static final List<String> DESCRIBE_PORTFOLIO_SHARE_TYPES =
List.of("ACCOUNT", "ORGANIZATION", "ORGANIZATIONAL_UNIT", "ORGANIZATION_MEMBER_ACCOUNT");
- private static final java.util.regex.Pattern ACCOUNT_ID_PATTERN =
- java.util.regex.Pattern.compile("[0-9]{12}");
+ private static final Pattern ACCOUNT_ID_PATTERN =
+ Pattern.compile("[0-9]{12}");
/**
* Rejects a value botocore does not list in the member's enum. Accepting one leaves the
@@ -614,7 +618,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
}
require(portfolioStore, portfolioId, "portfolio");
String prefix = portfolioId + "|";
- List<ObjectNode> results = new java.util.ArrayList<>();
+ List<ObjectNode> results = new ArrayList<>();
for (String key : shareStore.keys()) {
if (!key.startsWith(prefix)) {
continue;
@@ -748,7 +752,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
}
ObjectNode product = requireProduct(productId);
JsonNode artifactIds = product.path("ProvisioningArtifactIds");
- boolean found = artifactIds.isArray() && java.util.stream.StreamSupport.stream(artifactIds.spliterator(), false)
+ boolean found = artifactIds.isArray() && StreamSupport.stream(artifactIds.spliterator(), false)
.anyMatch(id -> provisioningArtifactId.equals(id.asText()));
if (!found) {
throw new AwsException("ResourceNotFoundException", "Unknown provisioning artifact: " + provisioningArtifactId, 400);
@@ -770,7 +774,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
if (!associations.isArray() || associations.isEmpty()) {
throw new AwsException("InvalidParametersException", "ServiceActionAssociations is required", 400);
}
- List<ObjectNode> failures = new java.util.ArrayList<>();
+ List<ObjectNode> failures = new ArrayList<>();
for (JsonNode assoc : associations) {
String productId = text(assoc, "ProductId");
String artifactId = text(assoc, "ProvisioningArtifactId");
@@ -789,7 +793,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
continue;
}
JsonNode artifactIds = product.path("ProvisioningArtifactIds");
- boolean artifactFound = artifactIds.isArray() && java.util.stream.StreamSupport
+ boolean artifactFound = artifactIds.isArray() && StreamSupport
.stream(artifactIds.spliterator(), false)
.anyMatch(id -> artifactId.equals(id.asText()));
if (!artifactFound) {
@@ -826,7 +830,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
if (!associations.isArray() || associations.isEmpty()) {
throw new AwsException("InvalidParametersException", "ServiceActionAssociations is required", 400);
}
- List<ObjectNode> failures = new java.util.ArrayList<>();
+ List<ObjectNode> failures = new ArrayList<>();
for (JsonNode assoc : associations) {
String productId = text(assoc, "ProductId");
String artifactId = text(assoc, "ProvisioningArtifactId");
@@ -1087,7 +1091,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
}
ObjectNode product = requireProduct(productId);
JsonNode artifactIds = product.path("ProvisioningArtifactIds");
- boolean found = artifactIds.isArray() && java.util.stream.StreamSupport.stream(artifactIds.spliterator(), false)
+ boolean found = artifactIds.isArray() && StreamSupport.stream(artifactIds.spliterator(), false)
.anyMatch(id -> provisioningArtifactId.equals(id.asText()));
if (!found) {
throw new AwsException("ResourceNotFoundException", "Unknown provisioning artifact: " + provisioningArtifactId, 400);
@@ -1222,7 +1226,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
}
require(portfolioStore, portfolioId, "portfolio");
String prefix = portfolioId + "|";
- List<String> accountIds = new java.util.ArrayList<>();
+ List<String> accountIds = new ArrayList<>();
for (String key : shareStore.keys()) {
if (!key.startsWith(prefix)) {
continue;
@@ -1273,7 +1277,7 @@ public class ServiceCatalogService implements PassedRoleLookup {
throw new AwsException("InvalidParametersException", "TagOptionId is required", 400);
}
require(tagOptionStore, tagOptionId, "TagOption");
- List<ObjectNode> results = new java.util.ArrayList<>();
+ List<ObjectNode> results = new ArrayList<>();
for (String key : associationStore.keys()) {
associationStore.get(key).ifPresent(assoc -> {
if (!"TAG_OPTION".equals(text(assoc, "Type"))) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesPolicyService.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesPolicyService.java
index f2e8096822..22ca2ba722 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesPolicyService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesPolicyService.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.ses;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
@@ -191,7 +192,7 @@ public class SesPolicyService {
try {
// AWS returns the policy with insignificant whitespace stripped; compact it to match.
return objectMapper.readTree(policy).toString();
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
// Floci does not validate policy semantics; keep an unparseable document verbatim.
LOG.debugv("Identity policy is not valid JSON, storing as-is: {0}", e.getMessage());
return policy;
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java
index 07518fbe05..838b22b009 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.ses;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
@@ -36,13 +37,16 @@ import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import org.jboss.logging.Logger;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
/**
* Query-protocol handler for SES actions.
@@ -332,7 +336,7 @@ public class SesQueryHandler {
.elem("Bounces", "0")
.elem("Complaints", "0")
.elem("Rejects", "0")
- .elem("Timestamp", java.time.Instant.now().toString())
+ .elem("Timestamp", Instant.now().toString())
.end("member");
}
xml.end("SendDataPoints");
@@ -1175,7 +1179,7 @@ public class SesQueryHandler {
*/
private List<String> parseReorderRuleNames(MultivaluedMap<String, String> params) {
String prefix = "RuleNames.member.";
- Map<Integer, String> byIndex = new java.util.TreeMap<>();
+ Map<Integer, String> byIndex = new TreeMap<>();
for (String key : params.keySet()) {
if (!key.startsWith(prefix)) {
continue;
@@ -1201,7 +1205,7 @@ public class SesQueryHandler {
int index = member.getKey();
int skip = index - Math.max(previous, 1);
if (skip > MAX_RULE_NAMES_INDEX_SKIP) {
- throw new AwsException("MalformedInput", String.format(java.util.Locale.ROOT,
+ throw new AwsException("MalformedInput", String.format(Locale.ROOT,
"Excessively sparse input would skip %,d list elements", skip), 400);
}
while (names.size() < index - 1) {
@@ -1295,7 +1299,7 @@ public class SesQueryHandler {
private List<String> receiptActionIndexTokens(MultivaluedMap<String, String> params) {
String prefix = "Rule.Actions.member.";
- Map<Integer, String> byValue = new java.util.HashMap<>();
+ Map<Integer, String> byValue = new HashMap<>();
for (String key : params.keySet()) {
if (!key.startsWith(prefix)) {
continue;
@@ -1456,26 +1460,26 @@ public class SesQueryHandler {
* Floci stores the V2 canonical form internally, so the V1 handler translates
* in both directions.
*/
- private static final java.util.Map<String, String> V1_EVENT_TYPE_TO_INTERNAL =
- java.util.Map.ofEntries(
- java.util.Map.entry("send", "SEND"),
- java.util.Map.entry("reject", "REJECT"),
- java.util.Map.entry("bounce", "BOUNCE"),
- java.util.Map.entry("complaint", "COMPLAINT"),
- java.util.Map.entry("delivery", "DELIVERY"),
- java.util.Map.entry("open", "OPEN"),
- java.util.Map.entry("click", "CLICK"),
- java.util.Map.entry("renderingFailure", "RENDERING_FAILURE"),
- java.util.Map.entry("deliveryDelay", "DELIVERY_DELAY"),
- java.util.Map.entry("subscription", "SUBSCRIPTION"));
-
- private static final java.util.Map<String, String> INTERNAL_EVENT_TYPE_TO_V1;
+ private static final Map<String, String> V1_EVENT_TYPE_TO_INTERNAL =
+ Map.ofEntries(
+ Map.entry("send", "SEND"),
+ Map.entry("reject", "REJECT"),
+ Map.entry("bounce", "BOUNCE"),
+ Map.entry("complaint", "COMPLAINT"),
+ Map.entry("delivery", "DELIVERY"),
+ Map.entry("open", "OPEN"),
+ Map.entry("click", "CLICK"),
+ Map.entry("renderingFailure", "RENDERING_FAILURE"),
+ Map.entry("deliveryDelay", "DELIVERY_DELAY"),
+ Map.entry("subscription", "SUBSCRIPTION"));
+
+ private static final Map<String, String> INTERNAL_EVENT_TYPE_TO_V1;
static {
- java.util.Map<String, String> reverse = new java.util.HashMap<>();
+ Map<String, String> reverse = new HashMap<>();
for (Map.Entry<String, String> e : V1_EVENT_TYPE_TO_INTERNAL.entrySet()) {
reverse.put(e.getValue(), e.getKey());
}
- INTERNAL_EVENT_TYPE_TO_V1 = java.util.Map.copyOf(reverse);
+ INTERNAL_EVENT_TYPE_TO_V1 = Map.copyOf(reverse);
}
/**
@@ -1566,7 +1570,7 @@ public class SesQueryHandler {
JsonNode node;
try {
node = objectMapper.readTree(raw);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
throw new AwsException("InvalidTemplate",
"Invalid TemplateData JSON: " + e.getMessage(), 400);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
index 7030421547..124dd5bff9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesService.java
@@ -38,6 +38,7 @@ import jakarta.inject.Inject;
import org.apache.james.mime4j.dom.Message;
import org.jboss.logging.Logger;
+import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
@@ -1030,7 +1031,7 @@ public class SesService {
return false;
}
try {
- java.net.URI uri = java.net.URI.create(url);
+ URI uri = URI.create(url);
String scheme = uri.getScheme();
return uri.getHost() != null
&& ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme));
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateService.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateService.java
index 9138f3c046..8e9291909a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesTemplateService.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.ses;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -262,7 +263,7 @@ public class SesTemplateService implements SesTaggable {
JsonNode node;
try {
node = mapper.readTree(raw);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ } catch (JsonProcessingException e) {
throw new AwsException("InvalidRenderingParameter",
"Template rendering data is invalid: " + e.getOriginalMessage(), 400);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SmtpRelay.java b/src/main/java/io/github/hectorvent/floci/services/ses/SmtpRelay.java
index 773c918ca4..bc37274a17 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SmtpRelay.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SmtpRelay.java
@@ -4,6 +4,7 @@ import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.services.ses.model.MessageAttachment;
import io.github.hectorvent.floci.services.ses.model.MessageHeader;
import io.github.hectorvent.floci.services.ses.model.MessageTag;
+import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.ext.mail.MailAttachment;
import io.vertx.ext.mail.MailClient;
@@ -45,6 +46,9 @@ import java.util.Set;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
/**
* Optional SMTP relay for SES. When {@code floci.services.ses.smtp-host}
@@ -96,7 +100,7 @@ public class SmtpRelay {
private final boolean enabled;
@Inject
- public SmtpRelay(io.vertx.core.Vertx vertx, EmulatorConfig config) {
+ public SmtpRelay(Vertx vertx, EmulatorConfig config) {
this.enabled = config.services().ses().enabled()
&& config.services().ses().smtpHost()
.filter(h -> !h.isBlank())
@@ -152,10 +156,10 @@ public class SmtpRelay {
private volatile boolean shutdown = false;
@Override public void execute(Runnable r) { r.run(); }
@Override public void shutdown() { shutdown = true; }
- @Override public java.util.List<Runnable> shutdownNow() { shutdown = true; return java.util.List.of(); }
+ @Override public List<Runnable> shutdownNow() { shutdown = true; return List.of(); }
@Override public boolean isShutdown() { return shutdown; }
@Override public boolean isTerminated() { return shutdown; }
- @Override public boolean awaitTermination(long t, java.util.concurrent.TimeUnit u) { return true; }
+ @Override public boolean awaitTermination(long t, TimeUnit u) { return true; }
};
this.enabled = enabled;
}
@@ -247,7 +251,7 @@ public class SmtpRelay {
}
try {
relayExecutor.execute(() -> doRelay(message));
- } catch (java.util.concurrent.RejectedExecutionException e) {
+ } catch (RejectedExecutionException e) {
LOG.warnv("SMTP relay skipped (executor shutting down) for from={0}", message.from());
}
}
@@ -260,7 +264,7 @@ public class SmtpRelay {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warnv(e, "SMTP relay interrupted for from={0}, to={1}", message.from(), message.to());
- } catch (java.util.concurrent.TimeoutException e) {
+ } catch (TimeoutException e) {
LOG.warnv("SMTP relay timed out after {0}s for from={1}, to={2}",
RELAY_TIMEOUT_SECONDS, message.from(), message.to());
} catch (Exception e) {
@@ -401,7 +405,7 @@ public class SmtpRelay {
}
try {
relayExecutor.execute(() -> doRelayRaw(message));
- } catch (java.util.concurrent.RejectedExecutionException e) {
+ } catch (RejectedExecutionException e) {
LOG.warnv("SMTP raw relay skipped (executor shutting down) for from={0}", message.from());
}
}
@@ -457,7 +461,7 @@ public class SmtpRelay {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warnv(e, "SMTP raw relay interrupted for from={0}", relayMessage.from());
- } catch (java.util.concurrent.TimeoutException e) {
+ } catch (TimeoutException e) {
LOG.warnv("SMTP raw relay timed out after {0}s for from={1}",
RELAY_TIMEOUT_SECONDS, relayMessage.from());
} catch (Exception e) {
@@ -467,7 +471,7 @@ public class SmtpRelay {
private void send(MailMessage mail) throws Exception {
mailClient.sendMail(mail).toCompletionStage().toCompletableFuture()
- .get(RELAY_TIMEOUT_SECONDS, java.util.concurrent.TimeUnit.SECONDS);
+ .get(RELAY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
private static void applyBounceAddress(MailMessage mail, String returnPath, String fallback) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/model/Identity.java b/src/main/java/io/github/hectorvent/floci/services/ses/model/Identity.java
index f2bdc73648..2691650a31 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/model/Identity.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/model/Identity.java
@@ -9,6 +9,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
@RegisterForReflection
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -80,7 +81,7 @@ public class Identity {
this.identity = identity;
this.identityType = identityType;
this.verificationStatus = "Success"; // auto-verify in emulator
- this.verificationToken = java.util.UUID.randomUUID().toString();
+ this.verificationToken = UUID.randomUUID().toString();
this.dkimEnabled = false;
this.dkimVerificationStatus = "NotStarted";
this.createdAt = Instant.now();
diff --git a/src/main/java/io/github/hectorvent/floci/services/signin/SigninService.java b/src/main/java/io/github/hectorvent/floci/services/signin/SigninService.java
index 8e65e4c7ff..dbaa75931a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/signin/SigninService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/signin/SigninService.java
@@ -530,9 +530,9 @@ public class SigninService {
if (i > 0) {
result.append('&');
}
- result.append(java.net.URLEncoder.encode(values[i], StandardCharsets.UTF_8))
+ result.append(URLEncoder.encode(values[i], StandardCharsets.UTF_8))
.append('=')
- .append(java.net.URLEncoder.encode(values[i + 1], StandardCharsets.UTF_8));
+ .append(URLEncoder.encode(values[i + 1], StandardCharsets.UTF_8));
}
return result.toString();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
index e9a7842217..85cf4b0d58 100644
--- a/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/sns/SnsQueryHandler.java
@@ -503,7 +503,7 @@ public class SnsQueryHandler {
String entryPrefix = "PublishBatchRequestEntries.member." + i;
String id = getParam(params, entryPrefix + ".Id");
if (id == null) break;
- Map<String, Object> entry = new java.util.HashMap<>();
+ Map<String, Object> entry = new HashMap<>();
entry.put("Id", id);
entry.put("Message", getParam(params, entryPrefix + ".Message"));
entry.put("Subject", getParam(params, entryPrefix + ".Subject"));
diff --git a/src/main/java/io/github/hectorvent/floci/services/sns/SnsService.java b/src/main/java/io/github/hectorvent/floci/services/sns/SnsService.java
index d419f333c3..32af331d2f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/sns/SnsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/sns/SnsService.java
@@ -59,10 +59,12 @@ import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.Deque;
+import java.util.HashMap;
import java.util.HexFormat;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -145,8 +147,8 @@ public class SnsService implements Resettable, ResourceProvider {
/** Mobile-push platforms Floci mocks. iOS and Android only — anything else is rejected. */
private static final Set<String> SUPPORTED_PUSH_PLATFORMS = Set.of(
"APNS", "APNS_SANDBOX", "GCM", "FCM");
- private static final java.util.regex.Pattern PLATFORM_APP_NAME_PATTERN =
- java.util.regex.Pattern.compile("[a-zA-Z0-9_.\\-]{1,256}");
+ private static final Pattern PLATFORM_APP_NAME_PATTERN =
+ Pattern.compile("[a-zA-Z0-9_.\\-]{1,256}");
/**
* Operator names that may not appear as a field name inside a {@code $or} array; their
@@ -1195,7 +1197,7 @@ public class SnsService implements Resettable, ResourceProvider {
PlatformApplication app = platformAppStore.get(key)
.orElseThrow(() -> new AwsException("NotFound",
"PlatformApplication does not exist.", 404));
- return new java.util.LinkedHashMap<>(app.getAttributes());
+ return new LinkedHashMap<>(app.getAttributes());
}
public void setPlatformApplicationAttributes(String arn, Map<String, String> attributes, String region) {
@@ -1270,7 +1272,7 @@ public class SnsService implements Resettable, ResourceProvider {
public Map<String, String> getEndpointAttributes(String endpointArn, String region) {
PlatformEndpoint endpoint = platformEndpointStore.get(endpointKey(region, endpointArn))
.orElseThrow(() -> new AwsException("NotFound", "Endpoint does not exist.", 404));
- return new java.util.LinkedHashMap<>(endpoint.getAttributes());
+ return new LinkedHashMap<>(endpoint.getAttributes());
}
public void setEndpointAttributes(String endpointArn, Map<String, String> attributes, String region) {
@@ -1457,7 +1459,7 @@ public class SnsService implements Resettable, ResourceProvider {
}
private static boolean isExpiredSentinelToken(String token) {
- return token != null && token.toUpperCase(java.util.Locale.ROOT).contains("EXPIRED");
+ return token != null && token.toUpperCase(Locale.ROOT).contains("EXPIRED");
}
private static boolean isEndpointArn(String arn) {
@@ -1634,7 +1636,7 @@ public class SnsService implements Resettable, ResourceProvider {
Topic topic = topicStore.get(key)
.orElseThrow(() -> new AwsException("ResourceNotFoundException",
"Resource does not exist.", 404));
- return new java.util.LinkedHashMap<>(topic.getTags());
+ return new LinkedHashMap<>(topic.getTags());
}
@Override
@@ -2782,7 +2784,7 @@ public class SnsService implements Resettable, ResourceProvider {
if (snsAttributes == null || snsAttributes.isEmpty()) {
return Collections.emptyMap();
}
- return new java.util.HashMap<>(snsAttributes);
+ return new HashMap<>(snsAttributes);
}
/**
diff --git a/src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminService.java b/src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminService.java
index 7864033df2..62b27ebd2f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminService.java
@@ -39,16 +39,28 @@ import io.github.hectorvent.floci.services.ssoadmin.model.TrustedTokenIssuer;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.nio.charset.StandardCharsets;
import java.time.Duration;
+import java.time.Instant;
+import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
@ApplicationScoped
public class SsoAdminService implements Resettable {
@@ -284,7 +296,7 @@ public class SsoAdminService implements Resettable {
public List<RegionMetadata> listRegionsForInstance(SsoInstance instance) {
List<RegionMetadata> result = new ArrayList<>();
result.add(new RegionMetadata(instance.primaryRegion(), "ACTIVE",
- java.time.Instant.ofEpochMilli(instance.createdDateEpochMillis()).toString(), true));
+ Instant.ofEpochMilli(instance.createdDateEpochMillis()).toString(), true));
if (!instance.accountInstance()) {
result.addAll(regions.scan(key -> true).stream()
.filter(region -> !instance.primaryRegion().equals(region.regionName()))
@@ -295,7 +307,7 @@ public class SsoAdminService implements Resettable {
}
public double regionAddedDateEpochSeconds(RegionMetadata region) {
- return java.time.Instant.parse(region.addedDate()).toEpochMilli() / 1000.0d;
+ return Instant.parse(region.addedDate()).toEpochMilli() / 1000.0d;
}
public synchronized TrustedTokenIssuer createTrustedTokenIssuer(JsonNode request, String callerAccountId) {
@@ -576,10 +588,10 @@ public class SsoAdminService implements Resettable {
private static boolean trustedTokenIssuerMatches(TrustedTokenIssuer issuer, String name, String issuerType,
OidcJwtIssuerConfiguration oidcConfiguration,
Map<String, String> tags) {
- return java.util.Objects.equals(issuer.name(), name)
- && java.util.Objects.equals(issuer.trustedTokenIssuerType(), issuerType)
- && java.util.Objects.equals(issuer.oidcJwtConfiguration(), oidcConfiguration)
- && java.util.Objects.equals(issuer.tags(), tags);
+ return Objects.equals(issuer.name(), name)
+ && Objects.equals(issuer.trustedTokenIssuerType(), issuerType)
+ && Objects.equals(issuer.oidcJwtConfiguration(), oidcConfiguration)
+ && Objects.equals(issuer.tags(), tags);
}
public synchronized InstanceAccessControlAttributeConfiguration createInstanceAccessControlAttributeConfiguration(JsonNode request) {
@@ -650,8 +662,8 @@ public class SsoAdminService implements Resettable {
Optional<String> priorArn = instanceClientTokens.get(tokenKey);
if (priorArn.isPresent()) {
SsoInstance prior = findInstanceByArn(priorArn.get());
- if (prior != null && java.util.Objects.equals(prior.name(), name)
- && java.util.Objects.equals(prior.tags(), tags)) {
+ if (prior != null && Objects.equals(prior.name(), name)
+ && Objects.equals(prior.tags(), tags)) {
return prior;
}
throw new AwsException("IdempotentParameterMismatch",
@@ -723,7 +735,7 @@ public class SsoAdminService implements Resettable {
|| !KMS_KEY_ARN.matcher(kmsKeyArn).matches()) {
throw validation("EncryptionConfiguration.KmsKeyArn is required and must be a valid KMS key ARN.");
}
- java.util.regex.Matcher kmsArnMatcher = KMS_KEY_ARN.matcher(kmsKeyArn);
+ Matcher kmsArnMatcher = KMS_KEY_ARN.matcher(kmsKeyArn);
if (!kmsArnMatcher.matches() || !instance.primaryRegion().equals(kmsArnMatcher.group(1))) {
throw validation("The customer managed KMS key must be in the IAM Identity Center primary Region.");
}
@@ -774,7 +786,7 @@ public class SsoAdminService implements Resettable {
}
Set<String> instancePermissionSets = permissionSets.keys().stream()
.filter(permissionSetArn -> instanceArn.equals(instanceArnForPermissionSet(permissionSetArn)))
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
for (String permissionSetArn : instancePermissionSets) {
permissionSets.delete(permissionSetArn);
resourceTagOverrides.delete(permissionSetArn);
@@ -786,7 +798,7 @@ public class SsoAdminService implements Resettable {
deleteByPermissionSet(permissionSetProvisioningOperations, PermissionSetProvisioningOperation::permissionSetArn,
instancePermissionSets);
accessControlAttributeConfigurations.delete(instanceArn);
- for (String key : new java.util.ArrayList<>(trustedTokenIssuers.keys())) {
+ for (String key : new ArrayList<>(trustedTokenIssuers.keys())) {
TrustedTokenIssuer issuer = trustedTokenIssuers.get(key).orElse(null);
if (issuer != null && instanceArn.equals(issuer.instanceArn())) {
trustedTokenIssuers.delete(key);
@@ -794,13 +806,13 @@ public class SsoAdminService implements Resettable {
resourceTagOverrides.delete(key);
}
}
- for (String key : new java.util.ArrayList<>(trustedTokenIssuerClientTokens.keys())) {
+ for (String key : new ArrayList<>(trustedTokenIssuerClientTokens.keys())) {
String issuerArn = trustedTokenIssuerClientTokens.get(key).orElse(null);
if (issuerArn != null && trustedTokenIssuers.get(issuerArn).isEmpty()) {
trustedTokenIssuerClientTokens.delete(key);
}
}
- for (String key : new java.util.ArrayList<>(instanceClientTokens.keys())) {
+ for (String key : new ArrayList<>(instanceClientTokens.keys())) {
if (instanceArn.equals(instanceClientTokens.get(key).orElse(null))) {
instanceClientTokens.delete(key);
}
@@ -817,31 +829,31 @@ public class SsoAdminService implements Resettable {
applications.delete(applicationArn);
applicationUpdateOverrides.delete(applicationArn);
resourceTagOverrides.delete(applicationArn);
- for (String key : new java.util.ArrayList<>(applicationAssignments.keys())) {
+ for (String key : new ArrayList<>(applicationAssignments.keys())) {
ApplicationAssignment assignment = applicationAssignments.get(key).orElse(null);
if (assignment != null && applicationArn.equals(assignment.applicationArn())) {
applicationAssignments.delete(key);
}
}
- for (String key : new java.util.ArrayList<>(applicationClientTokens.keys())) {
+ for (String key : new ArrayList<>(applicationClientTokens.keys())) {
if (applicationArn.equals(applicationClientTokens.get(key).orElse(null))) {
applicationClientTokens.delete(key);
}
}
- for (String key : new java.util.ArrayList<>(applicationAccessScopes.keys())) {
+ for (String key : new ArrayList<>(applicationAccessScopes.keys())) {
ApplicationAccessScope scope = applicationAccessScopes.get(key).orElse(null);
if (scope != null && applicationArn.equals(scope.applicationArn())) {
applicationAccessScopes.delete(key);
}
}
applicationAssignmentConfigurations.delete(applicationArn);
- for (String key : new java.util.ArrayList<>(applicationAuthenticationMethods.keys())) {
+ for (String key : new ArrayList<>(applicationAuthenticationMethods.keys())) {
ApplicationAuthenticationMethod method = applicationAuthenticationMethods.get(key).orElse(null);
if (method != null && applicationArn.equals(method.applicationArn())) {
applicationAuthenticationMethods.delete(key);
}
}
- for (String key : new java.util.ArrayList<>(applicationGrants.keys())) {
+ for (String key : new ArrayList<>(applicationGrants.keys())) {
ApplicationGrant grant = applicationGrants.get(key).orElse(null);
if (grant != null && applicationArn.equals(grant.applicationArn())) {
applicationGrants.delete(key);
@@ -991,7 +1003,7 @@ public class SsoAdminService implements Resettable {
|| accountId.equals(value) || rootArn.matcher(value).matches());
}
- private static boolean policyStringOrArrayMatches(JsonNode node, java.util.function.Predicate<String> predicate) {
+ private static boolean policyStringOrArrayMatches(JsonNode node, Predicate<String> predicate) {
if (node == null) {
return false;
}
@@ -1062,7 +1074,7 @@ public class SsoAdminService implements Resettable {
if (requested != null && requested > 100) {
throw validation("MaxResults must be between 1 and 100.");
}
- return Pagination.paginate(java.util.List.of(customApplicationProviderArn(region)), value -> value,
+ return Pagination.paginate(List.of(customApplicationProviderArn(region)), value -> value,
requested, text(request, "NextToken"), 50, 100, "ValidationException");
}
@@ -1468,7 +1480,7 @@ public class SsoAdminService implements Resettable {
if (regions.scan(key -> true).size() >= REGION_QUOTA - 1) {
throw quota("The IAM Identity Center Region quota has been exceeded.");
}
- String addedDate = java.time.Instant.now().toString();
+ String addedDate = Instant.now().toString();
RegionMetadata response = new RegionMetadata(regionName, "ADDING", addedDate, false);
regions.put(regionName, new RegionMetadata(regionName, "ACTIVE", addedDate, false));
return response;
@@ -1652,7 +1664,7 @@ public class SsoAdminService implements Resettable {
.thenComparing(CustomerManagedPolicyReference::path))
.toList();
return Pagination.paginate(references,
- reference -> reference.name().toLowerCase(java.util.Locale.ROOT) + "\n" + reference.path(),
+ reference -> reference.name().toLowerCase(Locale.ROOT) + "\n" + reference.path(),
optionalMaxResults(request), text(request, "NextToken"), 50, 100, "ValidationException");
}
@@ -1773,8 +1785,8 @@ public class SsoAdminService implements Resettable {
public List<Assignment> portalAssignmentsForUser(String userId) {
validatePrincipalId(userId);
- Map<String, Set<String>> groupsByIdentityStore = new java.util.HashMap<>();
- Set<String> invalidIdentityStores = new java.util.HashSet<>();
+ Map<String, Set<String>> groupsByIdentityStore = new HashMap<>();
+ Set<String> invalidIdentityStores = new HashSet<>();
return assignments.scan(key -> true).stream()
.filter(assignment -> {
if ("USER".equals(assignment.principalType())) {
@@ -2180,7 +2192,7 @@ public class SsoAdminService implements Resettable {
if (duration.compareTo(Duration.ofHours(1)) < 0 || duration.compareTo(Duration.ofHours(12)) > 0) {
throw validation("SessionDuration must be between 1 and 12 hours.");
}
- } catch (java.time.format.DateTimeParseException e) {
+ } catch (DateTimeParseException e) {
throw validation("SessionDuration must use ISO-8601 duration syntax.");
}
return value;
@@ -2199,7 +2211,7 @@ public class SsoAdminService implements Resettable {
}
private static void validateInlinePolicy(String policy) {
- if (policy == null || policy.isEmpty() || policy.getBytes(java.nio.charset.StandardCharsets.UTF_8).length > MAX_INLINE_POLICY_BYTES) {
+ if (policy == null || policy.isEmpty() || policy.getBytes(StandardCharsets.UTF_8).length > MAX_INLINE_POLICY_BYTES) {
throw validation("InlinePolicy must be between 1 and 32768 bytes.");
}
long nonWhitespace = policy.chars().filter(ch -> !Character.isWhitespace(ch)).count();
@@ -2227,7 +2239,7 @@ public class SsoAdminService implements Resettable {
if (!filter.isObject() || filter.size() > 2) {
throw validation("Filter may contain only ApplicationAccount and ApplicationProvider.");
}
- for (java.util.Iterator<String> fields = filter.fieldNames(); fields.hasNext();) {
+ for (Iterator<String> fields = filter.fieldNames(); fields.hasNext();) {
String field = fields.next();
if (!Set.of("ApplicationAccount", "ApplicationProvider").contains(field)) {
throw validation("Filter may contain only ApplicationAccount and ApplicationProvider.");
@@ -2290,12 +2302,12 @@ public class SsoAdminService implements Resettable {
private static boolean applicationMatches(SsoApplication application, String providerArn, String description,
String name, ApplicationPortalOptions portalOptions, String status,
Map<String, String> tags) {
- return java.util.Objects.equals(application.applicationProviderArn(), providerArn)
- && java.util.Objects.equals(application.description(), description)
- && java.util.Objects.equals(application.name(), name)
- && java.util.Objects.equals(application.portalOptions(), portalOptions)
- && java.util.Objects.equals(application.status(), status)
- && java.util.Objects.equals(application.tags(), tags);
+ return Objects.equals(application.applicationProviderArn(), providerArn)
+ && Objects.equals(application.description(), description)
+ && Objects.equals(application.name(), name)
+ && Objects.equals(application.portalOptions(), portalOptions)
+ && Objects.equals(application.status(), status)
+ && Objects.equals(application.tags(), tags);
}
private static List<AccessControlAttribute> parseAccessControlAttributes(JsonNode request) {
@@ -2452,12 +2464,12 @@ public class SsoAdminService implements Resettable {
}
private static String customerManagedPolicyKey(String name, String path) {
- return name.toLowerCase(java.util.Locale.ROOT) + "\n" + path;
+ return name.toLowerCase(Locale.ROOT) + "\n" + path;
}
private static <T> void deleteByPermissionSet(StorageBackend<String, T> storage,
- java.util.function.Function<T, String> permissionSetArn,
+ Function<T, String> permissionSetArn,
Set<String> permissionSetArns) {
for (String key : new ArrayList<>(storage.keys())) {
T value = storage.get(key).orElse(null);
diff --git a/src/main/java/io/github/hectorvent/floci/services/ssoadmin/model/PermissionSet.java b/src/main/java/io/github/hectorvent/floci/services/ssoadmin/model/PermissionSet.java
index 38245786da..ccca0803ca 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ssoadmin/model/PermissionSet.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ssoadmin/model/PermissionSet.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ssoadmin.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
+import java.util.LinkedHashMap;
import java.util.Map;
@RegisterForReflection
@@ -12,8 +13,8 @@ public record PermissionSet(String arn, String name, String description, String
PermissionsBoundary permissionsBoundary,
Map<String, String> tags) {
public PermissionSet {
- managedPolicies = managedPolicies == null ? new java.util.LinkedHashMap<>() : managedPolicies;
- customerManagedPolicies = customerManagedPolicies == null ? new java.util.LinkedHashMap<>() : customerManagedPolicies;
- tags = tags == null ? new java.util.LinkedHashMap<>() : tags;
+ managedPolicies = managedPolicies == null ? new LinkedHashMap<>() : managedPolicies;
+ customerManagedPolicies = customerManagedPolicies == null ? new LinkedHashMap<>() : customerManagedPolicies;
+ tags = tags == null ? new LinkedHashMap<>() : tags;
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/swf/SwfJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/swf/SwfJsonHandler.java
index 4036f94f77..fdf26be679 100644
--- a/src/main/java/io/github/hectorvent/floci/services/swf/SwfJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/swf/SwfJsonHandler.java
@@ -19,12 +19,16 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
+import java.util.function.ToDoubleFunction;
/**
* Translates the SWF JSON 1.0 wire protocol to and from {@link SwfService}.
@@ -153,7 +157,7 @@ public class SwfJsonHandler {
List<SwfDomain> domains = service.listDomains(region, text(request, "registrationStatus"));
if (request.path("reverseOrder").asBoolean(false)) {
domains = new ArrayList<>(domains);
- java.util.Collections.reverse(domains);
+ Collections.reverse(domains);
}
return pagedList(request, "domainInfos", domains, domain -> domainInfo(domain, region));
}
@@ -363,7 +367,7 @@ public class SwfJsonHandler {
buildFilter(request, closed), closed);
if (request.path("reverseOrder").asBoolean(false)) {
executions = new ArrayList<>(executions);
- java.util.Collections.reverse(executions);
+ Collections.reverse(executions);
}
return pagedList(request, "executionInfos", executions, this::executionInfo);
@@ -445,7 +449,7 @@ public class SwfJsonHandler {
}
private ExecutionFilter timeFilter(JsonNode filterNode,
- java.util.function.ToDoubleFunction<SwfWorkflowExecution> extractor) {
+ ToDoubleFunction<SwfWorkflowExecution> extractor) {
if (filterNode == null || filterNode.isMissingNode() || filterNode.isNull()) {
return ExecutionFilter.all();
}
@@ -740,8 +744,8 @@ public class SwfJsonHandler {
private static String encodePageToken(int offset, String taskToken) {
String body = "offset=" + offset + (taskToken == null ? "" : "\ntask=" + taskToken);
- return java.util.Base64.getEncoder()
- .encodeToString(body.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ return Base64.getEncoder()
+ .encodeToString(body.getBytes(StandardCharsets.UTF_8));
}
private static Page decodePageToken(String token) {
@@ -750,8 +754,8 @@ public class SwfJsonHandler {
}
String decoded;
try {
- decoded = new String(java.util.Base64.getDecoder().decode(token),
- java.nio.charset.StandardCharsets.UTF_8);
+ decoded = new String(Base64.getDecoder().decode(token),
+ StandardCharsets.UTF_8);
} catch (IllegalArgumentException e) {
throw SwfFaults.invalidPageToken();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/swf/SwfService.java b/src/main/java/io/github/hectorvent/floci/services/swf/SwfService.java
index 79821ac6ff..1b73892cd9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/swf/SwfService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/swf/SwfService.java
@@ -24,6 +24,7 @@ import java.nio.charset.StandardCharsets;
import java.time.Clock;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -221,7 +222,7 @@ public class SwfService implements Resettable {
}
types.sort(Comparator.comparing(SwfWorkflowType::getName).thenComparing(SwfWorkflowType::getVersion));
if (reverseOrder) {
- java.util.Collections.reverse(types);
+ Collections.reverse(types);
}
return types;
}
@@ -301,7 +302,7 @@ public class SwfService implements Resettable {
}
types.sort(Comparator.comparing(SwfActivityType::getName).thenComparing(SwfActivityType::getVersion));
if (reverseOrder) {
- java.util.Collections.reverse(types);
+ Collections.reverse(types);
}
return types;
}
@@ -437,7 +438,7 @@ public class SwfService implements Resettable {
SwfWorkflowExecution execution = requireExecution(region, domainName, workflowId, runId);
List<SwfHistoryEvent> events = new ArrayList<>(execution.getEvents());
if (reverseOrder) {
- java.util.Collections.reverse(events);
+ Collections.reverse(events);
}
return events;
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/CedarSidecarClient.java b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/CedarSidecarClient.java
index 1d7801f298..b7be80d2ed 100644
--- a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/CedarSidecarClient.java
+++ b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/CedarSidecarClient.java
@@ -17,6 +17,7 @@ import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.List;
import java.util.Map;
+import java.util.stream.StreamSupport;
/** HTTP client for the stateless Cedar 4 sidecar. */
@ApplicationScoped
@@ -81,7 +82,7 @@ public class CedarSidecarClient {
if (!node.isArray()) {
return List.of();
}
- return java.util.stream.StreamSupport.stream(node.spliterator(), false)
+ return StreamSupport.stream(node.spliterator(), false)
.map(JsonNode::asText)
.toList();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifier.java b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifier.java
index 84b47d7ab6..99deff7185 100644
--- a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifier.java
+++ b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifier.java
@@ -255,7 +255,7 @@ public class VerifiedPermissionsOidcSignatureVerifier implements AutoCloseable {
throw new VerificationException("Token header is not valid JSON");
}
return node;
- } catch (IllegalArgumentException | java.io.IOException e) {
+ } catch (IllegalArgumentException | IOException e) {
throw new VerificationException("Token header is not valid JSON", e);
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsTokenService.java b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsTokenService.java
index 42d39016b4..1b794ab889 100644
--- a/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsTokenService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsTokenService.java
@@ -9,10 +9,12 @@ import io.github.hectorvent.floci.services.verifiedpermissions.model.IdentitySou
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -152,7 +154,7 @@ public class VerifiedPermissionsTokenService {
}
private List<EntityIdentifier> mergeParents(TokenInfo identity, TokenInfo access) {
- java.util.LinkedHashSet<EntityIdentifier> parents = new java.util.LinkedHashSet<>();
+ LinkedHashSet<EntityIdentifier> parents = new LinkedHashSet<>();
if (identity != null) {
parents.addAll(identity.parents());
}
@@ -178,7 +180,7 @@ public class VerifiedPermissionsTokenService {
} else {
throw VerifiedPermissionsService.validation("context must contain cedarJson or contextMap.");
}
- } catch (java.io.IOException e) {
+ } catch (IOException e) {
throw VerifiedPermissionsService.validation("context.cedarJson isn't valid JSON.");
}
ObjectNode token = root.putObject("token");
@@ -227,7 +229,7 @@ public class VerifiedPermissionsTokenService {
throw VerifiedPermissionsService.validation("Token claims aren't a JSON object.");
}
return claims;
- } catch (IllegalArgumentException | java.io.IOException e) {
+ } catch (IllegalArgumentException | IOException e) {
throw VerifiedPermissionsService.validation("Token payload isn't valid base64url JSON.");
}
}
diff --git a/src/main/java/io/github/hectorvent/floci/tools/ami/AmiImageTool.java b/src/main/java/io/github/hectorvent/floci/tools/ami/AmiImageTool.java
index 68988ef543..952a4e806f 100644
--- a/src/main/java/io/github/hectorvent/floci/tools/ami/AmiImageTool.java
+++ b/src/main/java/io/github/hectorvent/floci/tools/ami/AmiImageTool.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
@@ -14,6 +15,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HexFormat;
@@ -302,7 +304,7 @@ public final class AmiImageTool {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
try (InputStream input = Files.newInputStream(path)) {
- input.transferTo(new java.io.OutputStream() {
+ input.transferTo(new OutputStream() {
@Override
public void write(int b) {
digest.update((byte) b);
@@ -315,7 +317,7 @@ public final class AmiImageTool {
});
}
return HexFormat.of().formatHex(digest.digest());
- } catch (java.security.NoSuchAlgorithmException e) {
+ } catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("SHA-256 is unavailable", e);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/compat/FixtureLoader.java b/src/test/java/io/github/hectorvent/floci/compat/FixtureLoader.java
index ef75e54756..6898ca23fd 100644
--- a/src/test/java/io/github/hectorvent/floci/compat/FixtureLoader.java
+++ b/src/test/java/io/github/hectorvent/floci/compat/FixtureLoader.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -66,7 +67,7 @@ public final class FixtureLoader {
}
if (node instanceof ObjectNode obj) {
Iterator<String> fields = obj.fieldNames();
- List<String> toRemove = new java.util.ArrayList<>();
+ List<String> toRemove = new ArrayList<>();
while (fields.hasNext()) {
String f = fields.next();
if (VOLATILE_FIELDS.contains(f)) toRemove.add(f);
diff --git a/src/test/java/io/github/hectorvent/floci/config/ContainerCaBundleTest.java b/src/test/java/io/github/hectorvent/floci/config/ContainerCaBundleTest.java
index a896a9097c..153c9a93b8 100644
--- a/src/test/java/io/github/hectorvent/floci/config/ContainerCaBundleTest.java
+++ b/src/test/java/io/github/hectorvent/floci/config/ContainerCaBundleTest.java
@@ -20,6 +20,7 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
@@ -101,7 +102,7 @@ class ContainerCaBundleTest {
byte[] first = Files.readAllBytes(ContainerCaBundle.write(tlsDir, ca.certificatePath()));
byte[] second = Files.readAllBytes(ContainerCaBundle.write(tlsDir, ca.certificatePath()));
- assertTrue(java.util.Arrays.equals(first, second));
+ assertTrue(Arrays.equals(first, second));
try (Stream<Path> files = Files.list(tlsDir)) {
assertTrue(files.noneMatch(file -> file.getFileName().toString().endsWith(".tmp")), "no temp file left behind");
}
diff --git a/src/test/java/io/github/hectorvent/floci/config/FlociCertificateAuthorityTest.java b/src/test/java/io/github/hectorvent/floci/config/FlociCertificateAuthorityTest.java
index 68266910b9..77eabd8047 100644
--- a/src/test/java/io/github/hectorvent/floci/config/FlociCertificateAuthorityTest.java
+++ b/src/test/java/io/github/hectorvent/floci/config/FlociCertificateAuthorityTest.java
@@ -214,34 +214,34 @@ class FlociCertificateAuthorityTest {
assertTrue(cert.getExtensionValue(Extension.subjectKeyIdentifier.getId()) != null);
assertTrue(cert.getExtensionValue(Extension.authorityKeyIdentifier.getId()) != null);
assertTrue(ca.isIssuedByUs(cert));
- assertEquals(java.time.Instant.parse("2049-12-31T23:59:59Z"), cert.getNotAfter().toInstant(), "AWS's fixed expiry");
- assertEquals(java.time.Instant.parse("2050-12-31T23:59:59Z"), ca.certificate().getNotAfter().toInstant(),
+ assertEquals(Instant.parse("2049-12-31T23:59:59Z"), cert.getNotAfter().toInstant(), "AWS's fixed expiry");
+ assertEquals(Instant.parse("2050-12-31T23:59:59Z"), ca.certificate().getNotAfter().toInstant(),
"a new CA outlives the device certificates it signs");
}
@Test
void expiryRulesStayValidAfterTheFixedDates() {
- java.time.Instant in2051 = java.time.Instant.parse("2051-06-01T00:00:00Z");
- assertEquals(in2051.plus(3650, java.time.temporal.ChronoUnit.DAYS), FlociCertificateAuthority.caNotAfter(in2051),
+ Instant in2051 = Instant.parse("2051-06-01T00:00:00Z");
+ assertEquals(in2051.plus(3650, ChronoUnit.DAYS), FlociCertificateAuthority.caNotAfter(in2051),
"a CA created after 2050 lives ten years instead of being born expired");
- assertEquals(java.time.Instant.parse("2050-12-31T23:59:59Z"),
- FlociCertificateAuthority.caNotAfter(java.time.Instant.parse("2026-09-05T00:00:00Z")));
+ assertEquals(Instant.parse("2050-12-31T23:59:59Z"),
+ FlociCertificateAuthority.caNotAfter(Instant.parse("2026-09-05T00:00:00Z")));
FlociCertificateAuthority ca = FlociCertificateAuthority.loadOrCreate(tempDir);
assertEquals(ca.certificate().getNotAfter().toInstant(),
- ca.deviceCertificateNotAfter(java.time.Instant.parse("2050-06-01T00:00:00Z")),
+ ca.deviceCertificateNotAfter(Instant.parse("2050-06-01T00:00:00Z")),
"after 2049 a device certificate lives a year, capped at the CA's expiry: never born expired");
- assertTrue(ca.deviceCertificateNotAfter(java.time.Instant.parse("2050-06-01T00:00:00Z"))
- .isAfter(java.time.Instant.parse("2050-06-01T00:00:00Z")));
- assertEquals(java.time.Instant.parse("2049-12-31T23:59:59Z"),
- ca.deviceCertificateNotAfter(java.time.Instant.parse("2026-09-05T00:00:00Z")));
+ assertTrue(ca.deviceCertificateNotAfter(Instant.parse("2050-06-01T00:00:00Z"))
+ .isAfter(Instant.parse("2050-06-01T00:00:00Z")));
+ assertEquals(Instant.parse("2049-12-31T23:59:59Z"),
+ ca.deviceCertificateNotAfter(Instant.parse("2026-09-05T00:00:00Z")));
}
@Test
void deviceCertificateNeverOutlivesAShortLivedCa() throws Exception {
CertificateGenerator gen = new CertificateGenerator();
CertificateGenerator.GeneratedCertificate shortLived = gen.generateCaCertificate(FlociCertificateAuthority.COMMON_NAME,
- java.time.Instant.now().plus(30, java.time.temporal.ChronoUnit.DAYS));
+ Instant.now().plus(30, ChronoUnit.DAYS));
Files.writeString(tempDir.resolve("floci-root-ca.crt"), shortLived.certificatePem());
Files.writeString(tempDir.resolve("floci-root-ca.key"), shortLived.privateKeyPem());
FlociCertificateAuthority ca = FlociCertificateAuthority.loadOrCreate(tempDir);
@@ -279,7 +279,7 @@ class FlociCertificateAuthorityTest {
@Test
void signsACsrAsAClientLeafWithTheCsrSubjectAndKey() throws Exception {
FlociCertificateAuthority ca = FlociCertificateAuthority.loadOrCreate(tempDir);
- java.security.KeyPair deviceKey = rsaKeyPair(2048);
+ KeyPair deviceKey = rsaKeyPair(2048);
X509Certificate cert = ca.signClientCsr(csrPem("CN=device-42,O=Example", deviceKey));
diff --git a/src/test/java/io/github/hectorvent/floci/config/TlsConfigSourceCertificatePathTest.java b/src/test/java/io/github/hectorvent/floci/config/TlsConfigSourceCertificatePathTest.java
index e16f33eda3..af73beb5b2 100644
--- a/src/test/java/io/github/hectorvent/floci/config/TlsConfigSourceCertificatePathTest.java
+++ b/src/test/java/io/github/hectorvent/floci/config/TlsConfigSourceCertificatePathTest.java
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
@@ -119,7 +120,7 @@ class TlsConfigSourceCertificatePathTest {
assertNotNull(certPath);
assertTrue(Path.of(certPath).isAbsolute(), "the emitted path must be absolute: " + certPath);
- assertTrue(java.nio.file.Files.exists(Path.of(certPath)),
+ assertTrue(Files.exists(Path.of(certPath)),
"the emitted path must resolve to the generated certificate: " + certPath);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/config/TlsProxyServerReservedPortTest.java b/src/test/java/io/github/hectorvent/floci/config/TlsProxyServerReservedPortTest.java
index 4bbd208b47..0ce8d34e1a 100644
--- a/src/test/java/io/github/hectorvent/floci/config/TlsProxyServerReservedPortTest.java
+++ b/src/test/java/io/github/hectorvent/floci/config/TlsProxyServerReservedPortTest.java
@@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
+import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -53,7 +54,7 @@ class TlsProxyServerReservedPortTest {
*/
private static TlsProxyServer proxyWith(int flociPort, boolean tlsEnabled, int awsHttpsPort,
Future<NetServer> outcome,
- java.util.function.Consumer<TlsProxyServer> beforeStart) {
+ Consumer<TlsProxyServer> beforeStart) {
return proxyWith(flociPort, tlsEnabled, awsHttpsPort,
Future.succeededFuture(mock(NetServer.class)), outcome, beforeStart);
}
@@ -61,7 +62,7 @@ class TlsProxyServerReservedPortTest {
private static TlsProxyServer proxyWith(int flociPort, boolean tlsEnabled, int awsHttpsPort,
Future<NetServer> publicOutcome,
Future<NetServer> awsHttpsOutcome,
- java.util.function.Consumer<TlsProxyServer> beforeStart) {
+ Consumer<TlsProxyServer> beforeStart) {
EmulatorConfig.TlsConfig tls = mock(EmulatorConfig.TlsConfig.class);
when(tls.enabled()).thenReturn(tlsEnabled);
when(tls.awsHttpsPort()).thenReturn(awsHttpsPort);
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/AccountContextFilterTest.java b/src/test/java/io/github/hectorvent/floci/core/common/AccountContextFilterTest.java
index a9ba4dd599..12c31a2c20 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/AccountContextFilterTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/AccountContextFilterTest.java
@@ -15,6 +15,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -49,7 +50,7 @@ class AccountContextFilterTest {
accountResolver = new AccountResolver(DEFAULT_ACCOUNT);
regionResolver = new RegionResolver(DEFAULT_REGION, DEFAULT_ACCOUNT);
requestContext = new RequestContext();
- sessionAccounts = new java.util.HashMap<>();
+ sessionAccounts = new HashMap<>();
allowUnknownRegions = false;
strictPartitions = false;
enforceIam = false;
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/JsonMalformedInputIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/core/common/JsonMalformedInputIntegrationTest.java
index 13ab89f8dc..4901294391 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/JsonMalformedInputIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/JsonMalformedInputIntegrationTest.java
@@ -9,6 +9,9 @@ import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
@@ -218,8 +221,8 @@ class JsonMalformedInputIntegrationTest {
@Test
void kinesisGetRecordsIteratorWithNonNumericIndexIsInvalidArgument() {
// valid base64 of "stream|shard|type|seq|NOTANUMBER" — decodes fine, parseInt(index) would throw
- String iterator = java.util.Base64.getEncoder()
- .encodeToString("s|shard-0|AT|0|xyz".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String iterator = Base64.getEncoder()
+ .encodeToString("s|shard-0|AT|0|xyz".getBytes(StandardCharsets.UTF_8));
req(JSON_1_1, "Kinesis_20131202.GetRecords", "{\"ShardIterator\":\"" + iterator + "\"}")
.when().post("/")
.then()
@@ -242,9 +245,9 @@ class JsonMalformedInputIntegrationTest {
@Test
void dynamoDbStreamsGetRecordsIteratorWithNonNumericPositionIsNot500() {
// valid base64 of "arn|NOTANUMBER" — decodeIterator succeeds, Integer.parseInt(position) would throw
- String iterator = java.util.Base64.getEncoder()
+ String iterator = Base64.getEncoder()
.encodeToString("arn:aws:dynamodb:us-east-1:0:table/T/stream/x|notanumber"
- .getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ .getBytes(StandardCharsets.UTF_8));
req(JSON_1_0, "DynamoDBStreams_20120810.GetRecords", "{\"ShardIterator\":\"" + iterator + "\"}")
.when().post("/")
.then()
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLifecycleManagerVolumeTest.java b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLifecycleManagerVolumeTest.java
index b98ac93832..c9454452fd 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLifecycleManagerVolumeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLifecycleManagerVolumeTest.java
@@ -348,7 +348,7 @@ class ContainerLifecycleManagerVolumeTest {
InspectVolumeResponse second = mock(InspectVolumeResponse.class);
when(dockerClient.listVolumesCmd()).thenReturn(cmd);
when(cmd.exec()).thenReturn(response);
- when(response.getVolumes()).thenReturn(java.util.List.of(first, second));
+ when(response.getVolumes()).thenReturn(List.of(first, second));
when(first.getName()).thenReturn("floci-code-first");
when(second.getName()).thenReturn("shared-data");
@@ -362,7 +362,7 @@ class ContainerLifecycleManagerVolumeTest {
ListVolumesResponse response = mock(ListVolumesResponse.class);
when(dockerClient.listVolumesCmd()).thenReturn(cmd);
when(cmd.exec()).thenReturn(response);
- when(response.getVolumes()).thenReturn(java.util.List.of());
+ when(response.getVolumes()).thenReturn(List.of());
assertEquals(Optional.of(Set.of()), manager.tryListVolumeNames());
}
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLogStreamerTest.java b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLogStreamerTest.java
index ae01cf28a1..c7c7f3b869 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLogStreamerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerLogStreamerTest.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.function.BiFunction;
import java.util.logging.LogRecord;
import java.util.stream.Stream;
@@ -349,7 +350,7 @@ class ContainerLogStreamerTest {
// heap is exhausted — regression guard for the unbounded-growth review finding.
ContainerLogStreamer.LogLineBuffer buffer = new ContainerLogStreamer.LogLineBuffer();
byte[] overlong = new byte[256 * 1024];
- java.util.Arrays.fill(overlong, (byte) 'a');
+ Arrays.fill(overlong, (byte) 'a');
List<String> lines = buffer.append(overlong);
@@ -366,7 +367,7 @@ class ContainerLogStreamerTest {
ContainerLogStreamer.LogLineBuffer buffer = new ContainerLogStreamer.LogLineBuffer();
int cap = 256 * 1024;
byte[] fill = new byte[cap - 1];
- java.util.Arrays.fill(fill, (byte) 'a');
+ Arrays.fill(fill, (byte) 'a');
assertEquals(List.of(), buffer.append(fill));
List<String> lines = buffer.append(utf8("€"));
@@ -387,7 +388,7 @@ class ContainerLogStreamerTest {
ContainerLogStreamer.LogLineBuffer buffer = new ContainerLogStreamer.LogLineBuffer();
int cap = 256 * 1024;
byte[] fill = new byte[cap - 4];
- java.util.Arrays.fill(fill, (byte) 'a');
+ Arrays.fill(fill, (byte) 'a');
byte[] rocket = utf8("🚀");
assertEquals(List.of(), buffer.append(fill));
@@ -405,7 +406,7 @@ class ContainerLogStreamerTest {
// force-split at the hard ceiling, not buffered without bound.
ContainerLogStreamer.LogLineBuffer buffer = new ContainerLogStreamer.LogLineBuffer();
byte[] leads = new byte[256 * 1024 + 64];
- java.util.Arrays.fill(leads, (byte) 0xE2); // 1110xxxx lead byte, never followed by continuations
+ Arrays.fill(leads, (byte) 0xE2); // 1110xxxx lead byte, never followed by continuations
List<String> lines = buffer.append(leads);
assertFalse(lines.isEmpty(), "a boundary-less lead-byte run must be force-split, not buffered unbounded");
}
@@ -416,7 +417,7 @@ class ContainerLogStreamerTest {
// cap rather than growing unbounded.
ContainerLogStreamer.LogLineBuffer buffer = new ContainerLogStreamer.LogLineBuffer();
byte[] continuations = new byte[256 * 1024 + 64];
- java.util.Arrays.fill(continuations, (byte) 0x80); // 10xxxxxx continuation
+ Arrays.fill(continuations, (byte) 0x80); // 10xxxxxx continuation
List<String> lines = buffer.append(continuations);
assertFalse(lines.isEmpty(), "a continuation-only run must be force-split, not buffered unbounded");
}
@@ -534,7 +535,7 @@ class ContainerLogStreamerTest {
// Fragments of ONE newline-free write are delivered by the transport reader AFTER close() is
// called; the terminal callback then flushes their reassembled line. A separate thread supplies
// the reader callbacks, mirroring the transport.
- List<String> emitted = java.util.Collections.synchronizedList(new ArrayList<>());
+ List<String> emitted = Collections.synchronizedList(new ArrayList<>());
ContainerLogStreamer.LogReassemblyCallback cb =
new ContainerLogStreamer.LogReassemblyCallback(emitted::add);
@@ -611,7 +612,7 @@ class ContainerLogStreamerTest {
assertEquals(List.of("unterminated-tail"), emitted);
}
- private static LogContainerCmd attachWith(java.util.function.BiFunction<ContainerLogStreamer, String, Closeable> attach) {
+ private static LogContainerCmd attachWith(BiFunction<ContainerLogStreamer, String, Closeable> attach) {
DockerClient dockerClient = mock(DockerClient.class);
LogContainerCmd command = mock(LogContainerCmd.class, RETURNS_SELF);
when(dockerClient.logContainerCmd("container-1")).thenReturn(command);
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelperTest.java b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelperTest.java
index 5ae4995042..21dd2fae69 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelperTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/docker/ContainerStorageHelperTest.java
@@ -351,7 +351,7 @@ class ContainerStorageHelperTest {
}
private static EmulatorConfig config(
- String namespace, java.util.List<EmulatorConfig.DockerConfig.LabelEntry> extraLabels) {
+ String namespace, List<EmulatorConfig.DockerConfig.LabelEntry> extraLabels) {
EmulatorConfig config = mock(EmulatorConfig.class);
EmulatorConfig.DockerConfig docker = mock(EmulatorConfig.DockerConfig.class);
EmulatorConfig.StorageConfig storage = mock(EmulatorConfig.StorageConfig.class);
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/port/RuntimeApiPortPoolDefaultTest.java b/src/test/java/io/github/hectorvent/floci/core/common/port/RuntimeApiPortPoolDefaultTest.java
index a604022f8c..14f88e554f 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/port/RuntimeApiPortPoolDefaultTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/port/RuntimeApiPortPoolDefaultTest.java
@@ -5,6 +5,13 @@ import io.smallrye.config.WithDefault;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -51,17 +58,17 @@ class RuntimeApiPortPoolDefaultTest {
/** {@code runtimeApiBasePort} -> {@code runtime-api-base-port}. */
private static String kebab(String method) {
- return method.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(java.util.Locale.ROOT);
+ return method.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
}
/** The value under {@code floci.services.lambda.<key>} in application.yml, or null. */
private static Integer yamlValue(String key) throws Exception {
- java.nio.file.Path yml = java.nio.file.Path.of("src/main/resources/application.yml");
- assertTrue(java.nio.file.Files.exists(yml), "application.yml not found at " + yml.toAbsolutePath());
- java.util.regex.Pattern p =
- java.util.regex.Pattern.compile("^\\s*" + java.util.regex.Pattern.quote(key) + ":\\s*(\\d+)\\s*$");
- for (String line : java.nio.file.Files.readAllLines(yml)) {
- java.util.regex.Matcher m = p.matcher(line);
+ Path yml = Path.of("src/main/resources/application.yml");
+ assertTrue(Files.exists(yml), "application.yml not found at " + yml.toAbsolutePath());
+ Pattern p =
+ Pattern.compile("^\\s*" + Pattern.quote(key) + ":\\s*(\\d+)\\s*$");
+ for (String line : Files.readAllLines(yml)) {
+ Matcher m = p.matcher(line);
if (m.matches()) {
return Integer.valueOf(m.group(1));
}
@@ -128,7 +135,7 @@ class RuntimeApiPortPoolDefaultTest {
// what happens to be listening on 12000+ on the machine running the suite.
PortAllocator allocator = new PortAllocator(base, max, w -> { }, p -> true);
- java.util.Set<Integer> handed = new java.util.HashSet<>();
+ Set<Integer> handed = new HashSet<>();
for (int i = 0; i < MIN_USABLE_POOL_WIDTH; i++) {
assertTrue(handed.add(allocator.allocate()),
"allocator handed out a duplicate port after " + handed.size() + " allocations");
diff --git a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorInfoControllerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorInfoControllerIntegrationTest.java
index e8f58ecd04..2b669e723a 100644
--- a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorInfoControllerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorInfoControllerIntegrationTest.java
@@ -11,6 +11,8 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.List;
@@ -142,7 +144,7 @@ class EmulatorInfoControllerIntegrationTest {
.extract().body().asString();
X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509")
- .generateCertificate(new java.io.ByteArrayInputStream(pem.getBytes(java.nio.charset.StandardCharsets.US_ASCII)));
+ .generateCertificate(new ByteArrayInputStream(pem.getBytes(StandardCharsets.US_ASCII)));
assertTrue(cert.getBasicConstraints() >= 0, "must be a CA certificate");
assertEquals(cert.getSubjectX500Principal(), cert.getIssuerX500Principal());
assertEquals(pem, given().when().get("/_floci/ca.pem").then().extract().body().asString(),
diff --git a/src/test/java/io/github/hectorvent/floci/services/account/AccountAlternateContactIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/account/AccountAlternateContactIntegrationTest.java
index b0161e66d7..6bdc18982a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/account/AccountAlternateContactIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/account/AccountAlternateContactIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.account;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -56,19 +57,19 @@ class AccountAlternateContactIntegrationTest {
delete().statusCode(404).body("__type", equalTo("ResourceNotFoundException"));
}
- private static io.restassured.response.ValidatableResponse put(String email) {
+ private static ValidatableResponse put(String email) {
return given().contentType("application/json").header("Authorization", AUTH)
.body("{\"AlternateContactType\":\"SECURITY\",\"Name\":\"Security\",\"Title\":\"Owner\",\"EmailAddress\":\"" + email + "\",\"PhoneNumber\":\"+12025550123\"}")
.post("/putAlternateContact").then();
}
- private static io.restassured.response.ValidatableResponse get() {
+ private static ValidatableResponse get() {
return given().contentType("application/json").header("Authorization", AUTH)
.body("{\"AlternateContactType\":\"SECURITY\"}")
.post("/getAlternateContact").then();
}
- private static io.restassured.response.ValidatableResponse delete() {
+ private static ValidatableResponse delete() {
return given().contentType("application/json").header("Authorization", AUTH)
.body("{\"AlternateContactType\":\"SECURITY\"}")
.post("/deleteAlternateContact").then();
diff --git a/src/test/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManagerTest.java
index b88ecbfd40..b8596e551a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/amazonmq/container/RabbitMqManagerTest.java
@@ -13,6 +13,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -157,7 +158,7 @@ class RabbitMqManagerTest {
verify(builder).withPortBinding(15672, 15673);
verify(builder, never()).withExposedPort(Mockito.anyInt());
verify(builder, never()).withDynamicPort(Mockito.anyInt());
- assertEquals(java.util.List.of("amqp://172.17.0.5:5672"),
+ assertEquals(List.of("amqp://172.17.0.5:5672"),
broker.getBrokerInstances().get(0).getEndpoints());
assertEquals("http://172.17.0.5:15672", broker.getBrokerInstances().get(0).getConsoleURL());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayApiKeyRevocationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayApiKeyRevocationIntegrationTest.java
index 72c2e04d98..686a6c07d9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayApiKeyRevocationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayApiKeyRevocationIntegrationTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -185,7 +186,7 @@ class ApiGatewayApiKeyRevocationIntegrationTest {
.body("{\"patchOperations\":[{\"op\":\"replace\",\"path\":\"/enabled\",\"value\":\"false\"}]}")
.when().patch("/apikeys/" + keyId)
.then().statusCode(200)
- .body("enabled", org.hamcrest.Matchers.is(false));
+ .body("enabled", Matchers.is(false));
IdentityApiKey identity = invokeAndReadIdentity(keyValue);
assertNull(identity.apiKey(),
@@ -201,7 +202,7 @@ class ApiGatewayApiKeyRevocationIntegrationTest {
.body("{\"patchOperations\":[{\"op\":\"replace\",\"path\":\"/enabled\",\"value\":\"true\"}]}")
.when().patch("/apikeys/" + keyId)
.then().statusCode(200)
- .body("enabled", org.hamcrest.Matchers.is(true));
+ .body("enabled", Matchers.is(true));
IdentityApiKey identity = invokeAndReadIdentity(keyValue);
assertEquals(keyValue, identity.apiKey(),
@@ -215,7 +216,7 @@ class ApiGatewayApiKeyRevocationIntegrationTest {
given()
.when().get("/usageplans/" + planId + "/keys")
.then().statusCode(200)
- .body("item.find { it.id == '" + keyId + "' }", org.hamcrest.Matchers.notNullValue());
+ .body("item.find { it.id == '" + keyId + "' }", Matchers.notNullValue());
given()
.when().delete("/apikeys/" + keyId)
@@ -224,7 +225,7 @@ class ApiGatewayApiKeyRevocationIntegrationTest {
given()
.when().get("/usageplans/" + planId + "/keys")
.then().statusCode(200)
- .body("item.find { it.id == '" + keyId + "' }", org.hamcrest.Matchers.nullValue());
+ .body("item.find { it.id == '" + keyId + "' }", Matchers.nullValue());
given()
.when().get("/usageplans/" + planId + "/keys/" + keyId)
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayAwsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayAwsIntegrationTest.java
index 8b508c03f1..4b9d1e1b21 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayAwsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayAwsIntegrationTest.java
@@ -7,6 +7,8 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.*;
import java.util.Map;
@@ -1251,11 +1253,11 @@ class ApiGatewayAwsIntegrationTest {
}
}
- private static org.hamcrest.Matcher<Integer> anyOf(int... values) {
- org.hamcrest.Matcher<Integer>[] matchers = new org.hamcrest.Matcher[values.length];
+ private static Matcher<Integer> anyOf(int... values) {
+ Matcher<Integer>[] matchers = new Matcher[values.length];
for (int i = 0; i < values.length; i++) {
- matchers[i] = org.hamcrest.Matchers.equalTo(values[i]);
+ matchers[i] = Matchers.equalTo(values[i]);
}
- return org.hamcrest.Matchers.anyOf(matchers);
+ return Matchers.anyOf(matchers);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayDomainNameIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayDomainNameIntegrationTest.java
index 3a61ef16f9..cea5763323 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayDomainNameIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayDomainNameIntegrationTest.java
@@ -3,9 +3,11 @@ package io.github.hectorvent.floci.services.apigateway;
import io.github.hectorvent.floci.core.common.AwsException;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import io.restassured.response.ValidatableResponse;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
@@ -206,7 +208,7 @@ class ApiGatewayDomainNameIntegrationTest {
AtomicInteger created = new AtomicInteger();
AtomicInteger rejected = new AtomicInteger();
try {
- List<Future<?>> calls = new java.util.ArrayList<>();
+ List<Future<?>> calls = new ArrayList<>();
for (int i = 0; i < callers; i++) {
calls.add(pool.submit(() -> {
start.await();
@@ -294,7 +296,7 @@ class ApiGatewayDomainNameIntegrationTest {
AtomicInteger succeeded = new AtomicInteger();
AtomicInteger rejected = new AtomicInteger();
try {
- List<Future<?>> calls = new java.util.ArrayList<>();
+ List<Future<?>> calls = new ArrayList<>();
for (int i = 0; i < callers; i++) {
calls.add(pool.submit(() -> {
start.await();
@@ -322,7 +324,7 @@ class ApiGatewayDomainNameIntegrationTest {
void run() throws Exception;
}
- private static io.restassured.response.ValidatableResponse createDomain(String body) {
+ private static ValidatableResponse createDomain(String body) {
return given().contentType(ContentType.JSON).body(body)
.when().post("/domainnames").then().statusCode(201);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayExportIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayExportIntegrationTest.java
index d3603679ae..183f0c329b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayExportIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayExportIntegrationTest.java
@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.services.apigateway.model.RequestValidator;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -180,7 +181,7 @@ class ApiGatewayExportIntegrationTest {
service.createDeployment(REGION, apiId, Map.of("stageName", "xml"));
given().get(exportPath("xml", "oas30")).then().statusCode(400).body("message", containsString("non-JSON"));
given().get("/restapis/" + apiId + "/deployments/" + deploymentId).then().statusCode(200)
- .body("exportSnapshot", org.hamcrest.Matchers.nullValue());
+ .body("exportSnapshot", Matchers.nullValue());
}
private String exportPath(String stage, String type) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayHttpProxyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayHttpProxyIntegrationTest.java
index 5f8975fd43..4fbfaf1cc8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayHttpProxyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayHttpProxyIntegrationTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.testutil.FreePorts;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -222,7 +223,7 @@ class ApiGatewayHttpProxyIntegrationTest {
.when().get("/execute-api/" + apiId + "/test/orders/42?limit=5")
.then().statusCode(200)
.header("X-Backend-Marker", "hit")
- .body("from", org.hamcrest.Matchers.equalTo("backend"));
+ .body("from", Matchers.equalTo("backend"));
assertEquals("GET", lastMethod.get());
assertEquals("/orders/42", lastPath.get());
@@ -344,7 +345,7 @@ class ApiGatewayHttpProxyIntegrationTest {
.when().get("/execute-api/" + apiId + "/test/orders/42")
.then()
.statusCode(200)
- .body("from", org.hamcrest.Matchers.equalTo("backend"));
+ .body("from", Matchers.equalTo("backend"));
assertEquals("/42", lastPath.get());
}
@@ -375,7 +376,7 @@ class ApiGatewayHttpProxyIntegrationTest {
given()
.when().get("/execute-api/" + apiId + "/test/orders/missing")
.then().statusCode(404)
- .body("from", org.hamcrest.Matchers.equalTo("backend"));
+ .body("from", Matchers.equalTo("backend"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayImportApiKeysIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayImportApiKeysIntegrationTest.java
index 8e5bb9039b..8cd183c41b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayImportApiKeysIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayImportApiKeysIntegrationTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.apigateway;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.net.URI;
@@ -57,9 +59,9 @@ class ApiGatewayImportApiKeysIntegrationTest {
.get("/apikeys/{importedId}?includeValue=true")
.then()
.statusCode(200)
- .body("name", org.hamcrest.Matchers.equalTo("imported-key"))
- .body("value", org.hamcrest.Matchers.equalTo("secret-value"))
- .body("enabled", org.hamcrest.Matchers.equalTo(true));
+ .body("name", Matchers.equalTo("imported-key"))
+ .body("value", Matchers.equalTo("secret-value"))
+ .body("enabled", Matchers.equalTo(true));
}
/** AWS ImportApiKeys uses the TitleCase header {@code Name,Key,Description,Enabled,UsagePlanIds}. */
@@ -124,7 +126,7 @@ class ApiGatewayImportApiKeysIntegrationTest {
.statusCode(201)
.extract().path("ids[0]");
- org.junit.jupiter.api.Assertions.assertNotEquals("distinct-id-secret-value", importedId);
+ Assertions.assertNotEquals("distinct-id-secret-value", importedId);
given()
.pathParam("importedId", importedId)
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTransportOptionsTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTransportOptionsTest.java
index 33b9f0dc73..abb5ef2bbe 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTransportOptionsTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTransportOptionsTest.java
@@ -21,6 +21,7 @@ import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -39,6 +40,7 @@ import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.PrivateKey;
+import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
@@ -302,7 +304,7 @@ class ApiGatewayIntegrationTransportOptionsTest {
}
/** A CA certificate, self-signed when {@code issuerDn} is its own subject. */
- private static X509Certificate buildCa(X500Name subjectDn, java.security.PublicKey subjectKey,
+ private static X509Certificate buildCa(X500Name subjectDn, PublicKey subjectKey,
X500Name issuerDn, PrivateKey issuerKey, Integer keyUsageBits,
NameConstraints nameConstraints, Instant now) throws Exception {
JcaX509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(
@@ -545,7 +547,7 @@ class ApiGatewayIntegrationTransportOptionsTest {
given().when().get("/execute-api/" + apiId + "/test/thing")
.then().statusCode(200)
- .body("tls", org.hamcrest.Matchers.equalTo("ok"));
+ .body("tls", Matchers.equalTo("ok"));
}
@Test
@@ -586,7 +588,7 @@ class ApiGatewayIntegrationTransportOptionsTest {
// correct, so it has to be accepted.
given().when().get("/execute-api/" + apiId + "/test/thing")
.then().statusCode(200)
- .body("tls", org.hamcrest.Matchers.equalTo("ok"));
+ .body("tls", Matchers.equalTo("ok"));
}
@Test
@@ -643,7 +645,7 @@ class ApiGatewayIntegrationTransportOptionsTest {
// than by the constraint it names.
given().when().get("/execute-api/" + apiId + "/test/thing")
.then().statusCode(200)
- .body("tls", org.hamcrest.Matchers.equalTo("ok"));
+ .body("tls", Matchers.equalTo("ok"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java
index c277785385..88b1b2a45a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayRequestAuthorizerIntegrationTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -530,7 +531,7 @@ class ApiGatewayRequestAuthorizerIntegrationTest {
.when().get("/execute-api/" + noneApiId + "/prod/open")
.then()
.statusCode(200)
- .body("invoked", org.hamcrest.Matchers.equalTo(true));
+ .body("invoked", Matchers.equalTo(true));
}
// ──────────────────────────── Allow / Deny policy ────────────────────────────
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayV2DomainNameIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayV2DomainNameIntegrationTest.java
index 8d48077828..b0cce30daf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayV2DomainNameIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayV2DomainNameIntegrationTest.java
@@ -2,6 +2,9 @@ package io.github.hectorvent.floci.services.apigateway;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -304,7 +307,7 @@ class ApiGatewayV2DomainNameIntegrationTest {
// read or delete by that id would pick between the two mappings arbitrarily.
String first = createMapping("Aa");
String second = createMapping("BB");
- org.junit.jupiter.api.Assertions.assertNotEquals(first, second);
+ Assertions.assertNotEquals(first, second);
given()
.when()
@@ -671,7 +674,7 @@ class ApiGatewayV2DomainNameIntegrationTest {
.statusCode(201);
}
- private static org.hamcrest.Matcher<Iterable<? super String>> hasItemEqualTo(String value) {
- return org.hamcrest.Matchers.hasItem(equalTo(value));
+ private static Matcher<Iterable<? super String>> hasItemEqualTo(String value) {
+ return Matchers.hasItem(equalTo(value));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ExecuteApiSigV4AuthorizerTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ExecuteApiSigV4AuthorizerTest.java
index 87e766a584..dbc1cf9079 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ExecuteApiSigV4AuthorizerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ExecuteApiSigV4AuthorizerTest.java
@@ -14,6 +14,8 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.net.URI;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.LinkedHashMap;
@@ -269,7 +271,7 @@ class ExecuteApiSigV4AuthorizerTest {
*/
private static Map<String, String> signedWithSessionToken(String accessKeyId, String sessionToken)
throws Exception {
- Map<String, String> signed = new java.util.LinkedHashMap<>(ExecuteApiRequestSigner.signedHeaders(
+ Map<String, String> signed = new LinkedHashMap<>(ExecuteApiRequestSigner.signedHeaders(
"GET", PATH, Map.of(), HOST, null, accessKeyId, "session-secret", REGION, Instant.now()));
signed.put("X-Amz-Security-Token", sessionToken);
return signed;
@@ -333,7 +335,7 @@ class ExecuteApiSigV4AuthorizerTest {
// x-amz-content-sha256 header alongside a replaced body must not restore the match:
// the header is not in SignedHeaders, and a literal hash is never taken on trust.
byte[] signedBody = "{\"amount\":1}".getBytes();
- Map<String, String> signed = new java.util.LinkedHashMap<>(ExecuteApiRequestSigner.signedHeaders(
+ Map<String, String> signed = new LinkedHashMap<>(ExecuteApiRequestSigner.signedHeaders(
"POST", PATH, Map.of(), HOST, signedBody, "test", "test", REGION, Instant.now()));
signed.put("x-amz-content-sha256", Digests.sha256Hex(signedBody));
@@ -401,8 +403,8 @@ class ExecuteApiSigV4AuthorizerTest {
for (String pair : rawQuery.split("&")) {
int equals = pair.indexOf('=');
queryParameters.add(equals >= 0 ? pair.substring(0, equals) : pair,
- equals >= 0 ? java.net.URLDecoder.decode(pair.substring(equals + 1),
- java.nio.charset.StandardCharsets.UTF_8) : "");
+ equals >= 0 ? URLDecoder.decode(pair.substring(equals + 1),
+ StandardCharsets.UTF_8) : "");
}
}
when(uriInfo.getQueryParameters()).thenReturn(queryParameters);
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandlerTest.java
index d810b3605f..50eb031c32 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2JsonHandlerTest.java
@@ -1,8 +1,11 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -233,7 +236,7 @@ class ApiGatewayV2JsonHandlerTest {
.then().statusCode(200)
.extract().jsonPath().getList("items").size();
- org.junit.jupiter.api.Assertions.assertEquals(beforeCount, afterCount,
+ Assertions.assertEquals(beforeCount, afterCount,
"No orphan deployment should be created when stageName is invalid");
}
@@ -311,15 +314,15 @@ class ApiGatewayV2JsonHandlerTest {
.when().post("/")
.then().statusCode(201).extract().asString();
- com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
- com.fasterxml.jackson.databind.JsonNode created = mapper.readTree(createBody);
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode created = mapper.readTree(createBody);
String localIntegrationId = created.get("IntegrationId").asText();
- org.junit.jupiter.api.Assertions.assertEquals("HTTP_PROXY", created.get("IntegrationType").asText());
- com.fasterxml.jackson.databind.JsonNode createdRP = created.get("RequestParameters");
- org.junit.jupiter.api.Assertions.assertNotNull(createdRP, "CreateIntegration response should include RequestParameters");
- org.junit.jupiter.api.Assertions.assertEquals("/public/$request.path.proxy", createdRP.get("overwrite:path").asText());
- org.junit.jupiter.api.Assertions.assertEquals("wallet.internal", createdRP.get("overwrite:header.Host").asText());
- org.junit.jupiter.api.Assertions.assertEquals("$context.authorizer.claims.userId", createdRP.get("append:header.x-user-id").asText());
+ Assertions.assertEquals("HTTP_PROXY", created.get("IntegrationType").asText());
+ JsonNode createdRP = created.get("RequestParameters");
+ Assertions.assertNotNull(createdRP, "CreateIntegration response should include RequestParameters");
+ Assertions.assertEquals("/public/$request.path.proxy", createdRP.get("overwrite:path").asText());
+ Assertions.assertEquals("wallet.internal", createdRP.get("overwrite:header.Host").asText());
+ Assertions.assertEquals("$context.authorizer.claims.userId", createdRP.get("append:header.x-user-id").asText());
// Get the integration and assert RequestParameters survived persistence
String getBody = given()
@@ -332,10 +335,10 @@ class ApiGatewayV2JsonHandlerTest {
.when().post("/")
.then().statusCode(200).extract().asString();
- com.fasterxml.jackson.databind.JsonNode getRP = mapper.readTree(getBody).get("RequestParameters");
- org.junit.jupiter.api.Assertions.assertNotNull(getRP, "GetIntegration response should include RequestParameters");
- org.junit.jupiter.api.Assertions.assertEquals("/public/$request.path.proxy", getRP.get("overwrite:path").asText());
- org.junit.jupiter.api.Assertions.assertEquals("$context.authorizer.claims.userId", getRP.get("append:header.x-user-id").asText());
+ JsonNode getRP = mapper.readTree(getBody).get("RequestParameters");
+ Assertions.assertNotNull(getRP, "GetIntegration response should include RequestParameters");
+ Assertions.assertEquals("/public/$request.path.proxy", getRP.get("overwrite:path").asText());
+ Assertions.assertEquals("$context.authorizer.claims.userId", getRP.get("append:header.x-user-id").asText());
// Cleanup
given().when().delete("/v2/apis/" + localApiId).then().statusCode(204);
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageSettingsTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageSettingsTest.java
index ceb65dfd6f..5afc3965ea 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageSettingsTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageSettingsTest.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -128,8 +129,8 @@ class ApiGatewayV2StageSettingsTest {
.when().post("/v2/apis/" + apiId + "/stages")
.then().statusCode(201)
.body("defaultRouteSettings.throttlingRateLimit", equalTo(50.0f))
- .body("defaultRouteSettings.throttlingBurstLimit", org.hamcrest.Matchers.nullValue())
- .body("defaultRouteSettings.dataTraceEnabled", org.hamcrest.Matchers.nullValue());
+ .body("defaultRouteSettings.throttlingBurstLimit", Matchers.nullValue())
+ .body("defaultRouteSettings.dataTraceEnabled", Matchers.nullValue());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageTaggingTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageTaggingTest.java
index 882d39ab13..5876f1f241 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageTaggingTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/ApiGatewayV2StageTaggingTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.apigatewayv2;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -82,8 +84,8 @@ class ApiGatewayV2StageTaggingTest {
}
/** UntagResource replies 204 on AWS; accept 200 too rather than pin an unrelated detail. */
- private static org.hamcrest.Matcher<Integer> anyOf204() {
- return org.hamcrest.Matchers.anyOf(equalTo(204), equalTo(200));
+ private static Matcher<Integer> anyOf204() {
+ return Matchers.anyOf(equalTo(204), equalTo(200));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerQuerystringTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerQuerystringTest.java
index 470acdb084..8b64f8a74b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerQuerystringTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerQuerystringTest.java
@@ -21,6 +21,7 @@ import java.security.KeyPairGenerator;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
+import java.util.Arrays;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.notNullValue;
@@ -271,7 +272,7 @@ class HttpApiJwtAuthorizerQuerystringTest {
private static String base64UrlUnsigned(BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length > 1 && bytes[0] == 0) {
- bytes = java.util.Arrays.copyOfRange(bytes, 1, bytes.length);
+ bytes = Arrays.copyOfRange(bytes, 1, bytes.length);
}
return Base64Url.encode(bytes);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerScopesTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerScopesTest.java
index 6cdfa3d5cf..82033cf568 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerScopesTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpApiJwtAuthorizerScopesTest.java
@@ -22,7 +22,9 @@ import java.security.KeyPairGenerator;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
+import java.util.Arrays;
import java.util.Base64;
+import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -202,7 +204,7 @@ class HttpApiJwtAuthorizerScopesTest {
.header("Authorization", "Bearer " + signedToken(Map.of(
"iss", issuer, "aud", AUDIENCE, "exp", farFuture(),
"scope", "read write",
- "cognito:groups", java.util.List.of("admin", "poweruser"))))
+ "cognito:groups", List.of("admin", "poweruser"))))
.when().get("/execute-api/" + httpApiId + "/test/unscoped")
.then().statusCode(200)
.extract().asString();
@@ -323,7 +325,7 @@ class HttpApiJwtAuthorizerScopesTest {
private static String base64UrlUnsigned(BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length > 1 && bytes[0] == 0) {
- bytes = java.util.Arrays.copyOfRange(bytes, 1, bytes.length);
+ bytes = Arrays.copyOfRange(bytes, 1, bytes.length);
}
return Base64Url.encode(bytes);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpProxyJwtClaimsMappingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpProxyJwtClaimsMappingIntegrationTest.java
index ba663ef6e9..b4ed074100 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpProxyJwtClaimsMappingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/HttpProxyJwtClaimsMappingIntegrationTest.java
@@ -21,6 +21,7 @@ import java.security.KeyPairGenerator;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
+import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
import static io.restassured.RestAssured.given;
@@ -235,7 +236,7 @@ class HttpProxyJwtClaimsMappingIntegrationTest {
private static String base64UrlUnsigned(BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length > 1 && bytes[0] == 0) {
- bytes = java.util.Arrays.copyOfRange(bytes, 1, bytes.length);
+ bytes = Arrays.copyOfRange(bytes, 1, bytes.length);
}
return Base64Url.encode(bytes);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/JwtSignatureVerifierTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/JwtSignatureVerifierTest.java
index 69e42fc6b1..cd50751d29 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/JwtSignatureVerifierTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/JwtSignatureVerifierTest.java
@@ -37,6 +37,7 @@ import java.security.Security;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -390,7 +391,7 @@ class JwtSignatureVerifierTest {
private static String base64UrlUnsigned(BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length > 1 && bytes[0] == 0) {
- bytes = java.util.Arrays.copyOfRange(bytes, 1, bytes.length);
+ bytes = Arrays.copyOfRange(bytes, 1, bytes.length);
}
return Base64Url.encode(bytes);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/RouteAuthorizerIdResponseTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/RouteAuthorizerIdResponseTest.java
index 01defb77dc..9fb2eeea72 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/RouteAuthorizerIdResponseTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/RouteAuthorizerIdResponseTest.java
@@ -4,6 +4,8 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
@@ -107,13 +109,13 @@ class RouteAuthorizerIdResponseTest {
""".formatted(authorizerId))
.when().post("/v2/apis/" + apiId + "/routes")
.then().statusCode(201)
- .body("authorizationScopes", equalTo(java.util.List.of("orders/read", "orders/write")))
+ .body("authorizationScopes", equalTo(List.of("orders/read", "orders/write")))
.extract().path("routeId");
given()
.when().get("/v2/apis/" + apiId + "/routes/" + routeId)
.then().statusCode(200)
- .body("authorizationScopes", equalTo(java.util.List.of("orders/read", "orders/write")));
+ .body("authorizationScopes", equalTo(List.of("orders/read", "orders/write")));
given()
.contentType(ContentType.JSON)
@@ -122,7 +124,7 @@ class RouteAuthorizerIdResponseTest {
""")
.when().patch("/v2/apis/" + apiId + "/routes/" + routeId)
.then().statusCode(200)
- .body("authorizationScopes", equalTo(java.util.List.of("orders/admin")));
+ .body("authorizationScopes", equalTo(List.of("orders/admin")));
}
@Test
@@ -150,7 +152,7 @@ class RouteAuthorizerIdResponseTest {
""")
.when().post("/v2/apis/" + apiId + "/routes")
.then().statusCode(201)
- .body("authorizationScopes", equalTo(java.util.List.of("orders/read", "42")));
+ .body("authorizationScopes", equalTo(List.of("orders/read", "42")));
}
@Test
@@ -203,7 +205,7 @@ class RouteAuthorizerIdResponseTest {
given()
.when().get("/v2/apis/" + apiId + "/routes/" + routeId)
.then().statusCode(200)
- .body("authorizationScopes", equalTo(java.util.List.of("orders/read")));
+ .body("authorizationScopes", equalTo(List.of("orders/read")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketAwsHttpIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketAwsHttpIntegrationTest.java
index 744efd48d1..e3b2b88b2c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketAwsHttpIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketAwsHttpIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.apigatewayv2;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -31,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketAwsHttpIntegrationTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static final ObjectMapper MAPPER = new ObjectMapper();
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java
index 302835632b..9843179313 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionLifecycleTest.java
@@ -1,7 +1,10 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -14,6 +17,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static io.restassured.RestAssured.given;
@@ -27,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketConnectionLifecycleTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static String wsApiId;
@@ -504,7 +508,7 @@ class WebSocketConnectionLifecycleTest {
try {
wsFuture.get(60, TimeUnit.SECONDS);
fail("Expected WebSocket connection to fail with status " + expectedStatus);
- } catch (java.util.concurrent.ExecutionException e) {
+ } catch (ExecutionException e) {
// The java.net.http WebSocket client wraps the rejection in an ExecutionException
// whose cause is a java.net.http.WebSocketHandshakeException (or IOException)
Throwable cause = e.getCause();
@@ -525,12 +529,12 @@ class WebSocketConnectionLifecycleTest {
}
// Helper for Hamcrest anyOf with integers
- private static org.hamcrest.Matcher<Integer> anyOf(int... values) {
+ private static Matcher<Integer> anyOf(int... values) {
@SuppressWarnings("unchecked")
- org.hamcrest.Matcher<Integer>[] matchers = new org.hamcrest.Matcher[values.length];
+ Matcher<Integer>[] matchers = new Matcher[values.length];
for (int i = 0; i < values.length; i++) {
- matchers[i] = org.hamcrest.Matchers.equalTo(values[i]);
+ matchers[i] = Matchers.equalTo(values[i]);
}
- return org.hamcrest.Matchers.anyOf(matchers);
+ return Matchers.anyOf(matchers);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionsApiTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionsApiTest.java
index 4cf8a50bd3..d5929c7e48 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionsApiTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketConnectionsApiTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.apigatewayv2;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -27,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketConnectionsApiTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static final ObjectMapper MAPPER = new ObjectMapper();
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketLambdaAuthorizerTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketLambdaAuthorizerTest.java
index 08a078d185..572ed8be15 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketLambdaAuthorizerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketLambdaAuthorizerTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.apigatewayv2;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -14,6 +15,7 @@ import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static io.restassured.RestAssured.given;
@@ -27,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketLambdaAuthorizerTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static final ObjectMapper MAPPER = new ObjectMapper();
@@ -609,7 +611,7 @@ class WebSocketLambdaAuthorizerTest {
try {
wsFuture.get(60, TimeUnit.SECONDS);
fail("Expected WebSocket connection to fail with status " + expectedStatus);
- } catch (java.util.concurrent.ExecutionException e) {
+ } catch (ExecutionException e) {
Throwable cause = e.getCause();
assertNotNull(cause, "Expected a cause for the ExecutionException");
String message = cause.getMessage() != null ? cause.getMessage() : "";
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMessageRoutingTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMessageRoutingTest.java
index e75d164549..a84bd89983 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMessageRoutingTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMessageRoutingTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -23,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketMessageRoutingTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
// API with $request.body.action (default expression)
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMockIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMockIntegrationTest.java
index 36deb51b1e..980f5ac49f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMockIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketMockIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -12,6 +13,7 @@ import java.net.http.HttpClient;
import java.net.http.WebSocket;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import static io.restassured.RestAssured.given;
@@ -29,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketMockIntegrationTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static String wsApiId;
@@ -246,7 +248,7 @@ class WebSocketMockIntegrationTest {
try {
wsFuture.get(60, TimeUnit.SECONDS);
fail("Expected WebSocket connection to fail with status " + expectedStatus);
- } catch (java.util.concurrent.ExecutionException e) {
+ } catch (ExecutionException e) {
Throwable cause = e.getCause();
assertNotNull(cause, "Expected a cause for the ExecutionException");
String message = cause.getMessage() != null ? cause.getMessage() : "";
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketProxyEventFormatTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketProxyEventFormatTest.java
index 22ba36e68d..e5da7ba5d2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketProxyEventFormatTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketProxyEventFormatTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.apigatewayv2;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -12,6 +13,8 @@ import org.junit.jupiter.api.TestMethodOrder;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.WebSocket;
+import java.nio.ByteBuffer;
+import java.util.Base64;
import java.util.concurrent.TimeUnit;
import static io.restassured.RestAssured.given;
@@ -34,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketProxyEventFormatTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static final ObjectMapper MAPPER = new ObjectMapper();
@@ -378,7 +381,7 @@ class WebSocketProxyEventFormatTest {
// Send a binary frame
byte[] binaryData = new byte[]{0x01, 0x02, 0x03, 0x04, 0x05};
- ws.sendBinary(java.nio.ByteBuffer.wrap(binaryData), true).join();
+ ws.sendBinary(ByteBuffer.wrap(binaryData), true).join();
String response = capture.getNextMessage(15, TimeUnit.SECONDS);
assertNotNull(response, "Should receive echoed event for binary frame");
@@ -395,7 +398,7 @@ class WebSocketProxyEventFormatTest {
String body = event.get("body").asText();
assertNotNull(body, "body should not be null for binary frames");
// Decode and verify it matches the original binary data
- byte[] decoded = java.util.Base64.getDecoder().decode(body);
+ byte[] decoded = Base64.getDecoder().decode(body);
assertArrayEquals(binaryData, decoded,
"Decoded body should match the original binary data");
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketRouteResponseTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketRouteResponseTest.java
index e6f0ca0305..af55c6b1f6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketRouteResponseTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketRouteResponseTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.MethodOrderer;
@@ -24,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketRouteResponseTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static String wsApiId;
diff --git a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketStageVariablesTest.java b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketStageVariablesTest.java
index 3dc91fff09..d8708c1806 100644
--- a/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketStageVariablesTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/apigatewayv2/WebSocketStageVariablesTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.apigatewayv2;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
@@ -28,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.*;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class WebSocketStageVariablesTest {
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
private static String wsApiId;
diff --git a/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java
index 6f6eb49c0c..195b3e17a6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appintegrations/AppIntegrationsIntegrationTest.java
@@ -8,6 +8,9 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@@ -265,8 +268,8 @@ class AppIntegrationsIntegrationTest {
.body("Description", equalTo("salesforce pull"))
.body("ScheduleConfiguration.FirstExecutionFrom", equalTo("1439788800000"));
- String encodedArn = java.net.URLEncoder.encode(dataIntegrationArn,
- java.nio.charset.StandardCharsets.UTF_8);
+ String encodedArn = URLEncoder.encode(dataIntegrationArn,
+ StandardCharsets.UTF_8);
given()
.urlEncodingEnabled(false)
.when()
diff --git a/src/test/java/io/github/hectorvent/floci/services/applicationautoscaling/ApplicationAutoScalingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/applicationautoscaling/ApplicationAutoScalingIntegrationTest.java
index 93508cf429..e7d3a8fed0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/applicationautoscaling/ApplicationAutoScalingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/applicationautoscaling/ApplicationAutoScalingIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.applicationautoscaling;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -45,7 +46,7 @@ class ApplicationAutoScalingIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
- private static io.restassured.specification.RequestSpecification call(String action) {
+ private static RequestSpecification call(String action) {
return given().header("X-Amz-Target", TARGET_PREFIX + action).contentType(CONTENT_TYPE);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncAuthIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncAuthIntegrationTest.java
index c4bb323e1d..8637afba65 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncAuthIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncAuthIntegrationTest.java
@@ -21,6 +21,7 @@ import java.net.URI;
import java.time.Duration;
import java.time.Instant;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -220,7 +221,7 @@ class AppSyncAuthIntegrationTest {
.body("data.hello", nullValue())
.body("errors[0].errorType", equalTo("Unauthorized"))
.body("errors[0].message", equalTo("Not Authorized to access hello on type Query"))
- .body("errors[0].path", equalTo(java.util.List.of("hello")));
+ .body("errors[0].path", equalTo(List.of("hello")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncIntegrationTest.java
index a15db838ff..0a8e1aa5cd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncIntegrationTest.java
@@ -1,5 +1,7 @@
package io.github.hectorvent.floci.services.appsync;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.storage.StorageBackend;
import io.github.hectorvent.floci.services.appsync.model.SchemaCreationStatus;
import io.github.hectorvent.floci.services.appsync.model.SchemaCreationStatusType;
@@ -7,6 +9,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -14,6 +17,8 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import java.time.Duration;
+import java.util.List;
+import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.awaitility.Awaitility.await;
@@ -33,7 +38,7 @@ class AppSyncIntegrationTest {
private static String apiId;
private static String keyId;
- @jakarta.inject.Inject
+ @Inject
StorageBackend<String, SchemaCreationStatus> schemaStatusStore;
@BeforeAll
@@ -49,7 +54,7 @@ class AppSyncIntegrationTest {
* returns PROCESSING. Use {@link #getTerminalStatus(String)} if only
* the status string is needed.
*/
- private static java.util.Map<String, Object> awaitSchemaTerminal(String apiId) {
+ private static Map<String, Object> awaitSchemaTerminal(String apiId) {
return await().atMost(Duration.ofSeconds(10))
.pollInterval(Duration.ofMillis(25))
.until(() -> given()
@@ -78,7 +83,7 @@ class AppSyncIntegrationTest {
* error surfaces in the polled FAILED status.
*/
@SuppressWarnings("unchecked")
- private static java.util.Map<String, Object> postSchemaAndAwaitFailed(String apiId, String body) {
+ private static Map<String, Object> postSchemaAndAwaitFailed(String apiId, String body) {
given()
.header("Authorization", AUTH)
.contentType("application/json")
@@ -89,14 +94,14 @@ class AppSyncIntegrationTest {
.statusCode(200)
.body("status", equalTo("PROCESSING"));
- java.util.Map<String, Object> full = awaitSchemaTerminal(apiId);
+ Map<String, Object> full = awaitSchemaTerminal(apiId);
assertThat(full.get("status"), equalTo("FAILED"));
String detailsJson = (String) full.get("details");
assertThat(detailsJson, notNullValue());
try {
- return new com.fasterxml.jackson.databind.ObjectMapper()
- .readValue(detailsJson, java.util.Map.class);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ return new ObjectMapper()
+ .readValue(detailsJson, Map.class);
+ } catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
@@ -2687,7 +2692,7 @@ class AppSyncIntegrationTest {
.then()
.statusCode(200)
.body("status", equalTo("PROCESSING"));
- java.util.Map<String, Object> body = awaitSchemaTerminal(apiId);
+ Map<String, Object> body = awaitSchemaTerminal(apiId);
assertThat(body.get("status"), equalTo("FAILED"));
String details = (String) body.get("details");
assertThat(details, notNullValue());
@@ -2910,14 +2915,14 @@ class AppSyncIntegrationTest {
.statusCode(200)
.extract().path("graphqlApi.apiId");
- java.util.Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
+ Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
{
"definition": "type Query { hello: String } directive @unknownDirective on FIELD_DEFINITION"
}
""");
assertThat(ext.get("reason"), equalTo("CODE_ERROR"));
- java.util.List<java.util.Map<String, Object>> codeErrors =
- (java.util.List<java.util.Map<String, Object>>) ((java.util.Map<?, ?>) ext.get("detail")).get("codeErrors");
+ List<Map<String, Object>> codeErrors =
+ (List<Map<String, Object>>) ((Map<?, ?>) ext.get("detail")).get("codeErrors");
assertThat(codeErrors.get(0).get("errorType"), equalTo("VALIDATION_ERROR"));
assertThat((String) codeErrors.get(0).get("value"), containsString("Unknown directive"));
@@ -2927,18 +2932,18 @@ class AppSyncIntegrationTest {
@Test
@Order(700)
void startSchemaCreation_syntaxError_returnsExtendedBadRequest() {
- java.util.Map<String, Object> ext = postSchemaAndAwaitFailed(apiId, """
+ Map<String, Object> ext = postSchemaAndAwaitFailed(apiId, """
{
"definition": "type Query { invalid syntax!!! }"
}
""");
assertThat(ext.get("reason"), equalTo("CODE_ERROR"));
- java.util.List<java.util.Map<String, Object>> codeErrors =
- (java.util.List<java.util.Map<String, Object>>) ((java.util.Map<?, ?>) ext.get("detail")).get("codeErrors");
+ List<Map<String, Object>> codeErrors =
+ (List<Map<String, Object>>) ((Map<?, ?>) ext.get("detail")).get("codeErrors");
assertThat(codeErrors.size(), greaterThanOrEqualTo(1));
assertThat(codeErrors.get(0).get("errorType"), equalTo("PARSER_ERROR"));
assertThat(codeErrors.get(0).get("value"), notNullValue());
- java.util.Map<String, Object> location = (java.util.Map<String, Object>) codeErrors.get(0).get("location");
+ Map<String, Object> location = (Map<String, Object>) codeErrors.get(0).get("location");
assertThat(location, notNullValue());
assertThat(location.get("line"), notNullValue());
assertThat(location.get("column"), notNullValue());
@@ -2960,17 +2965,17 @@ class AppSyncIntegrationTest {
.statusCode(200)
.extract().path("graphqlApi.apiId");
- java.util.Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
+ Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
{
"definition": "type Query { hello: NonExistentType }"
}
""");
assertThat(ext.get("reason"), equalTo("CODE_ERROR"));
- java.util.List<java.util.Map<String, Object>> codeErrors =
- (java.util.List<java.util.Map<String, Object>>) ((java.util.Map<?, ?>) ext.get("detail")).get("codeErrors");
+ List<Map<String, Object>> codeErrors =
+ (List<Map<String, Object>>) ((Map<?, ?>) ext.get("detail")).get("codeErrors");
assertThat(codeErrors.get(0).get("errorType"), equalTo("VALIDATION_ERROR"));
assertThat((String) codeErrors.get(0).get("value"), containsString("NonExistentType"));
- java.util.Map<String, Object> location = (java.util.Map<String, Object>) codeErrors.get(0).get("location");
+ Map<String, Object> location = (Map<String, Object>) codeErrors.get(0).get("location");
assertThat(location.get("line"), notNullValue());
assertThat(location.get("column"), notNullValue());
assertThat(location.get("span"), equalTo(-1));
@@ -2993,17 +2998,17 @@ class AppSyncIntegrationTest {
.statusCode(200)
.extract().path("graphqlApi.apiId");
- java.util.Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
+ Map<String, Object> ext = postSchemaAndAwaitFailed(tempApiId, """
{
"definition": "type Query { hello: String @unknownDirective }"
}
""");
assertThat(ext.get("reason"), equalTo("CODE_ERROR"));
- java.util.List<java.util.Map<String, Object>> codeErrors =
- (java.util.List<java.util.Map<String, Object>>) ((java.util.Map<?, ?>) ext.get("detail")).get("codeErrors");
+ List<Map<String, Object>> codeErrors =
+ (List<Map<String, Object>>) ((Map<?, ?>) ext.get("detail")).get("codeErrors");
assertThat(codeErrors.get(0).get("errorType"), equalTo("VALIDATION_ERROR"));
assertThat((String) codeErrors.get(0).get("value"), containsString("Unknown directive: @unknownDirective"));
- java.util.Map<String, Object> location = (java.util.Map<String, Object>) codeErrors.get(0).get("location");
+ Map<String, Object> location = (Map<String, Object>) codeErrors.get(0).get("location");
assertThat(location.get("span"), equalTo(-1));
given().header("Authorization", AUTH).delete("/v1/apis/" + tempApiId).then().statusCode(204);
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncJsResolverDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncJsResolverDockerIntegrationTest.java
index 9a82594573..02bc6ceff1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncJsResolverDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncJsResolverDockerIntegrationTest.java
@@ -4,6 +4,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -366,7 +367,7 @@ class AppSyncJsResolverDockerIntegrationTest {
// ── Helpers ──────────────────────────────────────────────────────────────
- private io.restassured.response.ValidatableResponse query(String graphql) {
+ private ValidatableResponse query(String graphql) {
return given()
.header("x-api-key", apiKey)
.contentType("application/json")
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncServiceTest.java
index f207e09b2f..2d3c59fc3f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/AppSyncServiceTest.java
@@ -21,6 +21,8 @@ import io.github.hectorvent.floci.services.appsync.model.SchemaCreationStatus;
import jakarta.enterprise.inject.Instance;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
import java.time.Clock;
import java.time.Duration;
@@ -494,8 +496,8 @@ class AppSyncServiceTest {
* {@code arn:aws:appsync:} meant refusing to tag an API using the exact ARN just returned.
* Botocore spells the literal, but this emulator has to accept its own output.
*/
- @org.junit.jupiter.params.ParameterizedTest
- @org.junit.jupiter.params.provider.CsvSource({
+ @ParameterizedTest
+ @CsvSource({
"us-east-1, aws",
"us-gov-west-1, aws-us-gov",
"cn-north-1, aws-cn",
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlContextTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlContextTest.java
index f4c7eac5fc..e452706d96 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlContextTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlContextTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.appsync.graphql;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.services.appsync.graphql.auth.AppSyncAuth;
import org.junit.jupiter.api.Test;
@@ -10,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
class AppSyncVtlContextTest {
- private final com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ private final ObjectMapper mapper = new ObjectMapper();
@Test
void nullIdentityStaysNullNotEmptyMap() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlEngineTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlEngineTest.java
index fa0fee3124..ce73512e9f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlEngineTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncVtlEngineTest.java
@@ -9,6 +9,7 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.util.*;
+import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.*;
@@ -29,7 +30,7 @@ class AppSyncVtlEngineTest {
);
}
- private AppSyncVtlContext ctxWith(java.util.function.Consumer<AppSyncVtlContext.Builder> customizer) {
+ private AppSyncVtlContext ctxWith(Consumer<AppSyncVtlContext.Builder> customizer) {
AppSyncVtlContext.Builder builder = AppSyncVtlContext.builder(objectMapper);
customizer.accept(builder);
return builder.build();
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/AuthMiddlewareTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/AuthMiddlewareTest.java
index f781602477..973ea05f82 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/AuthMiddlewareTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/AuthMiddlewareTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -114,7 +115,7 @@ class AuthMiddlewareTest {
"sub", "s",
"iss", "https://cognito-idp.us-east-1.amazonaws.com/pool",
"exp", 9999999999L);
- String jwt = JwtClaimsDecoder.encode(new java.util.HashMap<>(claims), new ObjectMapper());
+ String jwt = JwtClaimsDecoder.encode(new HashMap<>(claims), new ObjectMapper());
when(cognitoAuthValidator.matchesProvider(any(), any())).thenReturn(true);
when(cognitoAuthValidator.validate(any(), any(), any())).thenReturn(Map.of("sub", "s"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/IamAuthValidatorTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/IamAuthValidatorTest.java
index 2eb8c0fbc5..7a91c76e6c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/IamAuthValidatorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/IamAuthValidatorTest.java
@@ -10,6 +10,8 @@ import io.github.hectorvent.floci.testutil.AppSyncRequestSigner;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@@ -301,8 +303,8 @@ class IamAuthValidatorTest {
* A pinned {@code aws} here meant a GovCloud policy naming its own API never matched and the
* request was denied with nothing saying why.
*/
- @org.junit.jupiter.params.ParameterizedTest
- @org.junit.jupiter.params.provider.CsvSource({
+ @ParameterizedTest
+ @CsvSource({
"us-east-1, arn:aws:appsync:",
"us-gov-west-1, arn:aws-us-gov:appsync:",
"cn-north-1, arn:aws-cn:appsync:",
@@ -385,7 +387,7 @@ class IamAuthValidatorTest {
*/
private static Map<String, String> signedWithSessionToken(String accessKeyId, String secretKey, String token)
throws Exception {
- Map<String, String> signed = new java.util.LinkedHashMap<>(AppSyncRequestSigner.signedHeaders(
+ Map<String, String> signed = new LinkedHashMap<>(AppSyncRequestSigner.signedHeaders(
"api-1", HOST, BODY, accessKeyId, secretKey, REGION, NOW));
signed.put("X-Amz-Security-Token", token);
return signed;
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerCacheTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerCacheTest.java
index 213bbaf8b7..56610af014 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerCacheTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/LambdaAuthorizerCacheTest.java
@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
+import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.List;
@@ -144,7 +145,7 @@ class LambdaAuthorizerCacheTest {
instant = instant.plus(duration);
}
@Override public ZoneOffset getZone() { return ZoneOffset.UTC; }
- @Override public Clock withZone(java.time.ZoneId zone) { return this; }
+ @Override public Clock withZone(ZoneId zone) { return this; }
@Override public Instant instant() { return instant; }
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/OidcAuthValidatorTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/OidcAuthValidatorTest.java
index bc49630dbe..56f2cb0503 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/OidcAuthValidatorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/auth/OidcAuthValidatorTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.appsync.graphql.auth;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.Base64Url;
@@ -82,12 +83,12 @@ class OidcAuthValidatorTest {
server.stop(0);
}
- private void discovery(com.sun.net.httpserver.HttpExchange exchange) throws IOException {
+ private void discovery(HttpExchange exchange) throws IOException {
String body = "{\"issuer\":\"" + issuer + "\",\"jwks_uri\":\"" + issuer + "/jwks\"}";
respond(exchange, body);
}
- private void jwks(com.sun.net.httpserver.HttpExchange exchange) throws IOException {
+ private void jwks(HttpExchange exchange) throws IOException {
String n = base64UrlUnsigned(publicKey.getModulus());
String e = base64UrlUnsigned(publicKey.getPublicExponent());
String body = "{\"keys\":[{\"kty\":\"RSA\",\"kid\":\"" + KEY_ID + "\",\"alg\":\"RS256\",\"use\":\"sig\","
@@ -95,7 +96,7 @@ class OidcAuthValidatorTest {
respond(exchange, body);
}
- private static void respond(com.sun.net.httpserver.HttpExchange exchange, String body) throws IOException {
+ private static void respond(HttpExchange exchange, String body) throws IOException {
byte[] bytes = body.getBytes(StandardCharsets.UTF_8);
exchange.getResponseHeaders().add("Content-Type", "application/json");
exchange.sendResponseHeaders(200, bytes.length);
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/DynamoDbDataSourceInvokerTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/DynamoDbDataSourceInvokerTest.java
index e69fbb5a49..f08c33ebbd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/DynamoDbDataSourceInvokerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/DynamoDbDataSourceInvokerTest.java
@@ -9,7 +9,9 @@ import io.github.hectorvent.floci.services.dynamodb.DynamoDbJsonHandler;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -47,7 +49,7 @@ class DynamoDbDataSourceInvokerTest {
private JsonNode captureRequest(String action) throws Exception {
ArgumentCaptor<JsonNode> captor = ArgumentCaptor.forClass(JsonNode.class);
- org.mockito.Mockito.verify(handler).handle(eq(action), captor.capture(), anyString());
+ Mockito.verify(handler).handle(eq(action), captor.capture(), anyString());
return captor.getValue();
}
@@ -187,7 +189,7 @@ class DynamoDbDataSourceInvokerTest {
"""), "eu-west-1");
String nextToken = (String) first.get("nextToken");
- org.mockito.Mockito.reset(handler);
+ Mockito.reset(handler);
answers("{\"Items\": []}");
invoker.invoke(dataSource(), request("""
{"operation": "Scan", "nextToken": "%s"}
@@ -227,7 +229,7 @@ class DynamoDbDataSourceInvokerTest {
/** Drops the null-valued entries a NULL attribute produces, for a tidy comparison. */
private Object stripNulls(Object value) {
if (value instanceof Map<?, ?> map) {
- java.util.Map<Object, Object> copy = new java.util.LinkedHashMap<>();
+ Map<Object, Object> copy = new LinkedHashMap<>();
map.forEach((k, v) -> {
if (v != null) {
copy.put(k, stripNulls(v));
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/RelationalDataSourceInvokerTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/RelationalDataSourceInvokerTest.java
index 070268f6e7..af4e3f9dd8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/RelationalDataSourceInvokerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/datasource/RelationalDataSourceInvokerTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -180,7 +181,7 @@ class RelationalDataSourceInvokerTest {
"variableTypeHintMap", Map.of(":v0", "TIMESTAMP")), "eu-west-1");
JsonNode parameters = captureRequest().path("parameters");
- Map<String, JsonNode> byName = new java.util.LinkedHashMap<>();
+ Map<String, JsonNode> byName = new LinkedHashMap<>();
parameters.forEach(parameter -> byName.put(parameter.path("name").asText(), parameter));
// Without the hint the value binds as text and PostgreSQL refuses the comparison outright:
// "operator does not exist: timestamp with time zone >= character varying".
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/js/NodeAppSyncJsRuntimeTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/js/NodeAppSyncJsRuntimeTest.java
index 07eb5b8aa2..b95b386d95 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/js/NodeAppSyncJsRuntimeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/js/NodeAppSyncJsRuntimeTest.java
@@ -16,6 +16,8 @@ import io.github.hectorvent.floci.core.common.docker.ContainerSpec;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Answers;
+import org.mockito.Mockito;
import java.io.IOException;
import java.io.InputStream;
@@ -167,7 +169,7 @@ class NodeAppSyncJsRuntimeTest {
// A fluent builder that yields a spec, and a lifecycle manager that hands out a fresh
// container each time, pointed at the stub whose /evaluate always fails.
ContainerBuilder.Builder builder =
- mock(ContainerBuilder.Builder.class, withSettings().defaultAnswer(org.mockito.Answers.RETURNS_SELF));
+ mock(ContainerBuilder.Builder.class, withSettings().defaultAnswer(Answers.RETURNS_SELF));
when(containerBuilder.newContainer(anyString())).thenReturn(builder);
when(builder.build()).thenReturn(new ContainerSpec("test-image"));
@@ -180,7 +182,7 @@ class NodeAppSyncJsRuntimeTest {
return new ContainerInfo(id, Map.of(4600,
new EndpointInfo("127.0.0.1", server.getAddress().getPort())));
});
- org.mockito.Mockito.doAnswer(invocation -> {
+ Mockito.doAnswer(invocation -> {
stopped.add(invocation.getArgument(0));
return null;
}).when(lifecycleManager).stopAndRemove(anyString(), any());
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/resolver/ResolverCallbackResourceTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/resolver/ResolverCallbackResourceTest.java
index 0451f11a49..cb9e3b4d70 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/resolver/ResolverCallbackResourceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/resolver/ResolverCallbackResourceTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.services.appsync.model.Resolver;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
import java.util.List;
import java.util.Map;
@@ -89,8 +90,8 @@ class ResolverCallbackResourceTest {
resource.resolve("Bearer " + session.token(), body(invocation("0", "Query", "getMessages")));
- org.mockito.ArgumentCaptor<ResolverInvocation> captor =
- org.mockito.ArgumentCaptor.forClass(ResolverInvocation.class);
+ ArgumentCaptor<ResolverInvocation> captor =
+ ArgumentCaptor.forClass(ResolverInvocation.class);
verify(executor).execute(eq(resolver), captor.capture());
ResolverInvocation invocation = captor.getValue();
assertEquals(API_ID, invocation.apiId());
@@ -120,8 +121,8 @@ class ResolverCallbackResourceTest {
// an absent argument to a resolver reading ctx.args. Copying the map with Map.copyOf threw
// on the null, which answered 500 and failed every field in the batch, not just this one.
assertEquals("ok", results.get(0).get("data"));
- org.mockito.ArgumentCaptor<ResolverInvocation> captor =
- org.mockito.ArgumentCaptor.forClass(ResolverInvocation.class);
+ ArgumentCaptor<ResolverInvocation> captor =
+ ArgumentCaptor.forClass(ResolverInvocation.class);
verify(executor).execute(eq(resolver), captor.capture());
assertTrue(captor.getValue().arguments().containsKey("nextToken"));
assertNull(captor.getValue().arguments().get("nextToken"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/AppSyncUtilTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/AppSyncUtilTest.java
index 9a8ef1544a..ad7cc26b9a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/AppSyncUtilTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/AppSyncUtilTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -543,7 +544,7 @@ class AppSyncUtilTest {
@Test
void appendError_withErrorInfo() {
- List<Map<String, Object>> errorList = new java.util.ArrayList<>();
+ List<Map<String, Object>> errorList = new ArrayList<>();
util.setErrorList(errorList);
Object data = Map.of("k", "v");
Object info = Map.of("info", "detail");
diff --git a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/TransformUtilTest.java b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/TransformUtilTest.java
index adeed50039..0855f4763f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/TransformUtilTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/appsync/graphql/util/TransformUtilTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -89,7 +90,7 @@ class TransformUtilTest {
@Test
void toSubscriptionFilter_withFilterKeys() {
Map<String, Object> input = Map.of("filter", Map.of("field", "value"));
- Map<String, Object> result = transform.toSubscriptionFilter(input, java.util.List.of("key1"));
+ Map<String, Object> result = transform.toSubscriptionFilter(input, List.of("key1"));
assertThat(result, hasKey("filterKeys"));
}
@@ -97,7 +98,7 @@ class TransformUtilTest {
void toSubscriptionFilter_withHeaderOverrides() {
Map<String, Object> input = Map.of("filter", Map.of("field", "value"));
Map<String, Object> result = transform.toSubscriptionFilter(
- input, java.util.List.of("key1"), Map.of("header", "value"));
+ input, List.of("key1"), Map.of("header", "value"));
assertThat(result, hasKey("headerOverrides"));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/aps/ApsControllerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/aps/ApsControllerIntegrationTest.java
index e17d514f13..5bf4f64b13 100644
--- a/src/test/java/io/github/hectorvent/floci/services/aps/ApsControllerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/aps/ApsControllerIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.aps;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
@@ -225,7 +226,7 @@ class ApsControllerIntegrationTest {
.then()
.statusCode(200)
.body("tags.env", equalTo("test"))
- .body("tags", not(org.hamcrest.Matchers.hasKey("team")));
+ .body("tags", not(Matchers.hasKey("team")));
}
private static final String RULES = Base64.getEncoder().encodeToString(
diff --git a/src/test/java/io/github/hectorvent/floci/services/athena/AthenaCreateWorkGroupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/athena/AthenaCreateWorkGroupIntegrationTest.java
index db67e3817d..e8d4a30a19 100644
--- a/src/test/java/io/github/hectorvent/floci/services/athena/AthenaCreateWorkGroupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/athena/AthenaCreateWorkGroupIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.athena;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -37,7 +38,7 @@ class AthenaCreateWorkGroupIntegrationTest {
.statusCode(200)
.extract().asString();
- org.junit.jupiter.api.Assertions.assertEquals("{}", responseBody);
+ Assertions.assertEquals("{}", responseBody);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/athena/GlueViewDdlBuilderTest.java b/src/test/java/io/github/hectorvent/floci/services/athena/GlueViewDdlBuilderTest.java
index 4461eabb52..e88f22e36a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/athena/GlueViewDdlBuilderTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/athena/GlueViewDdlBuilderTest.java
@@ -7,10 +7,12 @@ import io.github.hectorvent.floci.services.glue.model.Column;
import io.github.hectorvent.floci.services.glue.model.Database;
import io.github.hectorvent.floci.services.glue.model.StorageDescriptor;
import io.github.hectorvent.floci.services.glue.model.Table;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -254,7 +256,7 @@ class GlueViewDdlBuilderTest {
Database nullNameDb = createDatabase(null);
Database blankNameDb = createDatabase(" ");
Database validDb = createDatabase("valid_db");
- when(glueService.getDatabases()).thenReturn(java.util.Arrays.asList(null, nullNameDb, blankNameDb, validDb));
+ when(glueService.getDatabases()).thenReturn(Arrays.asList(null, nullNameDb, blankNameDb, validDb));
when(glueService.getTables("valid_db")).thenReturn(List.of());
String ddl = builder.build(null);
@@ -266,7 +268,7 @@ class GlueViewDdlBuilderTest {
@Test
void testGetDatabasesExceptionPropagates() {
when(glueService.getDatabases()).thenThrow(new RuntimeException("Glue failure"));
- org.junit.jupiter.api.Assertions.assertThrows(RuntimeException.class, () -> builder.build(null));
+ Assertions.assertThrows(RuntimeException.class, () -> builder.build(null));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandlerTest.java
index 0423f4408e..a0a83b7027 100644
--- a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingQueryHandlerTest.java
@@ -8,6 +8,7 @@ import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.Test;
import java.util.List;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -39,7 +40,7 @@ class AutoScalingQueryHandlerTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(), Map.of(), AsgOptionalFields.none());
AutoScalingQueryHandler handler = new AutoScalingQueryHandler(service);
MultivaluedHashMap<String, String> startParams = new MultivaluedHashMap<>();
@@ -104,8 +105,8 @@ class AutoScalingQueryHandlerTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(),
- java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(),
+ Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-original");
instance.setAvailabilityZone("us-east-1a");
@@ -160,7 +161,7 @@ class AutoScalingQueryHandlerTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-current");
instance.setAvailabilityZone("us-east-1a");
@@ -193,7 +194,7 @@ class AutoScalingQueryHandlerTest {
service.regionResolver = new RegionResolver(REGION, "000000000000");
service.createAutoScalingGroup(REGION, "protected-asg", null, "lt", null, "1", null,
0, 2, 1, 300, List.of("us-east-1a"), List.of(), List.of(), List.of(),
- "EC2", 0, List.of("Default"), java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ "EC2", 0, List.of("Default"), Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-protected");
instance.setLifecycleState("InService");
@@ -220,7 +221,7 @@ class AutoScalingQueryHandlerTest {
service.regionResolver = new RegionResolver(REGION, "000000000000");
service.createAutoScalingGroup(REGION, "health-asg", null, "lt", null, "1", null,
0, 2, 1, 300, List.of("us-east-1a"), List.of(), List.of(), List.of(),
- "EC2", 0, List.of("Default"), java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ "EC2", 0, List.of("Default"), Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-unhealthy");
instance.setLifecycleState("InService");
@@ -246,7 +247,7 @@ class AutoScalingQueryHandlerTest {
service.regionResolver = new RegionResolver(REGION, "000000000000");
service.createAutoScalingGroup(REGION, "no-protection-flag-asg", null, "lt", null, "1", null,
0, 2, 1, 300, List.of("us-east-1a"), List.of(), List.of(), List.of(),
- "EC2", 0, List.of("Default"), java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ "EC2", 0, List.of("Default"), Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-flagless");
instance.setLifecycleState("InService");
@@ -275,7 +276,7 @@ class AutoScalingQueryHandlerTest {
service.regionResolver = new RegionResolver(REGION, "000000000000");
service.createAutoScalingGroup(REGION, "malformed-flag-asg", null, "lt", null, "1", null,
0, 2, 1, 300, List.of("us-east-1a"), List.of(), List.of(), List.of(),
- "EC2", 0, List.of("Default"), java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ "EC2", 0, List.of("Default"), Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-malformed");
instance.setLifecycleState("InService");
@@ -303,7 +304,7 @@ class AutoScalingQueryHandlerTest {
service.regionResolver = new RegionResolver(REGION, "000000000000");
service.createAutoScalingGroup(REGION, "grace-asg", null, "lt", null, "1", null,
0, 2, 1, 300, List.of("us-east-1a"), List.of(), List.of(), List.of(),
- "EC2", 0, List.of("Default"), java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ "EC2", 0, List.of("Default"), Map.of(), Map.of(), AsgOptionalFields.none());
AsgInstance instance = new AsgInstance();
instance.setInstanceId("i-grace");
instance.setLifecycleState("InService");
@@ -344,7 +345,7 @@ class AutoScalingQueryHandlerTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(), Map.of(), AsgOptionalFields.none());
AutoScalingQueryHandler handler = new AutoScalingQueryHandler(service);
MultivaluedHashMap<String, String> putParams = new MultivaluedHashMap<>();
diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingReconcilerTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingReconcilerTest.java
index 42aded3cc0..d4328a10f0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingReconcilerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingReconcilerTest.java
@@ -25,6 +25,7 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import java.util.List;
import java.util.Map;
@@ -626,23 +627,23 @@ class AutoScalingReconcilerTest {
assertEquals("i-pending", asg.getInstances().getFirst().getInstanceId());
verify(ec2Service, never()).runInstances(
eq("us-east-1"),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.anyInt(),
- org.mockito.ArgumentMatchers.anyInt(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
- org.mockito.ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.anyInt(),
+ ArgumentMatchers.anyInt(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
+ ArgumentMatchers.any(),
isNull(), eq(0), isNull(), isNull(), isNull(), any(),
- org.mockito.ArgumentMatchers.anyBoolean(),
- org.mockito.ArgumentMatchers.isNull(),
- org.mockito.ArgumentMatchers.isNull(),
- org.mockito.ArgumentMatchers.any(), eq(false), isNull(), isNull());
+ ArgumentMatchers.anyBoolean(),
+ ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(),
+ ArgumentMatchers.any(), eq(false), isNull(), isNull());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java
index 828c323c80..e549402217 100644
--- a/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/autoscaling/AutoScalingServiceTest.java
@@ -82,7 +82,7 @@ class AutoScalingServiceTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(), Map.of(), AsgOptionalFields.none());
}
@Test
@@ -313,7 +313,7 @@ class AutoScalingServiceTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none()));
+ Map.of(), Map.of(), AsgOptionalFields.none()));
assertEquals("ValidationError", error.getErrorCode());
assertEquals(AutoScalingService.MISSING_LAUNCH_TEMPLATE_IMAGE_ID_MESSAGE, error.getMessage());
@@ -417,7 +417,7 @@ class AutoScalingServiceTest {
.thenReturn(source.getIamInstanceProfileArn());
Reservation reservation = new Reservation();
reservation.getInstances().add(source);
- when(ec2Service.describeInstances(REGION, List.of("i-1234567890abcdef0"), java.util.Map.of()))
+ when(ec2Service.describeInstances(REGION, List.of("i-1234567890abcdef0"), Map.of()))
.thenReturn(List.of(reservation));
LaunchConfiguration launchConfiguration = service.createLaunchConfiguration(REGION,
@@ -517,7 +517,7 @@ class AutoScalingServiceTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none()));
+ Map.of(), Map.of(), AsgOptionalFields.none()));
assertEquals("ValidationError", error.getErrorCode());
assertEquals(AutoScalingService.INVALID_LAUNCH_TEMPLATE_MESSAGE, error.getMessage());
@@ -934,7 +934,7 @@ class AutoScalingServiceTest {
"EC2",
0,
List.of("Default"),
- java.util.Map.of(), java.util.Map.of(), AsgOptionalFields.none());
+ Map.of(), Map.of(), AsgOptionalFields.none());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/batch/BatchIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/batch/BatchIntegrationTest.java
index 65389a0b43..2e2d762f85 100644
--- a/src/test/java/io/github/hectorvent/floci/services/batch/BatchIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/batch/BatchIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.batch;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import java.util.Map;
@@ -807,7 +808,7 @@ class BatchIntegrationTest {
.header("X-Amzn-Errortype", "ClientException");
}
- private static io.restassured.specification.RequestSpecification givenJson(String body) {
+ private static RequestSpecification givenJson(String body) {
return given()
.header("Authorization", AUTH)
.contentType("application/json")
diff --git a/src/test/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorIntegrationTest.java
index d953a72d86..38780571aa 100644
--- a/src/test/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/bcmpricingcalculator/BcmPricingCalculatorIntegrationTest.java
@@ -2,9 +2,13 @@ package io.github.hectorvent.floci.services.bcmpricingcalculator;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -65,7 +69,7 @@ class BcmPricingCalculatorIntegrationTest {
.body(body).when().post("/").then().statusCode(200).extract().path("id");
String second = given().contentType(CONTENT_TYPE).header("X-Amz-Target", TARGET + "CreateWorkloadEstimate")
.body(body).when().post("/").then().statusCode(200).extract().path("id");
- org.junit.jupiter.api.Assertions.assertEquals(first, second);
+ Assertions.assertEquals(first, second);
}
@Test
void tokenConflictAndIdempotentDeleteMatchAwsContract() {
@@ -101,17 +105,17 @@ class BcmPricingCalculatorIntegrationTest {
@Test
void createAcceptsUpToTwoHundredTagsAndRejectsMore() {
- java.util.Map<String, String> tags = new java.util.LinkedHashMap<>();
+ Map<String, String> tags = new LinkedHashMap<>();
for (int i = 0; i < 200; i++) {
tags.put("tag" + i, "value");
}
given().contentType(CONTENT_TYPE).header("X-Amz-Target", TARGET + "CreateWorkloadEstimate")
- .body(java.util.Map.of("name", "two-hundred-tags", "tags", tags))
+ .body(Map.of("name", "two-hundred-tags", "tags", tags))
.when().post("/").then().statusCode(200);
tags.put("tag200", "value");
given().contentType(CONTENT_TYPE).header("X-Amz-Target", TARGET + "CreateWorkloadEstimate")
- .body(java.util.Map.of("name", "too-many-tags", "tags", tags))
+ .body(Map.of("name", "too-many-tags", "tags", tags))
.when().post("/").then().statusCode(400)
.body("__type", containsString("ValidationException"));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/bedrock/BedrockIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/bedrock/BedrockIntegrationTest.java
index 0b21283744..6bc569b8bb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/bedrock/BedrockIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/bedrock/BedrockIntegrationTest.java
@@ -10,6 +10,9 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@@ -105,7 +108,7 @@ class BedrockIntegrationTest {
@Test
@Order(3)
void getGuardrailByArnResolvesTheSameResource() {
- String encodedArn = java.net.URLEncoder.encode(guardrailArn, java.nio.charset.StandardCharsets.UTF_8);
+ String encodedArn = URLEncoder.encode(guardrailArn, StandardCharsets.UTF_8);
given()
.urlEncodingEnabled(false)
.when()
diff --git a/src/test/java/io/github/hectorvent/floci/services/bedrockagentcore/BedrockAgentCoreInvokeIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/bedrockagentcore/BedrockAgentCoreInvokeIntegrationTest.java
index d81a104632..4591de0920 100644
--- a/src/test/java/io/github/hectorvent/floci/services/bedrockagentcore/BedrockAgentCoreInvokeIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/bedrockagentcore/BedrockAgentCoreInvokeIntegrationTest.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.bedrockagentcore;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
+import java.util.Arrays;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
@@ -29,7 +31,7 @@ class BedrockAgentCoreInvokeIntegrationTest {
@Test
void invokeAcceptsLargeUnparsedPayload() {
byte[] big = new byte[1_000_000];
- java.util.Arrays.fill(big, (byte) 'x');
+ Arrays.fill(big, (byte) 'x');
given()
.contentType("application/octet-stream")
.body(big)
diff --git a/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyIntegrationTest.java
index 76c65e9502..7196d53098 100644
--- a/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockProxyIntegrationTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.testing.BedrockProxyBackendProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -780,9 +781,9 @@ class BedrockProxyIntegrationTest {
.post("/model/" + MAPPED_MODEL_ID + "/converse")
.then()
.statusCode(424)
- .body("message", org.hamcrest.Matchers.allOf(
- org.hamcrest.Matchers.containsString("…"),
- org.hamcrest.Matchers.not(org.hamcrest.Matchers.containsString("x".repeat(1000)))));
+ .body("message", Matchers.allOf(
+ Matchers.containsString("…"),
+ Matchers.not(Matchers.containsString("x".repeat(1000)))));
}
@Test
@@ -1214,7 +1215,7 @@ class BedrockProxyIntegrationTest {
assertThat(body, containsString("messageStart"));
assertThat(body, containsString("modelStreamErrorException"));
- assertThat(body, org.hamcrest.Matchers.not(containsString("messageStop")));
+ assertThat(body, Matchers.not(containsString("messageStop")));
}
@Test
@@ -1246,8 +1247,8 @@ class BedrockProxyIntegrationTest {
assertThat(body, containsString("messageStop"));
assertThat(body, containsString("end_turn"));
assertThat(body, containsString("metadata"));
- assertThat(body, org.hamcrest.Matchers.not(containsString("modelStreamErrorException")));
- assertThat(body, org.hamcrest.Matchers.not(containsString("contentBlockDelta")));
+ assertThat(body, Matchers.not(containsString("modelStreamErrorException")));
+ assertThat(body, Matchers.not(containsString("contentBlockDelta")));
}
@Test
@@ -1277,7 +1278,7 @@ class BedrockProxyIntegrationTest {
assertThat(body, containsString("messageStart"));
assertThat(body, containsString("Hello"));
assertThat(body, containsString("modelStreamErrorException"));
- assertThat(body, org.hamcrest.Matchers.not(containsString("messageStop")));
+ assertThat(body, Matchers.not(containsString("messageStop")));
}
@Test
@@ -1310,9 +1311,9 @@ class BedrockProxyIntegrationTest {
assertThat(body, containsString("messageStop"));
assertThat(body, containsString("end_turn"));
- assertThat(body, org.hamcrest.Matchers.not(containsString("call_1")));
- assertThat(body, org.hamcrest.Matchers.not(containsString("toolUse")));
- assertThat(body, org.hamcrest.Matchers.not(containsString("modelStreamErrorException")));
+ assertThat(body, Matchers.not(containsString("call_1")));
+ assertThat(body, Matchers.not(containsString("toolUse")));
+ assertThat(body, Matchers.not(containsString("modelStreamErrorException")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/budgets/BudgetsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/budgets/BudgetsIntegrationTest.java
index 63dd08bd8c..0068a9d43f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/budgets/BudgetsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/budgets/BudgetsIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.budgets;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -47,11 +48,11 @@ class BudgetsIntegrationTest {
.statusCode(400).body("__type", equalTo("NotFoundException"));
}
- private static io.restassured.response.ValidatableResponse json(String target, String body) {
+ private static ValidatableResponse json(String target, String body) {
return given().contentType(TYPE).header("Authorization", AUTH).header("X-Amz-Target", target).body(body).post("/").then();
}
- private static io.restassured.response.ValidatableResponse jsonAs(String accountId, String target, String body) {
+ private static ValidatableResponse jsonAs(String accountId, String target, String body) {
String auth = "AWS4-HMAC-SHA256 Credential=" + accountId + "/20260904/us-east-1/budgets/aws4_request";
return given().contentType(TYPE).header("Authorization", auth).header("X-Amz-Target", target).body(body).post("/").then();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
index c70cb66af5..a288131ae3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
@@ -213,12 +213,12 @@ class ApiGatewayV2CfnProvisionerTest {
previous.setLogicalId("Subnet");
previous.setResourceType("AWS::EC2::Subnet");
previous.setPhysicalId("subnet-prior");
- previous.setAttributes(new java.util.HashMap<>());
+ previous.setAttributes(new HashMap<>());
StackResource attempted = new StackResource();
attempted.setLogicalId("Subnet");
attempted.setResourceType("AWS::EC2::Subnet");
attempted.setPhysicalId("subnet-replacement");
- attempted.setAttributes(new java.util.HashMap<>(Map.of(
+ attempted.setAttributes(new HashMap<>(Map.of(
"__FlociReplacementCleanup",
"{\"region\":\"us-east-1\",\"displaced\":[{\"physicalId\":\"subnet-replacement\",\"resourceType\":\"AWS::EC2::Subnet\",\"region\":\"us-east-1\",\"retainable\":false,\"cleanupAttempts\":1}]}")));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAccountOwnershipIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAccountOwnershipIntegrationTest.java
index a373fd334f..cc43effa1f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAccountOwnershipIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAccountOwnershipIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -179,7 +180,7 @@ class CloudFormationAccountOwnershipIntegrationTest {
.when().post("/").then().statusCode(200);
}
- private static io.restassured.response.ValidatableResponse describeStack(
+ private static ValidatableResponse describeStack(
String account, String region, String name) {
return given().header("Authorization", auth(account, region))
.contentType("application/x-www-form-urlencoded")
@@ -188,7 +189,7 @@ class CloudFormationAccountOwnershipIntegrationTest {
.when().post("/").then();
}
- private static io.restassured.response.ValidatableResponse describeStackResources(
+ private static ValidatableResponse describeStackResources(
String account, String region, String name) {
return given().header("Authorization", auth(account, region))
.contentType("application/x-www-form-urlencoded")
@@ -197,14 +198,14 @@ class CloudFormationAccountOwnershipIntegrationTest {
.when().post("/").then();
}
- private static io.restassured.response.ValidatableResponse listStacks(String accessKeyId, String region) {
+ private static ValidatableResponse listStacks(String accessKeyId, String region) {
return given().header("Authorization", auth(accessKeyId, region))
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "ListStacks")
.when().post("/").then();
}
- private static io.restassured.response.ValidatableResponse listExports(String account, String region) {
+ private static ValidatableResponse listExports(String account, String region) {
return given().header("Authorization", auth(account, region))
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "ListExports")
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationApiGatewayV2CleanupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationApiGatewayV2CleanupIntegrationTest.java
index bfc1101d15..a17f837c89 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationApiGatewayV2CleanupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationApiGatewayV2CleanupIntegrationTest.java
@@ -17,6 +17,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -173,7 +174,7 @@ class CloudFormationApiGatewayV2CleanupIntegrationTest {
private static String httpApiTemplate(String apiName, List<String> paths) {
String pathDefinitions = paths.stream()
.map(path -> "\"" + path + "\":{\"get\":{}}")
- .collect(java.util.stream.Collectors.joining(","));
+ .collect(Collectors.joining(","));
return """
{"AWSTemplateFormatVersion":"2010-09-09",
"Transform":"AWS::Serverless-2016-10-31",
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
index 4607fef08a..aa67b474fa 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -402,7 +403,7 @@ class CloudFormationBatchIntegrationTest {
.body(containsString("<StackStatus>" + status + "</StackStatus>"));
}
- private static io.restassured.specification.RequestSpecification givenBatchJson(String body) {
+ private static RequestSpecification givenBatchJson(String body) {
return given()
.header("Authorization", BATCH_AUTH)
.contentType("application/json")
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
index 047c7579f6..f85ba24fa3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
@@ -7,6 +7,7 @@ import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
import io.restassured.http.ContentType;
import io.restassured.parsing.Parser;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -425,7 +426,7 @@ class CloudFormationCognitoUserPoolGroupIntegrationTest {
return XmlParser.extractPairs(describeXml, "Outputs", "OutputKey", "OutputValue").get(key);
}
- private io.restassured.response.ValidatableResponse cognito(String target, String body) {
+ private ValidatableResponse cognito(String target, String body) {
return given()
.config(RestAssured.config().encoderConfig(EncoderConfig.encoderConfig()
.encodeContentTypeAs(COGNITO_CONTENT_TYPE, ContentType.TEXT)))
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamicReferenceIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamicReferenceIntegrationTest.java
index 9d2d56040e..8ce26c2eab 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamicReferenceIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamicReferenceIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -220,7 +221,7 @@ class CloudFormationDynamicReferenceIntegrationTest {
.then()
.statusCode(200)
.body(containsString("cfn-dynref-resolved-topic"))
- .body(org.hamcrest.Matchers.not(containsString("{{resolve:ssm:")));
+ .body(Matchers.not(containsString("{{resolve:ssm:")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
index f9af6335c4..cc7e413f8e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -97,12 +98,12 @@ class CloudFormationDynamoDbReplicaIntegrationTest {
// Add a replica via UpdateTable ReplicaUpdates -> Create.
String added = ddb("UpdateTable", "{\"TableName\":\"" + tableName + "\","
+ "\"ReplicaUpdates\":[{\"Create\":{\"RegionName\":\"" + REPLICA_REGION + "\"}}]}");
- org.junit.jupiter.api.Assertions.assertTrue(added.contains("\"RegionName\":\"" + REPLICA_REGION + "\""),
+ Assertions.assertTrue(added.contains("\"RegionName\":\"" + REPLICA_REGION + "\""),
"UpdateTable response should report the new replica");
// DescribeTable reports it as an ACTIVE replica on a 2019.11.21 global table.
String afterAdd = ddb("DescribeTable", "{\"TableName\":\"" + tableName + "\"}");
- org.junit.jupiter.api.Assertions.assertTrue(
+ Assertions.assertTrue(
afterAdd.contains("\"RegionName\":\"" + REPLICA_REGION + "\"")
&& afterAdd.contains("\"ReplicaStatus\":\"ACTIVE\"")
&& afterAdd.contains("\"GlobalTableVersion\":\"2019.11.21\""),
@@ -112,7 +113,7 @@ class CloudFormationDynamoDbReplicaIntegrationTest {
ddb("UpdateTable", "{\"TableName\":\"" + tableName + "\","
+ "\"ReplicaUpdates\":[{\"Delete\":{\"RegionName\":\"" + REPLICA_REGION + "\"}}]}");
String afterRemove = ddb("DescribeTable", "{\"TableName\":\"" + tableName + "\"}");
- org.junit.jupiter.api.Assertions.assertFalse(afterRemove.contains(REPLICA_REGION),
+ Assertions.assertFalse(afterRemove.contains(REPLICA_REGION),
"DescribeTable should no longer list the removed replica, was: " + afterRemove);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java
index 7e4385a1e5..e29ded3d0f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.github.hectorvent.floci.services.cloudformation.model.Stack;
import io.github.hectorvent.floci.services.ec2.Ec2Service;
import io.github.hectorvent.floci.testing.MutableClock;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
@@ -10,6 +11,7 @@ import io.restassured.path.xml.XmlPath;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -18,6 +20,7 @@ import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Base64;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
@@ -71,8 +74,8 @@ class CloudFormationIntegrationTest {
private static byte[] buildHandlerZip() {
try {
- var baos = new ByteArrayOutputStream();
- try (var zos = new ZipOutputStream(baos)) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
zos.putNextEntry(new ZipEntry("index.js"));
zos.write("exports.handler=async(e)=>({statusCode:200})".getBytes(StandardCharsets.UTF_8));
zos.closeEntry();
@@ -2861,7 +2864,7 @@ class CloudFormationIntegrationTest {
.body(containsString("<StackId>"));
// 2. Verify stack completed and the auto-generated table name follows the pattern
- var describeResponse = given()
+ String describeResponse = given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeStackResources")
.formParam("StackName", "auto-name-stack")
@@ -3270,7 +3273,7 @@ class CloudFormationIntegrationTest {
// Verify SSM Parameter name via SSM API using DescribeStackResources physical ID
// We extract the auto-generated name from the stack resource and verify it's accessible
- var ssmResourceXml = given()
+ String ssmResourceXml = given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeStackResources")
.formParam("StackName", "ssm-auto-stack")
@@ -8104,7 +8107,7 @@ class CloudFormationIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("clusters", org.hamcrest.Matchers.empty());
+ .body("clusters", Matchers.empty());
// Task definition is deregistered (INACTIVE)
given()
@@ -8630,7 +8633,7 @@ class CloudFormationIntegrationTest {
getStages(apiId).body("Items.size()", equalTo(1));
}
- private io.restassured.response.ValidatableResponse getRoutes(String apiId) {
+ private ValidatableResponse getRoutes(String apiId) {
return given()
.header("X-Amz-Target", "AmazonApiGatewayV2.GetRoutes")
.contentType(APIGWV2_CONTENT_TYPE)
@@ -8641,7 +8644,7 @@ class CloudFormationIntegrationTest {
.statusCode(200);
}
- private io.restassured.response.ValidatableResponse getIntegrations(String apiId) {
+ private ValidatableResponse getIntegrations(String apiId) {
return given()
.header("X-Amz-Target", "AmazonApiGatewayV2.GetIntegrations")
.contentType(APIGWV2_CONTENT_TYPE)
@@ -8652,7 +8655,7 @@ class CloudFormationIntegrationTest {
.statusCode(200);
}
- private io.restassured.response.ValidatableResponse getStages(String apiId) {
+ private ValidatableResponse getStages(String apiId) {
return given()
.header("X-Amz-Target", "AmazonApiGatewayV2.GetStages")
.contentType(APIGWV2_CONTENT_TYPE)
@@ -8663,7 +8666,7 @@ class CloudFormationIntegrationTest {
.statusCode(200);
}
- private io.restassured.response.ValidatableResponse getAuthorizers(String apiId) {
+ private ValidatableResponse getAuthorizers(String apiId) {
return given()
.header("X-Amz-Target", "AmazonApiGatewayV2.GetAuthorizers")
.contentType(APIGWV2_CONTENT_TYPE)
@@ -10909,7 +10912,7 @@ class CloudFormationIntegrationTest {
.body(containsString("<StackStatus>ROLLBACK_COMPLETE</StackStatus>"));
}
- for (String stateMachineName : java.util.List.of(missingName, multipleName)) {
+ for (String stateMachineName : List.of(missingName, multipleName)) {
given()
.header("X-Amz-Target", "AWSStepFunctions.DescribeStateMachine")
.contentType(SFN_CONTENT_TYPE)
@@ -10922,7 +10925,7 @@ class CloudFormationIntegrationTest {
.body(containsString("StateMachineDoesNotExist"));
}
- for (String stack : java.util.List.of(missingStack, multipleStack)) {
+ for (String stack : List.of(missingStack, multipleStack)) {
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DeleteStack")
@@ -10972,7 +10975,7 @@ class CloudFormationIntegrationTest {
.statusCode(200)
.extract().asString(), "MyStateMachine");
- var stack = cloudFormationService.describeStacks(stackName, "us-east-1").getFirst();
+ Stack stack = cloudFormationService.describeStacks(stackName, "us-east-1").getFirst();
stack.getResources().get("MyStateMachine").getAttributes().remove("FlociStepFunctionsNameMode");
given()
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
index e2ef44f2c6..9291ee1b48 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
@@ -14,6 +14,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Function;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -144,12 +147,12 @@ class CloudFormationLambdaLegacyNameModeTest {
/** Collects the messages LambdaCfnProvisioner logs while {@code action} runs. */
private List<String> provisionerLogMessages(Runnable action) {
- java.util.logging.Logger logger =
- java.util.logging.Logger.getLogger(LambdaCfnProvisioner.class.getName());
+ Logger logger =
+ Logger.getLogger(LambdaCfnProvisioner.class.getName());
List<String> messages = new CopyOnWriteArrayList<>();
- java.util.logging.Handler handler = new java.util.logging.Handler() {
+ Handler handler = new Handler() {
@Override
- public void publish(java.util.logging.LogRecord logRecord) {
+ public void publish(LogRecord logRecord) {
messages.add(logRecord.getMessage());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
index 8a70863979..c52cb4dc18 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
@@ -660,7 +661,7 @@ class CloudFormationResourceConditionIntegrationTest {
}
}
- private static io.restassured.response.Response getQueueUrl(String queueName) {
+ private static Response getQueueUrl(String queueName) {
return given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "GetQueueUrl")
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketPropertiesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketPropertiesIntegrationTest.java
index 0d0319f84b..97d6d5ec7f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketPropertiesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketPropertiesIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -352,7 +353,7 @@ class CloudFormationS3BucketPropertiesIntegrationTest {
return member.substring(idStart, member.indexOf("</PhysicalResourceId>", idStart));
}
- private static io.restassured.response.ValidatableResponse bucketGet(String bucket, String subresource) {
+ private static ValidatableResponse bucketGet(String bucket, String subresource) {
return given().when().get("/" + bucket + "?" + subresource).then().statusCode(200);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeTest.java
index c7a3867a04..5ffff26f9c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeTest.java
@@ -14,9 +14,11 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Function;
+import java.util.function.Supplier;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
+import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -198,9 +200,9 @@ class CloudFormationUnsupportedResourceTypeTest {
/** Runs {@code action} with a handler on the provisioner's logger, collecting every record. */
private <T> T whileCapturingProvisionerLogs(List<LogRecord> collected,
- java.util.function.Supplier<T> action) {
- java.util.logging.Logger logger =
- java.util.logging.Logger.getLogger(CfnResourceDispatcher.class.getName());
+ Supplier<T> action) {
+ Logger logger =
+ Logger.getLogger(CfnResourceDispatcher.class.getName());
Level original = logger.getLevel();
Handler handler = new Handler() {
@Override
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcGatewayAttachmentIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcGatewayAttachmentIntegrationTest.java
index 2ce3553000..301fd296c2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcGatewayAttachmentIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcGatewayAttachmentIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -143,7 +144,7 @@ class CloudFormationVpcGatewayAttachmentIntegrationTest {
}
}
- private static io.restassured.response.Response describeIgw(String igwId) {
+ private static Response describeIgw(String igwId) {
return given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", EC2_AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationWafV2ConfigGetAttIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationWafV2ConfigGetAttIntegrationTest.java
index 45b6b6c38e..d2581ed60b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationWafV2ConfigGetAttIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationWafV2ConfigGetAttIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -98,7 +99,7 @@ class CloudFormationWafV2ConfigGetAttIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("WebACL.Name", org.hamcrest.Matchers.equalTo(aclName));
+ .body("WebACL.Name", Matchers.equalTo(aclName));
}
@Test
@@ -161,7 +162,7 @@ class CloudFormationWafV2ConfigGetAttIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("ConfigRules[0].ConfigRuleName", org.hamcrest.Matchers.equalTo(ruleName));
+ .body("ConfigRules[0].ConfigRuleName", Matchers.equalTo(ruleName));
}
@Test
@@ -246,7 +247,7 @@ class CloudFormationWafV2ConfigGetAttIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("ConfigRules[0].Scope.TagKey", org.hamcrest.Matchers.equalTo("env"))
+ .body("ConfigRules[0].Scope.TagKey", Matchers.equalTo("env"))
.body("ConfigRules[0].Scope", not(hasKey("ComplianceResourceTypes")));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
index 59bfacc8e1..5ca9a2d1af 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
+import java.util.function.Supplier;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -539,7 +540,7 @@ class CustomResourceProvisionerTest {
return readEvent(captor::getValue);
}
- private JsonNode readEvent(java.util.function.Supplier<byte[]> supplier) {
+ private JsonNode readEvent(Supplier<byte[]> supplier) {
try {
return mapper.readTree(supplier.get());
} catch (Exception e) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/InlineZipPackagerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/InlineZipPackagerTest.java
index 877a064595..c511eed028 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/InlineZipPackagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/InlineZipPackagerTest.java
@@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -36,7 +37,7 @@ class InlineZipPackagerTest {
if (entry.getName().equals(entryName)) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
zis.transferTo(out);
- return out.toString(java.nio.charset.StandardCharsets.UTF_8);
+ return out.toString(StandardCharsets.UTF_8);
}
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/OrganizationsCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/OrganizationsCfnIntegrationTest.java
index 102fee3fb3..1ccc8e5dad 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/OrganizationsCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/OrganizationsCfnIntegrationTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -313,7 +314,7 @@ class OrganizationsCfnIntegrationTest {
organizations("DescribeResourcePolicy", "{}")
.then().statusCode(200)
- .body("ResourcePolicy.Content", org.hamcrest.Matchers.containsString("organizations:Describe*"));
+ .body("ResourcePolicy.Content", Matchers.containsString("organizations:Describe*"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
index ad6adabd44..6096ab4366 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
@@ -30,6 +30,8 @@ import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import org.mockito.Mockito;
+import org.mockito.stubbing.Answer;
import java.time.Instant;
import java.util.List;
@@ -1470,7 +1472,7 @@ class RdsCfnProvisionerTest {
/** RdsService hands back a cluster named after whatever id the provisioner asked to create. */
private void createDbClusterEchoesRequestedId() {
- org.mockito.stubbing.Answer<DbCluster> echo = invocation -> {
+ Answer<DbCluster> echo = invocation -> {
DbCluster created = mock(DbCluster.class);
doReturn(invocation.getArgument(0)).when(created).getDbClusterIdentifier();
return created;
@@ -2086,7 +2088,7 @@ class RdsCfnProvisionerTest {
void targetGroupDeleteIsIdempotentWhenProxyDeletionAlreadyRemovedIt() {
String targetGroupArn =
"arn:aws:rds:us-east-1:000000000000:target-group:prx-tg-already-gone";
- org.mockito.Mockito.doThrow(new AwsException("DBProxyTargetGroupNotFoundFault",
+ Mockito.doThrow(new AwsException("DBProxyTargetGroupNotFoundFault",
"target group not found", 404))
.when(rdsService).clearDbProxyTargetGroupByArn(targetGroupArn, "us-east-1");
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java
index 913d46f550..b73661bd5f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformIntegrationTest.java
@@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
@@ -2012,8 +2013,8 @@ class SamTransformIntegrationTest {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(baos)) {
- zos.putNextEntry(new java.util.zip.ZipEntry("index.js"));
- zos.write("exports.handler=async(e)=>({statusCode:200})".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ zos.putNextEntry(new ZipEntry("index.js"));
+ zos.write("exports.handler=async(e)=>({statusCode:200})".getBytes(StandardCharsets.UTF_8));
zos.closeEntry();
}
return baos.toByteArray();
@@ -2025,7 +2026,7 @@ class SamTransformIntegrationTest {
private static void waitForStackStatus(String stackName, String status) {
String expected = "<StackStatus>" + status + "</StackStatus>";
String body = "";
- long deadline = System.nanoTime() + java.time.Duration.ofSeconds(5).toNanos();
+ long deadline = System.nanoTime() + Duration.ofSeconds(5).toNanos();
while (System.nanoTime() < deadline) {
body = given()
.contentType("application/x-www-form-urlencoded")
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessorTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessorTest.java
index 5309fa7429..2998523eb1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SamTransformProcessorTest.java
@@ -6,9 +6,15 @@ import io.github.hectorvent.floci.core.common.AwsException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.text.MessageFormat;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
import static org.junit.jupiter.api.Assertions.*;
@@ -2884,13 +2890,13 @@ class SamTransformProcessorTest {
}
""");
- java.util.List<java.util.logging.LogRecord> logged = new java.util.concurrent.CopyOnWriteArrayList<>();
- java.util.logging.Logger logger =
- java.util.logging.Logger.getLogger(SamTransformProcessor.class.getName());
- java.util.logging.Level original = logger.getLevel();
- java.util.logging.Handler handler = new java.util.logging.Handler() {
+ List<LogRecord> logged = new CopyOnWriteArrayList<>();
+ Logger logger =
+ Logger.getLogger(SamTransformProcessor.class.getName());
+ Level original = logger.getLevel();
+ Handler handler = new Handler() {
@Override
- public void publish(java.util.logging.LogRecord logRecord) {
+ public void publish(LogRecord logRecord) {
logged.add(logRecord);
}
@@ -2903,7 +2909,7 @@ class SamTransformProcessorTest {
}
};
logger.addHandler(handler);
- logger.setLevel(java.util.logging.Level.ALL);
+ logger.setLevel(Level.ALL);
try {
processor.expandSamTemplate(template);
} finally {
@@ -2914,7 +2920,7 @@ class SamTransformProcessorTest {
String expected = "Unsupported SAM resource type AWS::Serverless::Application (MyApp): "
+ "left in the template for the CloudFormation provisioner.";
assertTrue(logged.stream().anyMatch(r ->
- r.getLevel().intValue() >= java.util.logging.Level.WARNING.intValue()
+ r.getLevel().intValue() >= Level.WARNING.intValue()
&& expected.equals(text(r))),
"expected the unexpanded SAM type to be reported at warn, got: "
+ logged.stream().map(r -> r.getLevel() + " " + text(r)).toList());
@@ -2924,10 +2930,10 @@ class SamTransformProcessorTest {
* The record's text. Which logging backend is in play decides whether the parameters are
* already substituted or still carried alongside the pattern.
*/
- private static String text(java.util.logging.LogRecord record) {
+ private static String text(LogRecord record) {
Object[] parameters = record.getParameters();
return parameters == null || parameters.length == 0
? record.getMessage()
- : java.text.MessageFormat.format(record.getMessage(), parameters);
+ : MessageFormat.format(record.getMessage(), parameters);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
index 8848d6b29f..facaf24450 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
@@ -22,7 +22,10 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@@ -93,7 +96,7 @@ class SecretTargetAttachmentCfnProvisionerTest {
provisioner.delete(resource, REGION);
ArgumentCaptor<String> values = ArgumentCaptor.forClass(String.class);
- verify(secretsManagerService, org.mockito.Mockito.times(2)).putSecretValue(
+ verify(secretsManagerService, Mockito.times(2)).putSecretValue(
eq(SECRET_ARN), values.capture(), isNull(), isNull(), eq(REGION), isNull());
JsonNode attached = mapper.readTree(values.getAllValues().get(0));
@@ -638,11 +641,11 @@ class SecretTargetAttachmentCfnProvisionerTest {
private void stubSecretValues(String... values) {
when(secretsManagerService.describeSecret(SECRET_ID, REGION)).thenReturn(secret(SECRET_ARN));
- SecretVersion[] versions = java.util.Arrays.stream(values)
+ SecretVersion[] versions = Arrays.stream(values)
.map(this::secretVersion)
.toArray(SecretVersion[]::new);
when(secretsManagerService.getSecretValue(SECRET_ARN, null, null, REGION))
- .thenReturn(versions[0], java.util.Arrays.copyOfRange(versions, 1, versions.length));
+ .thenReturn(versions[0], Arrays.copyOfRange(versions, 1, versions.length));
}
private Secret secret(String arn) {
@@ -662,7 +665,7 @@ class SecretTargetAttachmentCfnProvisionerTest {
resource.setLogicalId("Attachment");
resource.setResourceType("AWS::SecretsManager::SecretTargetAttachment");
resource.setPhysicalId(SECRET_ARN);
- resource.setAttributes(new java.util.HashMap<>(Map.of(
+ resource.setAttributes(new HashMap<>(Map.of(
"__FlociSecretTargetManagedKeys",
"engine,host,port,dbname,dbInstanceIdentifier",
"__FlociSecretTargetOwner",
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
index aaacf1b171..8e1537c79b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -128,7 +129,7 @@ class SnsFifoThroughputScopeCfnIntegrationTest {
.formParam("Action", "DescribeStacks")
.formParam("StackName", STACK)
.when().post("/").then().statusCode(200)
- .body(org.hamcrest.Matchers.containsString("<StackStatus>" + expectedStatus + "</StackStatus>"))
+ .body(Matchers.containsString("<StackStatus>" + expectedStatus + "</StackStatus>"))
.extract().asString();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/StackSetServiceDeleteFailureTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/StackSetServiceDeleteFailureTest.java
index 4dc718d467..dea88027f4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/StackSetServiceDeleteFailureTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/StackSetServiceDeleteFailureTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackInstance;
import io.github.hectorvent.floci.services.cloudformation.model.StackSetOperation;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.util.List;
import java.util.Map;
@@ -91,7 +92,7 @@ class StackSetServiceDeleteFailureTest {
assertTrue(service.listStackInstances(SET, null, null).isEmpty(),
"RetainStacks detaches the instance from the StackSet");
// RetainStacks=true must never invoke the underlying stack delete.
- org.mockito.Mockito.verify(cfnService, org.mockito.Mockito.never())
+ Mockito.verify(cfnService, Mockito.never())
.deleteStack(anyString(), anyString(), anyString());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApiGatewayRestApiCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApiGatewayRestApiCfnProvisionerTest.java
index a65fdfe23e..7d4555e186 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApiGatewayRestApiCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApiGatewayRestApiCfnProvisionerTest.java
@@ -15,6 +15,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.s3.S3Service;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import java.util.ArrayList;
import java.util.HashMap;
@@ -627,11 +628,11 @@ class ApiGatewayRestApiCfnProvisionerTest {
Map.of("responseParameters", Map.of(
"method.response.header.Access-Control-Allow-Origin", true)));
verify(api).putIntegration(eq("us-east-1"), eq("api-1"), eq("res-1"), eq("OPTIONS"),
- org.mockito.ArgumentMatchers.argThat(request -> Map.of(
+ ArgumentMatchers.argThat(request -> Map.of(
"application/json", "{\"statusCode\":200}")
.equals(request.get("requestTemplates"))));
verify(api).putIntegrationResponse(eq("us-east-1"), eq("api-1"), eq("res-1"), eq("OPTIONS"), eq("200"),
- org.mockito.ArgumentMatchers.argThat(request ->
+ ArgumentMatchers.argThat(request ->
Map.of("method.response.header.Access-Control-Allow-Origin", "'*'")
.equals(request.get("responseParameters"))
&& Map.of("application/json", "{}").equals(request.get("responseTemplates"))));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisionerTest.java
index 4b73565887..8b48110fab 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/AppSyncCfnProvisionerTest.java
@@ -16,6 +16,7 @@ import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplate
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.List;
@@ -259,7 +260,7 @@ class AppSyncCfnProvisionerTest {
verify(appSync).startSchemaCreation(API_ID, "type Query { ping: String }");
// Every AppSync call for the API is refused with a 409 while the schema is PROCESSING, so a
// provision that returned early would fail the data sources and resolvers behind it.
- verify(appSync, org.mockito.Mockito.times(3)).getSchemaCreationStatus(API_ID);
+ verify(appSync, Mockito.times(3)).getSchemaCreationStatus(API_ID);
assertEquals(API_ID + "GraphQLSchema", r.getPhysicalId());
assertEquals(API_ID, r.getAttributes().get("ApiId"));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApplicationAutoScalingCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApplicationAutoScalingCfnProvisionerTest.java
index 45a6449e3d..ac13c1f535 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApplicationAutoScalingCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ApplicationAutoScalingCfnProvisionerTest.java
@@ -112,7 +112,7 @@ class ApplicationAutoScalingCfnProvisionerTest {
provisioner.provision(r, targetProps(), ctx());
verify(service).registerScalableTarget("ecs", "service/my-cluster/my-service",
- "ecs:service:DesiredCount", 1, 4, null, null, java.util.Map.of(), "us-east-1");
+ "ecs:service:DesiredCount", 1, 4, null, null, Map.of(), "us-east-1");
// CloudFormation's Ref for a scalable target is resourceId|scalableDimension|serviceNamespace.
assertEquals(TARGET_ID, r.getPhysicalId());
assertEquals(TARGET_ID, r.getAttributes().get("Id"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/BatchCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/BatchCfnProvisionerTest.java
index 3a3697cf5d..357978cd57 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/BatchCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/BatchCfnProvisionerTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.List;
@@ -384,7 +385,7 @@ class BatchCfnProvisionerTest {
// ── replacement cleanup ──────────────────────────────────────────────────
- private ObjectNode detail(String key, String arn, java.util.Map<String, Object> fields) {
+ private ObjectNode detail(String key, String arn, Map<String, Object> fields) {
ObjectNode out = mapper.createObjectNode();
ObjectNode item = out.putArray(key).addObject();
item.put("arn", arn);
@@ -492,7 +493,7 @@ class BatchCfnProvisionerTest {
// stack to UPDATE_ROLLBACK_FAILED and leaves the environment on the failed update's values.
when(batch.describeComputeEnvironments(any())).thenReturn(
detail("computeEnvironments", CE_ARN,
- java.util.Map.of("state", "ENABLED", "serviceRole", "role-before")));
+ Map.of("state", "ENABLED", "serviceRole", "role-before")));
StackResource r = resource("AWS::Batch::ComputeEnvironment", "Compute");
r.getAttributes().put("ComputeEnvironmentName", "envy");
ObjectNode props = mapper.createObjectNode();
@@ -505,7 +506,7 @@ class BatchCfnProvisionerTest {
assertTrue(provisioner.rollbackUpdate(r), "an in-place update is restorable from the snapshot");
ArgumentCaptor<JsonNode> calls = ArgumentCaptor.forClass(JsonNode.class);
- verify(batch, org.mockito.Mockito.times(2)).updateComputeEnvironment(calls.capture());
+ verify(batch, Mockito.times(2)).updateComputeEnvironment(calls.capture());
JsonNode restore = calls.getAllValues().get(1);
assertEquals(CE_ARN, restore.path("computeEnvironment").asText());
assertEquals("ENABLED", restore.path("state").asText(), "the state it was found with");
@@ -528,7 +529,7 @@ class BatchCfnProvisionerTest {
void aRollbackCannotRemoveAValueTheFailedUpdateAdded() {
// No serviceRole before the update: the environment simply does not carry one.
when(batch.describeComputeEnvironments(any())).thenReturn(
- detail("computeEnvironments", CE_ARN, java.util.Map.of("state", "ENABLED")));
+ detail("computeEnvironments", CE_ARN, Map.of("state", "ENABLED")));
StackResource r = resource("AWS::Batch::ComputeEnvironment", "Compute");
r.getAttributes().put("ComputeEnvironmentName", "envy");
ObjectNode props = mapper.createObjectNode();
@@ -541,7 +542,7 @@ class BatchCfnProvisionerTest {
assertTrue(provisioner.rollbackUpdate(r));
ArgumentCaptor<JsonNode> calls = ArgumentCaptor.forClass(JsonNode.class);
- verify(batch, org.mockito.Mockito.times(2)).updateComputeEnvironment(calls.capture());
+ verify(batch, Mockito.times(2)).updateComputeEnvironment(calls.capture());
JsonNode failedUpdate = calls.getAllValues().get(0);
JsonNode restore = calls.getAllValues().get(1);
@@ -556,7 +557,7 @@ class BatchCfnProvisionerTest {
@Test
void rollingBackAnInPlaceJobQueueUpdateRestoresPriorityAndState() {
when(batch.describeJobQueues(any())).thenReturn(
- detail("jobQueues", JQ_ARN, java.util.Map.of("state", "ENABLED", "priority", 3)));
+ detail("jobQueues", JQ_ARN, Map.of("state", "ENABLED", "priority", 3)));
StackResource r = resource("AWS::Batch::JobQueue", "Queue");
r.getAttributes().put("JobQueueName", "queue");
ObjectNode props = mapper.createObjectNode();
@@ -568,7 +569,7 @@ class BatchCfnProvisionerTest {
assertTrue(provisioner.rollbackUpdate(r));
ArgumentCaptor<JsonNode> calls = ArgumentCaptor.forClass(JsonNode.class);
- verify(batch, org.mockito.Mockito.times(2)).updateJobQueue(calls.capture());
+ verify(batch, Mockito.times(2)).updateJobQueue(calls.capture());
JsonNode restore = calls.getAllValues().get(1);
assertEquals(3, restore.path("priority").asInt(), "the priority it was found with");
assertEquals("ENABLED", restore.path("state").asText());
@@ -606,7 +607,7 @@ class BatchCfnProvisionerTest {
@Test
void clearingTheUpdateDropsTheSnapshot() {
when(batch.describeJobQueues(any())).thenReturn(
- detail("jobQueues", JQ_ARN, java.util.Map.of("state", "ENABLED", "priority", 3)));
+ detail("jobQueues", JQ_ARN, Map.of("state", "ENABLED", "priority", 3)));
StackResource r = resource("AWS::Batch::JobQueue", "Queue");
r.getAttributes().put("JobQueueName", "queue");
ObjectNode props = mapper.createObjectNode();
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CfnResourceDispatcherTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CfnResourceDispatcherTest.java
index f239070512..36a6d73593 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CfnResourceDispatcherTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CfnResourceDispatcherTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplateEngine;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentMatchers;
import java.util.Arrays;
import java.util.List;
@@ -243,7 +244,7 @@ class CfnResourceDispatcherTest {
dispatcher.deleteStandalone(TYPE, "thing-1", "us-east-1", Map.of("Role", "r"));
verify(owner).delete(any(StackResource.class), anyString());
- verify(owner).delete(org.mockito.ArgumentMatchers.argThat((StackResource r) ->
+ verify(owner).delete(ArgumentMatchers.argThat((StackResource r) ->
"thing-1".equals(r.getPhysicalId()) && "r".equals(r.getAttributes().get("Role"))), any());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudFrontCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudFrontCfnProvisionerTest.java
index 9ad10647b7..b602acba30 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudFrontCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudFrontCfnProvisionerTest.java
@@ -18,12 +18,14 @@ import io.github.hectorvent.floci.services.cloudfront.model.PublicKey;
import io.github.hectorvent.floci.services.cloudfront.model.ResponseHeadersPolicy;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -102,7 +104,7 @@ class CloudFrontCfnProvisionerTest {
return p;
}
- private static <T> T withIdentity(T model, java.util.function.Consumer<T> set) {
+ private static <T> T withIdentity(T model, Consumer<T> set) {
set.accept(model);
return model;
}
@@ -461,7 +463,7 @@ class CloudFrontCfnProvisionerTest {
when(cloudFront.getResponseHeadersPolicy(ID)).thenReturn(responseHeadersPolicy(ID, ETAG));
AwsException inUse = new AwsException("ResponseHeadersPolicyInUse",
"The response headers policy is attached to one or more distributions.", 409);
- org.mockito.Mockito.doThrow(inUse).when(cloudFront).deleteResponseHeadersPolicy(ID, ETAG);
+ Mockito.doThrow(inUse).when(cloudFront).deleteResponseHeadersPolicy(ID, ETAG);
AwsException e = assertThrows(AwsException.class,
() -> provisioner.delete(RESPONSE_HEADERS_POLICY, ID, REGION));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudWatchDashboardCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudWatchDashboardCfnProvisionerTest.java
index 1ebba9a746..5178e364f3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudWatchDashboardCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CloudWatchDashboardCfnProvisionerTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -369,7 +370,7 @@ class CloudWatchDashboardCfnProvisionerTest {
@Test
void anInPlaceUpdateIsRolledBackFromTheBodyAndTagsItReplaced() {
Dashboard before = new Dashboard("ops", arn("ops"), "{\"widgets\":[{\"type\":\"text\"}]}");
- before.setTags(new java.util.LinkedHashMap<>(Map.of("team", "platform")));
+ before.setTags(new LinkedHashMap<>(Map.of("team", "platform")));
when(dashboards.getDashboard("ops", REGION)).thenReturn(before);
when(dashboards.listTagsForResource(arn("ops"), REGION)).thenReturn(Map.of("team", "platform"));
@@ -454,7 +455,7 @@ class CloudWatchDashboardCfnProvisionerTest {
@Test
void anInPlaceUpdateThatFailedOnItsTagsPutsTheBodyBack() {
Dashboard before = new Dashboard("ops", arn("ops"), OLD_BODY);
- before.setTags(new java.util.LinkedHashMap<>(Map.of("team", "platform")));
+ before.setTags(new LinkedHashMap<>(Map.of("team", "platform")));
when(dashboards.getDashboard("ops", REGION)).thenReturn(before);
when(dashboards.listTagsForResource(arn("ops"), REGION)).thenReturn(Map.of("team", "platform"));
doThrow(new AwsException("InternalServiceError", "boom", 500))
@@ -471,7 +472,7 @@ class CloudWatchDashboardCfnProvisionerTest {
@Test
void anUnwoundInPlaceUpdateIsMarkedRestored() {
Dashboard before = new Dashboard("ops", arn("ops"), OLD_BODY);
- before.setTags(new java.util.LinkedHashMap<>(Map.of("team", "platform")));
+ before.setTags(new LinkedHashMap<>(Map.of("team", "platform")));
when(dashboards.getDashboard("ops", REGION)).thenReturn(before);
when(dashboards.listTagsForResource(arn("ops"), REGION)).thenReturn(Map.of("team", "platform"));
doThrow(new AwsException("InternalServiceError", "boom", 500))
@@ -530,7 +531,7 @@ class CloudWatchDashboardCfnProvisionerTest {
@Test
void anUnwindThatCannotRestoreIsReportedAsARollbackFailure() {
Dashboard before = new Dashboard("ops", arn("ops"), OLD_BODY);
- before.setTags(new java.util.LinkedHashMap<>(Map.of("team", "platform")));
+ before.setTags(new LinkedHashMap<>(Map.of("team", "platform")));
when(dashboards.getDashboard("ops", REGION)).thenReturn(before);
when(dashboards.listTagsForResource(arn("ops"), REGION)).thenReturn(Map.of("team", "platform"));
doThrow(new AwsException("InternalServiceError", "boom", 500))
@@ -560,7 +561,7 @@ class CloudWatchDashboardCfnProvisionerTest {
@Test
void anUnwindThatFailsWithTheUpdatesOwnExceptionIsStillRecorded() {
Dashboard before = new Dashboard("ops", arn("ops"), OLD_BODY);
- before.setTags(new java.util.LinkedHashMap<>(Map.of("team", "platform")));
+ before.setTags(new LinkedHashMap<>(Map.of("team", "platform")));
when(dashboards.getDashboard("ops", REGION)).thenReturn(before);
when(dashboards.listTagsForResource(arn("ops"), REGION)).thenReturn(Map.of("team", "platform"));
when(dashboards.putDashboard(eq("ops"), anyString(), anyMap(), eq(REGION))).thenReturn(before);
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisionerTest.java
index 9f7eff5113..84aa445cb1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodeBuildCfnProvisionerTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.util.HashMap;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -97,9 +98,9 @@ class CodeBuildCfnProvisionerTest {
void mapEntityFromHandlerIsConvertedNotDropped() throws Exception {
// The real handler returns Response.ok(Map.of(...)) — a Map/POJO entity, never a JsonNode —
// so a plain instanceof check silently drops the project and falls back to the guessed ARN.
- java.util.Map<String, Object> project = new java.util.HashMap<>();
+ Map<String, Object> project = new HashMap<>();
project.put("arn", "arn:aws:codebuild:us-east-1:000000000000:project/from-handler");
- java.util.Map<String, Object> entity = java.util.Map.of("project", project);
+ Map<String, Object> entity = Map.of("project", project);
when(handler.handle(eq("CreateProject"), any(), eq("us-east-1"), eq("000000000000")))
.thenReturn(Response.ok(entity).build());
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisionerTest.java
index 764d579827..a35470b022 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CodePipelineCfnProvisionerTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplateEngine;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.codepipeline.CodePipelineService;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
@@ -283,7 +284,7 @@ class CodePipelineCfnProvisionerTest {
props.putArray("DisableInboundStageTransitions").addObject()
.put("StageName", "Gate").put("Reason", "hold");
- RuntimeException thrown = org.junit.jupiter.api.Assertions.assertThrows(RuntimeException.class,
+ RuntimeException thrown = Assertions.assertThrows(RuntimeException.class,
() -> provisioner.provision(r, props, ctx()));
assertEquals("boom", thrown.getMessage());
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CognitoCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CognitoCfnProvisionerTest.java
index 890b50a24b..f1dbabc0d4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CognitoCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/CognitoCfnProvisionerTest.java
@@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -716,7 +717,7 @@ class CognitoCfnProvisionerTest {
CountDownLatch ready = new CountDownLatch(2);
ExecutorService pool = Executors.newFixedThreadPool(2);
try {
- List<Future<Throwable>> outcomes = new java.util.ArrayList<>();
+ List<Future<Throwable>> outcomes = new ArrayList<>();
for (int i = 0; i < 2; i++) {
outcomes.add(pool.submit(() -> {
ready.countDown();
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ConfigCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ConfigCfnProvisionerTest.java
index 9e20e219b8..cde21a86a8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ConfigCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ConfigCfnProvisionerTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.configservice.AwsConfigService;
import io.github.hectorvent.floci.services.configservice.model.ConfigRule;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.List;
@@ -100,7 +101,7 @@ class ConfigCfnProvisionerTest {
when(config.describeConfigRules("us-east-1", List.of()))
.thenReturn(List.of(new ConfigRule("old-rule", "arn:old", "config-rule-123",
null, null, null, null, null, "ACTIVE", null, List.of())));
- org.mockito.Mockito.doThrow(new RuntimeException("rule in use"))
+ Mockito.doThrow(new RuntimeException("rule in use"))
.when(config).deleteConfigRule("us-east-1", "old-rule");
StackResource resource = resource();
resource.setPhysicalId("old-rule");
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Ec2LaunchTemplateCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Ec2LaunchTemplateCfnProvisionerTest.java
index f69005c6ca..7b77728aa0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Ec2LaunchTemplateCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Ec2LaunchTemplateCfnProvisionerTest.java
@@ -12,6 +12,7 @@ import io.github.hectorvent.floci.services.ec2.model.LaunchTemplate;
import io.github.hectorvent.floci.services.ec2.model.LaunchTemplateData;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import org.mockito.InOrder;
import java.io.ByteArrayOutputStream;
@@ -134,7 +135,7 @@ class Ec2LaunchTemplateCfnProvisionerTest {
provisioner.provision(r, mapper.createObjectNode(), ctx());
verify(ec2).createLaunchTemplate(eq("us-east-1"),
- org.mockito.ArgumentMatchers.matches("my-stack-Lt-[0-9a-f]{12}"), any(), isNull());
+ ArgumentMatchers.matches("my-stack-Lt-[0-9a-f]{12}"), any(), isNull());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EcsCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EcsCfnProvisionerTest.java
index 0eca2c1798..f7d3c7d0d1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EcsCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EcsCfnProvisionerTest.java
@@ -23,6 +23,7 @@ import org.junit.jupiter.params.provider.NullSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import java.util.ArrayList;
@@ -671,7 +672,7 @@ class EcsCfnProvisionerTest {
assertEquals("busy", third.failureReason());
UpdateCleanupResult givenUp = provisioner.completeUpdate(failing);
assertEquals(3, givenUp.attempts(), "no fourth attempt");
- verify(ecs, org.mockito.Mockito.times(3)).deregisterTaskDefinition(TASK_DEF_ARN, REGION);
+ verify(ecs, Mockito.times(3)).deregisterTaskDefinition(TASK_DEF_ARN, REGION);
}
@Test
@@ -986,7 +987,7 @@ class EcsCfnProvisionerTest {
// The replacement the failed update created stays owed a delete; the restored prior does not.
assertTrue(provisioner.hasReplacementUpdate(r));
assertEquals(next.getTaskDefinitionArn(), provisioner.updateCleanupPhysicalId(r));
- org.mockito.Mockito.reset(ecs);
+ Mockito.reset(ecs);
assertEquals(new UpdateCleanupResult(true, true, next.getTaskDefinitionArn(), 0, null), provisioner.completeUpdate(r));
verify(ecs).deregisterTaskDefinition(next.getTaskDefinitionArn(), REGION);
verify(ecs, never()).deregisterTaskDefinition(TASK_DEF_ARN, REGION);
@@ -1018,7 +1019,7 @@ class EcsCfnProvisionerTest {
when(ecs.registerTaskDefinition(eq("web"), anyList(), isNull(), isNull(), isNull(), isNull(), isNull(), anyList(),
eq(REGION))).thenReturn(fifth);
provisioner.provision(r, mapper.createObjectNode().put("Family", "web"), ctx(TASK_DEF_ARN));
- org.mockito.Mockito.reset(ecs);
+ Mockito.reset(ecs);
UpdateCleanupResult cleanup = provisioner.completeUpdate(r);
assertTrue(cleanup.complete(), cleanup.toString());
verify(ecs).deregisterTaskDefinition(orphan, REGION);
@@ -1062,7 +1063,7 @@ class EcsCfnProvisionerTest {
// The engine gives up once the lowest count reaches three and clears; only the exhausted
// entries go, and an entry that succeeded meanwhile is gone already.
- org.mockito.Mockito.doReturn(new TaskDefinition()).when(ecs).deregisterTaskDefinition(TASK_DEF_ARN, REGION);
+ Mockito.doReturn(new TaskDefinition()).when(ecs).deregisterTaskDefinition(TASK_DEF_ARN, REGION);
UpdateCleanupResult second = provisioner.completeUpdate(r);
assertFalse(second.complete(), "the exhausted orphan is still listed");
assertEquals(3, second.attempts());
@@ -1070,7 +1071,7 @@ class EcsCfnProvisionerTest {
provisioner.clearUpdate(r);
assertFalse(provisioner.hasReplacementUpdate(r), "nothing with attempts left remains");
// One delete during the failed rollback, then the three cleanup attempts, never a fifth.
- verify(ecs, org.mockito.Mockito.times(4)).deregisterTaskDefinition(orphan, REGION);
+ verify(ecs, Mockito.times(4)).deregisterTaskDefinition(orphan, REGION);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ElbV2CfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ElbV2CfnProvisionerTest.java
index a979b1657a..0996a5818e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ElbV2CfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ElbV2CfnProvisionerTest.java
@@ -21,6 +21,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.HashSet;
@@ -236,7 +237,7 @@ class ElbV2CfnProvisionerTest {
updated.getAttributes().put("LoadBalancerName", generated);
provisioner.provision(updated, onTwoSubnets(mapper.createObjectNode()), ctx(LB_ARN));
- verify(elb, org.mockito.Mockito.times(2)).createLoadBalancer(eq(REGION), eq(generated), isNull(), isNull(),
+ verify(elb, Mockito.times(2)).createLoadBalancer(eq(REGION), eq(generated), isNull(), isNull(),
isNull(), eq(TWO_SUBNETS), anyList(), any());
}
@@ -424,7 +425,7 @@ class ElbV2CfnProvisionerTest {
provisioner.provision(retained, onTwoSubnets(mapper.createObjectNode().put("Name", "web-v2")), ctx(LB_ARN));
assertNull(provisioner.updateCleanupPhysicalId(retained));
assertEquals(new UpdateCleanupResult(true, true, LB_ARN, 0, null), provisioner.completeUpdate(retained));
- verify(elb, org.mockito.Mockito.times(1)).deleteLoadBalancer(REGION, LB_ARN);
+ verify(elb, Mockito.times(1)).deleteLoadBalancer(REGION, LB_ARN);
}
@Test
@@ -445,7 +446,7 @@ class ElbV2CfnProvisionerTest {
UpdateCleanupResult third = provisioner.completeUpdate(r);
assertEquals(3, third.attempts());
assertEquals(3, provisioner.completeUpdate(r).attempts(), "no fourth attempt");
- verify(elb, org.mockito.Mockito.times(3)).deleteListener(REGION, LISTENER_ARN);
+ verify(elb, Mockito.times(3)).deleteListener(REGION, LISTENER_ARN);
}
@Test
@@ -835,7 +836,7 @@ class ElbV2CfnProvisionerTest {
// The replacement the failed update created stays owed a delete; the restored prior does not.
assertTrue(provisioner.hasReplacementUpdate(r));
assertEquals(renamed.getLoadBalancerArn(), provisioner.updateCleanupPhysicalId(r));
- org.mockito.Mockito.reset(elb);
+ Mockito.reset(elb);
// A retried rollback (ContinueUpdateRollback) re-attempts the delete that failed; succeeding,
// it owes nothing more and never touches the restored prior.
assertTrue(provisioner.rollbackUpdate(r));
@@ -875,7 +876,7 @@ class ElbV2CfnProvisionerTest {
when(elb.createLoadBalancer(eq(REGION), eq("web-v3"), isNull(), isNull(), isNull(), eq(TWO_SUBNETS), anyList(), any()))
.thenReturn(third);
provisioner.provision(r, onTwoSubnets(mapper.createObjectNode().put("Name", "web-v3")), ctx(LB_ARN));
- org.mockito.Mockito.reset(elb);
+ Mockito.reset(elb);
UpdateCleanupResult cleanup = provisioner.completeUpdate(r);
assertTrue(cleanup.complete(), cleanup.toString());
verify(elb).deleteLoadBalancer(REGION, orphanArn);
@@ -913,8 +914,8 @@ class ElbV2CfnProvisionerTest {
UpdateCleanupResult third3 = provisioner.completeUpdate(r);
assertEquals(3, third3.attempts());
assertEquals("listeners attached", third3.failureReason());
- verify(elb, org.mockito.Mockito.times(1)).deleteLoadBalancer(REGION, LB_ARN);
- verify(elb, org.mockito.Mockito.times(4)).deleteLoadBalancer(REGION, orphanArn);
+ verify(elb, Mockito.times(1)).deleteLoadBalancer(REGION, LB_ARN);
+ verify(elb, Mockito.times(4)).deleteLoadBalancer(REGION, orphanArn);
}
@Test
@@ -949,13 +950,13 @@ class ElbV2CfnProvisionerTest {
assertEquals(first.previousPhysicalId(), provisioner.updateCleanupPhysicalId(r),
"progress and failure events name the same entity");
- org.mockito.Mockito.doNothing().when(elb).deleteLoadBalancer(REGION, LB_ARN);
+ Mockito.doNothing().when(elb).deleteLoadBalancer(REGION, LB_ARN);
UpdateCleanupResult second = provisioner.completeUpdate(r);
assertEquals(3, second.attempts(), "only the exhausted orphan remains");
assertEquals(orphanArn, second.previousPhysicalId());
provisioner.clearUpdate(r);
assertFalse(provisioner.hasReplacementUpdate(r));
- verify(elb, org.mockito.Mockito.times(4)).deleteLoadBalancer(REGION, orphanArn);
+ verify(elb, Mockito.times(4)).deleteLoadBalancer(REGION, orphanArn);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EventsCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EventsCfnProvisionerTest.java
index ee7f3cd839..8ce02317f3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EventsCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/EventsCfnProvisionerTest.java
@@ -18,6 +18,8 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
import org.mockito.stubbing.OngoingStubbing;
import java.util.ArrayList;
@@ -526,8 +528,8 @@ class EventsCfnProvisionerTest {
}
private void doThrowOnRemovePermission(AwsException e) {
- org.mockito.Mockito.doThrow(e).when(events)
- .removePermission(anyString(), anyString(), org.mockito.ArgumentMatchers.anyBoolean(), anyString());
+ Mockito.doThrow(e).when(events)
+ .removePermission(anyString(), anyString(), ArgumentMatchers.anyBoolean(), anyString());
}
// ── a failed stack update puts the rule's targets back ────────────────────
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamInstanceProfileCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamInstanceProfileCfnProvisionerTest.java
index 67e80bef78..fe71552931 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamInstanceProfileCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamInstanceProfileCfnProvisionerTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.iam.IamService;
import io.github.hectorvent.floci.services.iam.model.InstanceProfile;
import org.junit.jupiter.api.Test;
+import org.mockito.InOrder;
import java.util.ArrayList;
import java.util.HashMap;
@@ -106,7 +107,7 @@ class IamInstanceProfileCfnProvisionerTest {
{"InstanceProfileName": "web", "Roles": ["new-role"]}
"""), ctx("web"));
- org.mockito.InOrder order = inOrder(iam);
+ InOrder order = inOrder(iam);
order.verify(iam).removeRoleFromInstanceProfile("web", "old-role");
order.verify(iam).addRoleToInstanceProfile("web", "new-role");
}
@@ -263,7 +264,7 @@ class IamInstanceProfileCfnProvisionerTest {
provisioner.delete(TYPE, "web", "us-east-1");
- org.mockito.InOrder order = inOrder(iam);
+ InOrder order = inOrder(iam);
order.verify(iam).removeRoleFromInstanceProfile("web", "app-role");
order.verify(iam).deleteInstanceProfile("web");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamUserCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamUserCfnProvisionerTest.java
index ed91ba82e6..20ca5cbfd4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamUserCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamUserCfnProvisionerTest.java
@@ -17,6 +17,7 @@ import org.mockito.InOrder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -97,7 +98,7 @@ class IamUserCfnProvisionerTest {
@Test
void declaresIamUserResourceType() {
- assertEquals(java.util.Set.of("AWS::IAM::User"), provisioner.resourceTypes());
+ assertEquals(Set.of("AWS::IAM::User"), provisioner.resourceTypes());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/KinesisCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/KinesisCfnProvisionerTest.java
index 70dc0dad0c..8eea5b6a06 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/KinesisCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/KinesisCfnProvisionerTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.kinesis.KinesisService;
import io.github.hectorvent.floci.services.kinesis.model.KinesisStream;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.List;
@@ -195,7 +196,7 @@ class KinesisCfnProvisionerTest {
@Test
void aFailedCleanupOfTheRenamedStreamIsSwallowed() {
when(kinesis.createStream(eq("new"), anyInt(), any(), anyString())).thenReturn(stream("arn", 24));
- org.mockito.Mockito.doThrow(new RuntimeException("boom"))
+ Mockito.doThrow(new RuntimeException("boom"))
.when(kinesis).deleteStream("old", REGION);
StackResource r = provision("""
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaAddressingCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaAddressingCfnProvisionerTest.java
index 872de806b7..179d6cea9d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaAddressingCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaAddressingCfnProvisionerTest.java
@@ -11,6 +11,7 @@ import io.github.hectorvent.floci.services.lambda.model.LambdaUrlConfig;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -241,7 +242,7 @@ class LambdaAddressingCfnProvisionerTest {
CloudFormationTemplateEngine engine = ctx().engine();
when(engine.resolveStringList(any())).thenAnswer(inv -> {
JsonNode node = inv.getArgument(0);
- List<String> values = new java.util.ArrayList<>();
+ List<String> values = new ArrayList<>();
if (node != null && node.isArray()) {
node.forEach(element -> values.add(element.asText()));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaEventSourceMappingCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaEventSourceMappingCfnProvisionerTest.java
index 22e46853c6..6d6790bfe9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaEventSourceMappingCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaEventSourceMappingCfnProvisionerTest.java
@@ -12,6 +12,7 @@ import io.github.hectorvent.floci.services.lambda.model.EventSourceMapping;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -98,7 +99,7 @@ class LambdaEventSourceMappingCfnProvisionerTest {
if (props == null || !props.has(propName) || !props.get(propName).isArray()) {
return List.of();
}
- java.util.List<String> list = new java.util.ArrayList<>();
+ List<String> list = new ArrayList<>();
for (JsonNode elem : props.get(propName)) {
list.add(elem.isTextual() ? elem.asText() : engine.resolve(elem));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaVersionAliasCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaVersionAliasCfnProvisionerTest.java
index d527e30c6e..d6e1b5f0f0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaVersionAliasCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/LambdaVersionAliasCfnProvisionerTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.lambda.LambdaService;
import io.github.hectorvent.floci.services.lambda.model.LambdaAlias;
import io.github.hectorvent.floci.services.lambda.model.LambdaFunction;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.util.HashMap;
import java.util.Map;
@@ -165,7 +166,7 @@ class LambdaVersionAliasCfnProvisionerTest {
void deleteAliasAlreadyGoneIsIdempotent() {
// The function may have been deleted first, taking its aliases with it; a stack delete has
// to stay idempotent rather than transition to DELETE_FAILED.
- org.mockito.Mockito.doThrow(new AwsException("ResourceNotFoundException", "Alias not found: production", 404))
+ Mockito.doThrow(new AwsException("ResourceNotFoundException", "Alias not found: production", 404))
.when(lambda).deleteAlias(any(), any(), any());
provisioner.delete("AWS::Lambda::Alias", ALIAS_ARN, "us-east-1");
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/OrganizationsCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/OrganizationsCfnProvisionerTest.java
index 26d8e7f6a1..4eb4c09f3a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/OrganizationsCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/OrganizationsCfnProvisionerTest.java
@@ -15,6 +15,7 @@ import io.github.hectorvent.floci.services.organizations.model.OrganizationalUni
import io.github.hectorvent.floci.services.organizations.model.Root;
import org.junit.jupiter.api.Test;
import org.mockito.InOrder;
+import org.mockito.Mockito;
import java.time.Instant;
import java.util.HashMap;
@@ -520,7 +521,7 @@ class OrganizationsCfnProvisionerTest {
void deleteToleratesAResourceThatDisappearedBetweenLookupAndDelete() {
when(organizations.findManagementAccountForResource("ou-ab12-abcd1234"))
.thenReturn(Optional.of(ACCOUNT));
- org.mockito.Mockito.doThrow(new AwsException("OrganizationalUnitNotFoundException", "gone", 400))
+ Mockito.doThrow(new AwsException("OrganizationalUnitNotFoundException", "gone", 400))
.when(organizations).deleteOrganizationalUnit(ACCOUNT, "ou-ab12-abcd1234");
provisioner.delete("AWS::Organizations::OrganizationalUnit", "ou-ab12-abcd1234", "us-east-1");
@@ -530,7 +531,7 @@ class OrganizationsCfnProvisionerTest {
void deleteRethrowsARealFailure() {
when(organizations.findManagementAccountForResource("ou-ab12-abcd1234"))
.thenReturn(Optional.of(ACCOUNT));
- org.mockito.Mockito.doThrow(new AwsException("OrganizationalUnitNotEmptyException", "busy", 400))
+ Mockito.doThrow(new AwsException("OrganizationalUnitNotEmptyException", "busy", 400))
.when(organizations).deleteOrganizationalUnit(ACCOUNT, "ou-ab12-abcd1234");
AwsException error = assertThrows(AwsException.class, () -> provisioner.delete(
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/PipesCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/PipesCfnProvisionerTest.java
index 74744f5dd7..42b1caf665 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/PipesCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/PipesCfnProvisionerTest.java
@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -165,7 +166,7 @@ class PipesCfnProvisionerTest {
}
/** UpdatePipe reads an absent value as "leave this one alone", which the stub mirrors. */
- private static <T> void applyIfPresent(T value, java.util.function.Consumer<T> setter) {
+ private static <T> void applyIfPresent(T value, Consumer<T> setter) {
if (value != null) {
setter.accept(value);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ProvisionContextTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ProvisionContextTest.java
index 44ad24e72b..afb366bedc 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ProvisionContextTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/ProvisionContextTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplate
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -317,7 +318,7 @@ class ProvisionContextTest {
@Test
void staleTagKeysListsTheCurrentKeysTheTemplateDropped() {
- Map<String, String> current = new java.util.LinkedHashMap<>();
+ Map<String, String> current = new LinkedHashMap<>();
current.put("Keep", "same");
current.put("Old", "value");
current.put("Gone", "too");
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisionerTest.java
index 857f3ca258..254ee4735b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/Route53CfnProvisionerTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation.provisioners;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplateEngine;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
@@ -17,12 +18,15 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -59,9 +63,9 @@ class Route53CfnProvisionerTest {
JsonNode props = mapper.createObjectNode()
.put("Name", "ssm.us-east-1.amazonaws.com")
.set("HostedZoneConfig", mapper.createObjectNode().put("Comment", "central endpoint zone"));
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1")));
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
+ ((ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
.add(mapper.createObjectNode().put("Key", "Accelerator").put("Value", "AWSAccelerator")));
CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class);
@@ -81,7 +85,7 @@ class Route53CfnProvisionerTest {
eq("central endpoint zone"), argThat(sameVpc(vpc)));
verify(service, never()).associateVpcWithHostedZone(any(), any(), any());
verify(service).changeTagsForResource("hostedzone", "Z123456789",
- List.of(java.util.Map.of("Key", "Accelerator", "Value", "AWSAccelerator")), List.of());
+ List.of(Map.of("Key", "Accelerator", "Value", "AWSAccelerator")), List.of());
}
@Test
@@ -98,7 +102,7 @@ class Route53CfnProvisionerTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1"))
.add(mapper.createObjectNode().put("VPCId", "vpc-456").put("VPCRegion", "us-west-2")));
@@ -132,7 +136,7 @@ class Route53CfnProvisionerTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1"))
.add(mapper.createObjectNode().put("VPCId", "vpc-456").put("VPCRegion", "us-west-2")));
@@ -153,9 +157,9 @@ class Route53CfnProvisionerTest {
+ "follow-up VPC association fails, so CREATE_FAILED cleanup still deletes it");
}
- private static org.mockito.ArgumentMatcher<VpcAssociation> sameVpc(VpcAssociation expected) {
+ private static ArgumentMatcher<VpcAssociation> sameVpc(VpcAssociation expected) {
if (expected == null) {
- return java.util.Objects::isNull;
+ return Objects::isNull;
}
return actual -> actual != null
&& expected.getVpcId().equals(actual.getVpcId())
@@ -205,7 +209,7 @@ class Route53CfnProvisionerTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1")));
CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class);
@@ -229,7 +233,7 @@ class Route53CfnProvisionerTest {
Route53Service service = mock(Route53Service.class);
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123")));
CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class);
@@ -250,7 +254,7 @@ class Route53CfnProvisionerTest {
Route53Service service = mock(Route53Service.class);
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", " ")));
CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class);
@@ -278,9 +282,9 @@ class Route53CfnProvisionerTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1")));
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
+ ((ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
.add(mapper.createObjectNode().put("Key", "").put("Value", "blank-key-should-be-skipped"))
.add(mapper.createObjectNode().put("Key", "Accelerator").put("Value", "AWSAccelerator")));
@@ -295,7 +299,7 @@ class Route53CfnProvisionerTest {
new Route53CfnProvisioner(service).provision(resource, props, context);
verify(service).changeTagsForResource("hostedzone", "Z123456789",
- List.of(java.util.Map.of("Key", "Accelerator", "Value", "AWSAccelerator")), List.of());
+ List.of(Map.of("Key", "Accelerator", "Value", "AWSAccelerator")), List.of());
}
@Test
@@ -323,7 +327,7 @@ class Route53CfnProvisionerTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("VPCs", mapper.createArrayNode()
+ ((ObjectNode) props).set("VPCs", mapper.createArrayNode()
.add(mapper.createObjectNode().put("VPCId", "vpc-123").put("VPCRegion", "us-east-1"))
.add(mapper.createObjectNode().put("VPCId", "vpc-456").put("VPCRegion", "us-west-2")));
@@ -358,12 +362,12 @@ class Route53CfnProvisionerTest {
eq(null), eq(null))).thenReturn(new Route53Service.CreateZoneResult(zone, null));
when(service.getNameServers()).thenReturn(List.of("ns-1.example", "ns-2.example"));
RuntimeException tagFailure = new AwsException("ServiceUnavailable", "throttled", 503);
- org.mockito.Mockito.doThrow(tagFailure).when(service)
+ Mockito.doThrow(tagFailure).when(service)
.changeTagsForResource(eq("hostedzone"), eq("Z987654321"), any(), any());
ObjectMapper mapper = new ObjectMapper();
JsonNode props = mapper.createObjectNode().put("Name", "ssm.us-east-1.amazonaws.com");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
+ ((ObjectNode) props).set("HostedZoneTags", mapper.createArrayNode()
.add(mapper.createObjectNode().put("Key", "Accelerator").put("Value", "AWSAccelerator")));
CloudFormationTemplateEngine engine = mock(CloudFormationTemplateEngine.class);
@@ -395,7 +399,7 @@ class Route53CfnProvisionerTest {
.put("Name", "www.example.com")
.put("Type", "A")
.put("TTL", "300");
- ((com.fasterxml.jackson.databind.node.ObjectNode) props).set("ResourceRecords",
+ ((ObjectNode) props).set("ResourceRecords",
mapper.createArrayNode().add("10.0.0.1"));
CloudFormationTemplateEngine engine = recordEngine();
ProvisionContext context = new ProvisionContext(engine, "us-east-1", "623666680275", "dns-stack");
@@ -1451,7 +1455,7 @@ class Route53CfnProvisionerTest {
when(service.getHealthCheck("hc-1")).thenReturn(prior);
when(service.updateHealthCheck(eq("hc-1"), any())).thenReturn(prior);
when(service.listTagsForResource("healthcheck", "hc-1")).thenReturn(Map.of());
- org.mockito.Mockito.doThrow(new AwsException("Throttling", "slow down", 400)).doNothing()
+ Mockito.doThrow(new AwsException("Throttling", "slow down", 400)).doNothing()
.when(service).changeTagsForResource(eq("healthcheck"), eq("hc-1"), any(), any());
StackResource resource = existingCheck();
JsonNode props = new ObjectMapper().readTree("""
@@ -1470,7 +1474,7 @@ class Route53CfnProvisionerTest {
Route53Service service = mock(Route53Service.class);
when(service.createHealthCheck(any(), any(), any()))
.thenAnswer(inv -> new HealthCheck("hc-1", inv.getArgument(0), inv.getArgument(1), inv.getArgument(2)));
- org.mockito.Mockito.doThrow(new AwsException("Throttling", "slow down", 400))
+ Mockito.doThrow(new AwsException("Throttling", "slow down", 400))
.when(service).changeTagsForResource(any(), any(), any(), any());
JsonNode props = new ObjectMapper().readTree("""
{"HealthCheckConfig": {"Type": "TCP", "IPAddress": "10.0.0.5", "Port": 22},
@@ -1559,7 +1563,7 @@ class Route53CfnProvisionerTest {
@Test
void deletingAHealthCheckAlreadyGoneIsTolerated() {
Route53Service service = mock(Route53Service.class);
- org.mockito.Mockito.doThrow(new AwsException("NoSuchHealthCheck", "gone", 404))
+ Mockito.doThrow(new AwsException("NoSuchHealthCheck", "gone", 404))
.when(service).deleteHealthCheck("hc-1");
StackResource resource = new StackResource();
resource.setLogicalId("Check");
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/SchedulerScheduleGroupCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/SchedulerScheduleGroupCfnProvisionerTest.java
index 6394c84844..a6b7f670ee 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/SchedulerScheduleGroupCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/SchedulerScheduleGroupCfnProvisionerTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
import io.github.hectorvent.floci.services.scheduler.SchedulerService;
import io.github.hectorvent.floci.services.scheduler.model.ScheduleGroup;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.time.Instant;
import java.util.HashMap;
@@ -312,7 +313,7 @@ class SchedulerScheduleGroupCfnProvisionerTest {
}
private void doThrowNotFoundOnDelete(String name) {
- org.mockito.Mockito.doThrow(new AwsException("ResourceNotFoundException", "not found", 404))
+ Mockito.doThrow(new AwsException("ResourceNotFoundException", "not found", 404))
.when(schedulerService).deleteScheduleGroup(name, "us-east-1");
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/WafV2CfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/WafV2CfnProvisionerTest.java
index 7c241f7d79..b44f2477a5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/WafV2CfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/WafV2CfnProvisionerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation.provisioners;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.node.TextNode;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.cloudformation.CloudFormationTemplateEngine;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
@@ -137,7 +138,7 @@ class WafV2CfnProvisionerTest {
props.set("DefaultAction", mapper.createObjectNode());
ObjectNode resolved = requiredProps("portal");
resolved.set("DefaultAction",
- com.fasterxml.jackson.databind.node.TextNode.valueOf("{\"Allow\":{}}"));
+ TextNode.valueOf("{\"Allow\":{}}"));
WebAcl created = acl("portal", "acl-1", "REGIONAL", "lock-1");
when(wafV2.createWebAcl(any(), eq("REGIONAL"), eq("portal"), eq("us-east-1"))).thenReturn(created);
StackResource resource = resource();
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontOriginHttpClientTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontOriginHttpClientTest.java
index 660d1c2b38..4e018738d9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontOriginHttpClientTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudfront/CloudFrontOriginHttpClientTest.java
@@ -36,7 +36,9 @@ import java.net.UnknownHostException;
import java.net.http.HttpRequest;
import java.nio.charset.StandardCharsets;
import java.security.KeyStore;
+import java.security.PrivateKey;
import java.security.Security;
+import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.time.Duration;
import java.util.List;
@@ -171,7 +173,7 @@ class CloudFrontOriginHttpClientTest {
try (CloudFrontOriginHttpClient client = new CloudFrontOriginHttpClient(
resolver(InetAddress.getByName("127.0.0.1")), List.of("origin.invalid"))) {
- HttpRequest request = HttpRequest.newBuilder(java.net.URI.create(
+ HttpRequest request = HttpRequest.newBuilder(URI.create(
"http://origin.invalid:" + server.getAddress().getPort() + "/"))
.timeout(Duration.ofSeconds(5))
.header("X-Origin-Verify", "viewer-value")
@@ -206,7 +208,7 @@ class CloudFrontOriginHttpClientTest {
byte[] payload = "{\"a\":1}".getBytes(StandardCharsets.UTF_8);
try (CloudFrontOriginHttpClient client = new CloudFrontOriginHttpClient(
resolver(InetAddress.getByName("127.0.0.1")), List.of("origin.invalid"))) {
- HttpRequest request = HttpRequest.newBuilder(java.net.URI.create(
+ HttpRequest request = HttpRequest.newBuilder(URI.create(
"http://origin.invalid:" + server.getAddress().getPort() + "/items"))
.timeout(Duration.ofSeconds(5))
.header("Content-Type", "application/json")
@@ -911,7 +913,7 @@ class CloudFrontOriginHttpClientTest {
}
private static HttpRequest request(String uri) {
- return HttpRequest.newBuilder(java.net.URI.create(uri))
+ return HttpRequest.newBuilder(URI.create(uri))
.timeout(Duration.ofSeconds(5))
.GET()
.build();
@@ -948,12 +950,12 @@ class CloudFrontOriginHttpClientTest {
}
private static SSLContext serverSslContext(
- X509Certificate certificate, java.security.PrivateKey privateKey) throws Exception {
+ X509Certificate certificate, PrivateKey privateKey) throws Exception {
char[] password = "changeit".toCharArray();
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(null, password);
keyStore.setKeyEntry("origin", privateKey, password,
- new java.security.cert.Certificate[] { certificate });
+ new Certificate[] { certificate });
KeyManagerFactory keyManagers = KeyManagerFactory.getInstance(
KeyManagerFactory.getDefaultAlgorithm());
keyManagers.init(keyStore, password);
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudfront/ResponseHeadersPolicyConfigCodecTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudfront/ResponseHeadersPolicyConfigCodecTest.java
index 4e8ef49aa9..69355dd03b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudfront/ResponseHeadersPolicyConfigCodecTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudfront/ResponseHeadersPolicyConfigCodecTest.java
@@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -166,7 +167,7 @@ class ResponseHeadersPolicyConfigCodecTest {
ResponseHeadersPolicyConfigCodec.Directives simple = ResponseHeadersPolicyConfigCodec.directives(
config, "https://viewer.example", false, true, null);
Map<String, String> simpleHeaders = simple.add().stream().collect(
- java.util.stream.Collectors.toMap(
+ Collectors.toMap(
ResponseHeadersPolicyConfigCodec.PolicyHeader::name,
ResponseHeadersPolicyConfigCodec.PolicyHeader::value));
assertEquals(Map.of("Access-Control-Allow-Origin", "*"), simpleHeaders);
@@ -174,7 +175,7 @@ class ResponseHeadersPolicyConfigCodecTest {
ResponseHeadersPolicyConfigCodec.Directives preflight = ResponseHeadersPolicyConfigCodec.directives(
config, "https://viewer.example", true, true, null);
Map<String, String> preflightHeaders = preflight.add().stream().collect(
- java.util.stream.Collectors.toMap(
+ Collectors.toMap(
ResponseHeadersPolicyConfigCodec.PolicyHeader::name,
ResponseHeadersPolicyConfigCodec.PolicyHeader::value));
assertEquals("*", preflightHeaders.get("Access-Control-Allow-Origin"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2IntegrationTest.java
index ffc5ac7c4e..e9afe7596b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudhsmv2/CloudHsmV2IntegrationTest.java
@@ -2,6 +2,17 @@ package io.github.hectorvent.floci.services.cloudhsmv2;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.bouncycastle.asn1.x500.X500Name;
+import org.bouncycastle.cert.X509CertificateHolder;
+import org.bouncycastle.cert.X509v3CertificateBuilder;
+import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openssl.PEMParser;
+import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
+import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
+import org.bouncycastle.operator.ContentSigner;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
+import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -9,6 +20,16 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestMethodOrder;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.util.Date;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -949,35 +970,35 @@ class CloudHsmV2IntegrationTest {
}
private String[] generateCerts(String csrPem) throws Exception {
- java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
- java.security.KeyPairGenerator keyGen = java.security.KeyPairGenerator.getInstance("RSA", "BC");
- keyGen.initialize(2048, new java.security.SecureRandom());
- java.security.KeyPair caKeyPair = keyGen.generateKeyPair();
- org.bouncycastle.asn1.x500.X500Name caName = new org.bouncycastle.asn1.x500.X500Name("CN=Floci Test CA");
+ Security.addProvider(new BouncyCastleProvider());
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA", "BC");
+ keyGen.initialize(2048, new SecureRandom());
+ KeyPair caKeyPair = keyGen.generateKeyPair();
+ X500Name caName = new X500Name("CN=Floci Test CA");
long now = System.currentTimeMillis();
- java.util.Date startDate = new java.util.Date(now);
- java.util.Date endDate = new java.util.Date(now + 365L * 24 * 3600 * 1000);
- java.math.BigInteger serial = java.math.BigInteger.valueOf(now);
- org.bouncycastle.cert.X509v3CertificateBuilder caBuilder = new org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder(
+ Date startDate = new Date(now);
+ Date endDate = new Date(now + 365L * 24 * 3600 * 1000);
+ BigInteger serial = BigInteger.valueOf(now);
+ X509v3CertificateBuilder caBuilder = new JcaX509v3CertificateBuilder(
caName, serial, startDate, endDate, caName, caKeyPair.getPublic());
- org.bouncycastle.operator.ContentSigner caSigner = new org.bouncycastle.operator.jcajce.JcaContentSignerBuilder("SHA256WithRSA")
+ ContentSigner caSigner = new JcaContentSignerBuilder("SHA256WithRSA")
.setProvider("BC").build(caKeyPair.getPrivate());
- org.bouncycastle.cert.X509CertificateHolder caHolder = caBuilder.build(caSigner);
- java.io.StringWriter caSw = new java.io.StringWriter();
- try (org.bouncycastle.openssl.jcajce.JcaPEMWriter pw = new org.bouncycastle.openssl.jcajce.JcaPEMWriter(caSw)) {
+ X509CertificateHolder caHolder = caBuilder.build(caSigner);
+ StringWriter caSw = new StringWriter();
+ try (JcaPEMWriter pw = new JcaPEMWriter(caSw)) {
pw.writeObject(caHolder);
}
String trustAnchor = caSw.toString();
- org.bouncycastle.pkcs.PKCS10CertificationRequest csr;
- try (org.bouncycastle.openssl.PEMParser parser = new org.bouncycastle.openssl.PEMParser(new java.io.StringReader(csrPem))) {
- csr = (org.bouncycastle.pkcs.PKCS10CertificationRequest) parser.readObject();
+ PKCS10CertificationRequest csr;
+ try (PEMParser parser = new PEMParser(new StringReader(csrPem))) {
+ csr = (PKCS10CertificationRequest) parser.readObject();
}
- java.security.PublicKey csrPublicKey = new org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter().setProvider("BC").getPublicKey(csr.getSubjectPublicKeyInfo());
- org.bouncycastle.cert.X509v3CertificateBuilder certBuilder = new org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder(
- caName, serial.add(java.math.BigInteger.ONE), startDate, endDate, csr.getSubject(), csrPublicKey);
- org.bouncycastle.cert.X509CertificateHolder certHolder = certBuilder.build(caSigner);
- java.io.StringWriter certSw = new java.io.StringWriter();
- try (org.bouncycastle.openssl.jcajce.JcaPEMWriter pw = new org.bouncycastle.openssl.jcajce.JcaPEMWriter(certSw)) {
+ PublicKey csrPublicKey = new JcaPEMKeyConverter().setProvider("BC").getPublicKey(csr.getSubjectPublicKeyInfo());
+ X509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(
+ caName, serial.add(BigInteger.ONE), startDate, endDate, csr.getSubject(), csrPublicKey);
+ X509CertificateHolder certHolder = certBuilder.build(caSigner);
+ StringWriter certSw = new StringWriter();
+ try (JcaPEMWriter pw = new JcaPEMWriter(certSw)) {
pw.writeObject(certHolder);
}
String signedCert = certSw.toString();
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java
index a681516a60..0fe3c6b00b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudtrail;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -160,7 +161,7 @@ class CloudTrailAdvancedSelectorsIntegrationTest {
// --- Helpers ---
- private static io.restassured.response.Response invokeCloudTrail(String action, String body) {
+ private static Response invokeCloudTrail(String action, String body) {
return given()
.header("X-Amz-Target", CT_TARGET + action)
.contentType(JSON11)
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailIntegrationTest.java
index 06e58b6eb0..5b0c8771b5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailIntegrationTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -485,7 +486,7 @@ class CloudTrailIntegrationTest {
// --- Helpers ---
- private static io.restassured.response.Response invokeCloudTrail(String action, String body) {
+ private static Response invokeCloudTrail(String action, String body) {
return given()
.header("X-Amz-Target", CT_TARGET + action)
.contentType(JSON11)
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailListingAndTagsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailListingAndTagsIntegrationTest.java
index 38315821c1..5a922a8390 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailListingAndTagsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailListingAndTagsIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudtrail;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -154,7 +155,7 @@ class CloudTrailListingAndTagsIntegrationTest {
// --- Helpers ---
- private static io.restassured.response.Response invokeCloudTrail(String action, String body) {
+ private static Response invokeCloudTrail(String action, String body) {
return given()
.header("X-Amz-Target", CT_TARGET + action)
.contentType(JSON11)
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailLogWriterBoundedRetryIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailLogWriterBoundedRetryIntegrationTest.java
index 2f9bc26b92..3a6a12dfe6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailLogWriterBoundedRetryIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudtrail/CloudTrailLogWriterBoundedRetryIntegrationTest.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -270,7 +271,7 @@ class CloudTrailLogWriterBoundedRetryIntegrationTest {
return new ObjectMapper().readTree(body);
}
- private static io.restassured.response.Response invokeCloudTrail(String action, String body) {
+ private static Response invokeCloudTrail(String action, String body) {
return given()
.header("X-Amz-Target", CT_TARGET + action)
.contentType(JSON11)
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsCrossAccountIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsCrossAccountIntegrationTest.java
index b0080fc84b..af9d259d1a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsCrossAccountIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsCrossAccountIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudwatch.logs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -52,7 +53,7 @@ class CloudWatchLogsCrossAccountIntegrationTest {
.then().statusCode(400).body("__type", equalTo("InvalidParameterException"));
}
- private static io.restassured.response.Response json(String target, String body) {
+ private static Response json(String target, String body) {
return given().contentType(CONTENT_TYPE).header("Authorization", AUTH).header("X-Amz-Target", target)
.body(body).post("/");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsMetricFilterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsMetricFilterIntegrationTest.java
index 15cd8e2785..abb7419dda 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsMetricFilterIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsMetricFilterIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudwatch.logs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -159,7 +160,7 @@ class CloudWatchLogsMetricFilterIntegrationTest {
.body("nextToken", nullValue());
logs("DescribeMetricFilters", "{\"metricName\":\"Latency\",\"metricNamespace\":\"App\"}").then()
.statusCode(200)
- .body("metricFilters.logGroupName", org.hamcrest.Matchers.hasItem(group));
+ .body("metricFilters.logGroupName", Matchers.hasItem(group));
logs("DescribeLogGroups", "{\"logGroupNamePrefix\":\"" + group + "\"}").then()
.statusCode(200)
.body("logGroups[0].metricFilterCount", equalTo(1));
diff --git a/src/test/java/io/github/hectorvent/floci/services/codeartifact/BagetterSidecarClientTest.java b/src/test/java/io/github/hectorvent/floci/services/codeartifact/BagetterSidecarClientTest.java
index 636af91416..ae10a175df 100644
--- a/src/test/java/io/github/hectorvent/floci/services/codeartifact/BagetterSidecarClientTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/codeartifact/BagetterSidecarClientTest.java
@@ -15,6 +15,7 @@ import java.net.InetSocketAddress;
import java.net.http.HttpClient;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
+import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@@ -332,7 +333,7 @@ class BagetterSidecarClientTest {
private void respondWithVersions(String packageName, String... versions) {
String json = "{\"versions\":[" + String.join(",",
- java.util.Arrays.stream(versions).map(v -> "\"" + v + "\"").toArray(String[]::new)) + "]}";
+ Arrays.stream(versions).map(v -> "\"" + v + "\"").toArray(String[]::new)) + "]}";
backend.createContext("/v3/package/" + packageName + "/index.json", exchange -> {
byte[] bytes = json.getBytes(StandardCharsets.UTF_8);
exchange.getResponseHeaders().set("Content-Type", "application/json");
diff --git a/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactNuGetDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactNuGetDockerIntegrationTest.java
index 1b352ebd3f..0ebd651d40 100644
--- a/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactNuGetDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactNuGetDockerIntegrationTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.restassured.path.json.JsonPath;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -111,7 +112,7 @@ class CodeArtifactNuGetDockerIntegrationTest {
given().header("Authorization", "Bearer " + bearerToken)
.get("/codeartifact/nuget/" + DOMAIN + "/" + REPO + "/v3/package/" + LOWER_ID + "/index.json")
.then().statusCode(200)
- .body("versions", org.hamcrest.Matchers.hasItem(VERSION));
+ .body("versions", Matchers.hasItem(VERSION));
byte[] fetchedNupkg = given().header("Authorization", "Bearer " + bearerToken)
.get("/codeartifact/nuget/" + DOMAIN + "/" + REPO + "/v3/package/" + LOWER_ID + "/" + VERSION + "/"
diff --git a/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactPypiControllerTest.java b/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactPypiControllerTest.java
index 5ca8ca1db8..1456b0b9ad 100644
--- a/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactPypiControllerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/codeartifact/CodeArtifactPypiControllerTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.codeartifact;
+import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.codeartifact.CodeArtifactService.AuthorizationTokenScope;
@@ -11,6 +12,7 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.http.HttpClient;
import java.nio.charset.StandardCharsets;
@@ -626,13 +628,13 @@ class CodeArtifactPypiControllerTest {
return body.getBytes(StandardCharsets.UTF_8);
}
- private static void respond(com.sun.net.httpserver.HttpExchange exchange, int status, String contentType,
- String body) throws java.io.IOException {
+ private static void respond(HttpExchange exchange, int status, String contentType,
+ String body) throws IOException {
respond(exchange, status, contentType, body.getBytes(StandardCharsets.UTF_8));
}
- private static void respond(com.sun.net.httpserver.HttpExchange exchange, int status, String contentType,
- byte[] body) throws java.io.IOException {
+ private static void respond(HttpExchange exchange, int status, String contentType,
+ byte[] body) throws IOException {
exchange.getResponseHeaders().add("Content-Type", contentType);
exchange.sendResponseHeaders(status, body.length);
exchange.getResponseBody().write(body);
diff --git a/src/test/java/io/github/hectorvent/floci/services/codedeploy/CodeDeployServicePersistenceTest.java b/src/test/java/io/github/hectorvent/floci/services/codedeploy/CodeDeployServicePersistenceTest.java
index 08a4c7a017..f1e6bda89d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/codedeploy/CodeDeployServicePersistenceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/codedeploy/CodeDeployServicePersistenceTest.java
@@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -63,7 +64,7 @@ class CodeDeployServicePersistenceTest {
assertEquals("Registered",
reloaded.getOnPremisesInstance(REGION, "onprem-1").getRegistrationStatus());
Map<String, String> appTags = reloaded.listTagsForResource(first.applicationArn(REGION, "web-app"))
- .stream().collect(java.util.stream.Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
+ .stream().collect(Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
assertEquals("prod", appTags.get("env")); // tagResource
assertEquals("platform", appTags.get("team")); // createApplication tags
}
@@ -90,7 +91,7 @@ class CodeDeployServicePersistenceTest {
assertEquals(List.of("g1"), reloaded.listDeploymentGroups(REGION, "keep-app"));
assertThrows(Exception.class, () -> reloaded.getDeploymentGroup(REGION, "keep-app", "g2"));
Map<String, String> tags = reloaded.listTagsForResource(arn).stream()
- .collect(java.util.stream.Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
+ .collect(Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
assertEquals("prod", tags.get("env"));
assertTrue(!tags.containsKey("team"), "untagged key must not reappear after restart");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineIntegrationTest.java
index 3e3890030e..6cdea58339 100644
--- a/src/test/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineIntegrationTest.java
@@ -9,6 +9,7 @@ import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
@@ -1191,7 +1192,7 @@ class CodePipelineIntegrationTest {
putObject("codepipeline-source-override", "source.zip", "default artifact");
String oldVersion = given()
.contentType("application/octet-stream")
- .body("selected old version".getBytes(java.nio.charset.StandardCharsets.UTF_8))
+ .body("selected old version".getBytes(StandardCharsets.UTF_8))
.when()
.put("/codepipeline-source-override/alternate.zip")
.then()
@@ -2803,7 +2804,7 @@ class CodePipelineIntegrationTest {
private static String putObject(String bucket, String key, String body, String revisionSummary) {
RequestSpecification request = given()
.contentType("application/octet-stream")
- .body(body.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ .body(body.getBytes(StandardCharsets.UTF_8));
if (revisionSummary != null) {
request.header("x-amz-meta-codepipeline-artifact-revision-summary", revisionSummary);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAliasUsernameIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAliasUsernameIntegrationTest.java
index 6bb7d8c4b1..dc17dbb058 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAliasUsernameIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAliasUsernameIntegrationTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -166,7 +167,7 @@ class CognitoAliasUsernameIntegrationTest {
@Order(5)
void signInByUuidAlsoIssuesTokens() {
initiateUserPasswordAuth(uuidUsername).then().statusCode(200)
- .body("AuthenticationResult.AccessToken", org.hamcrest.Matchers.notNullValue());
+ .body("AuthenticationResult.AccessToken", Matchers.notNullValue());
}
@Test
@@ -204,7 +205,7 @@ class CognitoAliasUsernameIntegrationTest {
// New email now signs in.
initiateUserPasswordAuth(NEW_EMAIL).then().statusCode(200)
- .body("AuthenticationResult.AccessToken", org.hamcrest.Matchers.notNullValue());
+ .body("AuthenticationResult.AccessToken", Matchers.notNullValue());
// Old email no longer resolves.
cognitoAction("InitiateAuth", """
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationConcurrencyTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationConcurrencyTest.java
index 8b3503971f..c5b7870f54 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationConcurrencyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationConcurrencyTest.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test;
import java.time.Duration;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -53,7 +54,7 @@ class CognitoAttributeVerificationConcurrencyTest {
Harness harness = harness(codes, dispatcher);
AtomicInteger issues = new AtomicInteger();
AtomicReference<String> latestCode = new AtomicReference<>();
- Map<String, String> destinationByCode = new java.util.concurrent.ConcurrentHashMap<>();
+ Map<String, String> destinationByCode = new ConcurrentHashMap<>();
CountDownLatch firstIssueEntered = new CountDownLatch(1);
CountDownLatch releaseFirstIssue = new CountDownLatch(1);
CountDownLatch secondStarted = new CountDownLatch(1);
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationIntegrationTest.java
index eed12ef508..ba033473ac 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoAttributeVerificationIntegrationTest.java
@@ -11,6 +11,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.util.List;
import java.util.UUID;
import static io.github.hectorvent.floci.services.cognito.CognitoRestAssuredUtils.cognitoAction;
@@ -377,7 +378,7 @@ class CognitoAttributeVerificationIntegrationTest {
.then()
.statusCode(200)
.body("UserPool.UserAttributeUpdateSettings.AttributesRequireVerificationBeforeUpdate",
- equalTo(java.util.List.of("email", "phone_number")));
+ equalTo(List.of("email", "phone_number")));
cognitoAction("UpdateUserPool", """
{
@@ -398,7 +399,7 @@ class CognitoAttributeVerificationIntegrationTest {
.then()
.statusCode(200)
.body("UserPool.UserAttributeUpdateSettings.AttributesRequireVerificationBeforeUpdate",
- equalTo(java.util.List.of("phone_number")));
+ equalTo(List.of("phone_number")));
}
private static void clearInspectionEndpoint(String path) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoDeleteUserPoolCascadeIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoDeleteUserPoolCascadeIntegrationTest.java
index b0d00fc504..02b840c754 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoDeleteUserPoolCascadeIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoDeleteUserPoolCascadeIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cognito;
import com.fasterxml.jackson.databind.JsonNode;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -109,7 +110,7 @@ class CognitoDeleteUserPoolCascadeIntegrationTest {
}
""".formatted(poolId, clientId))
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("ResourceNotFoundException"));
+ .body("__type", Matchers.equalTo("ResourceNotFoundException"));
cognitoAction("DeleteUserPool", """
{ "UserPoolId": "%s" }
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoIntegrationTest.java
index 56082ebd23..e069a8e840 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoIntegrationTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testutil.SesMailbox;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -25,9 +26,11 @@ import java.security.Signature;
import java.security.spec.RSAPublicKeySpec;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Spliterators;
import java.util.UUID;
import java.util.regex.Matcher;
@@ -137,9 +140,9 @@ class CognitoIntegrationTest {
""".formatted(clientId, USERNAME, PASSWORD))
.then()
.statusCode(200)
- .body("AuthenticationResult.AccessToken", org.hamcrest.Matchers.notNullValue())
- .body("AuthenticationResult.IdToken", org.hamcrest.Matchers.notNullValue())
- .body("AuthenticationResult.RefreshToken", org.hamcrest.Matchers.notNullValue());
+ .body("AuthenticationResult.AccessToken", Matchers.notNullValue())
+ .body("AuthenticationResult.IdToken", Matchers.notNullValue())
+ .body("AuthenticationResult.RefreshToken", Matchers.notNullValue());
}
@Test
@@ -157,7 +160,7 @@ class CognitoIntegrationTest {
.then()
.statusCode(400)
.body("__type", equalTo("InvalidParameterException"))
- .body("AuthenticationResult", org.hamcrest.Matchers.nullValue());
+ .body("AuthenticationResult", Matchers.nullValue());
}
@Test
@@ -176,7 +179,7 @@ class CognitoIntegrationTest {
.then()
.statusCode(400)
.body("__type", equalTo("InvalidParameterException"))
- .body("AuthenticationResult", org.hamcrest.Matchers.nullValue());
+ .body("AuthenticationResult", Matchers.nullValue());
}
@Test
@@ -210,7 +213,7 @@ class CognitoIntegrationTest {
""".formatted(poolId, clientId, USERNAME, PASSWORD))
.then()
.statusCode(200)
- .body("AuthenticationResult.AccessToken", org.hamcrest.Matchers.notNullValue());
+ .body("AuthenticationResult.AccessToken", Matchers.notNullValue());
}
@Test
@@ -289,7 +292,7 @@ class CognitoIntegrationTest {
assertTrue(schema.size() >= 20,
"DescribeUserPool must include all 20 Cognito standard attributes");
- java.util.Set<String> names = new java.util.HashSet<>();
+ Set<String> names = new HashSet<>();
schema.forEach(attr -> names.add(attr.path("Name").asText()));
for (String expected : List.of("sub", "name", "given_name", "family_name", "middle_name",
@@ -386,8 +389,8 @@ class CognitoIntegrationTest {
""".formatted(forgotPasswordClientId, forgotPasswordUsername))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("CodeMismatchException"))
- .body("message", org.hamcrest.Matchers.equalTo("Invalid verification code provided, please try again."));
+ .body("__type", Matchers.equalTo("CodeMismatchException"))
+ .body("message", Matchers.equalTo("Invalid verification code provided, please try again."));
}
@Test
@@ -471,7 +474,7 @@ class CognitoIntegrationTest {
""".formatted(strictClientId))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("InvalidPasswordException"));
+ .body("__type", Matchers.equalTo("InvalidPasswordException"));
cognitoAction("SignUp", """
{
@@ -656,8 +659,8 @@ class CognitoIntegrationTest {
""".formatted(signUpClientId, signUpUsername))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("CodeMismatchException"))
- .body("message", org.hamcrest.Matchers.equalTo("Invalid verification code provided, please try again."));
+ .body("__type", Matchers.equalTo("CodeMismatchException"))
+ .body("message", Matchers.equalTo("Invalid verification code provided, please try again."));
JsonNode stillUnconfirmedUser = cognitoJson("AdminGetUser", """
{
@@ -987,7 +990,7 @@ class CognitoIntegrationTest {
""".formatted(resendClientId, resendUsername, originalCode))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("CodeMismatchException"));
+ .body("__type", Matchers.equalTo("CodeMismatchException"));
cognitoAction("ConfirmSignUp", """
{
@@ -1007,7 +1010,7 @@ class CognitoIntegrationTest {
""".formatted(resendClientId, resendUsername))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("NotAuthorizedException"));
+ .body("__type", Matchers.equalTo("NotAuthorizedException"));
}
@Test
@@ -1050,7 +1053,7 @@ class CognitoIntegrationTest {
""".formatted(client, user))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("InvalidParameterException"));
+ .body("__type", Matchers.equalTo("InvalidParameterException"));
}
@Test
@@ -2222,7 +2225,7 @@ class CognitoIntegrationTest {
""".formatted(clientId, USERNAME, PASSWORD))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("PasswordResetRequiredException"));
+ .body("__type", Matchers.containsString("PasswordResetRequiredException"));
// 3. Admin sets a new password
String newPassword = "NewPassword123!";
@@ -3051,7 +3054,7 @@ class CognitoIntegrationTest {
""".formatted(clientId))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("NotAuthorizedException"));
+ .body("__type", Matchers.equalTo("NotAuthorizedException"));
}
@Test
@@ -3059,7 +3062,7 @@ class CognitoIntegrationTest {
void initiateAuthRefreshTokenAuthRejectsUnknownWellFormedRefreshToken() {
// Well-formed shape (poolId|username|clientId|iat|nonce) but for a user that
// does not exist in this pool — must still be rejected, not silently accepted.
- String bogusToken = java.util.Base64.getEncoder().withoutPadding().encodeToString(
+ String bogusToken = Base64.getEncoder().withoutPadding().encodeToString(
(poolId + "|nonexistent-user|" + clientId + "|" + System.currentTimeMillis() + "|"
+ UUID.randomUUID()).getBytes(StandardCharsets.UTF_8));
@@ -3072,7 +3075,7 @@ class CognitoIntegrationTest {
""".formatted(clientId, bogusToken))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("NotAuthorizedException"));
+ .body("__type", Matchers.equalTo("NotAuthorizedException"));
}
@Test
@@ -3080,7 +3083,7 @@ class CognitoIntegrationTest {
void initiateAuthRefreshTokenAuthRejectsTokenWithNonNumericIssuedAt() {
// Well-formed shape (5 base64 parts), but the issued-at field is not a number.
// Must fail with NotAuthorizedException, not a 500 from an unguarded parseLong.
- String bogusToken = java.util.Base64.getEncoder().withoutPadding().encodeToString(
+ String bogusToken = Base64.getEncoder().withoutPadding().encodeToString(
(poolId + "|" + USERNAME + "|" + clientId + "|not-a-number|"
+ UUID.randomUUID()).getBytes(StandardCharsets.UTF_8));
@@ -3093,7 +3096,7 @@ class CognitoIntegrationTest {
""".formatted(clientId, bogusToken))
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("NotAuthorizedException"));
+ .body("__type", Matchers.equalTo("NotAuthorizedException"));
}
/**
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandlerTest.java
index 0a47b2e1d5..4c0c6cf8dc 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoJsonHandlerTest.java
@@ -128,7 +128,7 @@ class CognitoJsonHandlerTest {
JsonNode described = (JsonNode) handler.handle("DescribeUserPool", describeReq, "us-east-1").getEntity();
JsonNode describedPool = described.get("UserPool");
- for (JsonNode pool : java.util.List.of(createdPool, describedPool)) {
+ for (JsonNode pool : List.of(createdPool, describedPool)) {
// AWS's JSON protocol serializes only members with a value provided - an
// unconfigured pool omits these keys entirely, it doesn't write a JSON null
// (confirmed against moto's DescribeUserPool, which never emits either key unset).
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoLambdaTriggersTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoLambdaTriggersTest.java
index 8e6bd15b46..4482a77da6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoLambdaTriggersTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoLambdaTriggersTest.java
@@ -696,7 +696,7 @@ class CognitoLambdaTriggersTest {
"autoConfirmUser", true,
"autoVerifyEmail", true)));
- var user = service.signUp(client.getClientId(), "alice", "Perm1234!",
+ CognitoUser user = service.signUp(client.getClientId(), "alice", "Perm1234!",
Map.of("email", "[email protected]"), Map.of(), Map.of());
assertEquals("CONFIRMED", user.getUserStatus(),
@@ -714,7 +714,7 @@ class CognitoLambdaTriggersTest {
any(byte[].class), any()))
.thenReturn(ok(Map.of("autoVerifyPhone", true)));
- var user = service.signUp(client.getClientId(), "alice", "Perm1234!",
+ CognitoUser user = service.signUp(client.getClientId(), "alice", "Perm1234!",
Map.of("phone_number", "+15551234567"), Map.of(), Map.of());
assertEquals("true", user.getAttributes().get("phone_number_verified"),
@@ -1331,7 +1331,7 @@ class CognitoLambdaTriggersTest {
seedUser(pool, "alice", "Perm1234!");
UserPoolClient client = createClient(pool);
- org.mockito.ArgumentCaptor<byte[]> payloadCap = org.mockito.ArgumentCaptor.forClass(byte[].class);
+ ArgumentCaptor<byte[]> payloadCap = ArgumentCaptor.forClass(byte[].class);
when(lambdaService.invoke(anyString(), eq("arn:aws:lambda:::pre-token"), payloadCap.capture(), any()))
.thenReturn(ok(Map.of()));
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoServiceTest.java
index b1fe68f49a..0572e982ab 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoServiceTest.java
@@ -37,6 +37,9 @@ import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
@@ -45,8 +48,10 @@ import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -1154,7 +1159,7 @@ class CognitoServiceTest {
true,
true,
List.of(" code ", "code", "implicit", "", "implicit"),
- new ArrayList<>(java.util.Arrays.asList(" openid ", "openid", "email", null, "email")),
+ new ArrayList<>(Arrays.asList(" openid ", "openid", "email", null, "email")),
null,
List.of("https://example.com/callback"),
"https://example.com/callback",
@@ -4951,7 +4956,7 @@ class CognitoServiceTest {
// REFRESH_TOKEN_AUTH path never called the check at all, so this minted fresh tokens.
long issuedAtMillis = System.currentTimeMillis() - Duration.ofMinutes(61).toMillis();
String raw = pool.getId() + "|alice|" + client.getClientId() + "|" + issuedAtMillis + "|"
- + java.util.UUID.randomUUID();
+ + UUID.randomUUID();
String expiredRefreshToken = signRawRefreshToken(pool, raw);
AwsException exception = assertThrows(AwsException.class, () ->
@@ -4993,7 +4998,7 @@ class CognitoServiceTest {
// Attacker who knows the pool id, client id, and a valid username, but not the pool's secret.
String raw = pool.getId() + "|alice|" + client.getClientId() + "|"
- + System.currentTimeMillis() + "|" + java.util.UUID.randomUUID();
+ + System.currentTimeMillis() + "|" + UUID.randomUUID();
String forgedToken = Base64.getEncoder().withoutPadding().encodeToString(raw.getBytes(StandardCharsets.UTF_8));
AwsException exception = assertThrows(AwsException.class, () ->
@@ -5066,7 +5071,7 @@ class CognitoServiceTest {
// Validly signed, but with a non-numeric issued-at field, must not throw an
// uncaught NumberFormatException — it should be rejected as an invalid token.
- String raw = pool.getId() + "|alice|" + client.getClientId() + "|not-a-number|" + java.util.UUID.randomUUID();
+ String raw = pool.getId() + "|alice|" + client.getClientId() + "|not-a-number|" + UUID.randomUUID();
String malformedToken = signRawRefreshToken(pool, raw);
AwsException exception = assertThrows(AwsException.class, () ->
@@ -5483,8 +5488,8 @@ class CognitoServiceTest {
UserPool pool = createPoolAndUser();
UserPoolClient client = openClient(service, pool.getId(), "c", true);
- javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA256");
- mac.init(new javax.crypto.spec.SecretKeySpec(
+ Mac mac = Mac.getInstance("HmacSHA256");
+ mac.init(new SecretKeySpec(
client.getClientSecret().getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
String secretHash = Base64.getEncoder().encodeToString(
mac.doFinal(("alice" + client.getClientId()).getBytes(StandardCharsets.UTF_8)));
@@ -5645,7 +5650,7 @@ class CognitoServiceTest {
IdentityProvider held = service.describeIdentityProvider(pool.getId(), "CopyOidc");
- Map<String, String> updated = new java.util.LinkedHashMap<>(details);
+ Map<String, String> updated = new LinkedHashMap<>(details);
updated.put("client_id", "after");
service.updateIdentityProvider(pool.getId(), "CopyOidc", updated, null, null);
@@ -5971,7 +5976,7 @@ class CognitoServiceTest {
private static boolean isUuid(String value) {
try {
- java.util.UUID.fromString(value);
+ UUID.fromString(value);
return true;
} catch (RuntimeException e) {
return false;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoUserPoolDomainIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoUserPoolDomainIntegrationTest.java
index 96c182f352..65a074eb35 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoUserPoolDomainIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognito/CognitoUserPoolDomainIntegrationTest.java
@@ -3,6 +3,8 @@ package io.github.hectorvent.floci.services.cognito;
import com.fasterxml.jackson.databind.JsonNode;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -72,7 +74,7 @@ class CognitoUserPoolDomainIntegrationTest {
""".formatted(domainName)).path("CertificateArn").asText();
}
- private static io.restassured.response.Response acm(String action, String certificateArn) {
+ private static Response acm(String action, String certificateArn) {
return RestAssuredJsonUtils.awsAction("CertificateManager", action, """
{
"CertificateArn": "%s"
@@ -165,8 +167,8 @@ class CognitoUserPoolDomainIntegrationTest {
}
""".formatted(customDomain, poolId, CERTIFICATE_ARN));
- org.junit.jupiter.api.Assertions.assertTrue(response.path("CloudFrontDomain").isTextual());
- org.junit.jupiter.api.Assertions.assertFalse(response.path("CloudFrontDomain").asText().isBlank());
+ Assertions.assertTrue(response.path("CloudFrontDomain").isTextual());
+ Assertions.assertFalse(response.path("CloudFrontDomain").asText().isBlank());
}
@Test
@@ -183,7 +185,7 @@ class CognitoUserPoolDomainIntegrationTest {
assertEquals(poolId, description.path("UserPoolId").asText());
assertEquals(CERTIFICATE_ARN, description.path("CustomDomainConfig").path("CertificateArn").asText());
assertEquals("ACTIVE", description.path("Status").asText());
- org.junit.jupiter.api.Assertions.assertNotNull(description.path("CloudFrontDistribution").asText(null));
+ Assertions.assertNotNull(description.path("CloudFrontDistribution").asText(null));
String secondPrefixDomain = prefixDomain + "-again";
cognitoJson("CreateUserPoolDomain", """
diff --git a/src/test/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityIntegrationTest.java
index 7672945b50..8f0c22a43f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cognitoidentity/CognitoIdentityIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cognitoidentity;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -39,7 +40,7 @@ class CognitoIdentityIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
- private static io.restassured.specification.RequestSpecification action(String name) {
+ private static RequestSpecification action(String name) {
return given()
.header("X-Amz-Target", TARGET + "." + name)
.contentType(CONTENT_TYPE);
diff --git a/src/test/java/io/github/hectorvent/floci/services/configservice/AggregationAuthorizationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/configservice/AggregationAuthorizationIntegrationTest.java
index 5b4362f0de..6296ab5c09 100644
--- a/src/test/java/io/github/hectorvent/floci/services/configservice/AggregationAuthorizationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/configservice/AggregationAuthorizationIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.configservice;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -27,7 +28,7 @@ class AggregationAuthorizationIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
- private static io.restassured.response.Response call(String action, String body) {
+ private static Response call(String action, String body) {
return given()
.header("X-Amz-Target", TARGET_PREFIX + action)
.contentType(CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServiceEvaluationConcurrencyTest.java b/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServiceEvaluationConcurrencyTest.java
index f97db38294..14407f9de0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServiceEvaluationConcurrencyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServiceEvaluationConcurrencyTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.services.configservice.model.ConfigRule;
import io.github.hectorvent.floci.services.configservice.model.ConfigRuleSource;
import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -39,7 +40,7 @@ class AwsConfigServiceEvaluationConcurrencyTest {
String resourceId = "bucket-" + attempt;
CountDownLatch start = new CountDownLatch(1);
AtomicReference<Throwable> unexpected = new AtomicReference<>();
- List<Thread> writers = new java.util.ArrayList<>();
+ List<Thread> writers = new ArrayList<>();
// Every writer races on the SAME resource key; only the last one in should win, and
// by OrderingTimestamp rather than by write order. Half submit an older evaluation,
diff --git a/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServicePersistenceTest.java b/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServicePersistenceTest.java
index 53e6a69d04..9e95bb387f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServicePersistenceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/configservice/AwsConfigServicePersistenceTest.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -74,7 +75,7 @@ class AwsConfigServicePersistenceTest {
assertEquals(List.of("keep"),
reloaded.describeConfigRules(REGION, null).stream().map(ConfigRule::configRuleName).toList());
Map<String, String> tags = reloaded.listTagsForResource(REGION, rule.configRuleArn()).stream()
- .collect(java.util.stream.Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
+ .collect(Collectors.toMap(t -> t.get("Key"), t -> t.get("Value")));
assertEquals("prod", tags.get("env"));
assertTrue(!tags.containsKey("team"), "untagged key must not reappear after restart");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlControllerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlControllerIntegrationTest.java
index 83099bad1d..aae45bc517 100644
--- a/src/test/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlControllerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/controltower/ControlTowerControlControllerIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.controltower;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -81,7 +82,7 @@ class ControlTowerControlControllerIntegrationTest {
.then().statusCode(400).body("__type", containsString("ValidationException"));
}
- private static io.restassured.response.Response post(String path, String body) {
+ private static Response post(String path, String body) {
return given().contentType("application/json").header("Authorization", auth()).body(body).post(path);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cur/CurEmissionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cur/CurEmissionIntegrationTest.java
index 5cdb30d55b..74db40d255 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cur/CurEmissionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cur/CurEmissionIntegrationTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.testing.SynchronousBillingEmissionProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
@@ -85,7 +86,7 @@ class CurEmissionIntegrationTest {
assertThat(listing.size(), greaterThanOrEqualTo(1));
String parquetKey = listing.get(0).getKey();
assertThat(parquetKey, startsWith("billing/sync-emit/"));
- assertThat(parquetKey.endsWith(".parquet"), org.hamcrest.Matchers.equalTo(true));
+ assertThat(parquetKey.endsWith(".parquet"), Matchers.equalTo(true));
// Confirm DuckDB can read the artifact back.
String s3Uri = "s3://" + destBucket + "/" + parquetKey;
@@ -150,7 +151,7 @@ class CurEmissionIntegrationTest {
.then().statusCode(200)
.body("Executions.size()", greaterThanOrEqualTo(1))
.body("Executions[0].ExecutionStatus.StatusCode",
- org.hamcrest.Matchers.either(org.hamcrest.Matchers.equalTo("DELIVERY_SUCCESS"))
- .or(org.hamcrest.Matchers.equalTo("DELIVERY_FAILURE")));
+ Matchers.either(Matchers.equalTo("DELIVERY_SUCCESS"))
+ .or(Matchers.equalTo("DELIVERY_FAILURE")));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cur/FocusRowProjectorTest.java b/src/test/java/io/github/hectorvent/floci/services/cur/FocusRowProjectorTest.java
index 345be389d3..83a7591fa0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cur/FocusRowProjectorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cur/FocusRowProjectorTest.java
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test;
import java.time.Instant;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -134,7 +135,7 @@ class FocusRowProjectorTest {
@Test
void tagsAreSerializedAsJsonObject() throws Exception {
- Map<String, String> tags = new java.util.LinkedHashMap<>();
+ Map<String, String> tags = new LinkedHashMap<>();
tags.put("Owner", "team-a");
tags.put("CostCenter", "1234");
diff --git a/src/test/java/io/github/hectorvent/floci/services/datasync/DataSyncIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/datasync/DataSyncIntegrationTest.java
index 57e23c6087..b95fd52028 100644
--- a/src/test/java/io/github/hectorvent/floci/services/datasync/DataSyncIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/datasync/DataSyncIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.datasync;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -62,7 +63,7 @@ class DataSyncIntegrationTest {
.extract().path("LocationArn");
}
- private static io.restassured.response.Response describeLocation(String action, String locationArn) {
+ private static Response describeLocation(String action, String locationArn) {
return awsAction(TARGET, action, "{\"LocationArn\": \"" + locationArn + "\"}");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveIntegrationTest.java
index dc7a5b09c7..a06ce9855c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.detective;
import io.github.hectorvent.floci.services.organizations.OrganizationsService;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import jakarta.inject.Inject;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -93,7 +94,7 @@ class DetectiveIntegrationTest {
.statusCode(400).body("__type", equalTo("ValidationException"));
}
- private static io.restassured.response.ValidatableResponse post(String path, String body) {
+ private static ValidatableResponse post(String path, String body) {
return given()
.contentType("application/json")
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveServiceTest.java
index 0a00714d5f..4b69c6aa10 100644
--- a/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/detective/DetectiveServiceTest.java
@@ -11,6 +11,8 @@ import io.github.hectorvent.floci.services.organizations.model.OrganizationAccou
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -42,7 +44,7 @@ class DetectiveServiceTest {
OrganizationAccount member = new OrganizationAccount();
member.setId(MEMBER_ACCOUNT);
when(organizationsService.describeOrganization(MANAGEMENT_ACCOUNT)).thenReturn(organization);
- when(organizationsService.listAccounts(MANAGEMENT_ACCOUNT)).thenReturn(java.util.List.of(management, member));
+ when(organizationsService.listAccounts(MANAGEMENT_ACCOUNT)).thenReturn(List.of(management, member));
service = new DetectiveService(
AccountAwareStorageBackend.inMemory(MANAGEMENT_ACCOUNT), regionResolver, organizationsService);
diff --git a/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbServiceTest.java
index ac4b996765..fbc2d2cd28 100644
--- a/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/docdb/DocDbServiceTest.java
@@ -25,6 +25,7 @@ import org.mockito.Mockito;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -164,7 +165,7 @@ class DocDbServiceTest {
when(servicesConfig.docdb()).thenReturn(docdbConfig);
when(docdbConfig.mock()).thenReturn(false);
when(docdbConfig.defaultImage()).thenReturn("mongo:7.0");
- when(config.hostname()).thenReturn(java.util.Optional.of("localhost"));
+ when(config.hostname()).thenReturn(Optional.of("localhost"));
DocDbContainerManager noDaemonContainerManager = Mockito.mock(DocDbContainerManager.class);
when(noDaemonContainerManager.tryStart(anyString(), anyString(), anyString(), anyString(), any()))
@@ -196,8 +197,8 @@ class DocDbServiceTest {
// is the one a live account gives, which is the same for both cases.
docDbService.createDbCluster("scoped-cluster", null, "admin", "secret", false);
String arn = docDbService.getDbCluster("scoped-cluster").getDbClusterArn();
- docDbService.addTagsToResource(arn, java.util.Map.of("env", "test"));
- assertEquals(java.util.Map.of("env", "test"), docDbService.listTagsForResource(arn));
+ docDbService.addTagsToResource(arn, Map.of("env", "test"));
+ assertEquals(Map.of("env", "test"), docDbService.listTagsForResource(arn));
for (String foreign : new String[]{
"arn:aws:rds:eu-west-1:000000000000:cluster:scoped-cluster",
diff --git a/src/test/java/io/github/hectorvent/floci/services/docdb/PausingStorageBackend.java b/src/test/java/io/github/hectorvent/floci/services/docdb/PausingStorageBackend.java
index 26fad437e1..05e1390914 100644
--- a/src/test/java/io/github/hectorvent/floci/services/docdb/PausingStorageBackend.java
+++ b/src/test/java/io/github/hectorvent/floci/services/docdb/PausingStorageBackend.java
@@ -7,6 +7,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
/**
@@ -26,8 +27,8 @@ final class PausingStorageBackend<V> implements StorageBackend<String, V> {
private final StorageBackend<String, V> delegate;
private volatile Call pauseOn;
private volatile String pauseKey;
- private final java.util.concurrent.atomic.AtomicInteger skip =
- new java.util.concurrent.atomic.AtomicInteger();
+ private final AtomicInteger skip =
+ new AtomicInteger();
private final CountDownLatch reached = new CountDownLatch(1);
private final CountDownLatch release = new CountDownLatch(1);
diff --git a/src/test/java/io/github/hectorvent/floci/services/docdb/SharedClusterIdentifierIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/docdb/SharedClusterIdentifierIntegrationTest.java
index 93eef1928e..afd7d47008 100644
--- a/src/test/java/io/github/hectorvent/floci/services/docdb/SharedClusterIdentifierIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/docdb/SharedClusterIdentifierIntegrationTest.java
@@ -132,7 +132,7 @@ class SharedClusterIdentifierIntegrationTest {
.body(containsString("<Value>docdb</Value>"));
// The write went to the record that answers for the identifier, not to the other one.
- assertEquals(java.util.Map.of("answered-by", "docdb"),
+ assertEquals(Map.of("answered-by", "docdb"),
docDbService.listTagsForResource(arn));
assertTrue(rdsService.listTagsForResource(arn, "us-east-1").isEmpty());
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathIntegrationTest.java
index 49fbb4a58e..cfc229c0bd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathIntegrationTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.dynamodb;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -650,7 +652,7 @@ class DynamoDbAccessPathIntegrationTest {
{"Statement":"SELECT * FROM \\"%s\\" WHERE status = 'partiql-page'",
"Limit":1%s}
""".formatted(TABLE, scanToken == null ? "" : ",\"NextToken\":\"" + scanToken + "\"");
- io.restassured.response.ValidatableResponse page =
+ ValidatableResponse page =
request("DynamoDB_20120810.ExecuteStatement", pageBody).statusCode(200);
page.body("Items.size()", lessThanOrEqualTo(1));
List<String> pagePks = page.extract().jsonPath().getList("Items.pk.S");
@@ -659,7 +661,7 @@ class DynamoDbAccessPathIntegrationTest {
scanPages++;
} while (scanToken != null && scanPages < 10);
- org.junit.jupiter.api.Assertions.assertEquals(Set.of("partiql-page-1", "partiql-page-2"), scannedPks);
+ Assertions.assertEquals(Set.of("partiql-page-1", "partiql-page-2"), scannedPks);
// Query branch (partition-key equality): same pagination contract.
String queryToken = request("DynamoDB_20120810.ExecuteStatement", """
@@ -908,7 +910,7 @@ class DynamoDbAccessPathIntegrationTest {
.statusCode(200);
}
- private static io.restassured.response.ValidatableResponse request(String target, String body) {
+ private static ValidatableResponse request(String target, String body) {
return given()
.header("X-Amz-Target", target)
.contentType(CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathValidatorTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathValidatorTest.java
index fe2071f2bd..69c55d0e5d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathValidatorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbAccessPathValidatorTest.java
@@ -14,6 +14,8 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.List;
+import java.util.regex.MatchResult;
+import java.util.regex.Pattern;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -563,10 +565,10 @@ class DynamoDbAccessPathValidatorTest {
}
private String[] extractPlaceholders(String expression) {
- return java.util.regex.Pattern.compile(":\\w+")
+ return Pattern.compile(":\\w+")
.matcher(expression)
.results()
- .map(java.util.regex.MatchResult::group)
+ .map(MatchResult::group)
.distinct()
.toArray(String[]::new);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbConcurrencyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbConcurrencyIntegrationTest.java
index 69ab52c256..69c1079e55 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbConcurrencyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbConcurrencyIntegrationTest.java
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -520,7 +521,7 @@ class DynamoDbConcurrencyIntegrationTest {
// CDC delivery is asynchronous (bounded best-effort retry queue): wait for the background drain to
// flush every buffered record before reading the shard, otherwise this reads a partial stream.
- assertTrue(forwarder.awaitIdle(java.time.Duration.ofSeconds(10)),
+ assertTrue(forwarder.awaitIdle(Duration.ofSeconds(10)),
"the CDC drain must flush all buffered records");
// Paginated drain of the single shard.
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbGlobalTableIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbGlobalTableIntegrationTest.java
index e35baabb31..9e39fcbeb1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbGlobalTableIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbGlobalTableIntegrationTest.java
@@ -3,10 +3,12 @@ package io.github.hectorvent.floci.services.dynamodb;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.parsing.Parser;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import static io.github.hectorvent.floci.testing.DynamoDbRequests.assertEpochMillisBetween;
import static io.github.hectorvent.floci.testing.DynamoDbRequests.decimalAt;
@@ -26,11 +28,11 @@ class DynamoDbGlobalTableIntegrationTest {
RestAssured.registerParser("application/x-amz-json-1.0", Parser.JSON);
}
- private static io.restassured.response.Response call(String target, String body) {
+ private static Response call(String target, String body) {
return given()
.header("X-Amz-Target", "DynamoDB_20120810." + target)
.contentType("application/x-amz-json-1.0")
- .body(body.getBytes(java.nio.charset.StandardCharsets.UTF_8))
+ .body(body.getBytes(StandardCharsets.UTF_8))
.when().post("/");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbImportIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbImportIntegrationTest.java
index d7b796cff5..9de9dbe012 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbImportIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbImportIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.dynamodb;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -426,7 +427,7 @@ class DynamoDbImportIntegrationTest {
// --- Helpers ---
- private io.restassured.response.Response dynamo(String action, String body) {
+ private Response dynamo(String action, String body) {
return given()
.header("X-Amz-Target", "DynamoDB_20120810." + action)
.contentType(DYNAMODB_CONTENT_TYPE)
@@ -476,7 +477,7 @@ class DynamoDbImportIntegrationTest {
""".formatted(bucket, prefix, format, compression, tableName);
}
- private io.restassured.response.Response describeImport(String importArn) {
+ private Response describeImport(String importArn) {
return dynamo("DescribeImport", "{\"ImportArn\": \"" + importArn + "\"}");
}
@@ -489,7 +490,7 @@ class DynamoDbImportIntegrationTest {
"ExportDescription.ExportStatus");
}
- private String pollStatus(Supplier<io.restassured.response.Response> call, String statusPath) {
+ private String pollStatus(Supplier<Response> call, String statusPath) {
long deadline = System.currentTimeMillis() + 10_000;
while (System.currentTimeMillis() < deadline) {
String status = call.get().then().statusCode(200).extract().jsonPath().getString(statusPath);
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbIntegrationTest.java
index 591fdcbb8d..e838aeceef 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbIntegrationTest.java
@@ -4117,8 +4117,8 @@ given()
@Test
void partiqlBindsParametersOfEveryAttributeValueType() throws Exception {
- var mapper = new ObjectMapper();
- var tableName = "PartiqlOperandTypeTable";
+ ObjectMapper mapper = new ObjectMapper();
+ String tableName = "PartiqlOperandTypeTable";
given()
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
@@ -4179,7 +4179,7 @@ given()
private int partiqlMatchCount(ObjectMapper mapper, String tableName, String attribute, String parameter)
throws Exception {
- var body = given()
+ String body = given()
.header("X-Amz-Target", "DynamoDB_20120810.ExecuteStatement")
.contentType(DYNAMODB_CONTENT_TYPE)
.body("""
@@ -4200,7 +4200,7 @@ given()
// ValidationException naming the operator as it was written.
@Test
void partiqlOrderingOperatorRejectsAnOperandTypeWithNoOrdering() {
- var tableName = "PartiqlOrderingTable";
+ String tableName = "PartiqlOrderingTable";
given()
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
@@ -4252,7 +4252,7 @@ given()
// AttributeValue with zero or several type keys is a ValidationException.
@Test
void partiqlRejectsAParameterThatIsNotAWellFormedAttributeValue() {
- var tableName = "PartiqlParameterShapeTable";
+ String tableName = "PartiqlParameterShapeTable";
given()
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
@@ -4280,7 +4280,7 @@ given()
.when().post("/")
.then().statusCode(200);
- for (var op : List.of("=", "<")) {
+ for (String op : List.of("=", "<")) {
given()
.header("X-Amz-Target", "DynamoDB_20120810.ExecuteStatement")
.contentType(DYNAMODB_CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbServiceTest.java
index 3f50778062..a8dc1b1375 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbServiceTest.java
@@ -4335,7 +4335,7 @@ class DynamoDbServiceTest {
ObjectNode transactGet = mapper.createObjectNode();
transactGet.putObject("Get").put("TableName", "Users").set("Key", key);
- List<org.junit.jupiter.api.function.Executable> itemCalls = List.of(
+ List<Executable> itemCalls = List.of(
() -> svc.getItem("Users", key, region),
() -> svc.putItem("Users", key, null, null, null, region, "NONE"),
() -> svc.updateItem("Users", key, null, "SET x = :v", null, item("v", "1"), "NONE", region),
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbStreamServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbStreamServiceTest.java
index 2bf8f0799b..040d3b7c5c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbStreamServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbStreamServiceTest.java
@@ -40,7 +40,7 @@ class DynamoDbStreamServiceTest {
}
private TableDefinition createTestTableWithStream() {
- var tableDef = new TableDefinition("TestTable",
+ TableDefinition tableDef = new TableDefinition("TestTable",
List.of(new KeySchemaElement("userId", "HASH")),
List.of(new AttributeDefinition("userId", "S")),
"us-east-1", "000000000000");
@@ -68,7 +68,7 @@ class DynamoDbStreamServiceTest {
/** The retarget must reach the records themselves, not just the reported configuration. */
@Test
void recordsEmittedAfterARetargetUseTheNewViewType() throws Exception {
- var table = new TableDefinition("ViewTypeTable",
+ TableDefinition table = new TableDefinition("ViewTypeTable",
List.of(new KeySchemaElement("userId", "HASH")),
List.of(new AttributeDefinition("userId", "S")),
"us-east-1", "000000000000");
@@ -83,7 +83,7 @@ class DynamoDbStreamServiceTest {
String iterator = service.getShardIterator(
sd.getStreamArn(), "shardId-000000000000", "TRIM_HORIZON", null);
- var records = service.getRecords(iterator, 10).records();
+ List<DynamoDbStreamRecord> records = service.getRecords(iterator, 10).records();
assertEquals(1, records.size());
assertEquals("KEYS_ONLY", records.get(0).getStreamViewType());
@@ -120,7 +120,7 @@ class DynamoDbStreamServiceTest {
@Test
void rejectsAnIteratorWhenItsSequenceNumberHasBeenTrimmed() throws Exception {
- var table = createTestTableWithStream();
+ TableDefinition table = createTestTableWithStream();
service.enableStream(table.getTableName(), table.getTableArn(), "NEW_IMAGE", "us-east-1");
JsonNode item = mapper.readTree("{\"userId\":{\"S\":\"u1\"}}");
@@ -140,7 +140,7 @@ class DynamoDbStreamServiceTest {
@Test
void rejectsAnEmptyStreamIteratorWhenRecordsAreTrimmedBeforeFirstPoll() throws Exception {
- var table = new TableDefinition("EmptyTable",
+ TableDefinition table = new TableDefinition("EmptyTable",
List.of(new KeySchemaElement("userId", "HASH")),
List.of(new AttributeDefinition("userId", "S")),
"us-east-1", "000000000000");
@@ -163,7 +163,7 @@ class DynamoDbStreamServiceTest {
@Test
void rejectsAnEmptyLatestIteratorWhenRecordsAreTrimmedBeforeFirstPoll() throws Exception {
- var table = new TableDefinition("EmptyLatestTable",
+ TableDefinition table = new TableDefinition("EmptyLatestTable",
List.of(new KeySchemaElement("userId", "HASH")),
List.of(new AttributeDefinition("userId", "S")),
"us-east-1", "000000000000");
@@ -186,7 +186,7 @@ class DynamoDbStreamServiceTest {
@Test
void allowsAnEmptyStreamIteratorWhenRetentionHasNotBeenExceeded() throws Exception {
- var table = new TableDefinition("EmptyTable",
+ TableDefinition table = new TableDefinition("EmptyTable",
List.of(new KeySchemaElement("userId", "HASH")),
List.of(new AttributeDefinition("userId", "S")),
"us-east-1", "000000000000");
@@ -201,7 +201,7 @@ class DynamoDbStreamServiceTest {
service.captureEvent("INSERT", null, item, table, "us-east-1");
}
- var result = service.getRecords(iterator, 1);
+ DynamoDbStreamService.GetRecordsResult result = service.getRecords(iterator, 1);
assertEquals(1, result.records().size());
assertEquals("000000000000000000001", result.records().get(0).getSequenceNumber());
@@ -209,7 +209,7 @@ class DynamoDbStreamServiceTest {
@Test
void appliesInclusiveAndExclusiveSequencePositions() throws Exception {
- var table = createTestTableWithStream();
+ TableDefinition table = createTestTableWithStream();
service.enableStream(table.getTableName(), table.getTableArn(), "NEW_IMAGE", "us-east-1");
JsonNode item = mapper.readTree("{\"userId\":{\"S\":\"u1\"}}");
@@ -223,8 +223,8 @@ class DynamoDbStreamServiceTest {
table.getStreamArn(), DynamoDbStreamService.SHARD_ID,
"AFTER_SEQUENCE_NUMBER", "000000000000000000001");
- var atRecords = service.getRecords(at, 1).records();
- var afterRecords = service.getRecords(after, 1).records();
+ List<DynamoDbStreamRecord> atRecords = service.getRecords(at, 1).records();
+ List<DynamoDbStreamRecord> afterRecords = service.getRecords(after, 1).records();
assertEquals("000000000000000000001", atRecords.get(0).getSequenceNumber());
assertEquals("000000000000000000002", afterRecords.get(0).getSequenceNumber());
@@ -233,7 +233,7 @@ class DynamoDbStreamServiceTest {
@Test
void resumesAtTheRetainedSequenceAfterTheHeadIsTrimmed() throws Exception {
- var table = createTestTableWithStream();
+ TableDefinition table = createTestTableWithStream();
service.enableStream(table.getTableName(), table.getTableArn(), "NEW_IMAGE", "us-east-1");
JsonNode item = mapper.readTree("{\"userId\":{\"S\":\"u1\"}}");
@@ -247,7 +247,7 @@ class DynamoDbStreamServiceTest {
service.captureEvent("EVENT_" + i, null, item, table, "us-east-1");
}
- var records = service.getRecords(iterator, 1).records();
+ List<DynamoDbStreamRecord> records = service.getRecords(iterator, 1).records();
assertEquals(1, records.size());
assertEquals("EVENT_2", records.get(0).getEventName());
@@ -255,7 +255,7 @@ class DynamoDbStreamServiceTest {
@Test
void advancesToTheNextSequenceWithoutDuplicatingRecords() throws Exception {
- var table = createTestTableWithStream();
+ TableDefinition table = createTestTableWithStream();
service.enableStream(table.getTableName(), table.getTableArn(), "NEW_IMAGE", "us-east-1");
JsonNode item = mapper.readTree("{\"userId\":{\"S\":\"u1\"}}");
@@ -265,8 +265,8 @@ class DynamoDbStreamServiceTest {
table.getStreamArn(), DynamoDbStreamService.SHARD_ID,
"TRIM_HORIZON", null);
- var firstPage = service.getRecords(iterator, 1);
- var secondPage = service.getRecords(firstPage.nextShardIterator(), 1);
+ DynamoDbStreamService.GetRecordsResult firstPage = service.getRecords(iterator, 1);
+ DynamoDbStreamService.GetRecordsResult secondPage = service.getRecords(firstPage.nextShardIterator(), 1);
assertEquals("000000000000000000001", firstPage.records().get(0).getSequenceNumber());
assertEquals("000000000000000000002", secondPage.records().get(0).getSequenceNumber());
@@ -338,7 +338,7 @@ class DynamoDbStreamServiceTest {
@Test
void requiresASequenceNumberForSequenceBasedIterators() {
- var table = createTestTableWithStream();
+ TableDefinition table = createTestTableWithStream();
AwsException nullSequence = assertThrows(AwsException.class,
() -> service.getShardIterator(table.getStreamArn(), DynamoDbStreamService.SHARD_ID,
diff --git a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTagResourcePartitionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTagResourcePartitionIntegrationTest.java
index 8179c1e7dd..5646632cf1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTagResourcePartitionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/dynamodb/DynamoDbTagResourcePartitionIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.dynamodb;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -111,7 +112,7 @@ class DynamoDbTagResourcePartitionIntegrationTest {
String tableName = "tag-partition-" + UUID.randomUUID().toString().substring(0, 8);
String tableArn = createTable(region, tableName);
- org.hamcrest.MatcherAssert.assertThat(tableArn, startsWith(expectedArnPrefix));
+ MatcherAssert.assertThat(tableArn, startsWith(expectedArnPrefix));
tag(region, tableArn).then().statusCode(200);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2CreateImageCaptureTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2CreateImageCaptureTest.java
index c75b02f09f..4e468bcb45 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2CreateImageCaptureTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2CreateImageCaptureTest.java
@@ -17,6 +17,7 @@ import io.github.hectorvent.floci.services.ec2.model.Instance;
import io.github.hectorvent.floci.services.ec2.net.VpcNetworkManager;
import io.github.hectorvent.floci.services.ec2.portforward.Ec2PortForwardManager;
import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentMatchers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -105,7 +106,7 @@ class Ec2CreateImageCaptureTest {
assertNull(managerWith(dockerClient).commitInstance(instance(null), "floci-ami/ami-1:latest"));
- verify(dockerClient, never()).commitCmd(org.mockito.ArgumentMatchers.anyString());
+ verify(dockerClient, never()).commitCmd(ArgumentMatchers.anyString());
}
@Test
@@ -168,7 +169,7 @@ class Ec2CreateImageCaptureTest {
assertTrue(managerWith(dockerClient).removeCommittedImage(null));
- verify(dockerClient, never()).removeImageCmd(org.mockito.ArgumentMatchers.anyString());
+ verify(dockerClient, never()).removeImageCmd(ArgumentMatchers.anyString());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DedicatedHostIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DedicatedHostIntegrationTest.java
index b23399c487..1bc139ab97 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DedicatedHostIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DedicatedHostIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -279,7 +280,7 @@ class Ec2DedicatedHostIntegrationTest {
int before = hostCount();
post("Action", "AllocateHosts", "InstanceType", "m5.large", "AvailabilityZone", "us-east-1aa")
.statusCode(400).body(containsString("InvalidParameterValue"));
- org.junit.jupiter.api.Assertions.assertEquals(before, hostCount());
+ Assertions.assertEquals(before, hostCount());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DeregisterAndCopyImageIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DeregisterAndCopyImageIntegrationTest.java
index 3d43739776..f5be069bb3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DeregisterAndCopyImageIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DeregisterAndCopyImageIntegrationTest.java
@@ -16,6 +16,7 @@ import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
@@ -185,7 +186,7 @@ class Ec2DeregisterAndCopyImageIntegrationTest {
service.deregisterImage(EAST, image.getImageId(), false);
- Instance instance = service.describeInstances(EAST, List.of(instanceId), java.util.Map.of()).getFirst()
+ Instance instance = service.describeInstances(EAST, List.of(instanceId), Map.of()).getFirst()
.getInstances().getFirst();
assertEquals("running", instance.getState().getName());
assertEquals(image.getImageId(), instance.getImageId());
@@ -332,7 +333,7 @@ class Ec2DeregisterAndCopyImageIntegrationTest {
String instanceId = service.runInstances(WEST, copy.getImageId(), "t3.micro",
1, 1, null, List.of(), null, null, List.of(), null, null, null)
.getInstances().getFirst().getInstanceId();
- assertEquals(copy.getImageId(), service.describeInstances(WEST, List.of(instanceId), java.util.Map.of())
+ assertEquals(copy.getImageId(), service.describeInstances(WEST, List.of(instanceId), Map.of())
.getFirst().getInstances().getFirst().getImageId());
}
@@ -418,7 +419,7 @@ class Ec2DeregisterAndCopyImageIntegrationTest {
}
});
- List<Image> winners = created.stream().filter(java.util.Objects::nonNull).toList();
+ List<Image> winners = created.stream().filter(Objects::nonNull).toList();
assertEquals(1, winners.size(),
"exactly one copy may claim the name; round " + round + " produced " + winners.size());
assertEquals(RACE_THREADS - 1, duplicates.get());
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DuplicateRouteTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DuplicateRouteTest.java
index 6aed146152..529ca5da81 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DuplicateRouteTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2DuplicateRouteTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -50,11 +52,11 @@ class Ec2DuplicateRouteTest {
private static String routeTableId;
- private static io.restassured.specification.RequestSpecification ec2() {
+ private static RequestSpecification ec2() {
return given().header("Authorization", AUTH_HEADER);
}
- private static io.restassured.response.ValidatableResponse describe() {
+ private static ValidatableResponse describe() {
return ec2()
.formParam("Action", "DescribeRouteTables")
.formParam("RouteTableId.1", routeTableId)
@@ -65,7 +67,7 @@ class Ec2DuplicateRouteTest {
}
/** CreateRoute with one destination and the internet gateway as its target. */
- private static io.restassured.specification.RequestSpecification createRoute(
+ private static RequestSpecification createRoute(
String destinationParam, String destination) {
return ec2()
.formParam("Action", "CreateRoute")
@@ -76,7 +78,7 @@ class Ec2DuplicateRouteTest {
/** Asserts the response is RouteAlreadyExists and names the destination it refused. */
private static void expectRouteAlreadyExists(
- io.restassured.specification.RequestSpecification request, String destination) {
+ RequestSpecification request, String destination) {
String message = request
.when()
.post("/")
@@ -216,7 +218,7 @@ class Ec2DuplicateRouteTest {
}
/** Asserts the request fails with the given 400 error code. */
- private static void expectError(io.restassured.specification.RequestSpecification request, String code) {
+ private static void expectError(RequestSpecification request, String code) {
request
.when()
.post("/")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2Ipv6RouteTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2Ipv6RouteTest.java
index c65c073659..b706b0f03a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2Ipv6RouteTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2Ipv6RouteTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -44,11 +46,11 @@ class Ec2Ipv6RouteTest {
private static String routeTableId;
- private static io.restassured.specification.RequestSpecification ec2() {
+ private static RequestSpecification ec2() {
return given().header("Authorization", AUTH_HEADER);
}
- private static io.restassured.response.ValidatableResponse describe() {
+ private static ValidatableResponse describe() {
return ec2()
.formParam("Action", "DescribeRouteTables")
.formParam("RouteTableId.1", routeTableId)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2LaunchTemplateFieldsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2LaunchTemplateFieldsIntegrationTest.java
index 3ed101fbf0..0eb897a505 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2LaunchTemplateFieldsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2LaunchTemplateFieldsIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.UUID;
@@ -296,7 +297,7 @@ class Ec2LaunchTemplateFieldsIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId", org.hamcrest.Matchers.notNullValue());
+ .body("CreateLaunchTemplateResponse.launchTemplate.launchTemplateId", Matchers.notNullValue());
given()
.formParam("Action", "CreateLaunchTemplateVersion")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ManagedPrefixListIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ManagedPrefixListIntegrationTest.java
index 3e24269553..72029a50e8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ManagedPrefixListIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ManagedPrefixListIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -55,7 +56,7 @@ class Ec2ManagedPrefixListIntegrationTest {
.body("CreateManagedPrefixListResponse.prefixList.tagSet.item.key", equalTo("env"))
.extract().path("CreateManagedPrefixListResponse.prefixList.prefixListId");
- org.junit.jupiter.api.Assertions.assertTrue(prefixListId.startsWith("pl-"));
+ Assertions.assertTrue(prefixListId.startsWith("pl-"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ModifyVpcEndpointTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ModifyVpcEndpointTest.java
index 4dfc59da05..46adf04de2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ModifyVpcEndpointTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ModifyVpcEndpointTest.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.services.ec2.model.VpcEndpoint;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.NullAndEmptySource;
@@ -264,7 +265,7 @@ class Ec2ModifyVpcEndpointTest {
ec2("ModifyVpcEndpoint", "VpcEndpointId", f.endpointId(), "PolicyDocument", POLICY);
String xml = describe(f.endpointId());
- org.junit.jupiter.api.Assertions.assertTrue(xml.contains("s3:GetObject"),
+ Assertions.assertTrue(xml.contains("s3:GetObject"),
"expected the policy document to be reported back, got: " + xml);
}
@@ -275,7 +276,7 @@ class Ec2ModifyVpcEndpointTest {
ec2("ModifyVpcEndpoint", "VpcEndpointId", f.endpointId(), "ResetPolicy", "true");
String xml = describe(f.endpointId());
- org.junit.jupiter.api.Assertions.assertFalse(xml.contains("s3:GetObject"),
+ Assertions.assertFalse(xml.contains("s3:GetObject"),
"expected ResetPolicy to clear the document, got: " + xml);
}
@@ -290,7 +291,7 @@ class Ec2ModifyVpcEndpointTest {
"PolicyDocument", POLICY), "vpcEndpointId");
String xml = describe(endpointId);
- org.junit.jupiter.api.Assertions.assertTrue(xml.contains("s3:GetObject"),
+ Assertions.assertTrue(xml.contains("s3:GetObject"),
"expected the create-time policy to be reported back, got: " + xml);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2MonitorInstancesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2MonitorInstancesIntegrationTest.java
index b13d86d125..ddb35631a1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2MonitorInstancesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2MonitorInstancesIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -91,19 +92,19 @@ class Ec2MonitorInstancesIntegrationTest {
void monitoringStateSurvivesToDescribeInstances() {
String id = launchInstance();
// A fresh instance reports the AWS default before anything asks for monitoring.
- org.junit.jupiter.api.Assertions.assertEquals("disabled", monitoringStateOf(id));
+ Assertions.assertEquals("disabled", monitoringStateOf(id));
given().formParam("Action", "MonitorInstances").formParam("InstanceId.1", id)
.header("Authorization", AUTH_HEADER)
.when().post("/").then().statusCode(200);
- org.junit.jupiter.api.Assertions.assertEquals("enabled", monitoringStateOf(id));
+ Assertions.assertEquals("enabled", monitoringStateOf(id));
given().formParam("Action", "UnmonitorInstances").formParam("InstanceId.1", id)
.header("Authorization", AUTH_HEADER)
.when().post("/").then().statusCode(200);
- org.junit.jupiter.api.Assertions.assertEquals("disabled", monitoringStateOf(id));
+ Assertions.assertEquals("disabled", monitoringStateOf(id));
}
/**
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NatGatewayAddressIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NatGatewayAddressIntegrationTest.java
index c765e7f2a5..0ad37212fb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NatGatewayAddressIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NatGatewayAddressIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -44,7 +45,7 @@ class Ec2NatGatewayAddressIntegrationTest {
@Test
void aPublicGatewayReportsItsElasticIpPrivateIpAndInterface() {
String subnetId = subnetId();
- io.restassured.response.Response allocation = given()
+ Response allocation = given()
.formParam("Action", "AllocateAddress")
.formParam("Domain", "vpc")
.header("Authorization", AUTH_HEADER)
@@ -114,7 +115,7 @@ class Ec2NatGatewayAddressIntegrationTest {
.then().statusCode(200)
.extract().path("CreateNatGatewayResponse.natGateway.natGatewayId");
- io.restassured.response.Response described = given()
+ Response described = given()
.formParam("Action", "DescribeNatGateways")
.formParam("NatGatewayId.1", natGatewayId)
.header("Authorization", AUTH_HEADER)
@@ -244,7 +245,7 @@ class Ec2NatGatewayAddressIntegrationTest {
.extract().path("AllocateAddressResponse.allocationId");
}
- private io.restassured.response.Response createNat(String allocationId) {
+ private Response createNat(String allocationId) {
return given()
.formParam("Action", "CreateNatGateway")
.formParam("SubnetId", subnetId())
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NetworkInterfaceIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NetworkInterfaceIntegrationTest.java
index 216fcce544..1845c3ad38 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NetworkInterfaceIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2NetworkInterfaceIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -79,8 +80,8 @@ class Ec2NetworkInterfaceIntegrationTest {
.statusCode(200)
.extract().path("DescribeSecurityGroupsResponse.securityGroupInfo.item[0].groupId");
- org.junit.jupiter.api.Assertions.assertTrue(subnetId.startsWith("subnet-"));
- org.junit.jupiter.api.Assertions.assertTrue(securityGroupId.startsWith("sg-"));
+ Assertions.assertTrue(subnetId.startsWith("subnet-"));
+ Assertions.assertTrue(securityGroupId.startsWith("sg-"));
}
@Test
@@ -128,7 +129,7 @@ class Ec2NetworkInterfaceIntegrationTest {
.body("CreateNetworkInterfaceResponse.networkInterface.tagSet.item.value", equalTo("example"))
.extract().path("CreateNetworkInterfaceResponse.networkInterface.networkInterfaceId");
- org.junit.jupiter.api.Assertions.assertTrue(eniId.startsWith("eni-"));
+ Assertions.assertTrue(eniId.startsWith("eni-"));
}
@Test
@@ -180,7 +181,7 @@ class Ec2NetworkInterfaceIntegrationTest {
.statusCode(200)
.extract().path("RunInstancesResponse.instancesSet.item.instanceId");
- org.junit.jupiter.api.Assertions.assertTrue(instanceId.startsWith("i-"));
+ Assertions.assertTrue(instanceId.startsWith("i-"));
// Mock mode settles a pending instance to "running" on the next describe (see
// Ec2Service#describeInstances), AttachNetworkInterface requires running/stopped.
@@ -352,7 +353,7 @@ class Ec2NetworkInterfaceIntegrationTest {
equalTo(overrideEniId))
.extract().path("RunInstancesResponse.instancesSet.item.instanceId");
- org.junit.jupiter.api.Assertions.assertTrue(overrideInstanceId.startsWith("i-"));
+ Assertions.assertTrue(overrideInstanceId.startsWith("i-"));
// The interface keeps its own standalone record, that is the side that knows its real
// attach time and its deleteOnTermination, while the instance carries a copy. Describe
@@ -575,6 +576,6 @@ class Ec2NetworkInterfaceIntegrationTest {
.statusCode(200)
.extract().path("RunInstancesResponse.instancesSet.item.instanceId");
- org.junit.jupiter.api.Assertions.assertTrue(replacement.startsWith("i-"));
+ Assertions.assertTrue(replacement.startsWith("i-"));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2RouteCidrCanonicalizationTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2RouteCidrCanonicalizationTest.java
index 68cb1aa004..d46d10e9ef 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2RouteCidrCanonicalizationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2RouteCidrCanonicalizationTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.ec2;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -49,11 +51,11 @@ class Ec2RouteCidrCanonicalizationTest {
private static String routeTableId;
- private static io.restassured.specification.RequestSpecification ec2() {
+ private static RequestSpecification ec2() {
return given().header("Authorization", AUTH_HEADER);
}
- private static io.restassured.response.ValidatableResponse describe() {
+ private static ValidatableResponse describe() {
return ec2()
.formParam("Action", "DescribeRouteTables")
.formParam("RouteTableId.1", routeTableId)
@@ -63,7 +65,7 @@ class Ec2RouteCidrCanonicalizationTest {
.statusCode(200);
}
- private static io.restassured.specification.RequestSpecification createRoute(
+ private static RequestSpecification createRoute(
String destinationCidrBlock, String gatewayId) {
return ec2()
.formParam("Action", "CreateRoute")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServiceConcurrencyTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServiceConcurrencyTest.java
index 51c9b9b83f..72f3e8a77a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServiceConcurrencyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServiceConcurrencyTest.java
@@ -16,6 +16,7 @@ import io.github.hectorvent.floci.services.ec2.portforward.Ec2PortForwardManager
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -25,6 +26,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.IntConsumer;
+import java.util.function.IntFunction;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -257,10 +260,10 @@ class Ec2ServiceConcurrencyTest {
}
/** Runs N concurrent invocations of the same op; the op absorbs its own expected failures. */
- private static void runRaceAllowing(java.util.function.IntConsumer op) throws Exception {
+ private static void runRaceAllowing(IntConsumer op) throws Exception {
ExecutorService pool = Executors.newFixedThreadPool(THREADS);
CountDownLatch start = new CountDownLatch(1);
- List<java.util.concurrent.Future<?>> futures = new java.util.ArrayList<>();
+ List<Future<?>> futures = new ArrayList<>();
for (int i = 0; i < N; i++) {
int idx = i;
futures.add(pool.submit(() -> {
@@ -278,10 +281,10 @@ class Ec2ServiceConcurrencyTest {
}
/** Runs N indexed mutations across THREADS with a common start gate; returns their results. */
- private static Set<String> runRace(java.util.function.IntFunction<String> op) throws Exception {
+ private static Set<String> runRace(IntFunction<String> op) throws Exception {
ExecutorService pool = Executors.newFixedThreadPool(THREADS);
CountDownLatch start = new CountDownLatch(1);
- List<java.util.concurrent.Future<String>> futures = new java.util.ArrayList<>();
+ List<Future<String>> futures = new ArrayList<>();
for (int i = 0; i < N; i++) {
int idx = i;
futures.add(pool.submit(() -> {
@@ -290,7 +293,7 @@ class Ec2ServiceConcurrencyTest {
}));
}
start.countDown();
- Set<String> results = new java.util.HashSet<>();
+ Set<String> results = new HashSet<>();
for (Future<String> f : futures) {
results.add(f.get(30, TimeUnit.SECONDS));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServicePersistenceTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServicePersistenceTest.java
index df7a2da8a2..c496e01006 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServicePersistenceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/Ec2ServicePersistenceTest.java
@@ -522,7 +522,7 @@ class Ec2ServicePersistenceTest {
* versions map at all, i.e. one only ever read via {@code getData()} pre-migration).
*/
@Test
- void legacyIamProfileAndInstanceTagsSurviveRestart(@TempDir Path dir) throws java.io.IOException {
+ void legacyIamProfileAndInstanceTagsSurviveRestart(@TempDir Path dir) throws IOException {
String legacyJson = """
{
"us-east-1::lt-legacy-versioned": {
diff --git a/src/test/java/io/github/hectorvent/floci/services/ec2/portforward/Ec2PortForwardManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/ec2/portforward/Ec2PortForwardManagerTest.java
index 9b6a8788cd..c4d32880f9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ec2/portforward/Ec2PortForwardManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ec2/portforward/Ec2PortForwardManagerTest.java
@@ -286,7 +286,7 @@ class Ec2PortForwardManagerTest {
private static SecurityGroup sg(IpPermission... perms) {
SecurityGroup sg = new SecurityGroup();
sg.setGroupId("sg-test");
- sg.setIpPermissions(new java.util.ArrayList<>(List.of(perms)));
+ sg.setIpPermissions(new ArrayList<>(List.of(perms)));
return sg;
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecr/EcrIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecr/EcrIntegrationTest.java
index 801fa5bcea..3d3b177b4f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecr/EcrIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecr/EcrIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ecr;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -157,7 +158,7 @@ class EcrIntegrationTest {
.extract().jsonPath().getString("authorizationData[0].authorizationToken");
String decoded = new String(Base64.getDecoder().decode(token));
- org.junit.jupiter.api.Assertions.assertTrue(decoded.startsWith("AWS:"),
+ Assertions.assertTrue(decoded.startsWith("AWS:"),
"Decoded auth token must start with 'AWS:' but was: " + decoded);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsCreateClusterSettingsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsCreateClusterSettingsIntegrationTest.java
index 19f60dadbb..717de41cfd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsCreateClusterSettingsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsCreateClusterSettingsIntegrationTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.ecs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -28,7 +30,7 @@ class EcsCreateClusterSettingsIntegrationTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
- private static io.restassured.specification.RequestSpecification ecs(String action) {
+ private static RequestSpecification ecs(String action) {
return given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", TARGET_PREFIX + action);
@@ -83,6 +85,6 @@ class EcsCreateClusterSettingsIntegrationTest {
.then()
.statusCode(200)
.body("cluster.clusterName", equalTo(cluster))
- .body("cluster.settings", org.hamcrest.Matchers.nullValue());
+ .body("cluster.settings", Matchers.nullValue());
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsDescribeServicesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsDescribeServicesIntegrationTest.java
index 52734959a1..65b10c3c99 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsDescribeServicesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsDescribeServicesIntegrationTest.java
@@ -7,6 +7,8 @@ import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.math.BigDecimal;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
@@ -64,7 +66,7 @@ class EcsDescribeServicesIntegrationTest {
* same value, so read them as BigDecimal.
*/
private static double epochSeconds(Response response, String path) {
- return ((java.math.BigDecimal) response
+ return ((BigDecimal) response
.jsonPath(new JsonPathConfig(JsonPathConfig.NumberReturnType.BIG_DECIMAL))
.get(path)).doubleValue();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsIntegrationTest.java
index 863ace178e..4c4f531edf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsIntegrationTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.ecs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -54,7 +56,7 @@ class EcsIntegrationTest {
// ── Helpers ───────────────────────────────────────────────────────────────
- private static io.restassured.specification.RequestSpecification ecs(String action) {
+ private static RequestSpecification ecs(String action) {
return given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", TARGET_PREFIX + action);
@@ -233,7 +235,7 @@ class EcsIntegrationTest {
.body("taskDefinition.family", equalTo("ec2-fallback-family"))
.body("taskDefinition.compatibilities", hasItem("EC2"))
// requiresCompatibilities shouldn't exist or should be empty
- .body("taskDefinition.requiresCompatibilities", org.hamcrest.Matchers.nullValue());
+ .body("taskDefinition.requiresCompatibilities", Matchers.nullValue());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsLoadBalancersIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsLoadBalancersIntegrationTest.java
index 1885216fd5..d602dc9bf1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/EcsLoadBalancersIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/EcsLoadBalancersIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ecs;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -106,7 +107,7 @@ class EcsLoadBalancersIntegrationTest {
.when().post("/")
.then().statusCode(200)
.body("service.serviceName", equalTo("lb-svc-3"))
- .body("service.loadBalancers", org.hamcrest.Matchers.nullValue());
+ .body("service.loadBalancers", Matchers.nullValue());
}
@Test
@@ -119,7 +120,7 @@ class EcsLoadBalancersIntegrationTest {
+ "\"loadBalancers\":[{\"containerName\":\"web\"}]}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("InvalidParameterException"));
+ .body("__type", Matchers.containsString("InvalidParameterException"));
}
@Test
@@ -132,7 +133,7 @@ class EcsLoadBalancersIntegrationTest {
+ "\"loadBalancers\":[{\"containerName\":\"web\",\"containerPort\":8080}]}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("InvalidParameterException"));
+ .body("__type", Matchers.containsString("InvalidParameterException"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerEcrRewriteTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerEcrRewriteTest.java
index b076528ee6..574fceed73 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerEcrRewriteTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerEcrRewriteTest.java
@@ -20,6 +20,7 @@ import io.github.hectorvent.floci.services.ssm.SsmService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.util.List;
import java.util.Map;
@@ -108,7 +109,7 @@ class EcsContainerManagerEcrRewriteTest {
// newContainer(...) is called once per container definition, in definition order.
ArgumentCaptor<String> imageCaptor = ArgumentCaptor.forClass(String.class);
- verify(containerBuilder, org.mockito.Mockito.times(2)).newContainer(imageCaptor.capture());
+ verify(containerBuilder, Mockito.times(2)).newContainer(imageCaptor.capture());
List<String> images = imageCaptor.getAllValues();
assertEquals(REWRITTEN_IMAGE, images.get(0), "ECR-shaped image should be rewritten for the docker pull");
assertEquals("sidecar:latest", images.get(1), "non-ECR image should pass through unchanged");
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerOverridesTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerOverridesTest.java
index b9d7afa0e9..f6c40c3326 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerOverridesTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerOverridesTest.java
@@ -21,6 +21,7 @@ import io.github.hectorvent.floci.services.ssm.SsmService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.util.List;
import java.util.Map;
@@ -116,8 +117,8 @@ class EcsContainerManagerOverridesTest {
ArgumentCaptor<List<String>> cmdCaptor = ArgumentCaptor.forClass(List.class);
@SuppressWarnings("unchecked")
ArgumentCaptor<List<String>> envCaptor = ArgumentCaptor.forClass(List.class);
- org.mockito.Mockito.verify(builder, org.mockito.Mockito.times(2)).withCmd(cmdCaptor.capture());
- org.mockito.Mockito.verify(builder, org.mockito.Mockito.times(2)).withEnv(envCaptor.capture());
+ Mockito.verify(builder, Mockito.times(2)).withCmd(cmdCaptor.capture());
+ Mockito.verify(builder, Mockito.times(2)).withEnv(envCaptor.capture());
List<List<String>> commands = cmdCaptor.getAllValues();
List<List<String>> envs = envCaptor.getAllValues();
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerSecretsTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerSecretsTest.java
index f7ca412229..a0b37b8cdc 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerSecretsTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerSecretsTest.java
@@ -24,6 +24,8 @@ import io.github.hectorvent.floci.services.ssm.SsmService;
import io.github.hectorvent.floci.services.ssm.model.Parameter;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.ArgumentCaptor;
import java.util.List;
@@ -123,8 +125,8 @@ class EcsContainerManagerSecretsTest {
* partition a Secrets Manager ARN fell through to the SSM branch, so the task died at launch
* with ParameterNotFound rather than reading its own configuration.
*/
- @org.junit.jupiter.params.ParameterizedTest
- @org.junit.jupiter.params.provider.CsvSource({
+ @ParameterizedTest
+ @CsvSource({
"us-gov-west-1, aws-us-gov",
"cn-north-1, aws-cn",
"us-isob-east-1, aws-iso-b"})
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsCredentialsProxyTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsCredentialsProxyTest.java
index fb3efecb04..25ab72d88d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsCredentialsProxyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsCredentialsProxyTest.java
@@ -4,6 +4,8 @@ import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.InspectContainerCmd;
import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.api.command.InspectContainerResponse.ContainerState;
+import com.github.dockerjava.api.command.InspectImageCmd;
+import com.github.dockerjava.api.command.InspectImageResponse;
import com.github.dockerjava.api.command.ListContainersCmd;
import com.github.dockerjava.api.model.Container;
import io.github.hectorvent.floci.config.EmulatorConfig;
@@ -246,10 +248,10 @@ class EcsCredentialsProxyTest {
when(config.services().ecs().taskRoleCredentials().proxyImage()).thenReturn("floci/network-helper:local");
when(containerBuilder.resolveImage("floci/network-helper:local")).thenReturn("floci/network-helper:local");
stubNoStaleContainerByName();
- com.github.dockerjava.api.command.InspectImageCmd inspectImageCmd =
- mock(com.github.dockerjava.api.command.InspectImageCmd.class);
+ InspectImageCmd inspectImageCmd =
+ mock(InspectImageCmd.class);
when(dockerClient.inspectImageCmd(any())).thenReturn(inspectImageCmd);
- when(inspectImageCmd.exec()).thenReturn(mock(com.github.dockerjava.api.command.InspectImageResponse.class));
+ when(inspectImageCmd.exec()).thenReturn(mock(InspectImageResponse.class));
when(lifecycleManager.createAndStart(any())).thenReturn(
new ContainerLifecycleManager.ContainerInfo(containerId, Map.of()));
InspectContainerCmd inspectCmd = mock(InspectContainerCmd.class);
diff --git a/src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2LambdaTargetDataPlaneIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2LambdaTargetDataPlaneIntegrationTest.java
index bf2505bf67..2c0fa2cfc5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2LambdaTargetDataPlaneIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2LambdaTargetDataPlaneIntegrationTest.java
@@ -6,6 +6,7 @@ import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -261,7 +262,7 @@ class ElbV2LambdaTargetDataPlaneIntegrationTest {
.get("/response-at-limit")
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.hasLength(1024 * 1024));
+ .body(Matchers.hasLength(1024 * 1024));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessIntegrationTest.java
index 62f5cc790f..a86f0b1643 100644
--- a/src/test/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/emrserverless/EmrServerlessIntegrationTest.java
@@ -9,6 +9,7 @@ import io.restassured.config.RestAssuredConfig;
import io.restassured.path.json.config.JsonPathConfig;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -127,7 +128,7 @@ public class EmrServerlessIntegrationTest {
.statusCode(200)
.extract().path("applicationId");
- org.junit.jupiter.api.Assertions.assertEquals(applicationId, retryApplicationId, "Idempotent create should return the same application ID");
+ Assertions.assertEquals(applicationId, retryApplicationId, "Idempotent create should return the same application ID");
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
index 86c743bf3d..28a7cf3f96 100644
--- a/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
@@ -32,6 +32,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
@@ -1340,7 +1341,7 @@ class EventBridgeServiceTest {
target.setArn("arn:aws:sqs:us-west-2:000000000000:replay-queue");
service.putTargets("my-rule", null, List.of(target), "us-west-2");
- java.util.Map<String, Object> entry = new java.util.HashMap<>();
+ Map<String, Object> entry = new HashMap<>();
entry.put("Source", "my.app");
entry.put("DetailType", "Test");
entry.put("Detail", "{}");
diff --git a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseCompressionDecoder.java b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseCompressionDecoder.java
index 32a3396005..80e036d734 100644
--- a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseCompressionDecoder.java
+++ b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseCompressionDecoder.java
@@ -8,6 +8,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
@@ -39,7 +40,7 @@ final class FirehoseCompressionDecoder {
/** Fails when the archive does not hold exactly one entry, which is what AWS writes. */
static ZipEntryContent singleZipEntry(byte[] body) throws IOException {
- List<ZipEntryContent> entries = new java.util.ArrayList<>();
+ List<ZipEntryContent> entries = new ArrayList<>();
try (ZipInputStream zip = new ZipInputStream(new ByteArrayInputStream(body))) {
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseParquetConverterTest.java b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseParquetConverterTest.java
index b58b48b621..64ed45e5e8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseParquetConverterTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/firehose/FirehoseParquetConverterTest.java
@@ -27,10 +27,13 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import java.util.Map;
@@ -93,7 +96,7 @@ class FirehoseParquetConverterTest {
private static Table table(Column... columns) {
StorageDescriptor descriptor = new StorageDescriptor();
- descriptor.setColumns(java.util.Arrays.asList(columns));
+ descriptor.setColumns(Arrays.asList(columns));
Table table = new Table();
table.setStorageDescriptor(descriptor);
return table;
@@ -142,7 +145,7 @@ class FirehoseParquetConverterTest {
private List<JsonNode> errorLines() throws Exception {
ArgumentCaptor<String> key = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<byte[]> body = ArgumentCaptor.forClass(byte[].class);
- verify(s3Service, org.mockito.Mockito.atLeastOnce()).putObject(eq(BUCKET), key.capture(),
+ verify(s3Service, Mockito.atLeastOnce()).putObject(eq(BUCKET), key.capture(),
body.capture(), eq("application/octet-stream"), anyMap());
List<Integer> errorWrites = new ArrayList<>();
@@ -206,7 +209,7 @@ class FirehoseParquetConverterTest {
}
private static String endsWithSuffix(String suffix) {
- return org.mockito.ArgumentMatchers.argThat(key -> key != null && key.endsWith(suffix));
+ return ArgumentMatchers.argThat(key -> key != null && key.endsWith(suffix));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/firehose/S3DestinationValidatorTest.java b/src/test/java/io/github/hectorvent/floci/services/firehose/S3DestinationValidatorTest.java
index 958cb7f27b..a9de1ce135 100644
--- a/src/test/java/io/github/hectorvent/floci/services/firehose/S3DestinationValidatorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/firehose/S3DestinationValidatorTest.java
@@ -11,6 +11,12 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -40,7 +46,7 @@ class S3DestinationValidatorTest {
private static S3Destination withProcessors(String unusedShapeName, Processor... processors) {
ProcessingConfiguration processing = new ProcessingConfiguration();
processing.setEnabled(true);
- processing.setProcessors(java.util.List.of(processors));
+ processing.setProcessors(List.of(processors));
S3Destination config = new S3Destination();
config.setProcessingConfiguration(processing);
return config;
@@ -49,7 +55,7 @@ class S3DestinationValidatorTest {
private static S3Destination withProcessor(String type, String... parameterNames) {
Processor processor = new Processor();
processor.setType(type);
- java.util.List<ProcessorParameter> parameters = new java.util.ArrayList<>();
+ List<ProcessorParameter> parameters = new ArrayList<>();
for (String name : parameterNames) {
ProcessorParameter parameter = new ProcessorParameter();
parameter.setParameterName(name);
@@ -59,7 +65,7 @@ class S3DestinationValidatorTest {
processor.setParameters(parameters);
ProcessingConfiguration processing = new ProcessingConfiguration();
processing.setEnabled(true);
- processing.setProcessors(java.util.List.of(processor));
+ processing.setProcessors(List.of(processor));
S3Destination config = new S3Destination();
config.setProcessingConfiguration(processing);
return config;
@@ -90,7 +96,7 @@ class S3DestinationValidatorTest {
@Test
void aProcessorWithoutATypeFailsAsRequired() {
Processor processor = new Processor();
- processor.setParameters(java.util.List.of(namedParameter("LambdaArn", "value")));
+ processor.setParameters(List.of(namedParameter("LambdaArn", "value")));
AwsException error = assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
withProcessors("extendedS3DestinationConfiguration", processor),
"extendedS3DestinationConfiguration"));
@@ -104,7 +110,7 @@ class S3DestinationValidatorTest {
void aParameterMissingEitherMemberFailsAsRequired() {
Processor processor = new Processor();
processor.setType("Lambda");
- processor.setParameters(java.util.List.of(new ProcessorParameter()));
+ processor.setParameters(List.of(new ProcessorParameter()));
AwsException error = assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
withProcessors("extendedS3DestinationConfiguration", processor),
"extendedS3DestinationConfiguration"));
@@ -120,7 +126,7 @@ class S3DestinationValidatorTest {
void anEmptyParameterValueFailsBothItsConstraints() {
Processor processor = new Processor();
processor.setType("Lambda");
- processor.setParameters(java.util.List.of(namedParameter("LambdaArn", "")));
+ processor.setParameters(List.of(namedParameter("LambdaArn", "")));
AwsException error = assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
withProcessors("extendedS3DestinationConfiguration", processor),
"extendedS3DestinationConfiguration"));
@@ -140,10 +146,10 @@ class S3DestinationValidatorTest {
void aNullListMemberIsIgnoredRatherThanReported() {
Processor processor = new Processor();
processor.setType("Lambda");
- processor.setParameters(java.util.Arrays.asList(namedParameter("LambdaArn", "value"), null));
+ processor.setParameters(Arrays.asList(namedParameter("LambdaArn", "value"), null));
ProcessingConfiguration processing = new ProcessingConfiguration();
processing.setEnabled(true);
- processing.setProcessors(java.util.Arrays.asList(processor, null));
+ processing.setProcessors(Arrays.asList(processor, null));
S3Destination config = new S3Destination();
config.setProcessingConfiguration(processing);
@@ -475,7 +481,7 @@ class S3DestinationValidatorTest {
+ " Member must have length greater than or equal to 1,"
+ " Member must satisfy regular expression pattern: ";
- private static S3Destination withColumnMappings(java.util.Map<String, String> mappings) {
+ private static S3Destination withColumnMappings(Map<String, String> mappings) {
DeliveryStreamDescription.OpenXJsonSerDe openX = new DeliveryStreamDescription.OpenXJsonSerDe();
openX.setColumnToJsonKeyMappings(mappings);
DeliveryStreamDescription.Deserializer deserializer = new DeliveryStreamDescription.Deserializer();
@@ -494,7 +500,7 @@ class S3DestinationValidatorTest {
@Test
void wireShapeAcceptsWellFormedColumnMappings() {
assertDoesNotThrow(() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", "sym", "price", "unit price")),
+ withColumnMappings(Map.of("ticker", "sym", "price", "unit price")),
"extendedS3DestinationConfiguration"));
}
@@ -503,19 +509,19 @@ class S3DestinationValidatorTest {
void mappingKeysRejectWhitespaceButValuesOnlyRejectBlanks() {
AwsException keyError = assertThrows(AwsException.class,
() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("has space", "v")),
+ withColumnMappings(Map.of("has space", "v")),
"extendedS3DestinationConfiguration"));
assertEquals("1 validation error detected: Value at '" + MAPPINGS_PATH + "' failed to satisfy "
+ "constraint: Map keys must satisfy constraint: " + LENGTH_RULES + "^\\S+$]",
keyError.getMessage());
assertDoesNotThrow(() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", "has space")),
+ withColumnMappings(Map.of("ticker", "has space")),
"extendedS3DestinationConfiguration"));
AwsException valueError = assertThrows(AwsException.class,
() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", " ")),
+ withColumnMappings(Map.of("ticker", " ")),
"extendedS3DestinationConfiguration"));
assertEquals("1 validation error detected: Value at '" + MAPPINGS_PATH + "' failed to satisfy "
+ "constraint: Map value must satisfy constraint: " + LENGTH_RULES + "^(?!\\s*$).+]",
@@ -525,7 +531,7 @@ class S3DestinationValidatorTest {
/** However many entries break the rule, AWS reports keys once and values once. */
@Test
void mappingViolationsAreReportedOncePerAspectWithKeysFirst() {
- java.util.Map<String, String> mappings = new java.util.LinkedHashMap<>();
+ Map<String, String> mappings = new LinkedHashMap<>();
mappings.put("has space", "");
mappings.put("also space", " ");
@@ -550,32 +556,32 @@ class S3DestinationValidatorTest {
@Test
void mappingValuesFollowTheDeclaredPatternRatherThanIsBlank() {
assertDoesNotThrow(() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", " ")),
+ withColumnMappings(Map.of("ticker", " ")),
"extendedS3DestinationConfiguration"));
assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", "a\nb")),
+ withColumnMappings(Map.of("ticker", "a\nb")),
"extendedS3DestinationConfiguration"));
assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("ticker", "ab\n")),
+ withColumnMappings(Map.of("ticker", "ab\n")),
"extendedS3DestinationConfiguration"));
assertDoesNotThrow(() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("a b", "v")),
+ withColumnMappings(Map.of("a b", "v")),
"extendedS3DestinationConfiguration"));
assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("a\nb", "v")),
+ withColumnMappings(Map.of("a\nb", "v")),
"extendedS3DestinationConfiguration"));
}
@Test
void mappingLengthsAreBoundedAt1024() {
assertDoesNotThrow(() -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("k".repeat(1024), "v".repeat(1024))),
+ withColumnMappings(Map.of("k".repeat(1024), "v".repeat(1024))),
"extendedS3DestinationConfiguration"));
assertThrows(AwsException.class, () -> S3DestinationValidator.validateWireShape(
- withColumnMappings(java.util.Map.of("k".repeat(1025), "v")),
+ withColumnMappings(Map.of("k".repeat(1025), "v")),
"extendedS3DestinationConfiguration"));
}
@@ -586,7 +592,7 @@ class S3DestinationValidatorTest {
parquet.setPageSizeBytes(1L);
S3Destination config = withParquetSerDe(parquet);
DeliveryStreamDescription.OpenXJsonSerDe openX = new DeliveryStreamDescription.OpenXJsonSerDe();
- openX.setColumnToJsonKeyMappings(java.util.Map.of("has space", "v"));
+ openX.setColumnToJsonKeyMappings(Map.of("has space", "v"));
DeliveryStreamDescription.Deserializer deserializer = new DeliveryStreamDescription.Deserializer();
deserializer.setOpenXJsonSerDe(openX);
DeliveryStreamDescription.InputFormatConfiguration input =
diff --git a/src/test/java/io/github/hectorvent/floci/services/fis/FisIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/fis/FisIntegrationTest.java
index 70a51a2ee0..5e42f00fd7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/fis/FisIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/fis/FisIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.fis;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -545,19 +546,19 @@ class FisIntegrationTest {
}
}
- private static io.restassured.specification.RequestSpecification awsRequest() {
+ private static RequestSpecification awsRequest() {
return awsRequest(ACCOUNT_ID, REGION);
}
- private static io.restassured.specification.RequestSpecification awsRequest(String accountId, String region) {
+ private static RequestSpecification awsRequest(String accountId, String region) {
return given().header("Authorization", authorization(accountId, region));
}
- private static io.restassured.specification.RequestSpecification ec2Request() {
+ private static RequestSpecification ec2Request() {
return given().header("Authorization", authorization(ACCOUNT_ID, REGION, "ec2"));
}
- private static io.restassured.specification.RequestSpecification jsonRequest(String body) {
+ private static RequestSpecification jsonRequest(String body) {
return awsRequest().contentType("application/json").body(body);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java
index 00dddf5186..442564028e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/floci/ui/FlociUiManagerTest.java
@@ -27,6 +27,7 @@ import java.io.OutputStream;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -572,7 +573,7 @@ class FlociUiManagerTest {
when(ui.containerName()).thenReturn("floci-ui");
ContainerLifecycleManager lifecycleManager = mock(ContainerLifecycleManager.class);
when(lifecycleManager.findByName("floci-ui"))
- .thenThrow(new com.github.dockerjava.api.exception.DockerClientException(
+ .thenThrow(new DockerClientException(
"Cannot connect to the Docker daemon"));
FlociUiManager manager = new FlociUiManager(
@@ -835,7 +836,7 @@ class FlociUiManagerTest {
LinkedHashMap<String, String> env = new LinkedHashMap<>();
env.put("PORT", "4500");
- FlociUiManager.applyExtraEnv(env, Optional.of(java.util.Arrays.asList(
+ FlociUiManager.applyExtraEnv(env, Optional.of(Arrays.asList(
"NOT_A_PAIR", "=orphan", " ", null, "GOOD=yes")));
assertEquals(Map.of("PORT", "4500", "GOOD", "yes"), env);
diff --git a/src/test/java/io/github/hectorvent/floci/services/glue/GlueServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/glue/GlueServiceTest.java
index af67507284..9978d64649 100644
--- a/src/test/java/io/github/hectorvent/floci/services/glue/GlueServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/glue/GlueServiceTest.java
@@ -180,7 +180,7 @@ class GlueServiceTest {
StorageDescriptor sd = new StorageDescriptor();
Column column = new Column("a", "string");
column.setParameters(Map.of("trino_type_id", "varchar"));
- sd.setColumns(java.util.List.of(column));
+ sd.setColumns(List.of(column));
table.setStorageDescriptor(sd);
glueService.createTable("db1", table);
@@ -334,7 +334,7 @@ class GlueServiceTest {
Table table = new Table();
table.setName("plain");
StorageDescriptor sd = new StorageDescriptor();
- sd.setColumns(java.util.List.of(new Column("a", "string")));
+ sd.setColumns(List.of(new Column("a", "string")));
table.setStorageDescriptor(sd);
glueService.createTable("db1", table);
@@ -342,7 +342,7 @@ class GlueServiceTest {
Table replacement = new Table();
replacement.setName("plain");
StorageDescriptor replacementSd = new StorageDescriptor();
- replacementSd.setColumns(java.util.List.of(new Column("b", "bigint")));
+ replacementSd.setColumns(List.of(new Column("b", "bigint")));
replacement.setStorageDescriptor(replacementSd);
glueService.updateTable("db1", replacement, null, false);
@@ -415,7 +415,7 @@ class GlueServiceTest {
table.setViewExpandedText("SELECT 1 AS x");
table.setParameters(Map.of("presto_view", "true"));
StorageDescriptor storageDescriptor = new StorageDescriptor();
- storageDescriptor.setColumns(java.util.List.of(new Column("x", "int")));
+ storageDescriptor.setColumns(List.of(new Column("x", "int")));
table.setStorageDescriptor(storageDescriptor);
glueService.createTable("db1", table);
@@ -436,7 +436,7 @@ class GlueServiceTest {
glueService.createTable("db1", table);
Partition partition = new Partition();
- partition.setValues(java.util.List.of("2026"));
+ partition.setValues(List.of("2026"));
glueService.createPartition("db1", "plain", partition);
glueService.deleteDatabase("db1");
@@ -1208,7 +1208,7 @@ class GlueServiceTest {
crawler.setName(name);
crawler.setRole("arn:aws:iam::000000000000:role/my-role");
CrawlerTargets targets = new CrawlerTargets();
- targets.setS3Targets(java.util.List.of(new S3Target()));
+ targets.setS3Targets(List.of(new S3Target()));
crawler.setTargets(targets);
return crawler;
}
@@ -1422,9 +1422,9 @@ class GlueServiceTest {
Table table = new Table();
table.setName("indexed");
StorageDescriptor sd = new StorageDescriptor();
- sd.setColumns(java.util.List.of(new Column("a", "string")));
+ sd.setColumns(List.of(new Column("a", "string")));
table.setStorageDescriptor(sd);
- table.setPartitionKeys(java.util.List.of(new Column("a", "string"), new Column("b", "string")));
+ table.setPartitionKeys(List.of(new Column("a", "string"), new Column("b", "string")));
glueService.createTable("db1", table);
// Two settled indexes leave exactly one slot under the cap of three.
@@ -1441,7 +1441,7 @@ class GlueServiceTest {
start.await();
PartitionIndex index = new PartitionIndex();
index.setIndexName(indexName);
- index.setKeys(java.util.List.of("a", "b"));
+ index.setKeys(List.of("a", "b"));
glueService.createPartitionIndex("db1", "indexed", index);
} catch (AwsException | InterruptedException expected) {
// Only the create that takes the last slot succeeds; the rest are rejected.
@@ -1459,7 +1459,7 @@ class GlueServiceTest {
private void createSettledIndex(String indexName, String key) {
PartitionIndex index = new PartitionIndex();
index.setIndexName(indexName);
- index.setKeys(java.util.List.of(key));
+ index.setKeys(List.of(key));
glueService.createPartitionIndex("db1", "indexed", index);
glueService.getPartitionIndexes("db1", "indexed");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryServiceTest.java
index c233264331..9d7eb8435e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/GlueSchemaRegistryServiceTest.java
@@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
+import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -191,7 +192,7 @@ class GlueSchemaRegistryServiceTest {
@Test
void updateRegistryChangesDescriptionAndUpdatedTime() throws InterruptedException {
service.createRegistry("r1", "old", null, REGION);
- java.time.Instant beforeTime = service.getRegistry(new RegistryId("r1", null), REGION).getUpdatedTime();
+ Instant beforeTime = service.getRegistry(new RegistryId("r1", null), REGION).getUpdatedTime();
Thread.sleep(10);
Registry updated = service.updateRegistry(new RegistryId("r1", null), "new", REGION);
diff --git a/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/SchemaToColumnsConverterTest.java b/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/SchemaToColumnsConverterTest.java
index b13ae421b6..6e4bd23acb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/SchemaToColumnsConverterTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/glue/schemaregistry/SchemaToColumnsConverterTest.java
@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -110,7 +111,7 @@ class SchemaToColumnsConverterTest {
List<Column> cols = SchemaToColumnsConverter.toColumns("AVRO", def);
Map<String, String> byName = cols.stream()
- .collect(java.util.stream.Collectors.toMap(Column::getName, Column::getType));
+ .collect(Collectors.toMap(Column::getName, Column::getType));
assertEquals("timestamp", byName.get("created"));
assertEquals("timestamp", byName.get("created_micros"));
assertEquals("timestamp", byName.get("local_created"));
@@ -168,7 +169,7 @@ class SchemaToColumnsConverterTest {
List<Column> cols = SchemaToColumnsConverter.toColumns("JSON", def);
Map<String, String> byName = cols.stream()
- .collect(java.util.stream.Collectors.toMap(Column::getName, Column::getType));
+ .collect(Collectors.toMap(Column::getName, Column::getType));
assertEquals("bigint", byName.get("id"));
assertEquals("string", byName.get("name"));
assertEquals("boolean", byName.get("flag"));
@@ -220,8 +221,8 @@ class SchemaToColumnsConverterTest {
List<Column> cols = SchemaToColumnsConverter.toColumns("PROTOBUF", def);
- java.util.Map<String, String> byName = cols.stream()
- .collect(java.util.stream.Collectors.toMap(Column::getName, Column::getType));
+ Map<String, String> byName = cols.stream()
+ .collect(Collectors.toMap(Column::getName, Column::getType));
assertEquals(3, cols.size(), () -> "got cols: " + cols.stream().map(c -> c.getName() + ":" + c.getType()).toList());
assertEquals("bigint", byName.get("id"));
assertEquals("string", byName.get("name"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/AssumeRoleWithSamlValidationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/AssumeRoleWithSamlValidationIntegrationTest.java
index abc798674e..171a9b3833 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/AssumeRoleWithSamlValidationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/AssumeRoleWithSamlValidationIntegrationTest.java
@@ -22,6 +22,7 @@ import javax.xml.crypto.dsig.SignedInfo;
import javax.xml.crypto.dsig.Transform;
import javax.xml.crypto.dsig.XMLSignatureFactory;
import javax.xml.crypto.dsig.dom.DOMSignContext;
+import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
import javax.xml.crypto.dsig.spec.TransformParameterSpec;
import javax.xml.crypto.dsig.spec.XPathFilter2ParameterSpec;
import javax.xml.crypto.dsig.spec.XPathFilterParameterSpec;
@@ -355,7 +356,7 @@ class AssumeRoleWithSamlValidationIntegrationTest {
factory.newDigestMethod(DigestMethod.SHA256, null),
transforms.apply(factory), null, null);
SignedInfo signedInfo = factory.newSignedInfo(
- factory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (javax.xml.crypto.dsig.spec.C14NMethodParameterSpec) null),
+ factory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec) null),
factory.newSignatureMethod(SignatureMethod.RSA_SHA256, null), List.of(reference));
factory.newXMLSignature(signedInfo, null)
.sign(new DOMSignContext(signingKeys.getPrivate(), assertion));
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/CredentialReportIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/CredentialReportIntegrationTest.java
index bbc0cf1342..41cd054997 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/CredentialReportIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/CredentialReportIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.iam;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import java.util.Base64;
@@ -24,7 +25,7 @@ class CredentialReportIntegrationTest {
private static final String IAM_AUTH =
"AWS4-HMAC-SHA256 Credential=test/20260227/us-east-1/iam/aws4_request";
- private static io.restassured.specification.RequestSpecification iam(String action) {
+ private static RequestSpecification iam(String action) {
return given().header("Authorization", IAM_AUTH).formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/GetAccountAuthorizationDetailsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/GetAccountAuthorizationDetailsIntegrationTest.java
index d512653379..9d73293e44 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/GetAccountAuthorizationDetailsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/GetAccountAuthorizationDetailsIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.iam;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -28,7 +29,7 @@ class GetAccountAuthorizationDetailsIntegrationTest {
"{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\","
+ "\"Action\":\"s3:GetObject\",\"Resource\":\"*\"}]}";
- private static io.restassured.specification.RequestSpecification iam(String action) {
+ private static RequestSpecification iam(String action) {
return given().header("Authorization", IAM_AUTH).formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamResourceTagsInResponseTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamResourceTagsInResponseTest.java
index 3d8b1e8675..348a128c41 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/IamResourceTagsInResponseTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamResourceTagsInResponseTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.iam;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -31,7 +32,7 @@ class IamResourceTagsInResponseTest {
"{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\","
+ "\"Action\":\"s3:GetObject\",\"Resource\":\"*\"}]}";
- private static io.restassured.specification.RequestSpecification iam(String action) {
+ private static RequestSpecification iam(String action) {
return given().header("Authorization", IAM_AUTH).formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamRolePolicyConcurrencyTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamRolePolicyConcurrencyTest.java
index b1a1143972..031737d944 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/IamRolePolicyConcurrencyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamRolePolicyConcurrencyTest.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -107,7 +108,7 @@ class IamRolePolicyConcurrencyTest {
}
private static List<String> sorted(List<String> in) {
- List<String> copy = new java.util.ArrayList<>(in);
+ List<String> copy = new ArrayList<>(in);
Collections.sort(copy);
return copy;
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/InstanceProfileTagsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/InstanceProfileTagsIntegrationTest.java
index e4b1014e21..22fcfdcc63 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/InstanceProfileTagsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/InstanceProfileTagsIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.iam;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.UUID;
@@ -67,7 +68,7 @@ class InstanceProfileTagsIntegrationTest {
.then().statusCode(200);
}
- private static io.restassured.specification.RequestSpecification tagRequest(String profile,
+ private static RequestSpecification tagRequest(String profile,
int from, int to) {
RequestSpecification request = given()
.contentType("application/x-www-form-urlencoded")
@@ -105,7 +106,7 @@ class InstanceProfileTagsIntegrationTest {
.header("Authorization", auth(ACCOUNT, "iam"))
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.not(containsString("key1")));
+ .body(Matchers.not(containsString("key1")));
}
/**
@@ -131,7 +132,7 @@ class InstanceProfileTagsIntegrationTest {
.header("Authorization", auth(ACCOUNT, "iam"))
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.not(containsString("key60")));
+ .body(Matchers.not(containsString("key60")));
}
/** {@code tagKeyListType} is {@code max: 50} on the request itself. */
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/LambdaExecutionRoleCredentialsTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/LambdaExecutionRoleCredentialsTest.java
index 2c243d580e..0bebf36f29 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/LambdaExecutionRoleCredentialsTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/LambdaExecutionRoleCredentialsTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.lambda.model.LambdaFunction;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -58,7 +59,7 @@ class LambdaExecutionRoleCredentialsTest {
assertEquals(200, session.sessionToken().length());
CallerContext caller = iamService.resolveCallerContext(session.accessKeyId());
assertNotNull(caller);
- assertEquals(java.util.List.of(POLICY), caller.identityPolicies());
+ assertEquals(List.of(POLICY), caller.identityPolicies());
assertEquals(
"arn:aws:sts::000000000000:assumed-role/LambdaExecutionRole/function",
iamService.resolveCallerArn(session.accessKeyId()).orElseThrow());
@@ -80,7 +81,7 @@ class LambdaExecutionRoleCredentialsTest {
SessionCreds session = credentials.forFunction(version).orElseThrow();
- assertEquals(java.util.List.of(POLICY),
+ assertEquals(List.of(POLICY),
iamService.resolveCallerContext(session.accessKeyId()).identityPolicies());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/LambdaScopedTablePermissionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/LambdaScopedTablePermissionIntegrationTest.java
index bec742ce51..258957fb49 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/LambdaScopedTablePermissionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/LambdaScopedTablePermissionIntegrationTest.java
@@ -6,6 +6,9 @@ import io.github.hectorvent.floci.services.lambda.model.LambdaFunction;
import io.github.hectorvent.floci.testing.IamEnforcementProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import io.restassured.config.EncoderConfig;
+import io.restassured.http.ContentType;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
@@ -33,9 +36,9 @@ class LambdaScopedTablePermissionIntegrationTest {
String tableName = "granted-table-" + suffix;
String roleName = "ScopedTableRole" + suffix;
String tableArn = "arn:aws:dynamodb:" + REGION + ":" + ACCOUNT_ID + ":table/" + tableName;
- given().config(io.restassured.RestAssured.config().encoderConfig(
- io.restassured.config.EncoderConfig.encoderConfig().encodeContentTypeAs(
- "application/x-amz-json-1.0", io.restassured.http.ContentType.TEXT)))
+ given().config(RestAssured.config().encoderConfig(
+ EncoderConfig.encoderConfig().encodeContentTypeAs(
+ "application/x-amz-json-1.0", ContentType.TEXT)))
.header("Authorization", auth("test"))
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
.contentType("application/x-amz-json-1.0")
@@ -58,9 +61,9 @@ class LambdaScopedTablePermissionIntegrationTest {
function.setRole("arn:aws:iam::" + ACCOUNT_ID + ":role/" + roleName);
SessionCreds credentials = executionRoleCredentials.forFunction(function).orElseThrow();
try {
- given().config(io.restassured.RestAssured.config().encoderConfig(
- io.restassured.config.EncoderConfig.encoderConfig().encodeContentTypeAs(
- "application/x-amz-json-1.0", io.restassured.http.ContentType.TEXT)))
+ given().config(RestAssured.config().encoderConfig(
+ EncoderConfig.encoderConfig().encodeContentTypeAs(
+ "application/x-amz-json-1.0", ContentType.TEXT)))
.header("Authorization", auth(credentials.accessKeyId()))
.header("X-Amz-Target", "DynamoDB_20120810.PutItem")
.contentType("application/x-amz-json-1.0")
@@ -70,9 +73,9 @@ class LambdaScopedTablePermissionIntegrationTest {
.when().post("/")
.then().statusCode(200);
- given().config(io.restassured.RestAssured.config().encoderConfig(
- io.restassured.config.EncoderConfig.encoderConfig().encodeContentTypeAs(
- "application/x-amz-json-1.0", io.restassured.http.ContentType.TEXT)))
+ given().config(RestAssured.config().encoderConfig(
+ EncoderConfig.encoderConfig().encodeContentTypeAs(
+ "application/x-amz-json-1.0", ContentType.TEXT)))
.header("Authorization", auth(credentials.accessKeyId()))
.header("X-Amz-Target", "DynamoDB_20120810.GetItem")
.contentType("application/x-amz-json-1.0")
@@ -82,9 +85,9 @@ class LambdaScopedTablePermissionIntegrationTest {
.when().post("/")
.then().statusCode(200).body(containsString("persisted"));
- given().config(io.restassured.RestAssured.config().encoderConfig(
- io.restassured.config.EncoderConfig.encoderConfig().encodeContentTypeAs(
- "application/x-amz-json-1.0", io.restassured.http.ContentType.TEXT)))
+ given().config(RestAssured.config().encoderConfig(
+ EncoderConfig.encoderConfig().encodeContentTypeAs(
+ "application/x-amz-json-1.0", ContentType.TEXT)))
.header("Authorization", auth(credentials.accessKeyId()))
.header("X-Amz-Target", "DynamoDB_20120810.GetItem")
.contentType("application/x-amz-json-1.0")
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/StsWebIdentityEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/StsWebIdentityEnforcementIntegrationTest.java
index 8f56424373..2cafdae6ee 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/StsWebIdentityEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/StsWebIdentityEnforcementIntegrationTest.java
@@ -4,6 +4,7 @@ import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.testing.IamEnforcementProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import io.restassured.response.Response;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -32,7 +33,7 @@ class StsWebIdentityEnforcementIntegrationTest {
.body(containsString("InvalidIdentityToken"));
}
- private static io.restassured.response.Response assumeRole(String token) {
+ private static Response assumeRole(String token) {
return given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "AssumeRoleWithWebIdentity")
diff --git a/src/test/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreIntegrationTest.java
index ad7584db9d..ec4a7ba493 100644
--- a/src/test/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/identitystore/IdentityStoreIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.identitystore;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -147,7 +148,7 @@ class IdentityStoreIntegrationTest {
.body("UserName", equalTo("[email protected]"));
}
- private static io.restassured.response.ValidatableResponse json(String target, String body) {
+ private static ValidatableResponse json(String target, String body) {
return given()
.contentType(TYPE)
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/identitystore/ScimIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/identitystore/ScimIntegrationTest.java
index 35ad68ff66..105b199b30 100644
--- a/src/test/java/io/github/hectorvent/floci/services/identitystore/ScimIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/identitystore/ScimIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.identitystore;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -801,8 +802,8 @@ class ScimIntegrationTest {
.then()
.statusCode(200)
.body("itemsPerPage", equalTo(1))
- .body("totalResults", org.hamcrest.Matchers.nullValue())
- .body("startIndex", org.hamcrest.Matchers.nullValue())
+ .body("totalResults", Matchers.nullValue())
+ .body("startIndex", Matchers.nullValue())
.body("nextCursor", notNullValue())
.extract().path("nextCursor");
@@ -882,8 +883,8 @@ class ScimIntegrationTest {
.then()
.statusCode(200)
.body("itemsPerPage", equalTo(1))
- .body("totalResults", org.hamcrest.Matchers.nullValue())
- .body("startIndex", org.hamcrest.Matchers.nullValue())
+ .body("totalResults", Matchers.nullValue())
+ .body("startIndex", Matchers.nullValue())
.body("nextCursor", notNullValue())
.extract().path("nextCursor");
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotDeviceCertificateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotDeviceCertificateIntegrationTest.java
index 99a72c58e6..a82997dbb6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotDeviceCertificateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotDeviceCertificateIntegrationTest.java
@@ -1,26 +1,37 @@
package io.github.hectorvent.floci.services.iot;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.core.common.Pem;
import io.github.hectorvent.floci.services.iot.model.IotCertificate;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
+import jakarta.inject.Inject;
import org.bouncycastle.asn1.x500.X500Name;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import javax.security.auth.x500.X500Principal;
+
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
+import java.security.Security;
import java.security.Signature;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.ECGenParameterSpec;
+import java.time.Instant;
import java.util.Base64;
import java.util.List;
import java.util.Map;
@@ -40,13 +51,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@QuarkusTest
class IotDeviceCertificateIntegrationTest {
- @jakarta.inject.Inject
+ @Inject
IotService iotService;
- @org.junit.jupiter.api.BeforeAll
+ @BeforeAll
static void bouncyCastle() {
- if (java.security.Security.getProvider(org.bouncycastle.jce.provider.BouncyCastleProvider.PROVIDER_NAME) == null) {
- java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
+ if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
+ Security.addProvider(new BouncyCastleProvider());
}
}
@@ -71,10 +82,10 @@ class IotDeviceCertificateIntegrationTest {
assertEquals(List.of("1.3.6.1.5.5.7.3.2"), cert.getExtendedKeyUsage(), "clientAuth");
assertEquals(-1, cert.getBasicConstraints());
assertEquals("RSA", cert.getPublicKey().getAlgorithm());
- assertEquals(2048, ((java.security.interfaces.RSAPublicKey) cert.getPublicKey()).getModulus().bitLength());
+ assertEquals(2048, ((RSAPublicKey) cert.getPublicKey()).getModulus().bitLength());
assertEquals(expectedNotAfter(ca), cert.getNotAfter().toInstant(),
"AWS IoT-issued certificates all expire at the end of 2049, never past the CA");
- assertTrue(!cert.getNotBefore().toInstant().isAfter(java.time.Instant.now()), "valid from issue time");
+ assertTrue(!cert.getNotBefore().toInstant().isAfter(Instant.now()), "valid from issue time");
String expectedId = Digests.sha256Hex(cert.getEncoded());
assertEquals(expectedId, body.getString("certificateId"), "AWS certificateId is sha256(DER), lowercase hex");
@@ -140,7 +151,7 @@ class IotDeviceCertificateIntegrationTest {
cert.verify(ca.getPublicKey());
assertEquals(deviceKey.getPublic(), cert.getPublicKey(), "the CSR's key is the certificate's key");
- assertEquals(new javax.security.auth.x500.X500Principal(new X500Name("CN=thing-0001,O=Example").getEncoded()),
+ assertEquals(new X500Principal(new X500Name("CN=thing-0001,O=Example").getEncoded()),
cert.getSubjectX500Principal(), "the CSR's subject is the certificate's subject");
assertEquals(List.of("1.3.6.1.5.5.7.3.2"), cert.getExtendedKeyUsage(), "clientAuth");
assertEquals(-1, cert.getBasicConstraints());
@@ -166,7 +177,7 @@ class IotDeviceCertificateIntegrationTest {
@Test
void createCertificateFromCsrAcceptsAnEcKey() throws Exception {
KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");
- kpg.initialize(new java.security.spec.ECGenParameterSpec("secp256r1"));
+ kpg.initialize(new ECGenParameterSpec("secp256r1"));
KeyPair deviceKey = kpg.generateKeyPair();
PKCS10CertificationRequest csr = new JcaPKCS10CertificationRequestBuilder(
new X500Name("CN=ec-device"), deviceKey.getPublic())
@@ -282,7 +293,7 @@ class IotDeviceCertificateIntegrationTest {
.extract().asString();
// Read with Jackson: RestAssured's JsonPath narrows large epoch doubles to float precision.
- com.fasterxml.jackson.databind.JsonNode described = new com.fasterxml.jackson.databind.ObjectMapper().readTree(body)
+ JsonNode described = new ObjectMapper().readTree(body)
.path("certificateDescription");
X509Certificate ca = parse(given().when().get("/_floci/ca.pem").then().statusCode(200).extract().asString());
assertEquals(expectedNotAfter(ca).getEpochSecond(), described.path("validity").path("notAfter").asLong(),
@@ -319,7 +330,7 @@ class IotDeviceCertificateIntegrationTest {
/** Built with the BouncyCastle provider so curves the JDK dropped (secp256k1) can be requested. */
private static String ecCsrPem(String curve, String subject) throws Exception {
KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", "BC");
- kpg.initialize(new java.security.spec.ECGenParameterSpec(curve));
+ kpg.initialize(new ECGenParameterSpec(curve));
KeyPair keyPair = kpg.generateKeyPair();
PKCS10CertificationRequest csr = new JcaPKCS10CertificationRequestBuilder(
new X500Name(subject), keyPair.getPublic())
@@ -349,9 +360,9 @@ class IotDeviceCertificateIntegrationTest {
}
/** AWS's fixed 2049 expiry, capped at the CA's own: a CA created before this change lives ten years. */
- private static java.time.Instant expectedNotAfter(X509Certificate ca) {
- java.time.Instant aws = java.time.Instant.parse("2049-12-31T23:59:59Z");
- java.time.Instant caNotAfter = ca.getNotAfter().toInstant();
+ private static Instant expectedNotAfter(X509Certificate ca) {
+ Instant aws = Instant.parse("2049-12-31T23:59:59Z");
+ Instant caNotAfter = ca.getNotAfter().toInstant();
return caNotAfter.isBefore(aws) ? caNotAfter : aws;
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotIntegrationTest.java
index fd3dff1d36..e6c49f4ef7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotIntegrationTest.java
@@ -3,7 +3,9 @@ package io.github.hectorvent.floci.services.iot;
import io.github.hectorvent.floci.services.acm.CertificateGenerator;
import io.github.hectorvent.floci.services.acm.model.KeyAlgorithm;
import io.quarkus.test.junit.QuarkusTest;
+import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.openssl.jcajce.JcaPEMWriter;
+import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder;
import org.junit.jupiter.api.MethodOrderer;
@@ -11,6 +13,9 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.io.StringWriter;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
import java.util.List;
import java.util.Map;
@@ -574,7 +579,7 @@ class IotIntegrationTest {
String csrArn = given()
.contentType("application/json")
.queryParam("setAsActive", false)
- .body(java.util.Map.of("certificateSigningRequest", csrPem()))
+ .body(Map.of("certificateSigningRequest", csrPem()))
.when()
.post("/certificates")
.then()
@@ -1082,13 +1087,13 @@ class IotIntegrationTest {
private static String csrPem() throws Exception {
- java.security.KeyPairGenerator kpg = java.security.KeyPairGenerator.getInstance("RSA");
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
kpg.initialize(2048);
- java.security.KeyPair kp = kpg.generateKeyPair();
+ KeyPair kp = kpg.generateKeyPair();
PKCS10CertificationRequest csr = new JcaPKCS10CertificationRequestBuilder(
- new org.bouncycastle.asn1.x500.X500Name("CN=round-trip"), kp.getPublic())
- .build(new org.bouncycastle.operator.jcajce.JcaContentSignerBuilder("SHA256withRSA").build(kp.getPrivate()));
- java.io.StringWriter out = new java.io.StringWriter();
+ new X500Name("CN=round-trip"), kp.getPublic())
+ .build(new JcaContentSignerBuilder("SHA256withRSA").build(kp.getPrivate()));
+ StringWriter out = new StringWriter();
try (JcaPEMWriter w = new JcaPEMWriter(out)) {
w.writeObject(csr);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerDeviceVerificationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerDeviceVerificationTest.java
index ca68c92956..50a507f4d4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerDeviceVerificationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerDeviceVerificationTest.java
@@ -21,6 +21,7 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttSecurityException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
@@ -136,7 +137,7 @@ class IotMqttBrokerDeviceVerificationTest {
when(service.findRegisteredCertificate(any())).thenReturn(Optional.empty());
org.eclipse.paho.mqttv5.client.MqttClient client =
new org.eclipse.paho.mqttv5.client.MqttClient("ssl://127.0.0.1:" + tlsPort, "v5-unknown", null);
- org.eclipse.paho.mqttv5.client.MqttConnectionOptions options = new org.eclipse.paho.mqttv5.client.MqttConnectionOptions();
+ MqttConnectionOptions options = new MqttConnectionOptions();
options.setConnectionTimeout(10);
options.setAutomaticReconnect(false);
options.setSocketFactory(sslContext(keyManagers(deviceLeaf)).getSocketFactory());
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java
index faa5636d13..7107afd9bf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttBrokerServiceTest.java
@@ -72,6 +72,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -2107,7 +2108,7 @@ class IotMqttBrokerServiceTest {
.addKeyValue(Buffer.buffer(leaf.privateKeyPem()));
}
- private static java.math.BigInteger serial(CertificateGenerator.GeneratedCertificate leaf) {
+ private static BigInteger serial(CertificateGenerator.GeneratedCertificate leaf) {
return Pem.parseCertificate(leaf.certificatePem()).getSerialNumber();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttEnabledIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttEnabledIntegrationTest.java
index 80e1fed1a9..9e05fd66df 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttEnabledIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttEnabledIntegrationTest.java
@@ -17,6 +17,12 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+import org.eclipse.paho.mqttv5.client.IMqttToken;
+import org.eclipse.paho.mqttv5.client.MqttClientException;
+import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
+import org.eclipse.paho.mqttv5.client.MqttDisconnectResponse;
+import org.eclipse.paho.mqttv5.common.packet.MqttProperties;
+import org.eclipse.paho.mqttv5.common.packet.UserProperty;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -322,16 +328,16 @@ class IotMqttEnabledIntegrationTest {
org.eclipse.paho.mqttv5.common.MqttException thrown = assertThrows(
org.eclipse.paho.mqttv5.common.MqttException.class,
() -> publisher.publish(topic, randomPayload(AWS_MAX_PAYLOAD), 1, awsMaximumProperties(16 * 1024)));
- assertEquals(org.eclipse.paho.mqttv5.client.MqttClientException.REASON_CODE_CONNECTION_LOST, thrown.getReasonCode());
+ assertEquals(MqttClientException.REASON_CODE_CONNECTION_LOST, thrown.getReasonCode());
}
}
/** 8 KB correlation data plus user properties of the given key and value size, as AWS counts them. */
- private static org.eclipse.paho.mqttv5.common.packet.MqttProperties awsMaximumProperties(int userPropertiesSize) {
- org.eclipse.paho.mqttv5.common.packet.MqttProperties properties = new org.eclipse.paho.mqttv5.common.packet.MqttProperties();
+ private static MqttProperties awsMaximumProperties(int userPropertiesSize) {
+ MqttProperties properties = new MqttProperties();
properties.setCorrelationData(randomPayload(8 * 1024));
- properties.setUserProperties(java.util.List.of(
- new org.eclipse.paho.mqttv5.common.packet.UserProperty("k", "v".repeat(userPropertiesSize - 1))));
+ properties.setUserProperties(List.of(
+ new UserProperty("k", "v".repeat(userPropertiesSize - 1))));
return properties;
}
@@ -1061,7 +1067,7 @@ class IotMqttEnabledIntegrationTest {
Mqtt5TestClient testClient = new Mqtt5TestClient(client);
client.setCallback(new org.eclipse.paho.mqttv5.client.MqttCallback() {
@Override
- public void disconnected(org.eclipse.paho.mqttv5.client.MqttDisconnectResponse disconnectResponse) {
+ public void disconnected(MqttDisconnectResponse disconnectResponse) {
}
@Override
@@ -1074,7 +1080,7 @@ class IotMqttEnabledIntegrationTest {
}
@Override
- public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) {
+ public void deliveryComplete(IMqttToken token) {
}
@Override
@@ -1082,7 +1088,7 @@ class IotMqttEnabledIntegrationTest {
}
@Override
- public void authPacketArrived(int reasonCode, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties) {
+ public void authPacketArrived(int reasonCode, MqttProperties properties) {
}
});
client.setTimeToWait(10_000);
@@ -1099,10 +1105,10 @@ class IotMqttEnabledIntegrationTest {
}
void publish(String topic, byte[] payload) throws org.eclipse.paho.mqttv5.common.MqttException {
- publish(topic, payload, 0, new org.eclipse.paho.mqttv5.common.packet.MqttProperties());
+ publish(topic, payload, 0, new MqttProperties());
}
- void publish(String topic, byte[] payload, int qos, org.eclipse.paho.mqttv5.common.packet.MqttProperties properties)
+ void publish(String topic, byte[] payload, int qos, MqttProperties properties)
throws org.eclipse.paho.mqttv5.common.MqttException {
org.eclipse.paho.mqttv5.common.MqttMessage message = new org.eclipse.paho.mqttv5.common.MqttMessage(payload);
message.setQos(qos);
@@ -1123,9 +1129,9 @@ class IotMqttEnabledIntegrationTest {
client.close();
}
- private static org.eclipse.paho.mqttv5.client.MqttConnectionOptions connectOptions() {
- org.eclipse.paho.mqttv5.client.MqttConnectionOptions options =
- new org.eclipse.paho.mqttv5.client.MqttConnectionOptions();
+ private static MqttConnectionOptions connectOptions() {
+ MqttConnectionOptions options =
+ new MqttConnectionOptions();
options.setCleanStart(true);
options.setConnectionTimeout(2);
options.setKeepAliveInterval(60);
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttMutualTlsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttMutualTlsIntegrationTest.java
index 646b224d41..2fdfc84b3c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttMutualTlsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttMutualTlsIntegrationTest.java
@@ -9,6 +9,7 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttSecurityException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -305,8 +306,8 @@ class IotMqttMutualTlsIntegrationTest {
return new org.eclipse.paho.mqttv5.client.MqttClient("ssl://127.0.0.1:" + TLS_PORT, clientId, null);
}
- private static org.eclipse.paho.mqttv5.client.MqttConnectionOptions mqtt5Options(SSLSocketFactory socketFactory) {
- org.eclipse.paho.mqttv5.client.MqttConnectionOptions options = new org.eclipse.paho.mqttv5.client.MqttConnectionOptions();
+ private static MqttConnectionOptions mqtt5Options(SSLSocketFactory socketFactory) {
+ MqttConnectionOptions options = new MqttConnectionOptions();
options.setCleanStart(true);
options.setConnectionTimeout(10);
options.setAutomaticReconnect(false);
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttTlsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttTlsIntegrationTest.java
index aa041696f3..19851e3da6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttTlsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttTlsIntegrationTest.java
@@ -14,6 +14,7 @@ import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
+import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -109,8 +110,8 @@ class IotMqttTlsIntegrationTest {
void mqtt5ConnectsOverTls() throws Exception {
org.eclipse.paho.mqttv5.client.MqttClient client = new org.eclipse.paho.mqttv5.client.MqttClient(
"ssl://127.0.0.1:" + TLS_PORT, "tls-v5-" + System.nanoTime(), null);
- org.eclipse.paho.mqttv5.client.MqttConnectionOptions options =
- new org.eclipse.paho.mqttv5.client.MqttConnectionOptions();
+ MqttConnectionOptions options =
+ new MqttConnectionOptions();
options.setCleanStart(true);
options.setConnectionTimeout(10);
options.setSocketFactory(device().sslContext(TLS_DIR).getSocketFactory());
diff --git a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttWebSocketContractIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttWebSocketContractIntegrationTest.java
index f809c0b741..5241aabbb6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttWebSocketContractIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iot/IotMqttWebSocketContractIntegrationTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import org.eclipse.microprofile.config.inject.ConfigProperty;
+import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
@@ -238,7 +239,7 @@ class IotMqttWebSocketContractIntegrationTest {
}
@Override
- public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) {
+ public void deliveryComplete(IMqttDeliveryToken token) {
}
});
tcp.connect();
@@ -460,7 +461,7 @@ class IotMqttWebSocketContractIntegrationTest {
}
@Override
- public void deliveryComplete(org.eclipse.paho.client.mqttv3.IMqttDeliveryToken token) {
+ public void deliveryComplete(IMqttDeliveryToken token) {
}
});
MqttConnectOptions options = new MqttConnectOptions();
diff --git a/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisIntegrationTest.java
index 89995f8c3d..74028708c0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisIntegrationTest.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -15,8 +16,10 @@ import org.junit.jupiter.api.TestMethodOrder;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Base64;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -667,7 +670,7 @@ class KinesisIntegrationTest {
""")
.when().post("/").then().statusCode(200);
- java.util.Set<String> reported = new java.util.HashSet<>();
+ Set<String> reported = new HashSet<>();
// Probe enough partition keys that hash(pk) % 2 hits both shards. With 50 keys the
// odds of single-shard routing are ~1 in 2^49, so this is effectively deterministic.
for (int i = 0; i < 50 && reported.size() < 2; i++) {
@@ -682,7 +685,7 @@ class KinesisIntegrationTest {
.extract().jsonPath().getString("ShardId");
reported.add(shardId);
}
- org.junit.jupiter.api.Assertions.assertEquals(2, reported.size(),
+ Assertions.assertEquals(2, reported.size(),
"PutRecord should report distinct ShardIds across partition keys on a 2-shard stream");
}
@@ -704,7 +707,7 @@ class KinesisIntegrationTest {
}
body.append("]}");
- java.util.List<String> shardIds = given()
+ List<String> shardIds = given()
.header("X-Amz-Target", "Kinesis_20131202.PutRecords")
.contentType(KINESIS_CONTENT_TYPE)
.body(body.toString())
@@ -714,11 +717,11 @@ class KinesisIntegrationTest {
.body("Records.size()", equalTo(10))
.extract().jsonPath().getList("Records.ShardId", String.class);
- java.util.Set<String> distinct = new java.util.HashSet<>(shardIds);
- org.junit.jupiter.api.Assertions.assertTrue(distinct.size() >= 2,
+ Set<String> distinct = new HashSet<>(shardIds);
+ Assertions.assertTrue(distinct.size() >= 2,
"PutRecords should route 10 mixed partition keys across at least 2 shards, got: " + distinct);
for (String sid : shardIds) {
- org.junit.jupiter.api.Assertions.assertTrue(sid != null && sid.startsWith("shardId-"),
+ Assertions.assertTrue(sid != null && sid.startsWith("shardId-"),
"Each record must report a real shardId, got: " + sid);
}
}
@@ -1227,7 +1230,7 @@ class KinesisIntegrationTest {
.when().post("/")
.then().statusCode(200);
- String oversized = java.util.Base64.getEncoder().encodeToString(new byte[1_048_577]);
+ String oversized = Base64.getEncoder().encodeToString(new byte[1_048_577]);
given()
.header("X-Amz-Target", "Kinesis_20131202.PutRecord")
.contentType(KINESIS_CONTENT_TYPE)
@@ -1250,7 +1253,7 @@ class KinesisIntegrationTest {
.when().post("/")
.then().statusCode(200);
- String oversized = java.util.Base64.getEncoder().encodeToString(new byte[1_048_577]);
+ String oversized = Base64.getEncoder().encodeToString(new byte[1_048_577]);
given()
.header("X-Amz-Target", "Kinesis_20131202.PutRecords")
.contentType(KINESIS_CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisServiceTest.java
index b085b16757..0f422ca6a6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kinesis/KinesisServiceTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -363,7 +364,7 @@ class KinesisServiceTest {
while (!done.get()) {
// A fresh snapshot of the live list, exactly as a lock-free DescribeStream/ListShards sees it.
List<KinesisShard> snapshot = new ArrayList<>(stream.getShards());
- Map<String, Integer> splitChildCount = new java.util.HashMap<>();
+ Map<String, Integer> splitChildCount = new HashMap<>();
for (KinesisShard s : snapshot) {
// Split children carry a parent but no adjacent-parent (that marks a merge child).
if (s.getParentShardId() != null && s.getAdjacentParentShardId() == null) {
@@ -583,7 +584,7 @@ class KinesisServiceTest {
assertEquals(closedParent.getHashKeyRange().startingHashKey(), first.getHashKeyRange().startingHashKey());
assertEquals(closedParent.getHashKeyRange().endingHashKey(), second.getHashKeyRange().endingHashKey());
assertEquals(
- new java.math.BigInteger(first.getHashKeyRange().endingHashKey()).add(java.math.BigInteger.ONE).toString(),
+ new BigInteger(first.getHashKeyRange().endingHashKey()).add(BigInteger.ONE).toString(),
second.getHashKeyRange().startingHashKey(),
"children must tile the parent's range with no gap or overlap");
}
@@ -594,7 +595,7 @@ class KinesisServiceTest {
kinesisService.createStream("my-stream", 4, REGION);
KinesisStream before = kinesisService.describeStream("my-stream", REGION);
List<KinesisShard> originalOpenShards = before.getShards().stream()
- .sorted(Comparator.comparing(s -> new java.math.BigInteger(s.getHashKeyRange().startingHashKey())))
+ .sorted(Comparator.comparing(s -> new BigInteger(s.getHashKeyRange().startingHashKey())))
.toList();
kinesisService.updateShardCount("my-stream", 2, "UNIFORM_SCALING", REGION);
@@ -731,7 +732,7 @@ class KinesisServiceTest {
// Hand-crafted 5-part iterator in the pre-bump format.
String raw = "my-stream|shardId-000000000000|TRIM_HORIZON||0";
- String legacyIterator = java.util.Base64.getEncoder()
+ String legacyIterator = Base64.getEncoder()
.encodeToString(raw.getBytes(StandardCharsets.UTF_8));
Map<String, Object> result = kinesisService.getRecords(legacyIterator, null, REGION);
diff --git a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2IntegrationTest.java
index 827bc37746..15116bf740 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2IntegrationTest.java
@@ -6,6 +6,8 @@ import io.restassured.path.json.config.JsonPathConfig;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@@ -352,7 +354,7 @@ class KinesisAnalyticsV2IntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("SnapshotSummaries", equalTo(java.util.List.of()));
+ .body("SnapshotSummaries", equalTo(List.of()));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2ServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2ServiceTest.java
index b7d6b5e8cc..477cea4188 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2ServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/KinesisAnalyticsV2ServiceTest.java
@@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
+import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -210,7 +211,7 @@ class KinesisAnalyticsV2ServiceTest {
void deleteApplicationRejectsWrongTimestamp() {
create("demo");
assertThrows(AwsException.class,
- () -> service.deleteApplication("demo", java.time.Instant.ofEpochSecond(1)));
+ () -> service.deleteApplication("demo", Instant.ofEpochSecond(1)));
}
@Test
@@ -497,7 +498,7 @@ class KinesisAnalyticsV2ServiceTest {
createRunningWithCode("demo");
service.createApplicationSnapshot("demo", "snap1");
assertThrows(AwsException.class, () -> service.deleteApplicationSnapshot(
- "demo", "snap1", java.time.Instant.ofEpochSecond(1)));
+ "demo", "snap1", Instant.ofEpochSecond(1)));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/container/FlinkContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/container/FlinkContainerManagerTest.java
index a6a3c86de9..834e63b799 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/container/FlinkContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kinesisanalytics/container/FlinkContainerManagerTest.java
@@ -34,11 +34,13 @@ import org.mockito.Mockito;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;
+import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -269,7 +271,7 @@ class FlinkContainerManagerTest {
"FLINK-2_3", "arn:aws:iam::000000000000:role/x", "STREAMING");
app.setApplicationVersionId(2L);
- String config = new String(manager.msfStyleLog4j2Config(app), java.nio.charset.StandardCharsets.UTF_8);
+ String config = new String(manager.msfStyleLog4j2Config(app), StandardCharsets.UTF_8);
assertTrue(config.contains(
"\"applicationARN\":\"%enc{arn:aws:kinesisanalytics:us-east-1:000000000000:application/demo}{JSON}\""));
@@ -291,13 +293,13 @@ class FlinkContainerManagerTest {
"FLINK-2_3", "arn:aws:iam::000000000000:role/x", "STREAMING");
app.setApplicationVersionId(1L);
- String config = new String(manager.msfStyleLog4j2Config(app), java.nio.charset.StandardCharsets.UTF_8);
+ String config = new String(manager.msfStyleLog4j2Config(app), StandardCharsets.UTF_8);
assertTrue(config.contains(
"\"applicationARN\":\"%enc{arn:aws:kinesisanalytics:us-east-1:000000000000:application/100%%-\\\\-{env:PATH}-owned}{JSON}\""));
- java.util.Properties parsed = new java.util.Properties();
- parsed.load(new java.io.ByteArrayInputStream(config.getBytes(java.nio.charset.StandardCharsets.UTF_8)));
+ Properties parsed = new Properties();
+ parsed.load(new ByteArrayInputStream(config.getBytes(StandardCharsets.UTF_8)));
String loadedPattern = parsed.getProperty("appender.console.layout.pattern");
assertTrue(loadedPattern.contains(
"\"applicationARN\":\"%enc{arn:aws:kinesisanalytics:us-east-1:000000000000:application/100%%-\\-{env:PATH}-owned}{JSON}\""));
diff --git a/src/test/java/io/github/hectorvent/floci/services/kms/KmsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/kms/KmsIntegrationTest.java
index 4be44583f3..1d708e3f53 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kms/KmsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kms/KmsIntegrationTest.java
@@ -4,6 +4,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
+import io.restassured.response.ValidatableResponse;
import jakarta.inject.Inject;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -18,6 +19,8 @@ import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
@@ -3289,8 +3292,8 @@ class KmsIntegrationTest {
private static byte[] sha512(byte[] value) {
try {
- return java.security.MessageDigest.getInstance("SHA-512").digest(value);
- } catch (java.security.NoSuchAlgorithmException e) {
+ return MessageDigest.getInstance("SHA-512").digest(value);
+ } catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
}
@@ -3354,11 +3357,11 @@ class KmsIntegrationTest {
.extract().path("PublicKey");
PublicKey publicKey = KeyFactory.getInstance("RSA").generatePublic(
- new java.security.spec.X509EncodedKeySpec(Base64.getDecoder().decode(publicKeyBase64)));
+ new X509EncodedKeySpec(Base64.getDecoder().decode(publicKeyBase64)));
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPPadding");
- cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, publicKey, new javax.crypto.spec.OAEPParameterSpec(
- "SHA-256", "MGF1", java.security.spec.MGF1ParameterSpec.SHA256,
- javax.crypto.spec.PSource.PSpecified.DEFAULT));
+ cipher.init(Cipher.ENCRYPT_MODE, publicKey, new OAEPParameterSpec(
+ "SHA-256", "MGF1", MGF1ParameterSpec.SHA256,
+ PSource.PSpecified.DEFAULT));
byte[] localCiphertext = cipher.doFinal("secret payload".getBytes(StandardCharsets.UTF_8));
given()
@@ -3727,7 +3730,7 @@ class KmsIntegrationTest {
.extract().path("KeyMetadata.KeyId");
}
- private io.restassured.response.ValidatableResponse describeKey(String keyId) {
+ private ValidatableResponse describeKey(String keyId) {
return given()
.header("X-Amz-Target", "TrentService.DescribeKey")
.contentType(KMS_CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/kms/KmsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/kms/KmsServiceTest.java
index ca5ee4bc8d..87a6b3fcec 100644
--- a/src/test/java/io/github/hectorvent/floci/services/kms/KmsServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/kms/KmsServiceTest.java
@@ -1256,8 +1256,8 @@ class KmsServiceTest {
PublicKey publicKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(
Base64.getDecoder().decode(kmsService.getPublicKey(key.getKeyId(), REGION).getPublicKeyEncoded())));
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPPadding");
- cipher.init(javax.crypto.Cipher.ENCRYPT_MODE, publicKey, new javax.crypto.spec.OAEPParameterSpec(
- "SHA-256", "MGF1", MGF1ParameterSpec.SHA256, javax.crypto.spec.PSource.PSpecified.DEFAULT));
+ cipher.init(Cipher.ENCRYPT_MODE, publicKey, new OAEPParameterSpec(
+ "SHA-256", "MGF1", MGF1ParameterSpec.SHA256, PSource.PSpecified.DEFAULT));
byte[] localCiphertext = cipher.doFinal(PLAINTEXT);
KmsService.DecryptResult decrypted = kmsService.decryptAndResolveKey(
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaAccountScopedCodeTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaAccountScopedCodeTest.java
index 1f1c85d1a5..af216de49c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaAccountScopedCodeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaAccountScopedCodeTest.java
@@ -13,6 +13,7 @@ import java.io.ByteArrayOutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
+import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.zip.ZipEntry;
@@ -278,7 +279,7 @@ class LambdaAccountScopedCodeTest {
}
private Map<String, Object> zipRequest(String name, String handlerSource) throws Exception {
- return new java.util.HashMap<>(Map.of(
+ return new HashMap<>(Map.of(
"FunctionName", name,
"Runtime", "nodejs20.x",
"Role", "arn:aws:iam::000000000000:role/test-role",
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaIntegrationTest.java
index c3bd628be0..fe03d8af41 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaIntegrationTest.java
@@ -2,14 +2,18 @@ package io.github.hectorvent.floci.services.lambda;
import io.github.hectorvent.floci.core.common.Digests;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import java.io.ByteArrayOutputStream;
+import java.net.URI;
+import java.util.Arrays;
import java.util.Base64;
import java.util.List;
+import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -334,7 +338,7 @@ class LambdaIntegrationTest {
// base64 encoding) actually exceeds Jackson's former 20 MB limit
zos.putNextEntry(new ZipEntry("padding.bin"));
byte[] chunk = new byte[1024 * 1024];
- java.util.Random rng = new java.util.Random(42);
+ Random rng = new Random(42);
for (int i = 0; i < 16; i++) {
rng.nextBytes(chunk);
zos.write(chunk);
@@ -589,7 +593,7 @@ class LambdaIntegrationTest {
.extract().path("CodeSha256");
// Follow Code.Location against the same test server via its path.
- String path = java.net.URI.create(location).getRawPath();
+ String path = URI.create(location).getRawPath();
byte[] pkg = given()
.when()
.get(path)
@@ -598,13 +602,13 @@ class LambdaIntegrationTest {
.extract().asByteArray();
// Valid zip → local file header magic "PK\003\004".
- org.junit.jupiter.api.Assertions.assertTrue(pkg.length > 0, "package must not be empty");
- org.junit.jupiter.api.Assertions.assertEquals('P', pkg[0]);
- org.junit.jupiter.api.Assertions.assertEquals('K', pkg[1]);
+ Assertions.assertTrue(pkg.length > 0, "package must not be empty");
+ Assertions.assertEquals('P', pkg[0]);
+ Assertions.assertEquals('K', pkg[1]);
// Byte-exact: downloaded package hashes to the stored CodeSha256.
String downloadedSha256 = Base64.getEncoder().encodeToString(Digests.sha256(pkg));
- org.junit.jupiter.api.Assertions.assertEquals(expectedSha256, downloadedSha256,
+ Assertions.assertEquals(expectedSha256, downloadedSha256,
"downloaded package must be byte-identical to the uploaded zip");
// Redeploy overwrites in place (stable key), no stale package accumulates.
@@ -622,7 +626,7 @@ class LambdaIntegrationTest {
.then()
.statusCode(200);
byte[] pkg2 = given().when().get(path).then().statusCode(200).extract().asByteArray();
- org.junit.jupiter.api.Assertions.assertFalse(java.util.Arrays.equals(pkg, pkg2),
+ Assertions.assertFalse(Arrays.equals(pkg, pkg2),
"redeploy must replace the stored package");
// Deleting the function removes the stored package (Code.Location 404s).
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaListLayersParametersIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaListLayersParametersIntegrationTest.java
index e1283bc67a..829f9bcf64 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaListLayersParametersIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaListLayersParametersIntegrationTest.java
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.List;
import java.util.zip.ZipEntry;
@@ -264,7 +265,7 @@ class LambdaListLayersParametersIntegrationTest {
.extract().path("NextMarker");
String decoded = new String(Base64.getUrlDecoder().decode(marker),
- java.nio.charset.StandardCharsets.UTF_8);
+ StandardCharsets.UTF_8);
String spliced = LAYER_B + decoded.substring(decoded.lastIndexOf('.'));
given()
.queryParam("CompatibleRuntime", PAGE_RUNTIME)
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPermissionTagLayerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPermissionTagLayerIntegrationTest.java
index 95c964fbb7..65585a0e98 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPermissionTagLayerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPermissionTagLayerIntegrationTest.java
@@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import java.io.ByteArrayOutputStream;
+import java.util.Base64;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -44,7 +45,7 @@ class LambdaPermissionTagLayerIntegrationTest {
@Order(1)
void createFunction() throws Exception {
byte[] zip = minimalZip();
- String zipBase64 = java.util.Base64.getEncoder().encodeToString(zip);
+ String zipBase64 = Base64.getEncoder().encodeToString(zip);
given()
.contentType("application/json")
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishFlagIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishFlagIntegrationTest.java
index 93d1586cc2..77a9a3e808 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishFlagIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishFlagIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.lambda;
import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -153,7 +154,7 @@ class LambdaPublishFlagIntegrationTest {
.statusCode(200)
.extract().path("Versions.find { it.Version == '1' }.CodeSha256");
- org.junit.jupiter.api.Assertions.assertNotEquals(latestSha, versionOneSha);
+ Assertions.assertNotEquals(latestSha, versionOneSha);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionCodeSha256IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionCodeSha256IntegrationTest.java
index e68617d3ab..e1cdd4a2b6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionCodeSha256IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionCodeSha256IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.lambda;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
@@ -41,7 +42,7 @@ class LambdaPublishVersionCodeSha256IntegrationTest {
"Code": {"ZipFile": "%s"}}
""".formatted(name, zipB64("v1")))
.when().post("/2015-03-31/functions")
- .then().statusCode(org.hamcrest.Matchers.anyOf(equalTo(200), equalTo(201)));
+ .then().statusCode(Matchers.anyOf(equalTo(200), equalTo(201)));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionDedupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionDedupIntegrationTest.java
index 8f6dfedbaa..a395662740 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionDedupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaPublishVersionDedupIntegrationTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.lambda;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
@@ -38,7 +40,7 @@ class LambdaPublishVersionDedupIntegrationTest {
"Code": {"ZipFile": "%s"}}
""".formatted(name, zipB64("v1")))
.when().post("/2015-03-31/functions")
- .then().statusCode(org.hamcrest.Matchers.anyOf(equalTo(200), equalTo(201)));
+ .then().statusCode(Matchers.anyOf(equalTo(200), equalTo(201)));
}
private static String publish(String name, String bodyJson) {
@@ -53,9 +55,9 @@ class LambdaPublishVersionDedupIntegrationTest {
createFunction(fn);
String first = publish(fn, "{}");
- org.junit.jupiter.api.Assertions.assertEquals(first, publish(fn, "{}"),
+ Assertions.assertEquals(first, publish(fn, "{}"),
"an unchanged publish must return the existing version, not create a new one");
- org.junit.jupiter.api.Assertions.assertEquals(first, publish(fn, "{}"),
+ Assertions.assertEquals(first, publish(fn, "{}"),
"repeated unchanged publishes must keep returning the same version");
given().when().get("/2015-03-31/functions/" + fn + "/versions")
@@ -73,14 +75,14 @@ class LambdaPublishVersionDedupIntegrationTest {
.body("{\"ZipFile\": \"%s\"}".formatted(zipB64("v2")))
.when().put("/2015-03-31/functions/" + fn + "/code").then().statusCode(200);
String second = publish(fn, "{}");
- org.junit.jupiter.api.Assertions.assertNotEquals(first, second,
+ Assertions.assertNotEquals(first, second,
"a code change must still produce a new version");
// Configuration counts too, since a version snapshots configuration as well as code.
given().contentType("application/json").body("{\"Timeout\": 42}")
.when().put("/2015-03-31/functions/" + fn + "/configuration").then().statusCode(200);
String third = publish(fn, "{}");
- org.junit.jupiter.api.Assertions.assertNotEquals(second, third,
+ Assertions.assertNotEquals(second, third,
"a configuration change must still produce a new version");
}
@@ -96,9 +98,9 @@ class LambdaPublishVersionDedupIntegrationTest {
String b = publish(fn, "{\"Description\": \"B\"}");
String a2 = publish(fn, "{\"Description\": \"A\"}");
- org.junit.jupiter.api.Assertions.assertNotEquals(a1, b);
- org.junit.jupiter.api.Assertions.assertNotEquals(a1, a2,
+ Assertions.assertNotEquals(a1, b);
+ Assertions.assertNotEquals(a1, a2,
"returning to an earlier description must publish, not match the older version");
- org.junit.jupiter.api.Assertions.assertNotEquals(b, a2);
+ Assertions.assertNotEquals(b, a2);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaQualifiedReadIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaQualifiedReadIntegrationTest.java
index a9b5f9cb73..bbac0b2bf0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaQualifiedReadIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaQualifiedReadIntegrationTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.lambda;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matcher;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
@@ -48,8 +50,8 @@ class LambdaQualifiedReadIntegrationTest {
return name;
}
- private static org.hamcrest.Matcher<Integer> anyOf200Or201() {
- return org.hamcrest.Matchers.anyOf(equalTo(200), equalTo(201));
+ private static Matcher<Integer> anyOf200Or201() {
+ return Matchers.anyOf(equalTo(200), equalTo(201));
}
@Test
@@ -143,7 +145,7 @@ class LambdaQualifiedReadIntegrationTest {
"RoutingConfig": {"AdditionalVersionWeights": {"2": 0.5}}}
""")
.when().post("/2015-03-31/functions/" + fn + "/aliases")
- .then().statusCode(org.hamcrest.Matchers.anyOf(equalTo(200), equalTo(201)));
+ .then().statusCode(Matchers.anyOf(equalTo(200), equalTo(201)));
// Repeat enough that a random pick would almost certainly show version 2 at least once.
for (int i = 0; i < 20; i++) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaServiceTest.java
index 09d0b54a94..e5e1e17039 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaServiceTest.java
@@ -43,7 +43,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiFunction;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
@@ -78,7 +80,7 @@ class LambdaServiceTest {
}
private Map<String, Object> baseRequest(String name) {
- return new java.util.HashMap<>(Map.of(
+ return new HashMap<>(Map.of(
"FunctionName", name,
"Runtime", "nodejs20.x",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -324,7 +326,7 @@ class LambdaServiceTest {
@Test
void updateFunctionConfigurationRejectsExplicitNullHandler() {
service.createFunction(REGION, baseRequest("update-handler-null-function"));
- Map<String, Object> request = new java.util.HashMap<>();
+ Map<String, Object> request = new HashMap<>();
request.put("Handler", null);
AwsException error = assertThrows(AwsException.class,
@@ -554,7 +556,7 @@ class LambdaServiceTest {
@Test
void createImageFunctionSucceedsWithoutHandler() {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "image-fn",
"Role", "arn:aws:iam::000000000000:role/test-role",
"PackageType", "Image",
@@ -568,7 +570,7 @@ class LambdaServiceTest {
@Test
void createImageFunctionSucceedsWithHandler() {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "image-fn-with-handler",
"Role", "arn:aws:iam::000000000000:role/test-role",
"PackageType", "Image",
@@ -617,7 +619,7 @@ class LambdaServiceTest {
@Test
void createFunctionWithSubdirectoryHandler() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "subdir-handler-fn",
"Runtime", "nodejs20.x",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -630,7 +632,7 @@ class LambdaServiceTest {
@Test
void createFunctionWithRootHandler() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "root-handler-fn",
"Runtime", "nodejs20.x",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -643,7 +645,7 @@ class LambdaServiceTest {
@Test
void createFunctionWithNestedPythonModuleHandler() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "nested-python-handler-fn",
"Runtime", "python3.11",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -656,7 +658,7 @@ class LambdaServiceTest {
@Test
void createFunctionWithNestedPythonPackageHandler() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "nested-python-package-handler-fn",
"Runtime", "python3.11",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -669,7 +671,7 @@ class LambdaServiceTest {
@Test
void createFunctionDoesNotValidateHandlerAtDeployTime() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "missing-handler-fn",
"Runtime", "nodejs20.x",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -682,7 +684,7 @@ class LambdaServiceTest {
@Test
void updateFunctionCodeDoesNotValidateHandlerAtDeployTime() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "missing-nested-python-handler-fn",
"Runtime", "python3.11",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -698,7 +700,7 @@ class LambdaServiceTest {
@Test
void createDotnetFunctionWithAssemblyHandler() throws Exception {
- Map<String, Object> req = new java.util.HashMap<>(Map.of(
+ Map<String, Object> req = new HashMap<>(Map.of(
"FunctionName", "dotnet-fn",
"Runtime", "dotnet6",
"Role", "arn:aws:iam::000000000000:role/test-role",
@@ -890,7 +892,7 @@ class LambdaServiceTest {
LambdaFunctionStore store = new LambdaFunctionStore(new InMemoryStorage<>());
// Copy the two persisted functions into the new store to emulate a
// restart with the same disk state.
- for (LambdaFunction fn : new java.util.ArrayList<>(
+ for (LambdaFunction fn : new ArrayList<>(
service.listFunctions(REGION))) {
store.save(REGION, fn);
}
@@ -916,17 +918,17 @@ class LambdaServiceTest {
// Defaults: regionLimit=1000, unreservedMin=100. Each Put asks for
// 500; together they would leave 0 unreserved.
- java.util.concurrent.ExecutorService pool = java.util.concurrent.Executors.newFixedThreadPool(2);
- java.util.concurrent.CountDownLatch start = new java.util.concurrent.CountDownLatch(1);
+ ExecutorService pool = Executors.newFixedThreadPool(2);
+ CountDownLatch start = new CountDownLatch(1);
try {
- java.util.concurrent.Future<Throwable> fA = pool.submit(() -> {
+ Future<Throwable> fA = pool.submit(() -> {
start.await();
try {
service.putFunctionConcurrency(REGION, "multi-a", 500);
return null;
} catch (Throwable t) { return t; }
});
- java.util.concurrent.Future<Throwable> fB = pool.submit(() -> {
+ Future<Throwable> fB = pool.submit(() -> {
start.await();
try {
service.putFunctionConcurrency(REGION, "multi-b", 500);
@@ -1367,18 +1369,18 @@ class LambdaServiceTest {
service.createFunction(REGION, baseRequest("race-fn"));
int iterations = 50;
- java.util.concurrent.ExecutorService pool = java.util.concurrent.Executors.newFixedThreadPool(2);
+ ExecutorService pool = Executors.newFixedThreadPool(2);
try {
for (int i = 0; i < iterations; i++) {
int a = 100 + i;
int b = 200 + i;
- java.util.concurrent.CountDownLatch start = new java.util.concurrent.CountDownLatch(1);
- java.util.concurrent.Future<Integer> fA = pool.submit(() -> {
+ CountDownLatch start = new CountDownLatch(1);
+ Future<Integer> fA = pool.submit(() -> {
start.await();
return service.putFunctionConcurrency(REGION, "race-fn", a)
.getReservedConcurrentExecutions();
});
- java.util.concurrent.Future<Integer> fB = pool.submit(() -> {
+ Future<Integer> fB = pool.submit(() -> {
start.await();
return service.putFunctionConcurrency(REGION, "race-fn", b)
.getReservedConcurrentExecutions();
@@ -1416,7 +1418,7 @@ class LambdaServiceTest {
int mutationCount = 16;
CountDownLatch start = new CountDownLatch(1);
ExecutorService pool = Executors.newFixedThreadPool(8);
- List<Future<?>> futures = new java.util.ArrayList<>();
+ List<Future<?>> futures = new ArrayList<>();
Set<String> expectedStatementIds = new HashSet<>();
expectedStatementIds.add("baseline");
@@ -1471,7 +1473,7 @@ class LambdaServiceTest {
List<Map<String, Object>> statements = (List<Map<String, Object>>) policy.get("Statement");
Set<String> actualStatementIds = statements.stream()
.map(statement -> (String) statement.get("Sid"))
- .collect(java.util.stream.Collectors.toSet());
+ .collect(Collectors.toSet());
assertEquals(expectedStatementIds, actualStatementIds);
}
@@ -1504,17 +1506,17 @@ class LambdaServiceTest {
});
try {
holder.start();
- assertTrue(acquired.await(2, java.util.concurrent.TimeUnit.SECONDS));
+ assertTrue(acquired.await(2, TimeUnit.SECONDS));
Future<LambdaFunction> publishFuture = pool.submit(
() -> service.publishVersion(REGION, "lock-race-fn", null));
- assertThrows(java.util.concurrent.TimeoutException.class,
- () -> publishFuture.get(200, java.util.concurrent.TimeUnit.MILLISECONDS),
+ assertThrows(TimeoutException.class,
+ () -> publishFuture.get(200, TimeUnit.MILLISECONDS),
"publishVersion must block while another operation holds this function's lock");
release.countDown();
holder.join();
- assertNotNull(publishFuture.get(2, java.util.concurrent.TimeUnit.SECONDS));
+ assertNotNull(publishFuture.get(2, TimeUnit.SECONDS));
} finally {
release.countDown();
pool.shutdownNow();
@@ -1934,7 +1936,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_success() {
service.createFunction(REGION, baseRequest("kafka-fn"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn",
"Topics", List.of("my-topic"),
"SelfManagedEventSource", Map.of(
@@ -1973,7 +1975,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_missingTopics_throws() {
service.createFunction(REGION, baseRequest("kafka-fn-missing-topics"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn-missing-topics",
"SelfManagedEventSource", Map.of(
"Endpoints", Map.of(
@@ -1993,7 +1995,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_missingBootstrapServers_throws() {
service.createFunction(REGION, baseRequest("kafka-fn-missing-servers"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn-missing-servers",
"Topics", List.of("my-topic"),
"SelfManagedEventSource", Map.of(
@@ -2012,7 +2014,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_atTimestamp_succeeds() {
service.createFunction(REGION, baseRequest("kafka-fn-at-timestamp"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn-at-timestamp",
"Topics", List.of("my-topic"),
"SelfManagedEventSource", Map.of(
@@ -2034,7 +2036,7 @@ class LambdaServiceTest {
void createEventSourceMapping_dynamoDb_atTimestamp_throws() {
service.createFunction(REGION, baseRequest("dynamo-fn-at-timestamp"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "dynamo-fn-at-timestamp",
"EventSourceArn", "arn:aws:dynamodb:us-east-1:000000000000:table/my-table/stream/2026-01-01T00:00:00.000",
"StartingPosition", "AT_TIMESTAMP",
@@ -2052,7 +2054,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_crossRegionFunctionArn_throws() {
service.createFunction(REGION, baseRequest("kafka-fn-cross-region"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "arn:aws:lambda:us-west-2:000000000000:function:kafka-fn-cross-region",
"Topics", List.of("my-topic"),
"SelfManagedEventSource", Map.of(
@@ -2073,7 +2075,7 @@ class LambdaServiceTest {
void createEventSourceMapping_mixedSources_throws() {
service.createFunction(REGION, baseRequest("kafka-fn-mixed"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn-mixed",
"EventSourceArn", "arn:aws:sqs:us-east-1:000000000000:my-queue",
"Topics", List.of("my-topic"),
@@ -2095,7 +2097,7 @@ class LambdaServiceTest {
void createEventSourceMapping_selfManagedKafka_malformedTopics_throws() {
service.createFunction(REGION, baseRequest("kafka-fn-malformed-topics"));
- Map<String, Object> request = new java.util.HashMap<>(Map.of(
+ Map<String, Object> request = new HashMap<>(Map.of(
"FunctionName", "kafka-fn-malformed-topics",
"Topics", List.of(123),
"SelfManagedEventSource", Map.of(
@@ -2779,7 +2781,7 @@ class LambdaServiceTest {
*/
private void assertUpdaterWaitsForTheLock(
String functionName,
- java.util.function.BiFunction<LambdaService, String, LambdaFunction> updater) throws Exception {
+ BiFunction<LambdaService, String, LambdaFunction> updater) throws Exception {
LambdaFunction fn = service.createFunction(REGION, baseRequest(functionName));
Object lock = service.lockForConcurrencyOp(fn.getFunctionArn());
@@ -2798,16 +2800,16 @@ class LambdaServiceTest {
});
try {
holder.start();
- assertTrue(acquired.await(2, java.util.concurrent.TimeUnit.SECONDS));
+ assertTrue(acquired.await(2, TimeUnit.SECONDS));
Future<LambdaFunction> updateFuture = pool.submit(() -> updater.apply(service, functionName));
- assertThrows(java.util.concurrent.TimeoutException.class,
- () -> updateFuture.get(200, java.util.concurrent.TimeUnit.MILLISECONDS),
+ assertThrows(TimeoutException.class,
+ () -> updateFuture.get(200, TimeUnit.MILLISECONDS),
"the updater must block while another operation holds this function's lock");
release.countDown();
holder.join();
- assertNotNull(updateFuture.get(5, java.util.concurrent.TimeUnit.SECONDS));
+ assertNotNull(updateFuture.get(5, TimeUnit.SECONDS));
} finally {
release.countDown();
pool.shutdownNow();
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaStructureSerializationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaStructureSerializationIntegrationTest.java
index cc2a0ba58b..edc2e90e3c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaStructureSerializationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/LambdaStructureSerializationIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.lambda;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -22,7 +23,7 @@ class LambdaStructureSerializationIntegrationTest {
@Test
void createFunctionRejectsScalarStructureMembers() {
- List<String> members = new java.util.ArrayList<>(FUNCTION_STRUCTURE_MEMBERS);
+ List<String> members = new ArrayList<>(FUNCTION_STRUCTURE_MEMBERS);
members.add("Code");
for (String member : members) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncherCodeVolumeReuseTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncherCodeVolumeReuseTest.java
index 6366c7fd70..9bf32e1e87 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncherCodeVolumeReuseTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/launcher/ContainerLauncherCodeVolumeReuseTest.java
@@ -18,7 +18,11 @@ import org.junit.jupiter.api.io.TempDir;
import org.mockito.Answers;
import org.mockito.ArgumentCaptor;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.nio.file.Files;
+import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@@ -307,7 +311,7 @@ class ContainerLauncherCodeVolumeReuseTest {
assertEquals("keep", Files.readString(symlinkTarget),
"writing a completion marker must not follow and truncate a pre-existing symlink");
- assertTrue(Files.isRegularFile(marker, java.nio.file.LinkOption.NOFOLLOW_LINKS),
+ assertTrue(Files.isRegularFile(marker, LinkOption.NOFOLLOW_LINKS),
"successful population should replace the symlink with a real marker file");
assertFalse(Files.isSymbolicLink(marker));
}
@@ -316,7 +320,7 @@ class ContainerLauncherCodeVolumeReuseTest {
void partialTarProducerFailureIsStrictOnlyForCodeVolumePopulation() throws Exception {
DockerClient dockerClient = mock(DockerClient.class);
CopyArchiveToContainerCmd copyCommand = mock(CopyArchiveToContainerCmd.class);
- java.io.InputStream[] capturedInput = {null};
+ InputStream[] capturedInput = {null};
when(dockerClient.copyArchiveToContainerCmd("container-123")).thenReturn(copyCommand);
when(copyCommand.withRemotePath("/var/task")).thenReturn(copyCommand);
when(copyCommand.withTarInputStream(any()))
@@ -325,7 +329,7 @@ class ContainerLauncherCodeVolumeReuseTest {
return copyCommand;
});
doAnswer(invocation -> {
- capturedInput[0].transferTo(java.io.OutputStream.nullOutputStream());
+ capturedInput[0].transferTo(OutputStream.nullOutputStream());
return null;
}).when(copyCommand).exec();
@@ -333,7 +337,7 @@ class ContainerLauncherCodeVolumeReuseTest {
dockerClient, "container-123", tempDir, "/var/task", "orders",
(sourceDir, out) -> {
out.write(new byte[]{1, 2, 3});
- throw new java.io.IOException("ordinary copy producer closed");
+ throw new IOException("ordinary copy producer closed");
}));
RuntimeException failure = assertThrows(RuntimeException.class,
@@ -341,7 +345,7 @@ class ContainerLauncherCodeVolumeReuseTest {
dockerClient, "container-123", tempDir, "/var/task", "orders",
(sourceDir, out) -> {
out.write(new byte[]{1, 2, 3});
- throw new java.io.IOException("producer failed after partial archive");
+ throw new IOException("producer failed after partial archive");
}));
assertTrue(failure.getMessage().contains("Failed to copy directory"), failure.getMessage());
diff --git a/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java b/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java
index 6c2cbd3bd5..226d11de17 100644
--- a/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/lambda/runtime/RuntimeApiServerTest.java
@@ -4,6 +4,7 @@ import io.github.hectorvent.floci.services.lambda.model.InvokeResult;
import io.github.hectorvent.floci.services.lambda.model.PendingInvocation;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.RoutingContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -19,7 +20,9 @@ import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
+import java.time.Duration;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
@@ -28,6 +31,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Consumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -52,7 +57,7 @@ class RuntimeApiServerTest {
server = new RuntimeApiServer(vertx, port);
server.start().get(5, TimeUnit.SECONDS);
httpClient = HttpClient.newBuilder()
- .connectTimeout(java.time.Duration.ofSeconds(5))
+ .connectTimeout(Duration.ofSeconds(5))
.build();
scheduler = Executors.newSingleThreadScheduledExecutor();
}
@@ -573,12 +578,12 @@ class RuntimeApiServerTest {
* sendInvocation subsequently ran.
*/
private void installGatedServerWithDispatchObservation(
- java.util.function.Consumer<io.vertx.ext.web.RoutingContext> afterEnqueueLockReleased,
- java.util.function.Consumer<String> onSendInvocation) throws Exception {
+ Consumer<RoutingContext> afterEnqueueLockReleased,
+ Consumer<String> onSendInvocation) throws Exception {
server.stop().get(5, TimeUnit.SECONDS);
port = findFreePort();
server = new RuntimeApiServer(vertx, port) {
- @Override protected void afterEnqueueDispatchLockReleased(io.vertx.ext.web.RoutingContext waitingCtx) {
+ @Override protected void afterEnqueueDispatchLockReleased(RoutingContext waitingCtx) {
afterEnqueueLockReleased.accept(waitingCtx);
}
@Override protected void beforeSendInvocationWrite(String requestId) {
@@ -747,8 +752,8 @@ class RuntimeApiServerTest {
// A disconnect between the two reads made neither branch fire and stranded
// the invocation in inFlight until the function deadline. Force that
// interleaving by ending the ctx from afterEnqueueDispatchLockReleased.
- java.util.concurrent.atomic.AtomicInteger sendInvocationCalls =
- new java.util.concurrent.atomic.AtomicInteger();
+ AtomicInteger sendInvocationCalls =
+ new AtomicInteger();
installGatedServerWithDispatchObservation(
waitingCtx -> {
if (!waitingCtx.response().ended()) {
@@ -784,16 +789,16 @@ class RuntimeApiServerTest {
// .end() flush strands the invocation in inFlight. Force it by ending the
// parked ctx from beforeSendInvocationWrite; assert onFailure requeues +
// clears inFlight.
- java.util.concurrent.atomic.AtomicReference<io.vertx.ext.web.RoutingContext> parkedCtx =
- new java.util.concurrent.atomic.AtomicReference<>();
+ AtomicReference<RoutingContext> parkedCtx =
+ new AtomicReference<>();
server.stop().get(5, TimeUnit.SECONDS);
port = findFreePort();
server = new RuntimeApiServer(vertx, port) {
- @Override protected void afterEnqueueDispatchLockReleased(io.vertx.ext.web.RoutingContext waitingCtx) {
+ @Override protected void afterEnqueueDispatchLockReleased(RoutingContext waitingCtx) {
parkedCtx.set(waitingCtx);
}
@Override protected void beforeSendInvocationWrite(String requestId) {
- io.vertx.ext.web.RoutingContext ctx = parkedCtx.get();
+ RoutingContext ctx = parkedCtx.get();
if (ctx != null && !ctx.response().ended()) {
ctx.response().setStatusCode(500).end();
}
@@ -910,7 +915,7 @@ class RuntimeApiServerTest {
// request-line get through, proving the listener is up.
HttpRequest probe = HttpRequest.newBuilder()
.uri(URI.create("http://localhost:" + port + "/2018-06-01/runtime/invocation/next"))
- .timeout(java.time.Duration.ofMillis(500))
+ .timeout(Duration.ofMillis(500))
.GET()
.build();
CompletableFuture<HttpResponse<String>> probeFuture =
@@ -1328,21 +1333,21 @@ class RuntimeApiServerTest {
@Test
@Timeout(15)
void notifyExtensionsOfInvoke_requeuedOnWriteFailure_deliversInvokeExactlyOnce() throws Exception {
- java.util.concurrent.atomic.AtomicInteger sendInvocationCalls =
- new java.util.concurrent.atomic.AtomicInteger();
- java.util.concurrent.atomic.AtomicReference<io.vertx.ext.web.RoutingContext> parkedCtx =
- new java.util.concurrent.atomic.AtomicReference<>();
+ AtomicInteger sendInvocationCalls =
+ new AtomicInteger();
+ AtomicReference<RoutingContext> parkedCtx =
+ new AtomicReference<>();
server.stop().get(5, TimeUnit.SECONDS);
port = findFreePort();
server = new RuntimeApiServer(vertx, port) {
- @Override protected void afterEnqueueDispatchLockReleased(io.vertx.ext.web.RoutingContext waitingCtx) {
+ @Override protected void afterEnqueueDispatchLockReleased(RoutingContext waitingCtx) {
parkedCtx.set(waitingCtx);
}
@Override protected void beforeSendInvocationWrite(String requestId) {
if (sendInvocationCalls.incrementAndGet() == 1) {
// Simulate the client disconnecting between dispatch commitment and the
// write landing, forcing sendInvocation()'s write to fail.
- io.vertx.ext.web.RoutingContext ctx = parkedCtx.get();
+ RoutingContext ctx = parkedCtx.get();
if (ctx != null && !ctx.response().ended()) {
ctx.response().setStatusCode(500).end();
}
@@ -1729,7 +1734,7 @@ class RuntimeApiServerTest {
HttpResponse<String> next = httpClient.send(HttpRequest.newBuilder()
.uri(URI.create("http://localhost:" + port + "/2018-06-01/runtime/invocation/next"))
- .timeout(java.time.Duration.ofSeconds(5))
+ .timeout(Duration.ofSeconds(5))
.GET().build(),
HttpResponse.BodyHandlers.ofString());
assertEquals(204, next.statusCode(),
@@ -1910,7 +1915,7 @@ class RuntimeApiServerTest {
HttpResponse<String> response = httpClient.send(HttpRequest.newBuilder()
.uri(URI.create("http://localhost:" + port + "/2020-01-01/extension/event/next"))
.header("Lambda-Extension-Identifier", survivorId)
- .timeout(java.time.Duration.ofSeconds(5))
+ .timeout(Duration.ofSeconds(5))
.GET().build(),
HttpResponse.BodyHandlers.ofString());
@@ -1976,13 +1981,13 @@ class RuntimeApiServerTest {
@Timeout(60)
void extensionShutdown_racedAgainstStop_isNeverOrphaned() throws Exception {
int iterations = 500;
- java.util.concurrent.atomic.AtomicInteger totalDelivered = new java.util.concurrent.atomic.AtomicInteger();
+ AtomicInteger totalDelivered = new AtomicInteger();
for (int i = 0; i < iterations; i++) {
// A fresh client per iteration — the port may be reused from an earlier iteration, and
// a shared client's connection pool could otherwise hand back a stale pooled
// connection to that iteration's now-closed server.
- HttpClient client = HttpClient.newBuilder().connectTimeout(java.time.Duration.ofSeconds(5)).build();
+ HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).build();
int freshPort = findFreePort();
RuntimeApiServer freshServer = new RuntimeApiServer(vertx, freshPort);
freshServer.start().get(5, TimeUnit.SECONDS);
@@ -2048,7 +2053,7 @@ class RuntimeApiServerTest {
@Timeout(60)
void enqueueRacedAgainstStop_alwaysCompletesResultFuture() throws Exception {
int iterations = 500;
- java.util.concurrent.ThreadLocalRandom random = java.util.concurrent.ThreadLocalRandom.current();
+ ThreadLocalRandom random = ThreadLocalRandom.current();
for (int i = 0; i < iterations; i++) {
int freshPort = findFreePort();
@@ -2094,7 +2099,7 @@ class RuntimeApiServerTest {
int iterations = 300;
for (int i = 0; i < iterations; i++) {
- HttpClient client = HttpClient.newBuilder().connectTimeout(java.time.Duration.ofSeconds(5)).build();
+ HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).build();
int freshPort = findFreePort();
RuntimeApiServer freshServer = new RuntimeApiServer(vertx, freshPort);
freshServer.start().get(5, TimeUnit.SECONDS);
@@ -2143,7 +2148,7 @@ class RuntimeApiServerTest {
int iterations = 300;
for (int i = 0; i < iterations; i++) {
- HttpClient client = HttpClient.newBuilder().connectTimeout(java.time.Duration.ofSeconds(5)).build();
+ HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).build();
int freshPort = findFreePort();
RuntimeApiServer freshServer = new RuntimeApiServer(vertx, freshPort);
freshServer.start().get(5, TimeUnit.SECONDS);
@@ -2224,7 +2229,7 @@ class RuntimeApiServerTest {
private String registerExtensionOn(HttpClient client, int targetPort, String name, String... events)
throws Exception {
- String eventsJson = String.join(",", java.util.Arrays.stream(events).map(e -> "\"" + e + "\"").toList());
+ String eventsJson = String.join(",", Arrays.stream(events).map(e -> "\"" + e + "\"").toList());
HttpResponse<String> response = client.send(HttpRequest.newBuilder()
.uri(URI.create("http://localhost:" + targetPort + "/2020-01-01/extension/register"))
.header("Lambda-Extension-Name", name)
@@ -2273,7 +2278,7 @@ class RuntimeApiServerTest {
}
private String registerExtension(String name, String... events) throws Exception {
- String eventsJson = String.join(",", java.util.Arrays.stream(events).map(e -> "\"" + e + "\"").toList());
+ String eventsJson = String.join(",", Arrays.stream(events).map(e -> "\"" + e + "\"").toList());
HttpResponse<String> response = httpClient.send(HttpRequest.newBuilder()
.uri(URI.create("http://localhost:" + port + "/2020-01-01/extension/register"))
.header("Lambda-Extension-Name", name)
diff --git a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceAgreementControllerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceAgreementControllerIntegrationTest.java
index 8602b768e4..c14e5c1383 100644
--- a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceAgreementControllerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceAgreementControllerIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.marketplace;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -85,7 +86,7 @@ class MarketplaceAgreementControllerIntegrationTest {
.statusCode(400);
}
- private static io.restassured.response.ValidatableResponse rpc(String action, String body) {
+ private static ValidatableResponse rpc(String action, String body) {
return given()
.contentType("application/x-amz-json-1.0")
.header("Authorization", auth())
diff --git a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentIntegrationTest.java
index 04dc7c3673..1253a5a239 100644
--- a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceDeploymentIntegrationTest.java
@@ -6,6 +6,9 @@ import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
@@ -63,7 +66,7 @@ class MarketplaceDeploymentIntegrationTest {
}
private static String encode(String value) {
- return java.net.URLEncoder.encode(value, java.nio.charset.StandardCharsets.UTF_8);
+ return URLEncoder.encode(value, StandardCharsets.UTF_8);
}
private static String auth() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceMeteringIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceMeteringIntegrationTest.java
index cc0be35ff1..080d34a1bd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceMeteringIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/marketplace/MarketplaceMeteringIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.marketplace;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -51,7 +52,7 @@ class MarketplaceMeteringIntegrationTest {
.statusCode(200).body("Signature", matchesPattern("^[^.]+\\.[^.]+\\.[^.]+$"));
}
- private static io.restassured.response.ValidatableResponse rpc(String action, String body) {
+ private static ValidatableResponse rpc(String action, String body) {
return given().contentType("application/x-amz-json-1.1").header("Authorization", auth())
.header("X-Amz-Target", "AWSMPMeteringService." + action).body(body).post("/").then();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/memorydb/container/MemoryDbContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/memorydb/container/MemoryDbContainerManagerTest.java
index 37435ca663..6bfade1ca0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/memorydb/container/MemoryDbContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/memorydb/container/MemoryDbContainerManagerTest.java
@@ -16,6 +16,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Optional;
@@ -93,7 +94,7 @@ class MemoryDbContainerManagerTest {
try (Socket socket = serverSocket.accept()) {
socket.getInputStream().read(new byte[64]);
OutputStream out = socket.getOutputStream();
- out.write("+PONG\r\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ out.write("+PONG\r\n".getBytes(StandardCharsets.UTF_8));
out.flush();
} catch (IOException e) {
// Test teardown races the socket close; nothing left to assert on.
@@ -125,7 +126,7 @@ class MemoryDbContainerManagerTest {
try (Socket socket = serverSocket.accept()) {
socket.getInputStream().read(new byte[64]);
OutputStream out = socket.getOutputStream();
- out.write("+PONG\r\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ out.write("+PONG\r\n".getBytes(StandardCharsets.UTF_8));
out.flush();
} catch (IOException e) {
LOG.debugv(e, "Acceptor socket closed during test teardown");
diff --git a/src/test/java/io/github/hectorvent/floci/services/neptune/container/NeptuneContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/neptune/container/NeptuneContainerManagerTest.java
index 828d39092b..96bd878555 100644
--- a/src/test/java/io/github/hectorvent/floci/services/neptune/container/NeptuneContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/neptune/container/NeptuneContainerManagerTest.java
@@ -17,6 +17,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Optional;
@@ -96,7 +97,7 @@ class NeptuneContainerManagerTest {
try (Socket socket = serverSocket.accept()) {
socket.getInputStream().read(new byte[64]);
OutputStream out = socket.getOutputStream();
- out.write("HTTP/1.1 400 Bad Request\r\n\r\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ out.write("HTTP/1.1 400 Bad Request\r\n\r\n".getBytes(StandardCharsets.UTF_8));
out.flush();
} catch (IOException e) {
// Test teardown races the socket close; nothing left to assert on.
@@ -130,7 +131,7 @@ class NeptuneContainerManagerTest {
try (Socket socket = serverSocket.accept()) {
socket.getInputStream().read(new byte[64]);
OutputStream out = socket.getOutputStream();
- out.write("HTTP/1.1 400 Bad Request\r\n\r\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ out.write("HTTP/1.1 400 Bad Request\r\n\r\n".getBytes(StandardCharsets.UTF_8));
out.flush();
} catch (IOException e) {
LOG.debugv(e, "Acceptor socket closed during test teardown");
diff --git a/src/test/java/io/github/hectorvent/floci/services/oam/OamIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/oam/OamIntegrationTest.java
index 375d94cbf4..463e164942 100644
--- a/src/test/java/io/github/hectorvent/floci/services/oam/OamIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/oam/OamIntegrationTest.java
@@ -5,6 +5,9 @@ import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.List;
+import java.util.Map;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -40,15 +43,15 @@ class OamIntegrationTest {
+ "\"AWS::CloudWatch::Metric\",\"AWS::Logs::LogGroup\"]}}}]}";
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "Policy", policy))
+ .body(Map.of("SinkIdentifier", sinkArn, "Policy", policy))
.when().post("/PutSinkPolicy")
.then().statusCode(200).body("SinkArn", equalTo(sinkArn));
String linkArn = given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of(
+ .body(Map.of(
"SinkIdentifier", sinkArn,
"LabelTemplate", "source-account",
- "ResourceTypes", java.util.List.of("AWS::CloudWatch::Metric")))
+ "ResourceTypes", List.of("AWS::CloudWatch::Metric")))
.when().post("/CreateLink")
.then().statusCode(200)
.body("SinkArn", equalTo(sinkArn))
@@ -60,28 +63,28 @@ class OamIntegrationTest {
.then().statusCode(200).body("Items.Arn", contains(linkArn));
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn))
+ .body(Map.of("SinkIdentifier", sinkArn))
.when().post("/ListAttachedLinks")
.then().statusCode(200).body("Items.LinkArn", contains(linkArn));
given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of(
+ .body(Map.of(
"Identifier", linkArn,
- "ResourceTypes", java.util.List.of("AWS::CloudWatch::Metric", "AWS::Logs::LogGroup"),
- "LinkConfiguration", java.util.Map.of(
- "MetricConfiguration", java.util.Map.of("Filter", "Namespace LIKE 'AWS/%'"))))
+ "ResourceTypes", List.of("AWS::CloudWatch::Metric", "AWS::Logs::LogGroup"),
+ "LinkConfiguration", Map.of(
+ "MetricConfiguration", Map.of("Filter", "Namespace LIKE 'AWS/%'"))))
.when().post("/UpdateLink")
.then().statusCode(200)
.body("ResourceTypes.size()", equalTo(2))
.body("LinkConfiguration.MetricConfiguration.Filter", equalTo("Namespace LIKE 'AWS/%'"));
given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of("Identifier", linkArn))
+ .body(Map.of("Identifier", linkArn))
.when().post("/DeleteLink")
.then().statusCode(200);
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("Identifier", sinkArn))
+ .body(Map.of("Identifier", sinkArn))
.when().post("/DeleteSink")
.then().statusCode(200);
}
@@ -97,20 +100,20 @@ class OamIntegrationTest {
+ "\"Principal\":{\"AWS\":\"arn:aws:iam::333333333333:root\"},"
+ "\"Action\":\"oam:CreateLink\",\"Resource\":\"*\"}]}";
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "Policy", policy))
+ .body(Map.of("SinkIdentifier", sinkArn, "Policy", policy))
.when().post("/PutSinkPolicy")
.then().statusCode(200);
given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of(
+ .body(Map.of(
"SinkIdentifier", sinkArn,
"LabelTemplate", "denied",
- "ResourceTypes", java.util.List.of("AWS::CloudWatch::Metric")))
+ "ResourceTypes", List.of("AWS::CloudWatch::Metric")))
.when().post("/CreateLink")
.then().statusCode(400).body("__type", containsString("InvalidParameterException"));
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("Identifier", sinkArn))
+ .body(Map.of("Identifier", sinkArn))
.when().post("/DeleteSink")
.then().statusCode(200);
}
@@ -125,17 +128,17 @@ class OamIntegrationTest {
+ "\"Principal\":\"*\",\"Action\":\"oam:CreateLink\",\"Resource\":\"*\","
+ "\"Condition\":{\"StringEquals\":{\"aws:PrincipalOrgID\":\"o-example\"}}}]}";
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "Policy", policy))
+ .body(Map.of("SinkIdentifier", sinkArn, "Policy", policy))
.when().post("/PutSinkPolicy").then().statusCode(200);
given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "LabelTemplate", "source",
- "ResourceTypes", java.util.List.of("AWS::CloudWatch::Metric")))
+ .body(Map.of("SinkIdentifier", sinkArn, "LabelTemplate", "source",
+ "ResourceTypes", List.of("AWS::CloudWatch::Metric")))
.when().post("/CreateLink")
.then().statusCode(400).body("__type", containsString("InvalidParameterException"));
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("Identifier", sinkArn))
+ .body(Map.of("Identifier", sinkArn))
.when().post("/DeleteSink").then().statusCode(200);
}
@@ -151,17 +154,17 @@ class OamIntegrationTest {
+ "{\"Effect\":\"Deny\",\"Principal\":{\"AWS\":\"arn:aws:iam::222222222222:root\"},"
+ "\"Action\":\"oam:CreateLink\",\"Resource\":\"*\"}]}";
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "Policy", policy))
+ .body(Map.of("SinkIdentifier", sinkArn, "Policy", policy))
.when().post("/PutSinkPolicy").then().statusCode(200);
given().header("Authorization", SOURCE).contentType("application/json")
- .body(java.util.Map.of("SinkIdentifier", sinkArn, "LabelTemplate", "source",
- "ResourceTypes", java.util.List.of("AWS::CloudWatch::Metric")))
+ .body(Map.of("SinkIdentifier", sinkArn, "LabelTemplate", "source",
+ "ResourceTypes", List.of("AWS::CloudWatch::Metric")))
.when().post("/CreateLink")
.then().statusCode(400).body("__type", containsString("InvalidParameterException"));
given().header("Authorization", MONITORING).contentType("application/json")
- .body(java.util.Map.of("Identifier", sinkArn))
+ .body(Map.of("Identifier", sinkArn))
.when().post("/DeleteSink").then().statusCode(200);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/organizations/OrganizationsCrossAccountIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/organizations/OrganizationsCrossAccountIntegrationTest.java
index 1dcf35cca9..d04927ae11 100644
--- a/src/test/java/io/github/hectorvent/floci/services/organizations/OrganizationsCrossAccountIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/organizations/OrganizationsCrossAccountIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.organizations;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -100,7 +101,7 @@ class OrganizationsCrossAccountIntegrationTest {
.body("Handshake.State", equalTo("REQUESTED"))
.body("Handshake.Action", equalTo("INVITE"))
.body("Handshake.Arn",
- org.hamcrest.Matchers.startsWith("arn:aws:organizations::" + MANAGEMENT_ACCOUNT + ":handshake/"))
+ Matchers.startsWith("arn:aws:organizations::" + MANAGEMENT_ACCOUNT + ":handshake/"))
.body("Handshake.RequestedTimestamp", notNullValue())
.body("Handshake.ExpirationTimestamp", notNullValue())
.body("Handshake.Parties.Id", hasItem(INVITED_ACCOUNT))
@@ -118,11 +119,11 @@ class OrganizationsCrossAccountIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("Handshake.Resources.Type", org.hamcrest.Matchers.everyItem(
- org.hamcrest.Matchers.in(List.of("ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET",
+ .body("Handshake.Resources.Type", Matchers.everyItem(
+ Matchers.in(List.of("ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET",
"EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"))))
.body("Handshake.Resources.find { it.Type == 'ORGANIZATION' }.Resources.Type",
- org.hamcrest.Matchers.containsInAnyOrder("MASTER_EMAIL", "MASTER_NAME"));
+ Matchers.containsInAnyOrder("MASTER_EMAIL", "MASTER_NAME"));
}
@Test
@@ -310,7 +311,7 @@ class OrganizationsCrossAccountIntegrationTest {
.then()
.statusCode(200)
.body("Handshakes.Id",
- org.hamcrest.Matchers.hasItems(inviteHandshakeId, declinedHandshakeId, canceledHandshakeId));
+ Matchers.hasItems(inviteHandshakeId, declinedHandshakeId, canceledHandshakeId));
organizations(MANAGEMENT_ACCOUNT, "ListHandshakesForOrganization",
"{\"Filter\":{\"States\":[\"DECLINED\"]}}")
diff --git a/src/test/java/io/github/hectorvent/floci/services/pipes/KarapaceManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/pipes/KarapaceManagerTest.java
index 0ea8752de5..bbf3a72950 100644
--- a/src/test/java/io/github/hectorvent/floci/services/pipes/KarapaceManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/pipes/KarapaceManagerTest.java
@@ -22,6 +22,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.charset.StandardCharsets;
+import java.time.Duration;
import java.util.Map;
import java.util.Optional;
@@ -73,7 +74,7 @@ class KarapaceManagerTest {
ContainerBuilder containerBuilder = new ContainerBuilder(config, dockerHostResolver, embeddedDnsServer);
manager = new KarapaceManager(containerBuilder, lifecycleManager, containerDetector, config, portAllocator,
- dockerHostResolver, java.time.Duration.ofMillis(500));
+ dockerHostResolver, Duration.ofMillis(500));
}
@AfterEach
diff --git a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesKafkaRestClientTest.java b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesKafkaRestClientTest.java
index 8072d23354..5f263cd059 100644
--- a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesKafkaRestClientTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesKafkaRestClientTest.java
@@ -2,11 +2,13 @@ package io.github.hectorvent.floci.services.pipes;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.http.HttpClient;
@@ -98,13 +100,13 @@ class PipesKafkaRestClientTest {
return URI.create("http://localhost:" + fakeServer.getAddress().getPort() + "/");
}
- private void record(com.sun.net.httpserver.HttpExchange exchange) throws java.io.IOException {
+ private void record(HttpExchange exchange) throws IOException {
lastRequestMethod.set(exchange.getRequestMethod());
lastRequestPath.set(exchange.getRequestURI().toString());
lastRequestBody.set(new String(exchange.getRequestBody().readAllBytes(), StandardCharsets.UTF_8));
}
- private static void respond(com.sun.net.httpserver.HttpExchange exchange, int status, String body) throws java.io.IOException {
+ private static void respond(HttpExchange exchange, int status, String body) throws IOException {
byte[] bytes = body.getBytes(StandardCharsets.UTF_8);
exchange.sendResponseHeaders(status, bytes.length == 0 ? -1 : bytes.length);
if (bytes.length > 0) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerIntegrationTest.java
index c020258d0e..ea4755a10d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerIntegrationTest.java
@@ -3,6 +3,9 @@ package io.github.hectorvent.floci.services.pipes;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.*;
+import java.util.HashSet;
+import java.util.Set;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -383,7 +386,7 @@ class PipesPollerIntegrationTest {
@Test
@Order(24)
void allBatchMessagesEventuallyForwarded() throws Exception {
- java.util.Set<String> found = new java.util.HashSet<>();
+ Set<String> found = new HashSet<>();
for (int i = 0; i < 20 && found.size() < 3; i++) {
Thread.sleep(500);
String body = given()
diff --git a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerTest.java b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerTest.java
index 9c9ff83c69..2b646fc019 100644
--- a/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/pipes/PipesPollerTest.java
@@ -226,9 +226,9 @@ class PipesPollerTest {
@Test
void pollKafka_filtersUsingDecodedPayloadButDeliversOriginalRecord() throws Exception {
Pipe pipe = selfManagedKafkaPipe();
- byte[] key = "customer-123".getBytes(java.nio.charset.StandardCharsets.UTF_8);
- byte[] value = "{\"status\":\"active\",\"id\":\"order-1\"}".getBytes(java.nio.charset.StandardCharsets.UTF_8);
- byte[] traceId = "abc123".getBytes(java.nio.charset.StandardCharsets.UTF_8);
+ byte[] key = "customer-123".getBytes(StandardCharsets.UTF_8);
+ byte[] value = "{\"status\":\"active\",\"id\":\"order-1\"}".getBytes(StandardCharsets.UTF_8);
+ byte[] traceId = "abc123".getBytes(StandardCharsets.UTF_8);
KafkaRecordDto record = kafkaRecord("orders", 0, 42L, key, value, new KafkaHeaderDto("traceId", traceId));
when(kafkaConsumerManager.poll(pipe)).thenReturn(List.of(record));
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/PausingStorageBackend.java b/src/test/java/io/github/hectorvent/floci/services/rds/PausingStorageBackend.java
index 6840534d85..eab071e788 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/PausingStorageBackend.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/PausingStorageBackend.java
@@ -7,6 +7,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
/**
@@ -26,8 +27,8 @@ final class PausingStorageBackend<V> implements StorageBackend<String, V> {
private final StorageBackend<String, V> delegate;
private volatile Call pauseOn;
private volatile String pauseKey;
- private final java.util.concurrent.atomic.AtomicInteger skip =
- new java.util.concurrent.atomic.AtomicInteger();
+ private final AtomicInteger skip =
+ new AtomicInteger();
private final CountDownLatch reached = new CountDownLatch(1);
private final CountDownLatch release = new CountDownLatch(1);
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsParameterGroupTagIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsParameterGroupTagIntegrationTest.java
index 8be8171a5b..2beecaeb9b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsParameterGroupTagIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsParameterGroupTagIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.rds;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -32,7 +33,7 @@ class RdsParameterGroupTagIntegrationTest {
"AWS4-HMAC-SHA256 Credential=test/20260615/us-east-1/rds/aws4_request, "
+ "SignedHeaders=content-type;host, Signature=test";
- private static io.restassured.specification.RequestSpecification query(String action) {
+ private static RequestSpecification query(String action) {
return given().header("Authorization", AUTH)
.contentType(URLENC)
.formParam("Action", action)
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
index 4b020d995e..680c72973d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
@@ -36,8 +36,11 @@ import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.NullSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import java.time.Instant;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -614,7 +617,7 @@ class RdsQueryHandlerTest {
@Test
void describeDbInstances_defaultParameterGroupNameUsesHyphenAndMajorOnlyForAuroraPostgresql() {
DbInstance instance = makeInstance("aurora-pg");
- instance.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.POSTGRES);
+ instance.setEngine(DatabaseEngine.POSTGRES);
instance.setEngineIdentifier("aurora-postgresql");
instance.setEngineVersion("16.3");
when(service.listDbInstances(null, null)).thenReturn(List.of(instance));
@@ -630,7 +633,7 @@ class RdsQueryHandlerTest {
@Test
void describeDbInstances_defaultParameterGroupNameUsesMajorMinorForAuroraMysql() {
DbInstance instance = makeInstance("aurora-my");
- instance.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.MYSQL);
+ instance.setEngine(DatabaseEngine.MYSQL);
instance.setEngineIdentifier("aurora-mysql");
instance.setEngineVersion("8.0.36");
when(service.listDbInstances(null, null)).thenReturn(List.of(instance));
@@ -689,7 +692,7 @@ class RdsQueryHandlerTest {
@Test
void describeDbInstances_directIdentifierTakesPriorityOverFilters() {
- when(service.listDbInstances(any(), org.mockito.ArgumentMatchers.isNull()))
+ when(service.listDbInstances(any(), ArgumentMatchers.isNull()))
.thenReturn(List.of());
MultivaluedMap<String, String> p = params();
@@ -1575,7 +1578,7 @@ class RdsQueryHandlerTest {
DbSnapshot snapshot = new DbSnapshot();
snapshot.setDbSnapshotIdentifier("mysnap");
snapshot.setDbInstanceIdentifier("mydb");
- snapshot.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.POSTGRES);
+ snapshot.setEngine(DatabaseEngine.POSTGRES);
snapshot.setSnapshotType("manual");
snapshot.setSourceDbSnapshotIdentifier(
"arn:aws:rds:us-east-1:123456789012:snapshot:source");
@@ -2354,10 +2357,10 @@ class RdsQueryHandlerTest {
@Test
void createDbSnapshot_success() {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot = new io.github.hectorvent.floci.services.rds.model.DbSnapshot();
+ DbSnapshot snapshot = new DbSnapshot();
snapshot.setDbSnapshotIdentifier("mysnap");
snapshot.setDbInstanceIdentifier("mydb");
- snapshot.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.POSTGRES);
+ snapshot.setEngine(DatabaseEngine.POSTGRES);
snapshot.setTags(Map.of("owner", "platform"));
when(service.createDbSnapshot(eq("mysnap"), eq("mydb"), eq(Map.of("owner", "platform")), isNull()))
.thenReturn(snapshot);
@@ -2588,7 +2591,7 @@ class RdsQueryHandlerTest {
@Test
void describeDbSnapshotAttributes_returnsRestoreAttribute() {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot = new io.github.hectorvent.floci.services.rds.model.DbSnapshot();
+ DbSnapshot snapshot = new DbSnapshot();
snapshot.setDbSnapshotIdentifier("mysnap");
snapshot.setRestoreAccountIds(List.of("111111111111"));
when(service.describeDbSnapshotAttributes(eq("mysnap"), isNull())).thenReturn(snapshot);
@@ -2605,7 +2608,7 @@ class RdsQueryHandlerTest {
@Test
void modifyDbSnapshotAttribute_passesValuesToAddAndRemove() {
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot = new io.github.hectorvent.floci.services.rds.model.DbSnapshot();
+ DbSnapshot snapshot = new DbSnapshot();
snapshot.setDbSnapshotIdentifier("mysnap");
snapshot.setRestoreAccountIds(List.of("222222222222"));
when(service.modifyDbSnapshotAttribute(eq("mysnap"), eq("restore"),
@@ -2947,11 +2950,11 @@ class RdsQueryHandlerTest {
OptionGroupOption option = new OptionGroupOption("MEMCACHED");
option.setOptionDescription("Innodb Memcached for MySQL");
option.setPort(11211);
- option.setOptionSettings(new java.util.LinkedHashMap<>(
+ option.setOptionSettings(new LinkedHashMap<>(
Map.of("BACKLOG_QUEUE_LIMIT", "1024")));
option.setVpcSecurityGroupMemberships(List.of("sg-123"));
option.setDbSecurityGroupMemberships(List.of("default"));
- group.setOptions(new java.util.ArrayList<>(List.of(option)));
+ group.setOptions(new ArrayList<>(List.of(option)));
when(service.listOptionGroups(null, null, null, null)).thenReturn(List.of(group));
Response response = handler.handle("DescribeOptionGroups", params());
@@ -3261,7 +3264,7 @@ class RdsQueryHandlerTest {
DbInstance i = new DbInstance();
i.setDbInstanceIdentifier(id);
i.setStatus(DbInstanceStatus.AVAILABLE);
- i.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.POSTGRES);
+ i.setEngine(DatabaseEngine.POSTGRES);
i.setEngineVersion("15");
i.setMasterUsername("admin");
i.setDbInstanceClass("db.t3.micro");
@@ -3295,7 +3298,7 @@ class RdsQueryHandlerTest {
DbCluster c = new DbCluster();
c.setDbClusterIdentifier(id);
c.setStatus(DbInstanceStatus.AVAILABLE);
- c.setEngine(io.github.hectorvent.floci.services.rds.model.DatabaseEngine.POSTGRES);
+ c.setEngine(DatabaseEngine.POSTGRES);
c.setEngineVersion("15");
c.setMasterUsername("admin");
return c;
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
index e572802f1e..6447c59aa8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
@@ -63,16 +63,21 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
+import org.mockito.Mockito;
import java.lang.reflect.Field;
import java.net.ServerSocket;
import java.time.Duration;
import java.time.Instant;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Set;
@@ -201,7 +206,7 @@ class RdsServiceTest {
.collect(Collectors.toMap(Subnet::getSubnetId, subnet -> subnet));
return subnetIds.stream()
.map(byId::get)
- .filter(java.util.Objects::nonNull)
+ .filter(Objects::nonNull)
.toList();
});
}
@@ -1911,17 +1916,17 @@ class RdsServiceTest {
DbInstance instance = rdsService.createDbInstance("mydb", "postgres", "13",
"admin", "password", "dbname", "db.t3.micro",
20, false, null, null, null, false, null,
- java.util.Map.of("example:ClusterId", "cluster-a"));
+ Map.of("example:ClusterId", "cluster-a"));
- assertEquals(java.util.Map.of("example:ClusterId", "cluster-a"),
+ assertEquals(Map.of("example:ClusterId", "cluster-a"),
rdsService.listTagsForResource(instance.getDbInstanceArn()));
- rdsService.addTagsToResource(instance.getDbInstanceArn(), java.util.Map.of("Name", "mydb"));
- assertEquals(java.util.Map.of("example:ClusterId", "cluster-a", "Name", "mydb"),
+ rdsService.addTagsToResource(instance.getDbInstanceArn(), Map.of("Name", "mydb"));
+ assertEquals(Map.of("example:ClusterId", "cluster-a", "Name", "mydb"),
rdsService.listTagsForResource(instance.getDbInstanceArn()));
- rdsService.removeTagsFromResource(instance.getDbInstanceArn(), java.util.List.of("Name"));
- assertEquals(java.util.Map.of("example:ClusterId", "cluster-a"),
+ rdsService.removeTagsFromResource(instance.getDbInstanceArn(), List.of("Name"));
+ assertEquals(Map.of("example:ClusterId", "cluster-a"),
rdsService.listTagsForResource(instance.getDbInstanceArn()));
}
@@ -3149,10 +3154,10 @@ class RdsServiceTest {
@Test
void dbSubnetGroupRoundTrip() {
DbSubnetGroup group = rdsService.createDbSubnetGroup(
- "sample-db-subnets", "test", java.util.List.of("subnet-default-a", "subnet-default-b"));
+ "sample-db-subnets", "test", List.of("subnet-default-a", "subnet-default-b"));
assertEquals("sample-db-subnets", group.getDbSubnetGroupName());
- assertEquals(java.util.List.of("subnet-default-a", "subnet-default-b"), group.getSubnetIds());
+ assertEquals(List.of("subnet-default-a", "subnet-default-b"), group.getSubnetIds());
assertEquals(1, rdsService.listDbSubnetGroups("sample-db-subnets").size());
rdsService.deleteDbSubnetGroup("sample-db-subnets");
@@ -3180,31 +3185,31 @@ class RdsServiceTest {
@Test
void dbSubnetGroupTagsRoundTripAndMutateByArn() {
rdsService.createDbSubnetGroup(
- "sample-db-subnets", "test", java.util.List.of("subnet-default-a", "subnet-default-b"));
+ "sample-db-subnets", "test", List.of("subnet-default-a", "subnet-default-b"));
String arn = "arn:aws:rds:us-east-1:123456789012:subgrp:sample-db-subnets";
// A subnet group with no tags must list cleanly — previously this threw DBInstanceNotFound (404)
// because every ResourceName was resolved as a DB instance.
- assertEquals(java.util.Map.of(), rdsService.listTagsForResource(arn));
+ assertEquals(Map.of(), rdsService.listTagsForResource(arn));
- rdsService.addTagsToResource(arn, java.util.Map.of("Name", "sample-db-subnets"));
- assertEquals(java.util.Map.of("Name", "sample-db-subnets"),
+ rdsService.addTagsToResource(arn, Map.of("Name", "sample-db-subnets"));
+ assertEquals(Map.of("Name", "sample-db-subnets"),
rdsService.listTagsForResource(arn));
- rdsService.removeTagsFromResource(arn, java.util.List.of("Name"));
- assertEquals(java.util.Map.of(), rdsService.listTagsForResource(arn));
+ rdsService.removeTagsFromResource(arn, List.of("Name"));
+ assertEquals(Map.of(), rdsService.listTagsForResource(arn));
}
@Test
void dbSubnetGroupTagsSurviveModify() {
rdsService.createDbSubnetGroup(
- "sample-db-subnets", "test", java.util.List.of("subnet-default-a", "subnet-default-b"));
+ "sample-db-subnets", "test", List.of("subnet-default-a", "subnet-default-b"));
String arn = "arn:aws:rds:us-east-1:123456789012:subgrp:sample-db-subnets";
- rdsService.addTagsToResource(arn, java.util.Map.of("Name", "sample-db-subnets"));
+ rdsService.addTagsToResource(arn, Map.of("Name", "sample-db-subnets"));
- rdsService.modifyDbSubnetGroup("sample-db-subnets", java.util.List.of("subnet-default-a"));
+ rdsService.modifyDbSubnetGroup("sample-db-subnets", List.of("subnet-default-a"));
- assertEquals(java.util.Map.of("Name", "sample-db-subnets"),
+ assertEquals(Map.of("Name", "sample-db-subnets"),
rdsService.listTagsForResource(arn));
}
@@ -3257,10 +3262,10 @@ class RdsServiceTest {
DbCluster cluster = rdsService.createDbCluster("cluster1", "postgres", "13",
"admin", "password", "dbname", false, null);
- assertEquals(java.util.Map.of(), rdsService.listTagsForResource(cluster.getDbClusterArn()));
+ assertEquals(Map.of(), rdsService.listTagsForResource(cluster.getDbClusterArn()));
- rdsService.addTagsToResource(cluster.getDbClusterArn(), java.util.Map.of("env", "test"));
- assertEquals(java.util.Map.of("env", "test"),
+ rdsService.addTagsToResource(cluster.getDbClusterArn(), Map.of("env", "test"));
+ assertEquals(Map.of("env", "test"),
rdsService.listTagsForResource(cluster.getDbClusterArn()));
}
@@ -3271,14 +3276,14 @@ class RdsServiceTest {
String targetGroupArn = rdsService.describeDbProxyTargetGroups("app-proxy")
.iterator().next().getTargetGroupArn();
- assertEquals(java.util.Map.of(), rdsService.listTagsForResource(targetGroupArn));
+ assertEquals(Map.of(), rdsService.listTagsForResource(targetGroupArn));
- rdsService.addTagsToResource(targetGroupArn, java.util.Map.of("env", "test"));
- assertEquals(java.util.Map.of("env", "test"),
+ rdsService.addTagsToResource(targetGroupArn, Map.of("env", "test"));
+ assertEquals(Map.of("env", "test"),
rdsService.listTagsForResource(targetGroupArn));
- rdsService.removeTagsFromResource(targetGroupArn, java.util.List.of("env"));
- assertEquals(java.util.Map.of(), rdsService.listTagsForResource(targetGroupArn));
+ rdsService.removeTagsFromResource(targetGroupArn, List.of("env"));
+ assertEquals(Map.of(), rdsService.listTagsForResource(targetGroupArn));
}
@Test
@@ -5038,7 +5043,7 @@ class RdsServiceTest {
rdsService.createDbClusterParameterGroup("cpg1", "aurora-postgresql16", "desc");
DbClusterParameterGroup modified = rdsService.modifyDbClusterParameterGroup(
- "cpg1", java.util.Map.of("log_statement", "all", "shared_preload_libraries", "pg_stat_statements"));
+ "cpg1", Map.of("log_statement", "all", "shared_preload_libraries", "pg_stat_statements"));
assertEquals("all", modified.getParameters().get("log_statement"));
assertEquals("pg_stat_statements", modified.getParameters().get("shared_preload_libraries"));
@@ -5286,7 +5291,7 @@ class RdsServiceTest {
20, false, null, null, null, null, false);
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot = rdsService.createDbSnapshot("mysnap", "mydb");
+ DbSnapshot snapshot = rdsService.createDbSnapshot("mysnap", "mydb");
assertEquals("mysnap", snapshot.getDbSnapshotIdentifier());
assertEquals("mydb", snapshot.getDbInstanceIdentifier());
@@ -5593,7 +5598,7 @@ class RdsServiceTest {
20, false, null, null, null, null, false);
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
rdsService.createDbSnapshot("mysnap", "mydb", Map.of("owner", "platform"));
assertEquals(Map.of("owner", "platform"), snapshot.getTags());
@@ -5837,7 +5842,7 @@ class RdsServiceTest {
"admin", "password", "dbname", "db.t3.micro",
20, false, null, null, null, null, false);
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
rdsService.createDbSnapshot("mysnap", "mydb");
rdsService.addTagsToResource(snapshot.getDbSnapshotArn(), Map.of("Name", "mysnap"));
@@ -5855,7 +5860,7 @@ class RdsServiceTest {
Map.of(), "us-west-2");
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
rdsService.createDbSnapshot("mysnap", "mydb", Map.of("owner", "west-team"), "us-west-2");
assertEquals("arn:aws:rds:us-west-2:123456789012:snapshot:mysnap", snapshot.getDbSnapshotArn());
@@ -5915,7 +5920,7 @@ class RdsServiceTest {
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
rdsService.createDbSnapshot("mysnap", "mydb");
- org.mockito.Mockito.doThrow(new RuntimeException("failed restore"))
+ Mockito.doThrow(new RuntimeException("failed restore"))
.when(containerManager).restorePostgresSnapshot(any(), eq("admin"), eq("MOCK_DUMP_DATA"));
AwsException exception = assertThrows(AwsException.class, () ->
@@ -5966,11 +5971,11 @@ class RdsServiceTest {
rdsService.createDbSnapshot("snap2", "mydb2");
// 1. Describe all
- Collection<io.github.hectorvent.floci.services.rds.model.DbSnapshot> all = rdsService.describeDbSnapshots(null, null);
+ Collection<DbSnapshot> all = rdsService.describeDbSnapshots(null, null);
assertEquals(2, all.size());
// 2. Describe by snapshot ID
- Collection<io.github.hectorvent.floci.services.rds.model.DbSnapshot> snap1Result = rdsService.describeDbSnapshots("snap1", null);
+ Collection<DbSnapshot> snap1Result = rdsService.describeDbSnapshots("snap1", null);
assertEquals(1, snap1Result.size());
assertEquals("snap1", snap1Result.iterator().next().getDbSnapshotIdentifier());
@@ -5978,7 +5983,7 @@ class RdsServiceTest {
assertThrows(AwsException.class, () -> rdsService.describeDbSnapshots("invalid-snap", null));
// 4. Describe by DB instance ID
- Collection<io.github.hectorvent.floci.services.rds.model.DbSnapshot> inst1Result = rdsService.describeDbSnapshots(null, "mydb1");
+ Collection<DbSnapshot> inst1Result = rdsService.describeDbSnapshots(null, "mydb1");
assertEquals(1, inst1Result.size());
assertEquals("snap1", inst1Result.iterator().next().getDbSnapshotIdentifier());
}
@@ -5991,7 +5996,7 @@ class RdsServiceTest {
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
rdsService.createDbSnapshot("mysnap", "mydb");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot snapshot =
+ DbSnapshot snapshot =
rdsService.describeDbSnapshotAttributes("mysnap");
assertEquals(List.of(), snapshot.getRestoreAccountIds());
@@ -6006,11 +6011,11 @@ class RdsServiceTest {
when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA");
rdsService.createDbSnapshot("mysnap", "mydb");
- io.github.hectorvent.floci.services.rds.model.DbSnapshot added = rdsService.modifyDbSnapshotAttribute(
+ DbSnapshot added = rdsService.modifyDbSnapshotAttribute(
"mysnap", "restore", List.of("111111111111", "222222222222"), List.of());
assertEquals(List.of("111111111111", "222222222222"), added.getRestoreAccountIds());
- io.github.hectorvent.floci.services.rds.model.DbSnapshot removed = rdsService.modifyDbSnapshotAttribute(
+ DbSnapshot removed = rdsService.modifyDbSnapshotAttribute(
"mysnap", "restore", List.of(), List.of("111111111111"));
assertEquals(List.of("222222222222"), removed.getRestoreAccountIds());
@@ -6034,20 +6039,20 @@ class RdsServiceTest {
when(restoredContainerManager.tryStart(
any(), any(), any(), any(), any(), any(), any(), any(), any(), any()))
.thenReturn(restoredHandle, replacementHandle);
- org.mockito.Mockito.doThrow(new IllegalStateException("relay failed"))
+ Mockito.doThrow(new IllegalStateException("relay failed"))
.doNothing()
.doNothing()
.when(restoredProxyManager).startProxy(
any(), any(), any(), anyBoolean(), anyInt(), any(), anyInt(),
any(), any(), any(), any(), any(), any());
- org.mockito.Mockito.doThrow(new IllegalStateException("cleanup failed"))
+ Mockito.doThrow(new IllegalStateException("cleanup failed"))
.doNothing()
.doNothing()
.when(restoredProxyManager).stopProxy(any());
- org.mockito.Mockito.doThrow(new IllegalStateException("restore container cleanup failed"))
+ Mockito.doThrow(new IllegalStateException("restore container cleanup failed"))
.doThrow(new IllegalStateException("delete container cleanup failed"))
.doNothing()
- .when(restoredContainerManager).stop(org.mockito.ArgumentMatchers.argThat(
+ .when(restoredContainerManager).stop(ArgumentMatchers.argThat(
handle -> runtimeId.equals(handle.getRuntimeId())));
RdsService restoredService = newService(
restoredContainerManager, restoredProxyManager, instances,
@@ -6073,7 +6078,7 @@ class RdsServiceTest {
assertDoesNotThrow(() -> restoredService.deleteDbInstance("broken"));
assertThrows(AwsException.class, () -> restoredService.getDbInstance("broken"));
verify(restoredContainerManager, times(3)).stop(
- org.mockito.ArgumentMatchers.argThat(
+ ArgumentMatchers.argThat(
handle -> runtimeId.equals(handle.getRuntimeId())));
verify(restoredContainerManager).removeVolume(any(), any(), any());
@@ -6202,7 +6207,7 @@ class RdsServiceTest {
assertDoesNotThrow(() -> restoredService.deleteDbInstance("broken"));
verify(restoredContainerManager).stop(
- org.mockito.ArgumentMatchers.argThat(handle ->
+ ArgumentMatchers.argThat(handle ->
"persisted-container".equals(handle.getContainerId())
&& persisted.getDbInstanceArn().equals(handle.getRuntimeId())));
assertThrows(AwsException.class, () -> restoredService.getDbInstance("broken"));
@@ -6580,15 +6585,15 @@ class RdsServiceTest {
when(restoredContainerManager.tryStart(
any(), any(), any(), any(), any(), any(), any(), any(), any(), any()))
.thenReturn(restoredHandle, replacementHandle);
- org.mockito.Mockito.doThrow(new IllegalStateException("relay failed"))
+ Mockito.doThrow(new IllegalStateException("relay failed"))
.doNothing()
.when(restoredProxyManager).startProxy(
any(), any(), any(), anyBoolean(), anyInt(), any(), anyInt(),
any(), any(), any(), any(), any(), any());
- org.mockito.Mockito.doThrow(new IllegalStateException("restore container cleanup failed"))
+ Mockito.doThrow(new IllegalStateException("restore container cleanup failed"))
.doThrow(new IllegalStateException("delete container cleanup failed"))
.doNothing()
- .when(restoredContainerManager).stop(org.mockito.ArgumentMatchers.argThat(
+ .when(restoredContainerManager).stop(ArgumentMatchers.argThat(
handle -> runtimeId.equals(handle.getRuntimeId())));
RdsService restoredService = newService(
restoredContainerManager, restoredProxyManager, new InMemoryStorage<>(),
@@ -6615,7 +6620,7 @@ class RdsServiceTest {
assertDoesNotThrow(() -> restoredService.deleteDbCluster("cluster1"));
assertThrows(AwsException.class, () -> restoredService.getDbCluster("cluster1"));
verify(restoredContainerManager, times(3)).stop(
- org.mockito.ArgumentMatchers.argThat(
+ ArgumentMatchers.argThat(
handle -> runtimeId.equals(handle.getRuntimeId())));
verify(restoredContainerManager).removeVolume(any(), any(), any());
@@ -6917,7 +6922,7 @@ class RdsServiceTest {
PROXY_ROLE_ARN, PROXY_SUBNET_IDS, List.of(), List.of(longDescription),
1800, false, Map.of(), "us-east-1"));
- List<DbProxyAuth> tooManyEntries = java.util.Collections.nCopies(201, PROXY_AUTH.getFirst());
+ List<DbProxyAuth> tooManyEntries = Collections.nCopies(201, PROXY_AUTH.getFirst());
assertThrows(AwsException.class, () -> rdsService.createDbProxy(
"too-many-auth-proxy", "POSTGRESQL", true, false, "NONE",
PROXY_ROLE_ARN, PROXY_SUBNET_IDS, List.of(), tooManyEntries,
@@ -7159,7 +7164,7 @@ class RdsServiceTest {
relayRunning.set(false);
throw stopFailure;
}).when(proxyManager).stopProxy("db-proxy:" + proxy.getDbProxyArn());
- java.util.ArrayList<Boolean> startedModes = new java.util.ArrayList<>();
+ ArrayList<Boolean> startedModes = new ArrayList<>();
doAnswer(invocation -> {
startedModes.add(invocation.getArgument(3));
relayRunning.set(true);
@@ -7213,7 +7218,7 @@ class RdsServiceTest {
relayRunning.set(false);
return null;
}).when(proxyManager).stopProxy("db-proxy:" + proxy.getDbProxyArn());
- java.util.ArrayList<Boolean> startedModes = new java.util.ArrayList<>();
+ ArrayList<Boolean> startedModes = new ArrayList<>();
doAnswer(invocation -> {
startedModes.add(invocation.getArgument(3));
relayRunning.set(true);
@@ -8444,7 +8449,7 @@ class RdsServiceTest {
verify(proxyManager).startProxy(eq(relayKeyB), eq(instanceB.getDbInstanceArn()),
any(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), any(), any(), any(), any());
- org.mockito.Mockito.clearInvocations(proxyManager);
+ Mockito.clearInvocations(proxyManager);
serviceA.deleteDbInstance("shared-db");
verify(proxyManager).stopProxy(relayKeyA);
@@ -9026,7 +9031,7 @@ class RdsServiceTest {
rdsService.createOptionGroup("og1", "mariadb", "11.4", "mine");
OptionGroupOption option = new OptionGroupOption("MARIADB_AUDIT_PLUGIN");
option.setPort(11211);
- option.setOptionSettings(new java.util.LinkedHashMap<>(
+ option.setOptionSettings(new LinkedHashMap<>(
Map.of("SERVER_AUDIT_EVENTS", "CONNECT")));
option.setVpcSecurityGroupMemberships(List.of("sg-123"));
@@ -9045,12 +9050,12 @@ class RdsServiceTest {
void modifyOptionGroupUpdatesAnExistingOptionInPlace() {
rdsService.createOptionGroup("og1", "mariadb", "11.4", "mine");
OptionGroupOption first = new OptionGroupOption("MARIADB_AUDIT_PLUGIN");
- first.setOptionSettings(new java.util.LinkedHashMap<>(
+ first.setOptionSettings(new LinkedHashMap<>(
Map.of("SERVER_AUDIT_EVENTS", "CONNECT")));
rdsService.modifyOptionGroup("og1", List.of(first), List.of());
OptionGroupOption update = new OptionGroupOption("MARIADB_AUDIT_PLUGIN");
- update.setOptionSettings(new java.util.LinkedHashMap<>(
+ update.setOptionSettings(new LinkedHashMap<>(
Map.of("SERVER_AUDIT_EVENTS", "CONNECT,QUERY")));
OptionGroup group = rdsService.modifyOptionGroup("og1", List.of(update), List.of());
@@ -9978,7 +9983,7 @@ class RdsServiceTest {
20, false, null, null, null, null, false);
instances.pauseOn(PausingStorageBackend.Call.PUT, "::mydb");
- java.util.concurrent.atomic.AtomicReference<Throwable> modifyOutcome = new java.util.concurrent.atomic.AtomicReference<>();
+ AtomicReference<Throwable> modifyOutcome = new AtomicReference<>();
Thread modify = new Thread(() -> {
try {
service.modifyDbInstance("mydb", null, null, null, List.of(), null, null, null,
@@ -9993,7 +9998,7 @@ class RdsServiceTest {
Thread delete = new Thread(() -> service.deleteDbInstance("mydb"));
delete.start();
// guarded: the delete queues on the monitor modify holds; unguarded: it runs to completion
- long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(5);
+ long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
while (delete.getState() != Thread.State.BLOCKED && delete.getState() != Thread.State.TERMINATED) {
assertTrue(System.nanoTime() < deadline, "delete neither ran nor queued");
Thread.onSpinWait();
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerPostgresTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerPostgresTest.java
index 502a71eaa9..c9cdaec266 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerPostgresTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerPostgresTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.rds.container;
import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.CreateContainerResponse;
import com.github.dockerjava.api.exception.DockerException;
+import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.HostConfig;
import com.github.dockerjava.api.model.Ports;
@@ -222,12 +223,12 @@ class RdsContainerManagerPostgresTest {
private void removeContainerByName(String name) {
try {
- List<com.github.dockerjava.api.model.Container> containers = dockerClient
+ List<Container> containers = dockerClient
.listContainersCmd()
.withShowAll(true)
.withNameFilter(List.of(name))
.exec();
- for (com.github.dockerjava.api.model.Container c : containers) {
+ for (Container c : containers) {
removeContainer(c.getId());
}
} catch (DockerException ignored) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerTest.java
index 6361560d12..75b5d9c3d1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/container/RdsContainerManagerTest.java
@@ -32,6 +32,7 @@ import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.mockito.ArgumentCaptor;
+import org.mockito.ArgumentMatchers;
import org.mockito.InOrder;
import org.mockito.Mockito;
@@ -273,7 +274,7 @@ class RdsContainerManagerTest {
manager.start("db1", "vol1", DatabaseEngine.SQLSERVER,
"mcr.microsoft.com/mssql/server:2022-latest", "sa", "Password123!", null);
- org.mockito.ArgumentCaptor<ContainerSpec> spec = org.mockito.ArgumentCaptor.forClass(ContainerSpec.class);
+ ArgumentCaptor<ContainerSpec> spec = ArgumentCaptor.forClass(ContainerSpec.class);
verify(lifecycleManager).create(spec.capture());
assertEquals("mcr.microsoft.com/mssql/server:2022-latest", spec.getValue().image());
assertTrue(spec.getValue().env().contains("ACCEPT_EULA=Y"));
@@ -456,13 +457,13 @@ class RdsContainerManagerTest {
TarArchiveEntry entry = tar.getNextEntry();
assertEquals("floci-master-grants.sql", entry.getName());
assertEquals(RdsContainerManager.mysqlMasterGrantSql("admin"),
- new String(tar.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8));
+ new String(tar.readAllBytes(), StandardCharsets.UTF_8));
}
// The script lands on the created container before it starts, so the entrypoint's
// one-time init phase is the thing that runs it.
InOrder order = Mockito.inOrder(dockerClient, lifecycleManager);
order.verify(dockerClient).copyArchiveToContainerCmd("container-id");
- order.verify(lifecycleManager).startCreated(org.mockito.ArgumentMatchers.eq("container-id"), any());
+ order.verify(lifecycleManager).startCreated(ArgumentMatchers.eq("container-id"), any());
}
@Test
@@ -650,7 +651,7 @@ class RdsContainerManagerTest {
manager.stopAll();
verify(lifecycleManager, times(2)).stopAndRemoveStrict(
- any(), org.mockito.ArgumentMatchers.isNull());
+ any(), ArgumentMatchers.isNull());
}
@Test
@@ -816,7 +817,7 @@ class RdsContainerManagerTest {
ContainerLifecycleManager lifecycleManager = mock(ContainerLifecycleManager.class);
when(lifecycleManager.create(any()))
.thenThrow(new IllegalStateException("no such image: mysql:8.0"));
- DockerClient dockerClient = mock(DockerClient.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ DockerClient dockerClient = mock(DockerClient.class, Mockito.RETURNS_DEEP_STUBS);
when(lifecycleManager.getDockerClient()).thenReturn(dockerClient);
RdsContainerManager manager = daemonlessCapableManager(lifecycleManager);
@@ -844,10 +845,10 @@ class RdsContainerManagerTest {
DatabaseEngine.MYSQL, "mysql:8.0", "root", "password", "db", Map.of()));
// A Docker daemon appears.
- org.mockito.Mockito.reset(lifecycleManager);
+ Mockito.reset(lifecycleManager);
stubStarts(lifecycleManager, new ContainerLifecycleManager.ContainerInfo(
"late-container", Map.of(3306, new ContainerLifecycleManager.EndpointInfo("db1", 3306))));
- DockerClient dockerClient = mock(DockerClient.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ DockerClient dockerClient = mock(DockerClient.class, Mockito.RETURNS_DEEP_STUBS);
when(lifecycleManager.getDockerClient()).thenReturn(dockerClient);
RdsContainerHandle handle = manager.tryStart(runtimeId, "db1", "db1", "floci-rds-db1",
@@ -883,10 +884,10 @@ class RdsContainerManagerTest {
assertEquals("created-container", manager.getActiveHandle(runtimeId).getContainerId());
// The daemon is back: the leftover is removed first, then the start goes through.
- org.mockito.Mockito.reset(lifecycleManager);
+ Mockito.reset(lifecycleManager);
stubStarts(lifecycleManager, new ContainerLifecycleManager.ContainerInfo(
"late-container", Map.of(3306, new ContainerLifecycleManager.EndpointInfo("db1", 3306))));
- DockerClient dockerClient = mock(DockerClient.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ DockerClient dockerClient = mock(DockerClient.class, Mockito.RETURNS_DEEP_STUBS);
when(lifecycleManager.getDockerClient()).thenReturn(dockerClient);
RdsContainerHandle handle = manager.tryStart(runtimeId, "db1", "db1", "floci-rds-db1",
@@ -894,7 +895,7 @@ class RdsContainerManagerTest {
assertEquals("late-container", handle.getContainerId());
verify(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("created-container"), any());
+ ArgumentMatchers.eq("created-container"), any());
}
@Test
@@ -908,12 +909,12 @@ class RdsContainerManagerTest {
Map.of(3306, new ContainerLifecycleManager.EndpointInfo("db1", 3306))),
new ContainerLifecycleManager.ContainerInfo("second-container",
Map.of(3306, new ContainerLifecycleManager.EndpointInfo("db1", 3306))));
- DockerClient dockerClient = mock(DockerClient.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ DockerClient dockerClient = mock(DockerClient.class, Mockito.RETURNS_DEEP_STUBS);
when(lifecycleManager.getDockerClient()).thenReturn(dockerClient);
doThrow(new IllegalStateException("Failed to remove container first-container"))
.doNothing()
.when(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("first-container"), any());
+ ArgumentMatchers.eq("first-container"), any());
RdsContainerManager manager = daemonlessCapableManager(lifecycleManager);
String runtimeId = "arn:aws:rds:us-east-1:000000000000:db:db1";
@@ -928,7 +929,7 @@ class RdsContainerManagerTest {
assertEquals("second-container", retried.getContainerId());
assertEquals(retried, manager.getActiveHandle(runtimeId));
verify(lifecycleManager, times(2)).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("first-container"), any());
+ ArgumentMatchers.eq("first-container"), any());
}
@Test
@@ -1016,7 +1017,7 @@ class RdsContainerManagerTest {
.thenThrow(new IllegalStateException("Docker unavailable"))
.thenReturn("container-b");
when(lifecycleManager.startCreated(
- org.mockito.ArgumentMatchers.eq("container-b"), any()))
+ ArgumentMatchers.eq("container-b"), any()))
.thenReturn(new ContainerLifecycleManager.ContainerInfo(
"container-b", Map.of(3306,
new ContainerLifecycleManager.EndpointInfo("db1", 3306))));
@@ -1076,8 +1077,8 @@ class RdsContainerManagerTest {
assertEquals("container-b", retried.getContainerId());
verify(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("container-a"),
- org.mockito.ArgumentMatchers.isNull());
+ ArgumentMatchers.eq("container-a"),
+ ArgumentMatchers.isNull());
}
@Test
@@ -1119,7 +1120,7 @@ class RdsContainerManagerTest {
ContainerLifecycleManager lifecycleManager = mock(ContainerLifecycleManager.class);
when(lifecycleManager.create(any())).thenReturn("created-container");
when(lifecycleManager.startCreated(
- org.mockito.ArgumentMatchers.eq("created-container"), any()))
+ ArgumentMatchers.eq("created-container"), any()))
.thenThrow(new IllegalStateException("Docker start failed"));
doThrow(new IllegalStateException("Docker cleanup failed"))
.doNothing()
@@ -1196,7 +1197,7 @@ class RdsContainerManagerTest {
return "container-a";
});
when(lifecycleManager.startCreated(
- org.mockito.ArgumentMatchers.eq("container-a"), any()))
+ ArgumentMatchers.eq("container-a"), any()))
.thenReturn(new ContainerLifecycleManager.ContainerInfo(
"container-a", Map.of(3306,
new ContainerLifecycleManager.EndpointInfo("db1", 3306))));
@@ -1259,9 +1260,9 @@ class RdsContainerManagerTest {
assertDoesNotThrow(manager::stopAll);
verify(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("container-a"), any());
+ ArgumentMatchers.eq("container-a"), any());
verify(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("container-b"), any());
+ ArgumentMatchers.eq("container-b"), any());
assertEquals("container-a", manager.getActiveHandle(runtimeA).getContainerId());
assertNull(manager.getActiveHandle(runtimeB));
}
@@ -1386,7 +1387,7 @@ class RdsContainerManagerTest {
assertEquals("floci-aws-rds-db1", spec.getValue().name(),
"the container is renamed to the current prefix");
verify(lifecycleManager).ensureVolume("floci-rds-db1");
- verify(lifecycleManager, org.mockito.Mockito.never()).ensureVolume("floci-aws-rds-db1");
+ verify(lifecycleManager, Mockito.never()).ensureVolume("floci-aws-rds-db1");
// A pre-migration container under the old name holds the volume's engine lock, so it is
// cleared too before the new one starts.
verify(lifecycleManager).removeIfExistsStrict("floci-rds-db1");
@@ -1423,8 +1424,8 @@ class RdsContainerManagerTest {
assertEquals("db1", handle.getRuntimeId());
manager.stop(handle);
verify(lifecycleManager).stopAndRemoveStrict(
- org.mockito.ArgumentMatchers.eq("container-id"),
- org.mockito.ArgumentMatchers.isNull());
+ ArgumentMatchers.eq("container-id"),
+ ArgumentMatchers.isNull());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/proxy/PostgresProtocolHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/proxy/PostgresProtocolHandlerTest.java
index da825da505..341ccc777e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/proxy/PostgresProtocolHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/proxy/PostgresProtocolHandlerTest.java
@@ -38,6 +38,7 @@ import java.security.cert.X509Certificate;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -1395,7 +1396,7 @@ class PostgresProtocolHandlerTest {
@Test
void iamSessionKeepsRelayingWhenTheReportedRoleIsUnchanged() throws Exception {
byte[] wideRow = new byte[40_000];
- java.util.Arrays.fill(wideRow, (byte) 'x');
+ Arrays.fill(wideRow, (byte) 'x');
try (ServerSocket backendServer = new ServerSocket(0);
ServerSocket clientServer = new ServerSocket(0)) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/rdsdata/RdsDataResourceResolverTest.java b/src/test/java/io/github/hectorvent/floci/services/rdsdata/RdsDataResourceResolverTest.java
index 96e955e4c5..cf1d5476e9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rdsdata/RdsDataResourceResolverTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rdsdata/RdsDataResourceResolverTest.java
@@ -17,6 +17,7 @@ import io.github.hectorvent.floci.services.rds.proxy.RdsProxyManager;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
+import org.mockito.Mockito;
import java.time.Instant;
import java.util.ArrayList;
@@ -312,6 +313,6 @@ class RdsDataResourceResolverTest {
assertEquals("BadRequestException", error.getErrorCode());
assertEquals(400, error.getHttpStatus());
- org.mockito.Mockito.verifyNoInteractions(rdsService);
+ Mockito.verifyNoInteractions(rdsService);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSpectrumIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSpectrumIntegrationTest.java
index 52cac96454..feac67f541 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSpectrumIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSpectrumIntegrationTest.java
@@ -377,7 +377,7 @@ class RedshiftSpectrumIntegrationTest {
// Phase 1 does not support bind-parameterized Spectrum predicates (SpectrumQueryClassifier
// rejects them), so this exercises Extended Query with a literal predicate: pgjdbc still
// uses Parse/Bind/Describe/Execute/Sync for PreparedStatement even without a '?'.
- try (java.sql.PreparedStatement prepared = connection.prepareStatement(
+ try (PreparedStatement prepared = connection.prepareStatement(
"SELECT id, name FROM analytics_ext.events WHERE id = 1")) {
// Forces pgjdbc to send Describe('S', ...) (Describe Statement, not just Describe
// Portal): the response must be ParameterDescription followed by RowDescription/NoData.
@@ -417,7 +417,7 @@ class RedshiftSpectrumIntegrationTest {
// Fetch size only becomes a real server-side cursor (Execute with maxRows > 0, answered
// with PortalSuspended) in pgjdbc when autoCommit is off.
connection.setAutoCommit(false);
- try (java.sql.PreparedStatement prepared = connection.prepareStatement(
+ try (PreparedStatement prepared = connection.prepareStatement(
"SELECT id, name FROM analytics_fetch.events")) {
prepared.setFetchSize(2);
List<Integer> ids = new ArrayList<>();
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
index 092ee6acc6..6310da2b5c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/container/RedshiftContainerManagerTest.java
@@ -21,11 +21,15 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.C
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.EndpointInfo;
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
import io.github.hectorvent.floci.services.redshift.model.Cluster;
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.InOrder;
+import org.mockito.Mockito;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -120,7 +124,7 @@ class RedshiftContainerManagerTest {
lifecycleManager = mock(ContainerLifecycleManager.class);
logStreamer = mock(ContainerLogStreamer.class);
containerDetector = mock(ContainerDetector.class);
- config = mock(EmulatorConfig.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ config = mock(EmulatorConfig.class, Mockito.RETURNS_DEEP_STUBS);
dockerClient = mock(DockerClient.class);
when(lifecycleManager.getDockerClient()).thenReturn(dockerClient);
@@ -129,7 +133,7 @@ class RedshiftContainerManagerTest {
when(config.defaultRegion()).thenReturn("us-east-1");
// Default mock for execCreateCmd/execStartCmd/inspectExecCmd to make waitForReady succeed instantly
- ExecCreateCmd defaultCreateCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd defaultCreateCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse defaultCreateResponse = mock(ExecCreateCmdResponse.class);
when(defaultCreateResponse.getId()).thenReturn("exec-default");
when(defaultCreateCmd.exec()).thenReturn(defaultCreateResponse);
@@ -150,7 +154,7 @@ class RedshiftContainerManagerTest {
when(defaultInspectCmd.exec()).thenReturn(defaultInspectResponse);
when(dockerClient.inspectExecCmd(anyString())).thenReturn(defaultInspectCmd);
- CopyArchiveToContainerCmd defaultCopyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ CopyArchiveToContainerCmd defaultCopyCmd = mock(CopyArchiveToContainerCmd.class, Mockito.RETURNS_SELF);
when(dockerClient.copyArchiveToContainerCmd(anyString())).thenReturn(defaultCopyCmd);
manager = new RedshiftContainerManager(
@@ -198,7 +202,7 @@ class RedshiftContainerManagerTest {
@Test
void takeSnapshotSuccess() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -209,7 +213,7 @@ class RedshiftContainerManagerTest {
assertTrue(manager.getContainer(ACCOUNT_ID, "test-cluster").isPresent());
// Mock docker exec for pg_dump
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-1");
when(createCmd.exec()).thenReturn(createResponse);
@@ -231,11 +235,11 @@ class RedshiftContainerManagerTest {
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectCmd);
// mock copyArchiveFromContainerCmd
- CopyArchiveFromContainerCmd copyCmd = mock(CopyArchiveFromContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ CopyArchiveFromContainerCmd copyCmd = mock(CopyArchiveFromContainerCmd.class, Mockito.RETURNS_SELF);
byte[] tarBytes = "-- PostgreSQL dump\nCREATE TABLE foo (id int);\n".getBytes(StandardCharsets.UTF_8);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try (org.apache.commons.compress.archivers.tar.TarArchiveOutputStream tar = new org.apache.commons.compress.archivers.tar.TarArchiveOutputStream(bos)) {
- org.apache.commons.compress.archivers.tar.TarArchiveEntry entry = new org.apache.commons.compress.archivers.tar.TarArchiveEntry("dump.sql");
+ try (TarArchiveOutputStream tar = new TarArchiveOutputStream(bos)) {
+ TarArchiveEntry entry = new TarArchiveEntry("dump.sql");
entry.setSize(tarBytes.length);
tar.putArchiveEntry(entry);
tar.write(tarBytes);
@@ -257,14 +261,14 @@ class RedshiftContainerManagerTest {
@Test
void takeSnapshotFailureExitCode() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
manager.start(ACCOUNT_ID, "test-cluster", "admin", "pass");
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-fail");
when(createCmd.exec()).thenReturn(createResponse);
@@ -295,7 +299,7 @@ class RedshiftContainerManagerTest {
@Test
void restoreSnapshotEmptyDump() {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -309,7 +313,7 @@ class RedshiftContainerManagerTest {
@Test
void restoreSnapshotSuccess() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -317,11 +321,11 @@ class RedshiftContainerManagerTest {
manager.start(ACCOUNT_ID, "test-cluster", "admin", "pass");
// Mock copyArchiveToContainerCmd
- CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, Mockito.RETURNS_SELF);
when(dockerClient.copyArchiveToContainerCmd("cont-123")).thenReturn(copyCmd);
// Mock docker exec for psql
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-restore");
when(createCmd.exec()).thenReturn(createResponse);
@@ -345,8 +349,8 @@ class RedshiftContainerManagerTest {
Path tempFile = Files.createTempFile("test-restore-snapshot", ".sql");
try {
manager.restoreSnapshot(ACCOUNT_ID, "test-cluster", "admin", "dev",tempFile);
- verify(dockerClient, org.mockito.Mockito.times(2)).copyArchiveToContainerCmd("cont-123");
- verify(dockerClient, org.mockito.Mockito.times(4)).execCreateCmd("cont-123");
+ verify(dockerClient, Mockito.times(2)).copyArchiveToContainerCmd("cont-123");
+ verify(dockerClient, Mockito.times(4)).execCreateCmd("cont-123");
} finally {
Files.deleteIfExists(tempFile);
}
@@ -354,7 +358,7 @@ class RedshiftContainerManagerTest {
@Test
void stopRemovesContainer() {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -442,7 +446,7 @@ class RedshiftContainerManagerTest {
@Test
void sameClusterIdentifierAcrossAccountsDoesNotCollide() {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo infoA = new ContainerInfo("cont-account-a", Map.of(5432, new EndpointInfo("localhost", 5432)));
ContainerInfo infoB = new ContainerInfo("cont-account-b", Map.of(5432, new EndpointInfo("localhost", 5433)));
@@ -484,7 +488,7 @@ class RedshiftContainerManagerTest {
void adoptOrStartFallsBackToStartWhenNoExistingContainer() {
String containerName = "floci-aws-redshift-" + ACCOUNT_ID + "-test-cluster";
when(lifecycleManager.findByName(containerName)).thenReturn(Optional.empty());
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-fresh", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -497,13 +501,13 @@ class RedshiftContainerManagerTest {
@Test
void alterUserPasswordSuccess() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
manager.start(ACCOUNT_ID, "test-cluster", "admin", "pass");
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-alter");
when(createCmd.exec()).thenReturn(createResponse);
@@ -526,7 +530,7 @@ class RedshiftContainerManagerTest {
manager.alterUserPassword(ACCOUNT_ID, "test-cluster", "admin", "NewSecret1");
- verify(dockerClient, org.mockito.Mockito.times(4)).execCreateCmd("cont-123");
+ verify(dockerClient, Mockito.times(4)).execCreateCmd("cont-123");
}
@Test
@@ -539,7 +543,7 @@ class RedshiftContainerManagerTest {
@Test
void alterUserPasswordInvalidUsername() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -560,7 +564,7 @@ class RedshiftContainerManagerTest {
@Test
void alterUserPasswordInvalidPassword() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
@@ -593,13 +597,13 @@ class RedshiftContainerManagerTest {
@Test
void alterUserPasswordExecFailure() throws Exception {
- ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, org.mockito.Mockito.RETURNS_SELF);
+ ContainerBuilder.Builder specBuilder = mock(ContainerBuilder.Builder.class, Mockito.RETURNS_SELF);
when(containerBuilder.newContainer(anyString())).thenReturn(specBuilder);
ContainerInfo info = new ContainerInfo("cont-123", Map.of(5432, new EndpointInfo("localhost", 5432)));
when(lifecycleManager.createAndStartEphemeral(any())).thenReturn(info);
manager.start(ACCOUNT_ID, "test-cluster", "admin", "pass");
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-fail");
when(createCmd.exec()).thenReturn(createResponse);
@@ -678,10 +682,10 @@ class RedshiftContainerManagerTest {
@Test
void bootstrapCatalogSuccess() {
- CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, Mockito.RETURNS_SELF);
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap")).thenReturn(copyCmd);
- ExecCreateCmd createCmd = mock(ExecCreateCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ ExecCreateCmd createCmd = mock(ExecCreateCmd.class, Mockito.RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-bootstrap");
when(createCmd.exec()).thenReturn(createResponse);
@@ -696,17 +700,17 @@ class RedshiftContainerManagerTest {
manager.bootstrapCatalog("cont-bootstrap", "admin", "dev");
verify(dockerClient).copyArchiveToContainerCmd("cont-bootstrap");
- verify(dockerClient, org.mockito.Mockito.times(2)).execCreateCmd("cont-bootstrap");
+ verify(dockerClient, Mockito.times(2)).execCreateCmd("cont-bootstrap");
}
@Test
void bootstrapCatalogFailureDoesNotThrow() {
- CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, org.mockito.Mockito.RETURNS_SELF);
+ CopyArchiveToContainerCmd copyCmd = mock(CopyArchiveToContainerCmd.class, Mockito.RETURNS_SELF);
when(copyCmd.exec()).thenThrow(new RuntimeException("Docker copy error"));
when(dockerClient.copyArchiveToContainerCmd("cont-bootstrap-fail")).thenReturn(copyCmd);
// Must not bubble an exception that fails cluster startup
- org.junit.jupiter.api.Assertions.assertDoesNotThrow(() ->
+ Assertions.assertDoesNotThrow(() ->
manager.bootstrapCatalog("cont-bootstrap-fail", "admin", "dev"));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumCatalogTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumCatalogTest.java
index 7fe21220be..62eecde9dd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumCatalogTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumCatalogTest.java
@@ -7,6 +7,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.List;
+import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -38,7 +39,7 @@ class SpectrumCatalogTest {
catalog.createSchema(schema);
- assertEquals(java.util.Optional.of(schema), catalog.schema(ACCOUNT, "dev", "analytics"));
+ assertEquals(Optional.of(schema), catalog.schema(ACCOUNT, "dev", "analytics"));
}
@Test
@@ -51,7 +52,7 @@ class SpectrumCatalogTest {
catalog.createSchema(owning);
catalog.createTable(table("events"));
- assertEquals(java.util.Optional.of(owning), catalog.findLegacySchema(ACCOUNT, "dev", "analytics"));
+ assertEquals(Optional.of(owning), catalog.findLegacySchema(ACCOUNT, "dev", "analytics"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumInterceptorTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumInterceptorTest.java
index 4e01d359bf..19917fc220 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumInterceptorTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/spectrum/SpectrumInterceptorTest.java
@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
import java.net.Socket;
import java.util.List;
+import java.util.Optional;
import static io.github.hectorvent.floci.testing.InlineMocks.inlineMock;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -50,8 +51,8 @@ class SpectrumInterceptorTest {
"s3://b/root/", null);
SpectrumMaterializer.Materialization materialization = new SpectrumMaterializer.Materialization(
"spectrum_tmp_x", table.columns());
- when(catalog.table("000000000000", "dev", "analytics", "events")).thenReturn(java.util.Optional.of(table));
- when(catalog.schema("000000000000", "dev", "analytics")).thenReturn(java.util.Optional.of(schema));
+ when(catalog.table("000000000000", "dev", "analytics", "events")).thenReturn(Optional.of(table));
+ when(catalog.schema("000000000000", "dev", "analytics")).thenReturn(Optional.of(schema));
when(materializer.nextIdentifier()).thenReturn("spectrum_tmp_x");
when(materializer.materialize(any(), any(), any(), any(), eq("spectrum_tmp_x"))).thenReturn(materialization);
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataFieldMapperTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataFieldMapperTest.java
index 3ad42c8ebe..6730622fa8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataFieldMapperTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataFieldMapperTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.jupiter.api.Test;
+import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.sql.Types;
import java.util.List;
@@ -23,7 +24,7 @@ class RedshiftDataFieldMapperTest {
assertEquals(1.5, RedshiftDataFieldMapper.toField(om, 1.5d, Types.DOUBLE, false).get("doubleValue").asDouble());
assertTrue(RedshiftDataFieldMapper.toField(om, true, Types.BOOLEAN, false).get("booleanValue").asBoolean());
assertEquals("12.34",
- RedshiftDataFieldMapper.toField(om, new java.math.BigDecimal("12.34"), Types.NUMERIC, false)
+ RedshiftDataFieldMapper.toField(om, new BigDecimal("12.34"), Types.NUMERIC, false)
.get("stringValue").asText());
assertEquals("hello",
RedshiftDataFieldMapper.toField(om, "hello", Types.VARCHAR, false).get("stringValue").asText());
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessIntegrationTest.java
index 96e4d3f3c5..c7cf734c0b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessIntegrationTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.InjectMock;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@@ -656,7 +657,7 @@ class RedshiftServerlessIntegrationTest {
.body("resourcePolicy.policy", equalTo(policyJson));
}
- private static io.restassured.response.ValidatableResponse callAs(String accountId, String action, String body) {
+ private static ValidatableResponse callAs(String accountId, String action, String body) {
return given()
.header("X-Amz-Target", TARGET_PREFIX + action)
.header("Authorization", "AWS4-HMAC-SHA256 Credential=" + accountId
@@ -784,7 +785,7 @@ class RedshiftServerlessIntegrationTest {
call("DeleteScheduledAction", "{\"scheduledActionName\":\"admin-sched\"}").statusCode(200);
}
- private static io.restassured.response.ValidatableResponse call(String action, String body) {
+ private static ValidatableResponse call(String action, String body) {
return given()
.header("X-Amz-Target", TARGET_PREFIX + action)
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessJsonHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessJsonHandlerTest.java
index d998e10b86..78f544dba6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessJsonHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessJsonHandlerTest.java
@@ -19,6 +19,7 @@ import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
import jakarta.ws.rs.core.Response;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.time.Duration;
import java.time.Instant;
@@ -106,7 +107,7 @@ class RedshiftServerlessJsonHandlerTest {
Instant.ofEpochSecond(1_800_000_000L), List.of()));
iamDbUserResolver = mock(RedshiftIamDbUserResolver.class);
when(iamDbUserResolver.resolveDbUser("AUTH")).thenReturn("IAM:alice");
- EmulatorConfig config = mock(EmulatorConfig.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ EmulatorConfig config = mock(EmulatorConfig.class, Mockito.RETURNS_DEEP_STUBS);
when(storageFactory.create(eq("redshiftserverless"), eq("redshiftserverless-snapshots.json"),
any(TypeReference.class))).thenReturn((AccountAwareStorageBackend)
AccountAwareStorageBackend.inMemory(ACCOUNT_ID));
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessServiceTest.java
index 86b1ae341a..1b938c8192 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshiftserverless/RedshiftServerlessServiceTest.java
@@ -18,6 +18,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -98,7 +99,7 @@ class RedshiftServerlessServiceTest {
when(runtime.start(any(String.class), any(String.class), any(String.class), any(String.class),
any(String.class), any(String.class), any(Endpoint.class), anyBoolean(), any()))
.thenReturn(new RedshiftServerlessRuntime.Backend("127.0.0.1", 55432));
- EmulatorConfig config = mock(EmulatorConfig.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ EmulatorConfig config = mock(EmulatorConfig.class, Mockito.RETURNS_DEEP_STUBS);
when(config.storage().persistentPath()).thenReturn(dumpDir.toString());
service = new RedshiftServerlessService(storageFactory, regionResolver, endpoints, runtime, config);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/route53/Route53VpcAssociationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/route53/Route53VpcAssociationIntegrationTest.java
index c13c0b3d58..c76984afa2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/route53/Route53VpcAssociationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/route53/Route53VpcAssociationIntegrationTest.java
@@ -4,9 +4,16 @@ import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.route53.model.HostedZone;
import io.github.hectorvent.floci.services.route53.model.VpcAssociation;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.path.xml.XmlPath;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
@@ -348,20 +355,20 @@ class Route53VpcAssociationIntegrationTest {
// ID-based continuation point. Tie-breaking by ID as well makes the total order fixed
// regardless of iteration order, so this asserts the walk is a stable ID-ascending walk.
String shared = "vpc-tiebreak-shared";
- java.util.List<String> zoneIds = new java.util.ArrayList<>();
+ List<String> zoneIds = new ArrayList<>();
for (int i = 0; i < 4; i++) {
zoneIds.add(createPrivateZone("tiebreak.internal.", "vpc-tiebreak-" + i, shared));
}
- java.util.List<String> expectedOrder = new java.util.ArrayList<>(zoneIds);
- java.util.Collections.sort(expectedOrder);
+ List<String> expectedOrder = new ArrayList<>(zoneIds);
+ Collections.sort(expectedOrder);
- java.util.List<String> walked = new java.util.ArrayList<>();
+ List<String> walked = new ArrayList<>();
String token = null;
for (int page = 0; page < zoneIds.size(); page++) {
String url = "/2013-04-01/hostedzonesbyvpc?vpcid=" + shared + "&vpcregion=us-east-1&maxitems=1"
+ (token != null ? "&nexttoken=" + token : "");
- io.restassured.response.Response resp = given().get(url).then().statusCode(200).extract().response();
- io.restassured.path.xml.XmlPath xml = resp.xmlPath();
+ Response resp = given().get(url).then().statusCode(200).extract().response();
+ XmlPath xml = resp.xmlPath();
walked.add(xml.getString("ListHostedZonesByVPCResponse.HostedZoneSummaries.HostedZoneSummary.HostedZoneId"));
String next = xml.getString("ListHostedZonesByVPCResponse.NextToken");
token = (next == null || next.isEmpty()) ? null : next;
@@ -455,7 +462,7 @@ class Route53VpcAssociationIntegrationTest {
.body(vpcRequest("DeleteVPCAssociationAuthorizationRequest", spokeVpc, ""))
.post("/2013-04-01/hostedzone/" + zoneId + "/deauthorizevpcassociation")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.emptyOrNullString());
+ .body(Matchers.emptyOrNullString());
given().header("Authorization", route53Auth(VPC_ACCOUNT))
.get("/2013-04-01/hostedzonesbyvpc?vpcid=" + spokeVpc + "&vpcregion=us-east-1")
diff --git a/src/test/java/io/github/hectorvent/floci/services/route53resolver/Route53ResolverIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/route53resolver/Route53ResolverIntegrationTest.java
index cef28de6aa..81cf7c0447 100644
--- a/src/test/java/io/github/hectorvent/floci/services/route53resolver/Route53ResolverIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/route53resolver/Route53ResolverIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.route53resolver;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.path.json.JsonPath;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -248,7 +249,7 @@ class Route53ResolverIntegrationTest {
.extract().path("ResolverEndpoint.Id");
String first = listIpAddresses(endpointId);
- List<String> ids = io.restassured.path.json.JsonPath.from(first).getList("IpAddresses.IpId");
+ List<String> ids = JsonPath.from(first).getList("IpAddresses.IpId");
assertEquals(2, ids.size());
assertEquals(2, new HashSet<>(ids).size(), "repeated entries share an IpId: " + ids);
assertEquals(first, listIpAddresses(endpointId));
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/PreSignedUrlFilterTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/PreSignedUrlFilterTest.java
index 3fcc4df5bd..09a7ee8926 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/PreSignedUrlFilterTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/PreSignedUrlFilterTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.lang.reflect.Method;
+import java.time.Instant;
import java.util.List;
import java.util.Set;
@@ -60,7 +61,7 @@ class PreSignedUrlFilterTest {
@Test
void temporaryCredentialRequiresMatchingSessionToken() throws Exception {
IamService iamService = IamServiceTestHelper.iamServiceWithSessionCredential(
- "ASIAS3EXAMPLE", "temporary-secret", "issued-token", java.time.Instant.now().plusSeconds(3600));
+ "ASIAS3EXAMPLE", "temporary-secret", "issued-token", Instant.now().plusSeconds(3600));
PreSignedUrlFilter filter = new PreSignedUrlFilter(null, null, iamService, null);
assertEquals("temporary-secret", resolveSecretKey(filter, "ASIAS3EXAMPLE", "issued-token"));
@@ -71,7 +72,7 @@ class PreSignedUrlFilterTest {
@Test
void temporaryCredentialIsRejectedAfterExpiration() throws Exception {
IamService iamService = IamServiceTestHelper.iamServiceWithSessionCredential(
- "ASIAS3EXPIRED", "temporary-secret", "issued-token", java.time.Instant.now().minusSeconds(1));
+ "ASIAS3EXPIRED", "temporary-secret", "issued-token", Instant.now().minusSeconds(1));
PreSignedUrlFilter filter = new PreSignedUrlFilter(null, null, iamService, null);
assertNull(resolveSecretKey(filter, "ASIAS3EXPIRED", "issued-token"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3AuthEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3AuthEnforcementIntegrationTest.java
index ccae446235..7c056e12c1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3AuthEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3AuthEnforcementIntegrationTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.testing.S3EnforceAuthProfile;
import io.github.hectorvent.floci.testutil.S3RequestSigner;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
import io.restassured.specification.RequestSpecification;
import jakarta.inject.Inject;
import org.junit.jupiter.api.MethodOrderer;
@@ -300,7 +301,7 @@ class S3AuthEnforcementIntegrationTest {
given()
.header("Host", WEBSITE_BUCKET + ".s3-website-us-east-1.localhost:"
- + io.restassured.RestAssured.port)
+ + RestAssured.port)
.when()
.get("/")
.then()
@@ -358,7 +359,7 @@ class S3AuthEnforcementIntegrationTest {
given()
.header("Host", WEBSITE_ERROR_BUCKET + ".s3-website-us-east-1.localhost:"
- + io.restassured.RestAssured.port)
+ + RestAssured.port)
.when()
.get("/")
.then()
@@ -623,7 +624,7 @@ class S3AuthEnforcementIntegrationTest {
@Order(23)
void virtualHostedPresignedRequestUsesOriginalHostAndPath() throws Exception {
String path = "/" + PRIVATE_KEY;
- String authority = PRIVATE_BUCKET + ".localhost:" + io.restassured.RestAssured.port;
+ String authority = PRIVATE_BUCKET + ".localhost:" + RestAssured.port;
String signature = presignedSignature(
"GET", path, "test", "test", "3600", "UNSIGNED-PAYLOAD", authority);
@@ -2217,7 +2218,7 @@ class S3AuthEnforcementIntegrationTest {
private static HttpResponse<String> putWithoutContentType(String pathAndQuery, byte[] body,
S3RequestSigner signer) throws Exception {
- URI uri = URI.create("http://localhost:" + io.restassured.RestAssured.port + "/" + pathAndQuery);
+ URI uri = URI.create("http://localhost:" + RestAssured.port + "/" + pathAndQuery);
HttpRequest.Builder request = HttpRequest.newBuilder(uri)
.PUT(HttpRequest.BodyPublishers.ofByteArray(body));
signer.headersFor("PUT", uri, body).forEach(request::header);
@@ -2233,7 +2234,7 @@ class S3AuthEnforcementIntegrationTest {
String accessKeyId, String secretKey,
String expires, String payloadHash) {
return presignedSignature(method, path, accessKeyId, secretKey, expires, payloadHash,
- "localhost:" + io.restassured.RestAssured.port);
+ "localhost:" + RestAssured.port);
}
private static String presignedSignature(String method, String path,
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3CopyObjectSourcePermissionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3CopyObjectSourcePermissionIntegrationTest.java
index ef1cb47b47..76d4da036c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3CopyObjectSourcePermissionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3CopyObjectSourcePermissionIntegrationTest.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.testutil.S3RequestSigner;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.restassured.RestAssured;
+import io.restassured.path.xml.XmlPath;
import org.junit.jupiter.api.Test;
import java.net.URI;
@@ -674,7 +675,7 @@ class S3CopyObjectSourcePermissionIntegrationTest {
.then()
.statusCode(200);
- io.restassured.path.xml.XmlPath key = given()
+ XmlPath key = given()
.formParam("Action", "CreateAccessKey")
.formParam("UserName", userName)
.header("Authorization", auth(accountId, "iam"))
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3CorsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3CorsIntegrationTest.java
index 3fff8e5072..b0ce752fb0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3CorsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3CorsIntegrationTest.java
@@ -1,11 +1,15 @@
package io.github.hectorvent.floci.services.s3;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.util.Arrays;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -631,18 +635,18 @@ class S3CorsIntegrationTest {
// Vary may be a single comma-separated string or multiple header lines;
// either way "Origin" should appear exactly once.
- long count = java.util.Arrays.stream(vary.split(","))
+ long count = Arrays.stream(vary.split(","))
.map(String::trim)
.filter("Origin"::equalsIgnoreCase)
.count();
- org.junit.jupiter.api.Assertions.assertEquals(1, count,
+ Assertions.assertEquals(1, count,
"Vary: Origin should appear exactly once, got: " + vary);
}
@Test
@Order(72)
void accessControlAllowOriginAppearsExactlyOnce() {
- io.restassured.response.Response resp = given()
+ Response resp = given()
.header("Origin", "http://localhost:3000")
.when()
.get("/" + BUCKET + "/hello.txt")
@@ -652,7 +656,7 @@ class S3CorsIntegrationTest {
// getHeaders() returns all values including duplicates
long count = resp.headers().getList("Access-Control-Allow-Origin").stream().count();
- org.junit.jupiter.api.Assertions.assertEquals(1, count,
+ Assertions.assertEquals(1, count,
"Access-Control-Allow-Origin must appear exactly once");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3EventBridgeNotificationValidationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3EventBridgeNotificationValidationIntegrationTest.java
index d1d5b74ff8..dd83ab8a47 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3EventBridgeNotificationValidationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3EventBridgeNotificationValidationIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.s3;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
@@ -98,7 +99,7 @@ class S3EventBridgeNotificationValidationIntegrationTest {
return bucket;
}
- private static io.restassured.response.ValidatableResponse putNotification(String bucket, String body) {
+ private static ValidatableResponse putNotification(String bucket, String body) {
return given()
.contentType("application/xml")
.body(body)
@@ -107,7 +108,7 @@ class S3EventBridgeNotificationValidationIntegrationTest {
.then();
}
- private static io.restassured.response.ValidatableResponse getNotification(String bucket) {
+ private static ValidatableResponse getNotification(String bucket) {
return given()
.when()
.get("/" + bucket + "?notification")
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3LeadingSlashKeyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3LeadingSlashKeyIntegrationTest.java
index 5cbdf780ad..f359af679e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3LeadingSlashKeyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3LeadingSlashKeyIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.s3;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -33,7 +34,7 @@ class S3LeadingSlashKeyIntegrationTest {
private static final String BUCKET = "test-slash-bucket";
- @io.quarkus.test.common.http.TestHTTPResource("/")
+ @TestHTTPResource("/")
URI baseUri;
// --- Setup ---
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3MultipartIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3MultipartIntegrationTest.java
index 526aacd2f7..df7acbdb73 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3MultipartIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3MultipartIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.s3;
import io.github.hectorvent.floci.services.s3.model.S3Checksum;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -1335,7 +1336,7 @@ class S3MultipartIntegrationTest {
.statusCode(200);
}
- private static io.restassured.response.ValidatableResponse completeMultipart(String uploadId, String key,
+ private static ValidatableResponse completeMultipart(String uploadId, String key,
String body) {
return given().contentType("application/xml").body(body)
.when().post("/" + BUCKET + "/" + key + "?uploadId=" + uploadId).then();
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostAuthEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostAuthEnforcementIntegrationTest.java
index f730f73b01..8999c79e2c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostAuthEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostAuthEnforcementIntegrationTest.java
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.testutil.S3RequestSigner;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -77,7 +78,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -100,7 +101,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("SignatureDoesNotMatch"));
+ .body("Error.Code", Matchers.equalTo("SignatureDoesNotMatch"));
given()
.filter(S3RequestSigner.signedAs(LEGACY_ACCESS_KEY_ID, LEGACY_SECRET_KEY))
@@ -131,7 +132,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("SignatureDoesNotMatch"));
+ .body("Error.Code", Matchers.equalTo("SignatureDoesNotMatch"));
}
@Test
@@ -155,7 +156,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -180,7 +181,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -205,7 +206,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -232,7 +233,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -264,7 +265,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.get("/" + BUCKET + "/" + key)
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.equalTo(fileContent));
+ .body(Matchers.equalTo(fileContent));
}
@Test
@@ -300,7 +301,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
@@ -332,7 +333,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
// --- IAM identity-policy enforcement (#3195): a genuinely-signed presigned POST from a
@@ -370,7 +371,7 @@ class S3PresignedPostAuthEnforcementIntegrationTest {
.post("/" + BUCKET)
.then()
.statusCode(403)
- .body("Error.Code", org.hamcrest.Matchers.equalTo("AccessDenied"));
+ .body("Error.Code", Matchers.equalTo("AccessDenied"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIntegrationTest.java
index 7ea91d23e7..fb22f116d0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPostIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.s3;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -245,7 +246,7 @@ class S3PresignedPostIntegrationTest {
.statusCode(200)
.extract().body().asByteArray();
- org.junit.jupiter.api.Assertions.assertArrayEquals(binaryData, retrieved);
+ Assertions.assertArrayEquals(binaryData, retrieved);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPutTaggingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPutTaggingIntegrationTest.java
index 2a7b3bf1a2..5403a9dd6d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPutTaggingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3PresignedPutTaggingIntegrationTest.java
@@ -45,7 +45,7 @@ class S3PresignedPutTaggingIntegrationTest {
.then()
.statusCode(200);
- int port = io.restassured.RestAssured.port;
+ int port = RestAssured.port;
String fullBaseUrl = "http://localhost:" + port;
String presignedUrl = presignGenerator.generatePresignedUrl(
fullBaseUrl, BUCKET, "tagged-via-presign.txt", "PUT", 3600);
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3SelectIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3SelectIntegrationTest.java
index ff179e94e1..ed6915bbdd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3SelectIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3SelectIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.s3;
import io.github.hectorvent.floci.services.s3.EventStreamMessages.Message;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Test;
import java.util.List;
@@ -22,7 +23,7 @@ class S3SelectIntegrationTest {
given().header("Host", bucket + ".localhost").body(body).when().put("/" + key).then().statusCode(200);
}
- private static io.restassured.response.ValidatableResponse select(
+ private static ValidatableResponse select(
String bucket, String key, String expression,
String inputSerialization, String outputSerialization) {
// XML-escape the expression so operators like < and & are valid inside <Expression>
@@ -45,7 +46,7 @@ class S3SelectIntegrationTest {
.then().statusCode(200);
}
- private static io.restassured.response.ValidatableResponse selectExpectingStatus(
+ private static ValidatableResponse selectExpectingStatus(
String bucket,
String key,
String expression,
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3ServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3ServiceTest.java
index 6ff30d9b50..da64c282bf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3ServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3ServiceTest.java
@@ -15,6 +15,7 @@ import io.github.hectorvent.floci.services.s3.model.ChecksumType;
import io.github.hectorvent.floci.services.s3.model.FilterRule;
import io.github.hectorvent.floci.services.s3.model.GetObjectAttributesResult;
import io.github.hectorvent.floci.services.s3.model.LambdaNotification;
+import io.github.hectorvent.floci.services.s3.model.MultipartUpload;
import io.github.hectorvent.floci.services.s3.model.NotificationConfiguration;
import io.github.hectorvent.floci.services.s3.model.ObjectAttributeName;
import io.github.hectorvent.floci.services.s3.model.PutObjectOptions;
@@ -46,6 +47,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
@@ -688,7 +690,7 @@ class S3ServiceTest {
s3Service.createBucket("test-bucket", "us-east-1");
byte[] part1 = new byte[5 * 1024 * 1024];
byte[] part2 = "Part2Data-World".getBytes(StandardCharsets.UTF_8);
- var upload = s3Service.initiateMultipartUpload("test-bucket", "multipart.bin", "application/octet-stream");
+ MultipartUpload upload = s3Service.initiateMultipartUpload("test-bucket", "multipart.bin", "application/octet-stream");
s3Service.uploadPart("test-bucket", "multipart.bin", upload.getUploadId(), 1, part1);
s3Service.uploadPart("test-bucket", "multipart.bin", upload.getUploadId(), 2, part2);
S3Object source = s3Service.completeMultipartUpload("test-bucket", "multipart.bin", upload.getUploadId(),
@@ -1122,9 +1124,9 @@ class S3ServiceTest {
websiteBucket("index.html", null);
s3Service.putObject("site", "docs/index.html", "hi".getBytes(), "text/html", null);
- var resolution = s3Service.resolveWebsiteRequest("site", "docs", true, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "docs", true, UNSIGNED);
- var serve = assertInstanceOf(S3Service.WebsiteResolution.ServeObject.class, resolution);
+ S3Service.WebsiteResolution.ServeObject serve = assertInstanceOf(S3Service.WebsiteResolution.ServeObject.class, resolution);
assertEquals("docs/index.html", serve.key());
}
@@ -1134,7 +1136,7 @@ class S3ServiceTest {
s3Service.putObject("site", "index.html", "root".getBytes(), "text/html", null);
// The site root is a directory request even though the caller saw no trailing slash.
- var resolution = s3Service.resolveWebsiteRequest("site", "", false, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "", false, UNSIGNED);
assertEquals("index.html",
assertInstanceOf(S3Service.WebsiteResolution.ServeObject.class, resolution).key());
@@ -1146,7 +1148,7 @@ class S3ServiceTest {
s3Service.putObject("site", "docs/index.html", "hi".getBytes(), "text/html", null);
// No trailing slash, no object at "docs", but an index lives beneath it.
- var resolution = s3Service.resolveWebsiteRequest("site", "docs", false, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "docs", false, UNSIGNED);
assertInstanceOf(S3Service.WebsiteResolution.RedirectToDirectory.class, resolution);
}
@@ -1158,7 +1160,7 @@ class S3ServiceTest {
s3Service.putObject("site", "docs/index.html", "hi".getBytes(), "text/html", null);
// An exact object hit is served by the normal object path, not redirected.
- var resolution = s3Service.resolveWebsiteRequest("site", "docs", false, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "docs", false, UNSIGNED);
assertInstanceOf(S3Service.WebsiteResolution.NotAWebsite.class, resolution);
}
@@ -1168,9 +1170,9 @@ class S3ServiceTest {
websiteBucket("index.html", "error.html");
s3Service.putObject("site", "error.html", "oops".getBytes(), "text/html", null);
- var resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
- var err = assertInstanceOf(S3Service.WebsiteResolution.ErrorDocument.class, resolution);
+ S3Service.WebsiteResolution.ErrorDocument err = assertInstanceOf(S3Service.WebsiteResolution.ErrorDocument.class, resolution);
assertEquals(404, err.status());
assertArrayEquals("oops".getBytes(), err.object().getData());
}
@@ -1179,7 +1181,7 @@ class S3ServiceTest {
void resolveWebsiteRequestFallsBackToDefaultErrorWhenNoErrorDocumentConfigured() {
websiteBucket("index.html", null);
- var resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
assertEquals(404,
assertInstanceOf(S3Service.WebsiteResolution.DefaultError.class, resolution).status());
@@ -1190,7 +1192,7 @@ class S3ServiceTest {
// Configured but never uploaded: S3 serves its built-in page rather than 500-ing.
websiteBucket("index.html", "error.html");
- var resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("site", "missing", true, UNSIGNED);
assertEquals(404,
assertInstanceOf(S3Service.WebsiteResolution.DefaultError.class, resolution).status());
@@ -1200,7 +1202,7 @@ class S3ServiceTest {
void resolveWebsiteRequestIsNotAWebsiteWithoutConfiguration() {
s3Service.createBucket("plain", "us-east-1");
- var resolution = s3Service.resolveWebsiteRequest("plain", "any", true, UNSIGNED);
+ S3Service.WebsiteResolution resolution = s3Service.resolveWebsiteRequest("plain", "any", true, UNSIGNED);
assertInstanceOf(S3Service.WebsiteResolution.NotAWebsite.class, resolution);
}
@@ -1271,7 +1273,7 @@ class S3ServiceTest {
// Through the real storage layer rather than Jackson alone: written, flushed to disk, and
// read back by a second service over the same file, the way a restart does it.
Path bucketsFile = tempDir.resolve("s3-buckets.json");
- var beforeRestart = new HybridStorage<String, Bucket>(
+ HybridStorage<String, Bucket> beforeRestart = new HybridStorage<String, Bucket>(
bucketsFile, new TypeReference<Map<String, Bucket>>() {}, 60000);
S3Service before = new S3Service(beforeRestart, new InMemoryStorage<>(), tempDir.resolve("s3a"), false);
before.createBucket("persisted-metrics", "us-east-1");
@@ -1279,7 +1281,7 @@ class S3ServiceTest {
beforeRestart.flush();
beforeRestart.shutdown();
- var afterRestart = new HybridStorage<String, Bucket>(
+ HybridStorage<String, Bucket> afterRestart = new HybridStorage<String, Bucket>(
bucketsFile, new TypeReference<Map<String, Bucket>>() {}, 60000);
afterRestart.load();
try {
@@ -1334,7 +1336,7 @@ class S3ServiceTest {
@Test
void analyticsAndInventoryConfigurationsSurviveAJacksonRoundTrip() throws Exception {
- var mapper = new ObjectMapper().findAndRegisterModules();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
Bucket bucket = new Bucket("persisted-configs");
bucket.setAnalyticsConfigurations(new LinkedHashMap<>(Map.of("a", "<Id>a</Id>")));
bucket.setInventoryConfigurations(new LinkedHashMap<>(Map.of("i", "<Id>i</Id>")));
@@ -1348,7 +1350,7 @@ class S3ServiceTest {
void metricsConfigurationsSurviveAJacksonRoundTrip() throws Exception {
// Bucket records are persisted as JSON, so the configurations have to come back after a
// restart, and a record written before the field existed has to still load.
- var mapper = new ObjectMapper().findAndRegisterModules();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
Bucket bucket = new Bucket("persisted");
bucket.setMetricsConfigurations(new LinkedHashMap<>(
Map.of("EntireBucket", "<Id>EntireBucket</Id>")));
@@ -1381,7 +1383,7 @@ class S3ServiceTest {
// mutation's re-read and its write would still be undone. That interleaving is too narrow
// to force from a test, so what is asserted here is the property that closes it — the
// delete waits for whoever holds the record's monitor.
- var buckets = new InMemoryStorage<String, Bucket>();
+ InMemoryStorage<String, Bucket> buckets = new InMemoryStorage<String, Bucket>();
S3Service service = new S3Service(buckets, new InMemoryStorage<>(), tempDir.resolve("s3-monitor"), false);
service.createBucket("monitor-bucket", "us-east-1");
Bucket record = buckets.get("monitor-bucket").orElseThrow();
@@ -1410,13 +1412,13 @@ class S3ServiceTest {
// would be undone by the write. The interleaving is forced rather than raced for: the test
// holds the bucket monitor, lets the put resolve the record and block on it, deletes the
// bucket from the same thread, and only then releases.
- var buckets = new InMemoryStorage<String, Bucket>();
+ InMemoryStorage<String, Bucket> buckets = new InMemoryStorage<String, Bucket>();
S3Service service = new S3Service(buckets, new InMemoryStorage<>(), tempDir.resolve("s3-race"), false);
service.createBucket("race-bucket", "us-east-1");
Bucket record = buckets.get("race-bucket").orElseThrow();
- var putStarted = new CountDownLatch(1);
- var thrownByPut = new AtomicReference<Exception>();
+ CountDownLatch putStarted = new CountDownLatch(1);
+ AtomicReference<Exception> thrownByPut = new AtomicReference<Exception>();
Thread put = new Thread(() -> {
putStarted.countDown();
try {
@@ -1445,13 +1447,13 @@ class S3ServiceTest {
// Presence is not enough: deleted and recreated under the same name, the store holds a
// different record, and writing the resolved one back would replace the new bucket with
// the old one's state.
- var buckets = new InMemoryStorage<String, Bucket>();
+ InMemoryStorage<String, Bucket> buckets = new InMemoryStorage<String, Bucket>();
S3Service service = new S3Service(buckets, new InMemoryStorage<>(), tempDir.resolve("s3-recreate"), false);
service.createBucket("recreated-bucket", "us-east-1");
Bucket original = buckets.get("recreated-bucket").orElseThrow();
- var putStarted = new CountDownLatch(1);
- var thrownByPut = new AtomicReference<Exception>();
+ CountDownLatch putStarted = new CountDownLatch(1);
+ AtomicReference<Exception> thrownByPut = new AtomicReference<Exception>();
Thread put = new Thread(() -> {
putStarted.countDown();
try {
@@ -1484,10 +1486,10 @@ class S3ServiceTest {
// monitor concurrent puts of different ids overwrite each other's work.
s3Service.createBucket("metrics-race", "us-east-1");
int count = 24;
- var pool = Executors.newFixedThreadPool(8);
- var start = new CountDownLatch(1);
+ ExecutorService pool = Executors.newFixedThreadPool(8);
+ CountDownLatch start = new CountDownLatch(1);
try {
- var submitted = new ArrayList<Future<?>>();
+ ArrayList<Future<?>> submitted = new ArrayList<Future<?>>();
for (int i = 0; i < count; i++) {
String id = "config-" + i;
submitted.add(pool.submit(() -> {
@@ -1497,7 +1499,7 @@ class S3ServiceTest {
}));
}
start.countDown();
- for (var future : submitted) {
+ for (Future<?> future : submitted) {
future.get(30, TimeUnit.SECONDS);
}
} finally {
@@ -1585,7 +1587,7 @@ class S3ServiceTest {
// Through the real storage layer rather than Jackson alone: written, flushed to disk, and
// read back by a second service over the same file, the way a restart does it.
Path bucketsFile = tempDir.resolve("s3-buckets-tiering.json");
- var beforeRestart = new HybridStorage<String, Bucket>(
+ HybridStorage<String, Bucket> beforeRestart = new HybridStorage<String, Bucket>(
bucketsFile, new TypeReference<Map<String, Bucket>>() {}, 60000);
S3Service before = new S3Service(beforeRestart, new InMemoryStorage<>(), tempDir.resolve("s3b"), false);
before.createBucket("persisted-tiering", "us-east-1");
@@ -1594,7 +1596,7 @@ class S3ServiceTest {
beforeRestart.flush();
beforeRestart.shutdown();
- var afterRestart = new HybridStorage<String, Bucket>(
+ HybridStorage<String, Bucket> afterRestart = new HybridStorage<String, Bucket>(
bucketsFile, new TypeReference<Map<String, Bucket>>() {}, 60000);
afterRestart.load();
try {
@@ -1610,7 +1612,7 @@ class S3ServiceTest {
void intelligentTieringConfigurationsSurviveAJacksonRoundTrip() throws Exception {
// Bucket records are persisted as JSON, so the configurations have to come back after a
// restart, and a record written before the field existed has to still load.
- var mapper = new ObjectMapper().findAndRegisterModules();
+ ObjectMapper mapper = new ObjectMapper().findAndRegisterModules();
Bucket bucket = new Bucket("persisted");
bucket.setIntelligentTieringConfigurations(new LinkedHashMap<>(
Map.of("EntireBucket", "<Id>EntireBucket</Id>")));
@@ -1629,10 +1631,10 @@ class S3ServiceTest {
// monitor concurrent puts of different ids overwrite each other's work.
s3Service.createBucket("tiering-race", "us-east-1");
int count = 24;
- var pool = Executors.newFixedThreadPool(8);
- var start = new CountDownLatch(1);
+ ExecutorService pool = Executors.newFixedThreadPool(8);
+ CountDownLatch start = new CountDownLatch(1);
try {
- var submitted = new ArrayList<Future<?>>();
+ ArrayList<Future<?>> submitted = new ArrayList<Future<?>>();
for (int i = 0; i < count; i++) {
String id = "config-" + i;
submitted.add(pool.submit(() -> {
@@ -1643,7 +1645,7 @@ class S3ServiceTest {
}));
}
start.countDown();
- for (var future : submitted) {
+ for (Future<?> future : submitted) {
future.get(30, TimeUnit.SECONDS);
}
} finally {
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java
index 5850194578..a5d4ae47d4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3/S3VirtualHostIntegrationTest.java
@@ -371,7 +371,7 @@ class S3VirtualHostIntegrationTest {
@Order(22)
void createMultipartUploadViaVirtualHostWithXForwardedHost() {
String key = "multipart-xfh.zip";
- io.restassured.response.Response response = given()
+ Response response = given()
.header("Host", "floci:4566")
.header("X-Forwarded-Host", HOST)
.header("Authorization",
diff --git a/src/test/java/io/github/hectorvent/floci/services/s3tables/S3TablesServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/s3tables/S3TablesServiceTest.java
index 5e81894eba..fbba93d48a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/s3tables/S3TablesServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/s3tables/S3TablesServiceTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.s3tables.model.S3Table;
import io.github.hectorvent.floci.services.s3tables.model.TableBucket;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
import java.util.List;
import java.util.Map;
@@ -16,6 +17,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@@ -149,7 +151,7 @@ class S3TablesServiceTest {
null, null, Map.of(), REGION);
}
- private void assertError(String expectedCode, org.junit.jupiter.api.function.Executable action) {
+ private void assertError(String expectedCode, Executable action) {
AwsException exception = assertThrows(AwsException.class, action);
assertEquals(expectedCode, exception.getErrorCode());
}
@@ -168,10 +170,10 @@ class S3TablesServiceTest {
Future<String> second = executor.submit(() -> updateMetadataWithToken(arn, created.getVersionToken(),
"s3://warehouse/events/metadata/v3.json", ready, start));
- assertEquals(true, ready.await(5, java.util.concurrent.TimeUnit.SECONDS));
+ assertEquals(true, ready.await(5, TimeUnit.SECONDS));
start.countDown();
- List<String> outcomes = List.of(first.get(5, java.util.concurrent.TimeUnit.SECONDS),
- second.get(5, java.util.concurrent.TimeUnit.SECONDS));
+ List<String> outcomes = List.of(first.get(5, TimeUnit.SECONDS),
+ second.get(5, TimeUnit.SECONDS));
assertEquals(1L, outcomes.stream().filter("updated"::equals).count());
assertEquals(1L, outcomes.stream().filter("ConflictException"::equals).count());
@@ -181,10 +183,10 @@ class S3TablesServiceTest {
}
private String updateMetadataWithToken(String arn, String token, String metadataLocation,
- java.util.concurrent.CountDownLatch ready,
- java.util.concurrent.CountDownLatch start) throws InterruptedException {
+ CountDownLatch ready,
+ CountDownLatch start) throws InterruptedException {
ready.countDown();
- if (!start.await(5, java.util.concurrent.TimeUnit.SECONDS)) {
+ if (!start.await(5, TimeUnit.SECONDS)) {
return "timed out";
}
try {
diff --git a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerDockerIntegrationTest.java
index fa16206225..5123170e9c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerDockerIntegrationTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.services.s3.S3Service;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testing.TestImages;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeAll;
@@ -236,7 +237,7 @@ class SageMakerDockerIntegrationTest {
.until(currentStatus, current -> wanted.equals(current) || "Failed".equals(current));
}
- private io.restassured.response.Response post(String target, String body) {
+ private Response post(String target, String body) {
return given().header("Authorization", AUTH).header("X-Amz-Target", target)
.contentType("application/x-amz-json-1.1").body(body).when().post("/");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerIntegrationTest.java
index 394b080533..264620ec1e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sagemaker/SageMakerIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.sagemaker;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
@@ -138,7 +139,7 @@ class SageMakerIntegrationTest {
}
}
- private io.restassured.response.Response post(String target, String body) {
+ private Response post(String target, String body) {
return given().header("Authorization", AUTH)
.header("X-Amz-Target", target)
.contentType("application/x-amz-json-1.1")
diff --git a/src/test/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerRotationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerRotationIntegrationTest.java
index 1351f86169..bee011357f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerRotationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/secretsmanager/SecretsManagerRotationIntegrationTest.java
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
+import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@@ -110,7 +111,7 @@ public class SecretsManagerRotationIntegrationTest {
boolean hasFinish = false;
for (byte[] payloadBytes : payloadCaptor.getAllValues()) {
- String payloadStr = new String(payloadBytes, java.nio.charset.StandardCharsets.UTF_8);
+ String payloadStr = new String(payloadBytes, StandardCharsets.UTF_8);
if (payloadStr.contains("\"Step\":\"createSecret\"")) hasCreate = true;
if (payloadStr.contains("\"Step\":\"setSecret\"")) hasSet = true;
if (payloadStr.contains("\"Step\":\"testSecret\"")) hasTest = true;
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogConstraintConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogConstraintConsumerTest.java
index 69b80aa8de..a7431e8748 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogConstraintConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogConstraintConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -77,7 +78,7 @@ class ServiceCatalogConstraintConsumerTest {
.body("ConstraintDetail.Type", equalTo("LAUNCH"))
.body("ConstraintDetail.PortfolioId", equalTo(portfolioId))
.body("ConstraintDetail.ProductId", equalTo(productId))
- .body("ConstraintDetail.ConstraintId", org.hamcrest.Matchers.notNullValue());
+ .body("ConstraintDetail.ConstraintId", Matchers.notNullValue());
}
// ---------- DescribeConstraint ----------
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogDescribeQueryConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogDescribeQueryConsumerTest.java
index bc5e43b69a..96c67089eb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogDescribeQueryConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogDescribeQueryConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -72,7 +73,7 @@ class ServiceCatalogDescribeQueryConsumerTest {
.then()
.statusCode(200)
.body("CopyProductStatus", equalTo("SUCCEEDED"))
- .body("TargetProductId", org.hamcrest.Matchers.notNullValue());
+ .body("TargetProductId", Matchers.notNullValue());
}
// ---------- DescribeProductView ----------
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogOrgAccessConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogOrgAccessConsumerTest.java
index f969a2df9e..81ac972e0a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogOrgAccessConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogOrgAccessConsumerTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -29,7 +31,7 @@ class ServiceCatalogOrgAccessConsumerTest {
RestAssuredJsonUtils.configureAwsContentTypes();
}
- private static io.restassured.response.Response call(String action, String body) {
+ private static Response call(String action, String body) {
return given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", "AWS242ServiceCatalogService." + action)
@@ -58,6 +60,6 @@ class ServiceCatalogOrgAccessConsumerTest {
call("GetAWSOrganizationsAccessStatus", "{}")
.then()
.statusCode(200)
- .body("AccessStatus", org.hamcrest.Matchers.equalTo("ENABLED"));
+ .body("AccessStatus", Matchers.equalTo("ENABLED"));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogPrincipalAccessConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogPrincipalAccessConsumerTest.java
index 25bbbf39fd..ca766604c4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogPrincipalAccessConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogPrincipalAccessConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -115,7 +116,7 @@ class ServiceCatalogPrincipalAccessConsumerTest {
call("ListPrincipalsForPortfolio", "{\"PortfolioId\":\"" + portfolioId + "\"}")
.then()
.statusCode(200)
- .body("Principals.PrincipalARN", org.hamcrest.Matchers.not(hasItem(arn)));
+ .body("Principals.PrincipalARN", Matchers.not(hasItem(arn)));
}
// ---------- ListPortfolioAccess ----------
@@ -166,7 +167,7 @@ class ServiceCatalogPrincipalAccessConsumerTest {
.then()
.statusCode(400)
.body("__type", equalTo("InvalidParametersException"))
- .body("message", org.hamcrest.Matchers.startsWith("OrganizationNodeType must be one of"));
+ .body("message", Matchers.startsWith("OrganizationNodeType must be one of"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisionedProductPlanConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisionedProductPlanConsumerTest.java
index 8d1ef61c4b..34c1c51606 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisionedProductPlanConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisionedProductPlanConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -95,7 +96,7 @@ class ServiceCatalogProvisionedProductPlanConsumerTest {
.then()
.statusCode(400)
.body("__type", equalTo("InvalidParametersException"))
- .body("message", org.hamcrest.Matchers.startsWith("PlanType must be one of"));
+ .body("message", Matchers.startsWith("PlanType must be one of"));
}
@Test
@@ -112,7 +113,7 @@ class ServiceCatalogProvisionedProductPlanConsumerTest {
.body("PlanName", equalTo("ab-create-plan"))
.body("ProvisionProductId", equalTo(productId))
.body("ProvisioningArtifactId", equalTo(artifactId))
- .body("PlanId", org.hamcrest.Matchers.notNullValue());
+ .body("PlanId", Matchers.notNullValue());
}
// ---------- DescribeProvisionedProductPlan ----------
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisioningArtifactConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisioningArtifactConsumerTest.java
index 7a277033f2..36bfe1e7aa 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisioningArtifactConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogProvisioningArtifactConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -125,7 +126,7 @@ class ServiceCatalogProvisioningArtifactConsumerTest {
call("ListProvisioningArtifacts", "{\"ProductId\":\"" + productId + "\"}")
.then()
.statusCode(200)
- .body("ProvisioningArtifactDetails.Name", org.hamcrest.Matchers.not(hasItem("v2-to-delete")));
+ .body("ProvisioningArtifactDetails.Name", Matchers.not(hasItem("v2-to-delete")));
}
// ---------- ListProvisioningArtifactsForServiceAction ----------
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogRecordAndResourceQueryConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogRecordAndResourceQueryConsumerTest.java
index e7bec8c0b3..16362a4c3c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogRecordAndResourceQueryConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogRecordAndResourceQueryConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -155,7 +156,7 @@ class ServiceCatalogRecordAndResourceQueryConsumerTest {
+ provisionedId + "\"}")
.then()
.statusCode(200)
- .body("StackInstances.size()", org.hamcrest.Matchers.greaterThan(0));
+ .body("StackInstances.size()", Matchers.greaterThan(0));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogResourceInUseConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogResourceInUseConsumerTest.java
index 7068068385..2710b1062f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogResourceInUseConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogResourceInUseConsumerTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -80,7 +81,7 @@ class ServiceCatalogResourceInUseConsumerTest {
call("ListPortfoliosForProduct", "{\"ProductId\":\"" + productId + "\"}")
.then()
.statusCode(200)
- .body("PortfolioDetails.Id", org.hamcrest.Matchers.hasItem(portfolioId));
+ .body("PortfolioDetails.Id", Matchers.hasItem(portfolioId));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogServiceActionConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogServiceActionConsumerTest.java
index 0e2264a245..cac48b0b72 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogServiceActionConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicecatalog/ServiceCatalogServiceActionConsumerTest.java
@@ -3,9 +3,13 @@ package io.github.hectorvent.floci.services.servicecatalog;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
@@ -68,7 +72,7 @@ class ServiceCatalogServiceActionConsumerTest {
.statusCode(200)
.body("ServiceActionDetail.ServiceActionSummary.Name", equalTo("ab-create-action"))
.body("ServiceActionDetail.ServiceActionSummary.DefinitionType", equalTo("SSM_AUTOMATION"))
- .body("ServiceActionDetail.ServiceActionSummary.Id", org.hamcrest.Matchers.notNullValue());
+ .body("ServiceActionDetail.ServiceActionSummary.Id", Matchers.notNullValue());
}
/**
@@ -83,7 +87,7 @@ class ServiceCatalogServiceActionConsumerTest {
.then()
.statusCode(400)
.body("__type", equalTo("InvalidParametersException"))
- .body("message", org.hamcrest.Matchers.startsWith("DefinitionType must be one of"));
+ .body("message", Matchers.startsWith("DefinitionType must be one of"));
}
// ---------- DeleteServiceAction ----------
@@ -99,7 +103,7 @@ class ServiceCatalogServiceActionConsumerTest {
call("ListServiceActions", "{}")
.then()
.statusCode(200)
- .body("ServiceActionSummaries.Id", org.hamcrest.Matchers.not(hasItem(id)));
+ .body("ServiceActionSummaries.Id", Matchers.not(hasItem(id)));
}
@Test
@@ -131,9 +135,9 @@ class ServiceCatalogServiceActionConsumerTest {
Response list = call("ListServiceActions", "{}");
list.then().statusCode(200);
- java.util.List<String> ids = list.jsonPath().getList("ServiceActionSummaries.Id", String.class);
+ List<String> ids = list.jsonPath().getList("ServiceActionSummaries.Id", String.class);
long matches = ids.stream().filter(id::equals).count();
- org.junit.jupiter.api.Assertions.assertEquals(1L, matches,
+ Assertions.assertEquals(1L, matches,
"expected exactly one entry for " + id + " after update, found " + matches);
}
@@ -162,10 +166,10 @@ class ServiceCatalogServiceActionConsumerTest {
Response list = call("ListServiceActions", "{}");
list.then().statusCode(200);
- java.util.List<String> ids = list.jsonPath().getList("ServiceActionSummaries.Id", String.class);
- org.junit.jupiter.api.Assertions.assertFalse(ids.contains(""),
+ List<String> ids = list.jsonPath().getList("ServiceActionSummaries.Id", String.class);
+ Assertions.assertFalse(ids.contains(""),
"association row leaked into ListServiceActions with an empty Id: " + ids);
- org.junit.jupiter.api.Assertions.assertTrue(ids.contains(actionId),
+ Assertions.assertTrue(ids.contains(actionId),
"the real service action should still be listed: " + ids);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/servicequotas/RequestServiceQuotaIncreaseConsumerTest.java b/src/test/java/io/github/hectorvent/floci/services/servicequotas/RequestServiceQuotaIncreaseConsumerTest.java
index 049370a646..110d4799d7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/servicequotas/RequestServiceQuotaIncreaseConsumerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/servicequotas/RequestServiceQuotaIncreaseConsumerTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.servicequotas;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -48,7 +49,7 @@ class RequestServiceQuotaIncreaseConsumerTest {
given().post("/_floci/state/reset").then().statusCode(200);
}
- private static io.restassured.response.Response request(String body) {
+ private static Response request(String body) {
return given()
.contentType(CONTENT_TYPE)
.header("X-Amz-Target", TARGET)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesBulkV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesBulkV2IntegrationTest.java
index beaa9d5ca0..5adaac6c77 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesBulkV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesBulkV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -329,7 +330,7 @@ class SesBulkV2IntegrationTest {
.then()
.statusCode(200)
.body("BulkEmailEntryResults[0].Status", equalTo("INVALID_PARAMETER"))
- .body("BulkEmailEntryResults[0].Error", org.hamcrest.Matchers.containsString("name"));
+ .body("BulkEmailEntryResults[0].Error", Matchers.containsString("name"));
}
@ParameterizedTest(name = "{0}")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSendingOptionsV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSendingOptionsV2IntegrationTest.java
index 0d66d2acfd..27cd387115 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSendingOptionsV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSendingOptionsV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -280,7 +281,7 @@ class SesConfigurationSetSendingOptionsV2IntegrationTest {
.body(containsString("boolean must follow xsd1.1 definition"));
}
- private static io.restassured.response.Response sendEmail(String configSet) {
+ private static Response sendEmail(String configSet) {
return given()
.contentType("application/json")
.header("Authorization", SES_AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSuppressionOptionsV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSuppressionOptionsV2IntegrationTest.java
index 45b6e4998a..97c4e765c3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSuppressionOptionsV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesConfigurationSetSuppressionOptionsV2IntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ses;
import io.github.hectorvent.floci.core.common.AwsException;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -150,8 +151,8 @@ class SesConfigurationSetSuppressionOptionsV2IntegrationTest {
.put("/v2/email/configuration-sets/" + CS + "/suppression-options")
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.equalTo("BadRequestException"))
- .body("message", org.hamcrest.Matchers.equalTo(
+ .body("__type", Matchers.equalTo("BadRequestException"))
+ .body("message", Matchers.equalTo(
"Reason INVALID is invalid, must be one of [BOUNCE, COMPLAINT]."));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesContactListV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesContactListV2IntegrationTest.java
index 6dc1ce362c..b593b43c96 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesContactListV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesContactListV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -445,7 +446,7 @@ class SesContactListV2IntegrationTest {
.body("message", equalTo("Cannot provide multiple tags with the same key"));
}
- private static io.restassured.response.Response post(String body) {
+ private static Response post(String body) {
return given()
.contentType("application/json")
.header("Authorization", SES_AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesContactV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesContactV2IntegrationTest.java
index c7b2697516..54f1e3933e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesContactV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesContactV2IntegrationTest.java
@@ -1,6 +1,8 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -28,7 +30,7 @@ class SesContactV2IntegrationTest {
private static final String EMAIL = "[email protected]";
private static final String CONTACTS = "/v2/email/contact-lists/" + LIST + "/contacts";
- private static io.restassured.response.Response post(String path, String body) {
+ private static Response post(String path, String body) {
return given().contentType("application/json").header("Authorization", SES_AUTH)
.body(body).when().post(path);
}
@@ -155,7 +157,7 @@ class SesContactV2IntegrationTest {
// TopicPreferences kept; AttributesData cleared (replace semantics).
.body("TopicPreferences", hasSize(1))
.body("TopicPreferences[0].TopicName", equalTo("weekly"))
- .body("AttributesData", org.hamcrest.Matchers.nullValue());
+ .body("AttributesData", Matchers.nullValue());
}
@Test
@@ -184,8 +186,8 @@ class SesContactV2IntegrationTest {
.body("Contacts[0].TopicPreferences", hasSize(2))
.body("Contacts[0].LastUpdatedTimestamp", epochSecondsWithMillis())
// ListContacts is a lightweight projection: no AttributesData / CreatedTimestamp.
- .body("Contacts[0].AttributesData", org.hamcrest.Matchers.nullValue())
- .body("Contacts[0].CreatedTimestamp", org.hamcrest.Matchers.nullValue());
+ .body("Contacts[0].AttributesData", Matchers.nullValue())
+ .body("Contacts[0].CreatedTimestamp", Matchers.nullValue());
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesCustomVerificationEmailTemplateV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesCustomVerificationEmailTemplateV1IntegrationTest.java
index 2697aacb40..b004d5f9c3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesCustomVerificationEmailTemplateV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesCustomVerificationEmailTemplateV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -25,12 +26,12 @@ class SesCustomVerificationEmailTemplateV1IntegrationTest {
private static final String FROM = "[email protected]";
private static final String NAME = "cvet-v1-a";
- private static io.restassured.specification.RequestSpecification query(String action) {
+ private static RequestSpecification query(String action) {
return given().contentType("application/x-www-form-urlencoded").header("Authorization", AUTH)
.formParam("Action", action);
}
- private static io.restassured.specification.RequestSpecification create(String name, String subject) {
+ private static RequestSpecification create(String name, String subject) {
return query("CreateCustomVerificationEmailTemplate")
.formParam("TemplateName", name)
.formParam("FromEmailAddress", FROM)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesDkimSigningActionsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesDkimSigningActionsIntegrationTest.java
index 9a08cdbde7..2125727023 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesDkimSigningActionsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesDkimSigningActionsIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ses;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
import java.util.List;
@@ -30,7 +31,7 @@ class SesDkimSigningActionsIntegrationTest {
private static final String V2_AUTH =
"AWS4-HMAC-SHA256 Credential=AKID/20260101/us-east-1/ses/aws4_request";
- private io.restassured.specification.RequestSpecification v1(String action) {
+ private RequestSpecification v1(String action) {
return given().contentType("application/x-www-form-urlencoded")
.header("Authorization", V1_AUTH).formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesEmailIdentityConfigurationSetV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesEmailIdentityConfigurationSetV2IntegrationTest.java
index 2aec275c21..16d0ca7eac 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesEmailIdentityConfigurationSetV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesEmailIdentityConfigurationSetV2IntegrationTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -152,7 +153,7 @@ class SesEmailIdentityConfigurationSetV2IntegrationTest {
given().header("Authorization", SES_AUTH)
.when().get("/v2/email/identities/" + IDENTITY)
.then().statusCode(200)
- .body("$", org.hamcrest.Matchers.not(org.hamcrest.Matchers.hasKey("ConfigurationSetName")));
+ .body("$", Matchers.not(Matchers.hasKey("ConfigurationSetName")));
}
@Test
@@ -381,7 +382,7 @@ class SesEmailIdentityConfigurationSetV2IntegrationTest {
.when().post("/v2/email/identities").then().statusCode(200);
given().header("Authorization", SES_AUTH)
.when().get("/v2/email/identities/" + id).then().statusCode(200)
- .body("$", org.hamcrest.Matchers.not(org.hamcrest.Matchers.hasKey("ConfigurationSetName")));
+ .body("$", Matchers.not(Matchers.hasKey("ConfigurationSetName")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPayloadTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPayloadTest.java
index 3422918f4e..175f6021e6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPayloadTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPayloadTest.java
@@ -144,7 +144,7 @@ class SesEventPayloadTest {
ArrayNode headers = (ArrayNode) node.get("mail").get("headers");
// Only the auto headers (From/To/Subject) and the single valid X-Real.
boolean hasXReal = false;
- for (com.fasterxml.jackson.databind.JsonNode h : headers) {
+ for (JsonNode h : headers) {
String name = h.path("name").asText();
assertFalse(name.isBlank(), "no blank-named header should be emitted");
if ("X-Real".equals(name)) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPublishingV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPublishingV2IntegrationTest.java
index 8b4fcb55cb..da59804e43 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPublishingV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesEventPublishingV2IntegrationTest.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
@@ -249,14 +250,14 @@ class SesEventPublishingV2IntegrationTest {
String raw = "From: " + SENDER + "\r\n"
+ "To: [email protected]\r\n"
+ "Subject: mime-only\r\n\r\nbody";
- String rawB64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String rawB64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", SES_AUTH)
.body("Action=SendRawEmail"
- + "&Source=" + java.net.URLEncoder.encode(SENDER, java.nio.charset.StandardCharsets.UTF_8)
- + "&RawMessage.Data=" + java.net.URLEncoder.encode(rawB64, java.nio.charset.StandardCharsets.UTF_8)
+ + "&Source=" + URLEncoder.encode(SENDER, StandardCharsets.UTF_8)
+ + "&RawMessage.Data=" + URLEncoder.encode(rawB64, StandardCharsets.UTF_8)
+ "&ConfigurationSetName=" + CS
+ "&Version=2010-12-01")
.when()
@@ -423,10 +424,10 @@ class SesEventPublishingV2IntegrationTest {
.contentType("application/x-www-form-urlencoded")
.header("Authorization", SES_AUTH)
.body("Action=SendEmail"
- + "&Source=" + java.net.URLEncoder.encode(SENDER, java.nio.charset.StandardCharsets.UTF_8)
+ + "&Source=" + URLEncoder.encode(SENDER, StandardCharsets.UTF_8)
+ "&Destination.ToAddresses.member.1="
- + java.net.URLEncoder.encode("[email protected]",
- java.nio.charset.StandardCharsets.UTF_8)
+ + URLEncoder.encode("[email protected]",
+ StandardCharsets.UTF_8)
+ "&Message.Subject.Data=v1tagged"
+ "&Message.Body.Text.Data=hi"
+ "&Tags.member.1.Name=campaign&Tags.member.1.Value=v1launch"
@@ -2041,14 +2042,14 @@ class SesEventPublishingV2IntegrationTest {
+ "X-SES-CONFIGURATION-SET: " + CS + "\r\n"
+ "X-SES-MESSAGE-TAGS: campaign=headercampaign, env=headerenv\r\n"
+ "\r\nbody";
- String rawB64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String rawB64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", SES_AUTH)
.body("Action=SendRawEmail"
- + "&Source=" + java.net.URLEncoder.encode(SENDER, java.nio.charset.StandardCharsets.UTF_8)
- + "&RawMessage.Data=" + java.net.URLEncoder.encode(rawB64, java.nio.charset.StandardCharsets.UTF_8)
+ + "&Source=" + URLEncoder.encode(SENDER, StandardCharsets.UTF_8)
+ + "&RawMessage.Data=" + URLEncoder.encode(rawB64, StandardCharsets.UTF_8)
+ "&Version=2010-12-01")
.when()
.post("/")
@@ -2074,14 +2075,14 @@ class SesEventPublishingV2IntegrationTest {
+ "Subject: header-vs-request\r\n"
+ "X-SES-MESSAGE-TAGS: campaign=fromheader, only=inheader\r\n"
+ "\r\nbody";
- String rawB64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String rawB64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", SES_AUTH)
.body("Action=SendRawEmail"
- + "&Source=" + java.net.URLEncoder.encode(SENDER, java.nio.charset.StandardCharsets.UTF_8)
- + "&RawMessage.Data=" + java.net.URLEncoder.encode(rawB64, java.nio.charset.StandardCharsets.UTF_8)
+ + "&Source=" + URLEncoder.encode(SENDER, StandardCharsets.UTF_8)
+ + "&RawMessage.Data=" + URLEncoder.encode(rawB64, StandardCharsets.UTF_8)
+ "&Tags.member.1.Name=campaign&Tags.member.1.Value=fromrequest"
+ "&ConfigurationSetName=" + CS
+ "&Version=2010-12-01")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesIdentityPolicyV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesIdentityPolicyV1IntegrationTest.java
index a03923ab3f..dfbf25efa8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesIdentityPolicyV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesIdentityPolicyV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -28,7 +29,7 @@ class SesIdentityPolicyV1IntegrationTest {
private static final String DOC_A = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"AAA\"}]}";
private static final String DOC_B = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"BBB\"}]}";
- private static io.restassured.specification.RequestSpecification query(String action) {
+ private static RequestSpecification query(String action) {
return given().contentType("application/x-www-form-urlencoded").header("Authorization", AUTH)
.formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
index 03c60c3d0a..7dde859e29 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java
@@ -6,6 +6,9 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
@@ -504,8 +507,8 @@ class SesIntegrationTest {
+ "To: [email protected]\r\n"
+ "Return-Path: <[email protected]>\r\n"
+ "Subject: raw-return-path\r\n\r\nbody";
- String rawB64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String rawB64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
given()
.contentType("application/x-www-form-urlencoded")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesListManagementOptionsV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesListManagementOptionsV2IntegrationTest.java
index b6a8a914fb..7f34f9451a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesListManagementOptionsV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesListManagementOptionsV2IntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ses;
import io.github.hectorvent.floci.testutil.SesMailbox;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -189,12 +190,12 @@ class SesListManagementOptionsV2IntegrationTest {
.queryParam("region", "us-west-2").queryParam("contactList", LIST)
.queryParam("topic", "Sports").queryParam("address", recipient)
.when().get("/_aws/ses/unsubscribe").then().statusCode(200)
- .body(org.hamcrest.Matchers.containsString("<form method=\"post\""))
- .body(org.hamcrest.Matchers.containsString("Unsubscribe"))
+ .body(Matchers.containsString("<form method=\"post\""))
+ .body(Matchers.containsString("Unsubscribe"))
// The form action escapes '&' as '&amp;' for valid HTML, and carries the RFC 8058
// one-click parameter so its POST body matches the advertised header.
- .body(org.hamcrest.Matchers.containsString("&amp;contactList="))
- .body(org.hamcrest.Matchers.containsString(
+ .body(Matchers.containsString("&amp;contactList="))
+ .body(Matchers.containsString(
"<input type=\"hidden\" name=\"List-Unsubscribe\" value=\"One-Click\">"));
given().header("Authorization", AUTH)
@@ -247,9 +248,9 @@ class SesListManagementOptionsV2IntegrationTest {
""".formatted(FROM))
.when().post("/v2/email/outbound-emails").then().statusCode(400)
.body("__type", equalTo("BadRequestException"))
- .body("message", org.hamcrest.Matchers.containsString(
+ .body("message", Matchers.containsString(
"content.simple.headers.1.member.value"))
- .body("message", org.hamcrest.Matchers.containsString("Member must not be null"));
+ .body("message", Matchers.containsString("Member must not be null"));
}
@Test
@@ -266,9 +267,9 @@ class SesListManagementOptionsV2IntegrationTest {
""".formatted(FROM))
.when().post("/v2/email/outbound-emails").then().statusCode(400)
.body("__type", equalTo("BadRequestException"))
- .body("message", org.hamcrest.Matchers.containsString(
+ .body("message", Matchers.containsString(
"content.simple.headers.1.member.name"))
- .body("message", org.hamcrest.Matchers.containsString("Member must not be null"));
+ .body("message", Matchers.containsString("Member must not be null"));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptFilterV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptFilterV1IntegrationTest.java
index c531f52b3e..7d104ff694 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptFilterV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptFilterV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -25,14 +26,14 @@ class SesReceiptFilterV1IntegrationTest {
private static final String AUTH =
"AWS4-HMAC-SHA256 Credential=AKID/20260101/us-west-2/email/aws4_request";
- private static io.restassured.specification.RequestSpecification req(String action) {
+ private static RequestSpecification req(String action) {
return given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", AUTH)
.formParam("Action", action);
}
- private static io.restassured.specification.RequestSpecification create(
+ private static RequestSpecification create(
String name, String policy, String cidr) {
return req("CreateReceiptFilter")
.formParam("Filter.Name", name)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetReorderCloneV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetReorderCloneV1IntegrationTest.java
index 3962016974..23e6b8d2bf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetReorderCloneV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetReorderCloneV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -25,7 +26,7 @@ class SesReceiptRuleSetReorderCloneV1IntegrationTest {
private static final String RS = "floci-v1-reorder";
private static final String CLONE = "floci-v1-reorder-copy";
- private static io.restassured.specification.RequestSpecification req(String action) {
+ private static RequestSpecification req(String action) {
return given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetV1IntegrationTest.java
index f2c54615ae..4b11106a67 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleSetV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -24,7 +25,7 @@ class SesReceiptRuleSetV1IntegrationTest {
"AWS4-HMAC-SHA256 Credential=AKID/20260101/us-west-2/email/aws4_request";
private static final String RS = "floci-v1-rule-set";
- private static io.restassured.specification.RequestSpecification req(String action) {
+ private static RequestSpecification req(String action) {
return given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleV1IntegrationTest.java
index aa68350a3f..3b1ee8b3e9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesReceiptRuleV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -28,7 +29,7 @@ class SesReceiptRuleV1IntegrationTest {
private static String snsTopicArn;
- private static io.restassured.specification.RequestSpecification req(String action) {
+ private static RequestSpecification req(String action) {
return given()
.contentType("application/x-www-form-urlencoded")
.header("Authorization", AUTH)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesSendCustomVerificationEmailV1IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesSendCustomVerificationEmailV1IntegrationTest.java
index 8317086523..267eecc139 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesSendCustomVerificationEmailV1IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesSendCustomVerificationEmailV1IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -25,7 +26,7 @@ class SesSendCustomVerificationEmailV1IntegrationTest {
private static final String RECIPIENT = "[email protected]";
private static final String NAME = "scve-v1-template";
- private static io.restassured.specification.RequestSpecification query(String action) {
+ private static RequestSpecification query(String action) {
return given().contentType("application/x-www-form-urlencoded").header("Authorization", AUTH)
.formParam("Action", action);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTemplateServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTemplateServiceTest.java
index 7c054bc11a..1b4bbfb21e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTemplateServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTemplateServiceTest.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import java.security.SecureRandom;
import java.time.Clock;
import java.time.Instant;
+import java.time.ZonedDateTime;
import java.util.List;
import java.util.stream.Stream;
@@ -274,7 +275,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_asciiBody_uses7bit() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("Hello", "Hi there", "<p>Hi</p>", date, "BOUND");
assertTrue(mime.contains("Subject: Hello\r\n"));
assertTrue(mime.contains("Content-Type: multipart/alternative; boundary=\"BOUND\""));
@@ -285,7 +286,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_utf8Body_uses8bit() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("件名", "こんにちは", "<p>こんにちは</p>", date, "BOUND");
assertTrue(mime.contains("Subject: 件名\r\n"));
assertTrue(mime.contains("Content-Transfer-Encoding: 8bit"));
@@ -294,7 +295,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_subjectStripsCRLF() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("Multi\r\nLine", "x", "x", date, "BOUND");
// CR and LF are both C0 controls and are replaced with spaces.
assertTrue(mime.contains("Subject: Multi Line\r\n"));
@@ -355,7 +356,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_bodyWithBareLf_normalizedToCrlf() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("S", "line1\nline2", "<p>x\ny</p>", date, "BOUND");
assertTrue(mime.contains("line1\r\nline2"));
assertTrue(mime.contains("x\r\ny"));
@@ -364,7 +365,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_bodyEndingWithNewline_noExtraBlankLine() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("S", "hello\n", "<p>hi</p>\n", date, "BOUND");
assertFalse(mime.contains("hello\r\n\r\n--BOUND"));
assertTrue(mime.contains("hello\r\n--BOUND"));
@@ -374,7 +375,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_bodyWithoutTrailingNewline_addsCrlfBeforeBoundary() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime("S", "hello", "<p>hi</p>", date, "BOUND");
assertTrue(mime.contains("hello\r\n--BOUND"));
assertTrue(mime.contains("</p>\r\n--BOUND"));
@@ -404,7 +405,7 @@ class SesTemplateServiceTest {
@Test
void buildTestRenderMime_subjectWithControlChars_replacedWithSpace() {
- java.time.ZonedDateTime date = java.time.ZonedDateTime.parse("2026-05-02T12:00:00Z");
+ ZonedDateTime date = ZonedDateTime.parse("2026-05-02T12:00:00Z");
String mime = SesTemplateService.buildTestRenderMime(
"Hello\u0001World", "x", "x", date, "BOUND");
assertTrue(mime.contains("Subject: Hello World\r\n"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantAssociationV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantAssociationV2IntegrationTest.java
index f9b0056340..266330e9e3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantAssociationV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantAssociationV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -37,7 +38,7 @@ class SesTenantAssociationV2IntegrationTest {
private static final String CONFIG_SET_ARN = ARN_PREFIX + "configuration-set/" + CONFIG_SET;
private static final String TEMPLATE_ARN = ARN_PREFIX + "template/" + TEMPLATE;
- private static io.restassured.specification.RequestSpecification v2() {
+ private static RequestSpecification v2() {
return given().contentType("application/json").header("Authorization", AUTH);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSendV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSendV2IntegrationTest.java
index 54311defcd..dd51ce94f3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSendV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSendV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -37,7 +38,7 @@ class SesTenantSendV2IntegrationTest {
private static final String TEMPLATE = "floci-send-tpl";
private static final String ARN_PREFIX = "arn:aws:ses:us-east-1:000000000000:";
- private static io.restassured.specification.RequestSpecification v2() {
+ private static RequestSpecification v2() {
return given().contentType("application/json").header("Authorization", AUTH);
}
@@ -189,7 +190,7 @@ class SesTenantSendV2IntegrationTest {
SesDomainIdentityTestHelper.createVerified("floci-raw.example.com", AUTH);
String mime = "From: [email protected]\r\nTo: [email protected]\r\n"
+ "Subject: s\r\n\r\nbody";
- String data = java.util.Base64.getEncoder().encodeToString(mime.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String data = Base64.getEncoder().encodeToString(mime.getBytes(StandardCharsets.UTF_8));
// FromEmailAddress omitted: the sender comes from the MIME From header, and that identity
// is not associated with the tenant.
v2().body("{\"TenantName\":\"" + TENANT + "\","
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSuppressionV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSuppressionV2IntegrationTest.java
index 39d0320991..f6052b6844 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSuppressionV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantSuppressionV2IntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -31,7 +32,7 @@ class SesTenantSuppressionV2IntegrationTest {
private static final String TENANT_ADDR = "[email protected]";
private static final String ACCOUNT_ADDR = "[email protected]";
- private static io.restassured.specification.RequestSpecification v2() {
+ private static RequestSpecification v2() {
return given().contentType("application/json").header("Authorization", AUTH);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantTagV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantTagV2IntegrationTest.java
index 8c0b7901b9..f902662db6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantTagV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTenantTagV2IntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
+import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -30,7 +31,7 @@ class SesTenantTagV2IntegrationTest {
private static String tenantArn;
private static String tenantId;
- private static io.restassured.specification.RequestSpecification v2() {
+ private static RequestSpecification v2() {
return given().contentType("application/json").header("Authorization", AUTH);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesTestRenderV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesTestRenderV2IntegrationTest.java
index 8aa440d800..05c215d841 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesTestRenderV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesTestRenderV2IntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ses;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
@@ -59,10 +60,10 @@ class SesTestRenderV2IntegrationTest {
.statusCode(200)
.extract().path("RenderedTemplate");
- org.junit.jupiter.api.Assertions.assertNotNull(rendered);
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("Subject: Hello Alice"));
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("Hi Alice, team floci!"));
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("multipart/alternative"));
+ Assertions.assertNotNull(rendered);
+ Assertions.assertTrue(rendered.contains("Subject: Hello Alice"));
+ Assertions.assertTrue(rendered.contains("Hi Alice, team floci!"));
+ Assertions.assertTrue(rendered.contains("multipart/alternative"));
}
@Test
@@ -169,7 +170,7 @@ class SesTestRenderV2IntegrationTest {
.extract().path("RenderedTemplate");
// RFC 1123 with UTC ends with "GMT"; non-UTC zones would render numeric offsets
- org.junit.jupiter.api.Assertions.assertTrue(
+ Assertions.assertTrue(
rendered.contains("Date: ") && rendered.split("\r\n", 2)[0].endsWith("GMT"),
"expected Date header in UTC/GMT form, got: " + rendered.split("\r\n", 2)[0]);
}
@@ -206,8 +207,8 @@ class SesTestRenderV2IntegrationTest {
.statusCode(200)
.extract().path("RenderedTemplate");
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("Subject: 件名 太郎"));
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("Content-Transfer-Encoding: 8bit"));
- org.junit.jupiter.api.Assertions.assertTrue(rendered.contains("こんにちは 太郎 さん"));
+ Assertions.assertTrue(rendered.contains("Subject: 件名 太郎"));
+ Assertions.assertTrue(rendered.contains("Content-Transfer-Encoding: 8bit"));
+ Assertions.assertTrue(rendered.contains("こんにちは 太郎 さん"));
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayServerTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayServerTest.java
index 635388ca70..cd6266456b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayServerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayServerTest.java
@@ -11,6 +11,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -26,6 +27,8 @@ import java.util.Base64;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
@@ -78,7 +81,7 @@ class SmtpRelayServerTest {
}
private static EmulatorConfig config(String user, String pass, String starttls) {
- EmulatorConfig config = mock(EmulatorConfig.class, org.mockito.Mockito.RETURNS_DEEP_STUBS);
+ EmulatorConfig config = mock(EmulatorConfig.class, Mockito.RETURNS_DEEP_STUBS);
when(config.services().ses().smtpUser()).thenReturn(Optional.ofNullable(user));
when(config.services().ses().smtpPass()).thenReturn(Optional.ofNullable(pass));
when(config.services().ses().smtpStarttls()).thenReturn(starttls);
@@ -230,8 +233,8 @@ class SmtpRelayServerTest {
private final ServerSocket serverSocket;
private final Thread acceptThread;
- private volatile java.util.concurrent.CountDownLatch delivered =
- new java.util.concurrent.CountDownLatch(1);
+ private volatile CountDownLatch delivered =
+ new CountDownLatch(1);
private volatile String mailFrom;
private volatile String authCommand;
private volatile String data;
@@ -253,7 +256,7 @@ class SmtpRelayServerTest {
}
void reset() {
- delivered = new java.util.concurrent.CountDownLatch(1);
+ delivered = new CountDownLatch(1);
mailFrom = null;
authCommand = null;
data = null;
@@ -261,7 +264,7 @@ class SmtpRelayServerTest {
}
boolean awaitDelivery() throws InterruptedException {
- return delivered.await(20, java.util.concurrent.TimeUnit.SECONDS);
+ return delivered.await(20, TimeUnit.SECONDS);
}
String mailFrom() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayTest.java
index 42f780c06e..bff103753a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SmtpRelayTest.java
@@ -15,6 +15,7 @@ import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.StandardCharsets;
+import java.util.Base64;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -198,8 +199,8 @@ class SmtpRelayTest {
SmtpRelay relay = enabledRelay();
String rawMime = "From: [email protected]\r\nTo: [email protected]\r\nSubject: B64\r\n\r\nDecoded body";
- String encoded = java.util.Base64.getEncoder().encodeToString(
- rawMime.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String encoded = Base64.getEncoder().encodeToString(
+ rawMime.getBytes(StandardCharsets.UTF_8));
relay.relayRaw(raw("[email protected]", List.of("[email protected]"), encoded));
ArgumentCaptor<MailMessage> captor = ArgumentCaptor.forClass(MailMessage.class);
@@ -338,8 +339,8 @@ class SmtpRelayTest {
@Test
void parseRawRecipients_acceptsBase64Encoded() {
String raw = "From: [email protected]\r\nTo: [email protected]\r\nSubject: x\r\n\r\nbody";
- String b64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String b64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
assertEquals(List.of("[email protected]"), SmtpRelay.parseRawRecipients(b64));
}
@@ -350,16 +351,16 @@ class SmtpRelayTest {
// into garbage.
String raw = "From: [email protected]\r\nMessage-ID: <[email protected]>\r\nSubject: x\r\n\r\nbody";
assertEquals(raw, new String(SmtpRelay.tryBase64Decode(raw),
- java.nio.charset.StandardCharsets.UTF_8));
+ StandardCharsets.UTF_8));
}
@Test
void tryBase64Decode_base64Payload_isDecoded() {
String raw = "From: [email protected]\r\nSubject: x\r\n\r\nbody";
- String encoded = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String encoded = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
assertEquals(raw, new String(SmtpRelay.tryBase64Decode(encoded),
- java.nio.charset.StandardCharsets.UTF_8));
+ StandardCharsets.UTF_8));
}
@Test
@@ -382,8 +383,8 @@ class SmtpRelayTest {
+ "Cc: [email protected]\r\n"
+ "Bcc: [email protected]\r\n"
+ "Subject: Hello world\r\n\r\nbody";
- String b64 = java.util.Base64.getEncoder().encodeToString(
- raw.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ String b64 = Base64.getEncoder().encodeToString(
+ raw.getBytes(StandardCharsets.UTF_8));
SmtpRelay.RawMessageHeaders h = SmtpRelay.parseRawHeaders(b64);
assertEquals("Hello world", h.subject());
assertEquals(List.of("[email protected]", "[email protected]"), h.to());
@@ -678,8 +679,8 @@ class SmtpRelayTest {
+ "Content-Description: Quarterly report\r\n"
+ "Content-Transfer-Encoding: base64\r\n"
+ "\r\n"
- + java.util.Base64.getEncoder().encodeToString("PDF-BYTES".getBytes(
- java.nio.charset.StandardCharsets.UTF_8)) + "\r\n"
+ + Base64.getEncoder().encodeToString("PDF-BYTES".getBytes(
+ StandardCharsets.UTF_8)) + "\r\n"
+ "--outer--";
relay.relayRaw(raw("[email protected]", List.of("[email protected]"), rawMime));
@@ -756,8 +757,8 @@ class SmtpRelayTest {
+ "Content-ID: <logo>\r\n"
+ "Content-Transfer-Encoding: base64\r\n"
+ "\r\n"
- + java.util.Base64.getEncoder().encodeToString("PNG".getBytes(
- java.nio.charset.StandardCharsets.UTF_8)) + "\r\n"
+ + Base64.getEncoder().encodeToString("PNG".getBytes(
+ StandardCharsets.UTF_8)) + "\r\n"
+ "--rel--";
relay.relayRaw(raw("[email protected]", List.of("[email protected]"), rawMime));
diff --git a/src/test/java/io/github/hectorvent/floci/services/signin/SigninIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/signin/SigninIntegrationTest.java
index a1d1aa7c41..0b39e53b3c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/signin/SigninIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/signin/SigninIntegrationTest.java
@@ -6,16 +6,20 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.net.URI;
import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import java.util.Base64;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
@@ -87,24 +91,24 @@ class SigninIntegrationTest {
.get("/_floci/signin/floci-header.svg")
.then()
.statusCode(200)
- .header("Content-Type", org.hamcrest.Matchers.startsWith("image/svg+xml"))
- .body(org.hamcrest.Matchers.containsString("viewBox=\"0 0 531.25 156.71\""))
- .body(org.hamcrest.Matchers.containsString("#FF9900"));
+ .header("Content-Type", Matchers.startsWith("image/svg+xml"))
+ .body(Matchers.containsString("viewBox=\"0 0 531.25 156.71\""))
+ .body(Matchers.containsString("#FF9900"));
request()
.get("/_floci/signin/floci.svg")
.then()
.statusCode(200)
- .header("Content-Type", org.hamcrest.Matchers.startsWith("image/svg+xml"));
+ .header("Content-Type", Matchers.startsWith("image/svg+xml"));
request()
.get("/_floci/signin/signin.css")
.then()
.statusCode(200)
- .header("Content-Type", org.hamcrest.Matchers.startsWith("text/css"))
- .body(org.hamcrest.Matchers.containsString("--floci-brand: #5559a7"))
- .body(org.hamcrest.Matchers.containsString("--floci-orange: #ff9900"))
- .body(org.hamcrest.Matchers.containsString("border-color: #667085"));
+ .header("Content-Type", Matchers.startsWith("text/css"))
+ .body(Matchers.containsString("--floci-brand: #5559a7"))
+ .body(Matchers.containsString("--floci-orange: #ff9900"))
+ .body(Matchers.containsString("border-color: #667085"));
String redirectLocation = approve(location);
URI redirect = URI.create(redirectLocation);
@@ -266,7 +270,7 @@ class SigninIntegrationTest {
.header("X-Content-Type-Options", equalTo("nosniff"))
.header("Content-Security-Policy", equalTo("default-src 'none'; img-src 'self'; "
+ "style-src 'self'; form-action 'self'; base-uri 'none'; frame-ancestors 'none'"))
- .body(org.hamcrest.Matchers.containsString("request_id is required"));
+ .body(Matchers.containsString("request_id is required"));
String verifier = verifier();
String state = UUID.randomUUID().toString();
@@ -281,7 +285,7 @@ class SigninIntegrationTest {
.post("/_floci/signin/consent")
.then()
.statusCode(400)
- .body(org.hamcrest.Matchers.containsString("action must be continue or cancel"));
+ .body(Matchers.containsString("action must be continue or cancel"));
String redirectLocation = approve(consentLocation);
Map<String, String> params = queryParams(URI.create(redirectLocation).getRawQuery());
@@ -353,7 +357,7 @@ class SigninIntegrationTest {
.body("client_id=" + CLIENT_ID
+ "&grant_type=authorization_code"
+ "&code=bogus"
- + "&redirect_uri=" + java.net.URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8)
+ + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8)
+ "&code_verifier=" + verifier())
.when()
.post("/v1/token")
@@ -621,9 +625,9 @@ class SigninIntegrationTest {
}
private static Map<String, String> queryParams(String query) {
- return java.util.Arrays.stream(query.split("&"))
+ return Arrays.stream(query.split("&"))
.map(pair -> pair.split("=", 2))
- .collect(java.util.stream.Collectors.toMap(
+ .collect(Collectors.toMap(
parts -> URLDecoder.decode(parts[0], StandardCharsets.UTF_8),
parts -> URLDecoder.decode(parts[1], StandardCharsets.UTF_8)));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/signin/SigninServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/signin/SigninServiceTest.java
index c31ed8a670..73048b7cda 100644
--- a/src/test/java/io/github/hectorvent/floci/services/signin/SigninServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/signin/SigninServiceTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.signin.model.TokenResult;
import io.github.hectorvent.floci.testing.MutableClock;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
@@ -17,6 +18,7 @@ import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
+import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import java.util.Map;
@@ -26,6 +28,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -303,7 +307,7 @@ class SigninServiceTest {
CountDownLatch ready = new CountDownLatch(callers);
CountDownLatch start = new CountDownLatch(1);
try {
- List<Future<TokenResult>> futures = java.util.stream.IntStream.range(0, callers)
+ List<Future<TokenResult>> futures = IntStream.range(0, callers)
.mapToObj(ignored -> executor.submit(() -> {
ready.countDown();
start.await();
@@ -515,12 +519,12 @@ class SigninServiceTest {
assertEquals(401, error.getHttpStatus());
}
- private void assertInvalidRequest(org.junit.jupiter.api.function.Executable request) {
+ private void assertInvalidRequest(Executable request) {
SigninException error = assertThrows(SigninException.class, request);
assertEquals("invalid_request", error.error());
}
- private void assertTokenValidation(org.junit.jupiter.api.function.Executable request) {
+ private void assertTokenValidation(Executable request) {
SigninTokenException error = assertThrows(SigninTokenException.class, request);
assertEquals("ValidationException", error.getErrorCode());
assertEquals("INVALID_REQUEST", error.responseError());
@@ -541,9 +545,9 @@ class SigninServiceTest {
private static Map<String, String> query(String redirect) {
String query = redirect.substring(redirect.indexOf('?') + 1);
- return java.util.Arrays.stream(query.split("&"))
+ return Arrays.stream(query.split("&"))
.map(pair -> pair.split("=", 2))
- .collect(java.util.stream.Collectors.toMap(
+ .collect(Collectors.toMap(
parts -> URLDecoder.decode(parts[0], StandardCharsets.UTF_8),
parts -> URLDecoder.decode(parts[1], StandardCharsets.UTF_8)));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/sns/SnsHttpDeliveryIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/sns/SnsHttpDeliveryIntegrationTest.java
index 8957df271e..074a9a4907 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sns/SnsHttpDeliveryIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sns/SnsHttpDeliveryIntegrationTest.java
@@ -15,6 +15,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
@@ -32,8 +34,8 @@ class SnsHttpDeliveryIntegrationTest {
private static int httpPort;
private static final List<ReceivedRequest> receivedRequests = new CopyOnWriteArrayList<>();
private static final ObjectMapper objectMapper = new ObjectMapper();
- private static final java.util.logging.Logger LOG =
- java.util.logging.Logger.getLogger(SnsHttpDeliveryIntegrationTest.class.getName());
+ private static final Logger LOG =
+ Logger.getLogger(SnsHttpDeliveryIntegrationTest.class.getName());
record ReceivedRequest(String body, Map<String, List<String>> headers) {}
@BeforeAll
@@ -67,7 +69,7 @@ class SnsHttpDeliveryIntegrationTest {
// Record even on failure so awaitRequests unblocks and the assertion
// reports the real state instead of timing out opaquely.
receivedRequests.add(received);
- LOG.log(java.util.logging.Level.SEVERE,
+ LOG.log(Level.SEVERE,
"confirming-webhook: subscription confirmation failed", e);
exchange.sendResponseHeaders(500, 0);
} finally {
diff --git a/src/test/java/io/github/hectorvent/floci/services/sns/SnsMobilePushTest.java b/src/test/java/io/github/hectorvent/floci/services/sns/SnsMobilePushTest.java
index 7b935f7209..e83e43489a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/sns/SnsMobilePushTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/sns/SnsMobilePushTest.java
@@ -11,6 +11,7 @@ import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import static org.junit.jupiter.api.Assertions.*;
@@ -297,7 +298,7 @@ class SnsMobilePushTest {
void publish_unknownEndpointArnReturnsNotFound() {
AwsException e = assertThrows(AwsException.class, () -> snsService.publish(
null,
- "arn:aws:sns:us-east-1:000000000000:endpoint/APNS/missing/" + java.util.UUID.randomUUID(),
+ "arn:aws:sns:us-east-1:000000000000:endpoint/APNS/missing/" + UUID.randomUUID(),
null, "hello", null, null, null, null, null, REGION));
assertEquals("NotFound", e.getErrorCode());
assertEquals(404, e.getHttpStatus());
@@ -494,7 +495,7 @@ class SnsMobilePushTest {
@Test
void deleteEndpoint_isIdempotent() {
assertDoesNotThrow(() -> snsService.deleteEndpoint(
- "arn:aws:sns:us-east-1:000000000000:endpoint/APNS/x/" + java.util.UUID.randomUUID(), REGION));
+ "arn:aws:sns:us-east-1:000000000000:endpoint/APNS/x/" + UUID.randomUUID(), REGION));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
index 3f49e842c8..2a70b41162 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
@@ -2173,7 +2173,7 @@ class SsmIntegrationTest {
.body("message", equalTo("NUMBER_VALUE can not be converted to a String"));
}
- private io.restassured.response.ValidatableResponse labelParameterVersion(String body) {
+ private ValidatableResponse labelParameterVersion(String body) {
return given()
.header("X-Amz-Target", "AmazonSSM.LabelParameterVersion")
.contentType(SSM_CONTENT_TYPE)
@@ -2379,7 +2379,7 @@ class SsmIntegrationTest {
}
}
- private io.restassured.response.ValidatableResponse unlabel(String body) {
+ private ValidatableResponse unlabel(String body) {
return given()
.header("X-Amz-Target", "AmazonSSM.UnlabelParameterVersion")
.contentType(SSM_CONTENT_TYPE)
@@ -2521,7 +2521,7 @@ class SsmIntegrationTest {
return received;
}
- private io.restassured.response.ValidatableResponse describeParameters(String body) {
+ private ValidatableResponse describeParameters(String body) {
return given()
.header("X-Amz-Target", "AmazonSSM.DescribeParameters")
.contentType(SSM_CONTENT_TYPE)
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmSendCommandIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmSendCommandIntegrationTest.java
index f5d4c05e89..099027ac04 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmSendCommandIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmSendCommandIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.ssm;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusMock;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.path.json.JsonPath;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@@ -149,7 +150,7 @@ class SsmSendCommandIntegrationTest {
.body("Command.TargetCount", equalTo(1))
.extract().body().asString();
- commandId = io.restassured.path.json.JsonPath.from(response).getString("Command.CommandId");
+ commandId = JsonPath.from(response).getString("Command.CommandId");
}
@Test
@@ -266,7 +267,7 @@ class SsmSendCommandIntegrationTest {
.when().post("/")
.then().statusCode(200).extract().body().asString();
- String newCmdId = io.restassured.path.json.JsonPath.from(resp).getString("Command.CommandId");
+ String newCmdId = JsonPath.from(resp).getString("Command.CommandId");
msgId = given()
.header("X-Amz-Target", "AmazonSSMMessageDeliveryService.GetMessages")
@@ -312,7 +313,7 @@ class SsmSendCommandIntegrationTest {
.when().post("/")
.then().statusCode(200).extract().body().asString();
- String cid = io.restassured.path.json.JsonPath.from(resp).getString("Command.CommandId");
+ String cid = JsonPath.from(resp).getString("Command.CommandId");
// Poll
String msgId = given()
@@ -381,7 +382,7 @@ class SsmSendCommandIntegrationTest {
.when().post("/")
.then().statusCode(200).extract().body().asString();
- String cid = io.restassured.path.json.JsonPath.from(resp).getString("Command.CommandId");
+ String cid = JsonPath.from(resp).getString("Command.CommandId");
given()
.header("X-Amz-Target", "AmazonSSM.CancelCommand")
@@ -444,7 +445,7 @@ class SsmSendCommandIntegrationTest {
.body("Command.ErrorCount", equalTo(0))
.extract().body().asString();
- String cid = io.restassured.path.json.JsonPath.from(response).getString("Command.CommandId");
+ String cid = JsonPath.from(response).getString("Command.CommandId");
given()
.header("X-Amz-Target", "AmazonSSM.GetCommandInvocation")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminAssignmentsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminAssignmentsIntegrationTest.java
index 211e3f94af..85922d0f6d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminAssignmentsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminAssignmentsIntegrationTest.java
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.ssoadmin;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -29,7 +31,7 @@ class SsoAdminAssignmentsIntegrationTest {
.then().statusCode(200).body("PermissionSet.PermissionSetArn", notNullValue())
.extract().path("PermissionSet.PermissionSetArn");
json("SWBExternalService.ListPermissionSets", "{\"InstanceArn\":\"" + instanceArn + "\"}")
- .then().statusCode(200).body("PermissionSets", org.hamcrest.Matchers.hasItem(permissionSetArn));
+ .then().statusCode(200).body("PermissionSets", Matchers.hasItem(permissionSetArn));
String assignment = "{\"InstanceArn\":\"" + instanceArn
+ "\",\"TargetId\":\"123456789012\",\"TargetType\":\"AWS_ACCOUNT\",\"PermissionSetArn\":\""
@@ -44,7 +46,7 @@ class SsoAdminAssignmentsIntegrationTest {
json("SWBExternalService.ListAccountAssignmentCreationStatus",
"{\"InstanceArn\":\"" + instanceArn + "\",\"Filter\":{\"Status\":\"SUCCEEDED\"}}")
.then().statusCode(200)
- .body("AccountAssignmentsCreationStatus.RequestId", org.hamcrest.Matchers.hasItem(requestId));
+ .body("AccountAssignmentsCreationStatus.RequestId", Matchers.hasItem(requestId));
json("SWBExternalService.ListAccountAssignments",
"{\"InstanceArn\":\"" + instanceArn + "\",\"AccountId\":\"123456789012\",\"PermissionSetArn\":\""
+ permissionSetArn + "\"}")
@@ -117,7 +119,7 @@ class SsoAdminAssignmentsIntegrationTest {
.then().statusCode(400).body("__type", equalTo("ResourceNotFoundException"));
}
- private static io.restassured.response.Response json(String target, String body) {
+ private static Response json(String target, String body) {
return given().contentType(CONTENT_TYPE).header("Authorization", AUTH).header("X-Amz-Target", target)
.body(body).post("/");
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminIntegrationTest.java
index a0b07818d0..20840e9134 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminIntegrationTest.java
@@ -2,9 +2,13 @@ package io.github.hectorvent.floci.services.ssoadmin;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.List;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.matchesPattern;
@@ -47,7 +51,7 @@ class SsoAdminIntegrationTest {
void listInstances_isStableAcrossCalls() {
String firstArn = listInstancesArn();
String secondArn = listInstancesArn();
- org.junit.jupiter.api.Assertions.assertEquals(firstArn, secondArn);
+ Assertions.assertEquals(firstArn, secondArn);
}
@Test
@@ -71,7 +75,7 @@ class SsoAdminIntegrationTest {
+ "\"InstanceAccessControlAttributeConfiguration\":{\"AccessControlAttributes\":[{"
+ "\"Key\":\"Department\",\"Value\":{\"Source\":[\"${path:enterprise.department}\"]}}]}}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -94,7 +98,7 @@ class SsoAdminIntegrationTest {
+ "\"EncryptionConfiguration\":{\"KeyType\":\"CUSTOMER_MANAGED_KEY\","
+ "\"KmsKeyArn\":\"arn:aws:kms:us-east-1:000000000000:key/12345678-1234-1234-1234-1234567890ab\"}}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -134,7 +138,7 @@ class SsoAdminIntegrationTest {
.body("RegionName", equalTo("eu-west-2"))
.body("Status", equalTo("ACTIVE"))
.body("IsPrimaryRegion", equalTo(false))
- .body("AddedDate", org.hamcrest.Matchers.notNullValue());
+ .body("AddedDate", Matchers.notNullValue());
given()
.contentType("application/x-amz-json-1.1")
@@ -145,7 +149,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("Regions.RegionName", org.hamcrest.Matchers.hasItem("eu-west-2"))
+ .body("Regions.RegionName", Matchers.hasItem("eu-west-2"))
.body("Regions.find { it.RegionName == 'eu-west-2' }.Status", equalTo("ACTIVE"));
given()
@@ -157,7 +161,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ConflictException"));
+ .body("__type", Matchers.containsString("ConflictException"));
}
@Test
@@ -186,7 +190,7 @@ class SsoAdminIntegrationTest {
.body(request)
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
}
@Test
@@ -221,7 +225,7 @@ class SsoAdminIntegrationTest {
.body("{\"InstanceArn\":\"" + instanceArn + "\",\"ResourceArn\":\"" + permissionSetArn + "\","
+ "\"Tags\":[{\"Key\":\"Environment\",\"Value\":\"prod\"},{\"Key\":\"Owner\",\"Value\":\"platform\"}]}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -241,7 +245,7 @@ class SsoAdminIntegrationTest {
.header("X-Amz-Target", "SWBExternalService.UntagResource")
.body("{\"ResourceArn\":\"" + permissionSetArn + "\",\"TagKeys\":[\"Environment\"]}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -276,7 +280,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
}
@Test
@@ -338,7 +342,7 @@ class SsoAdminIntegrationTest {
.body("ApplicationAccount", equalTo("000000000000"))
.body("ApplicationArn", equalTo(applicationArn))
.body("ApplicationProviderArn", equalTo("arn:aws:sso::aws:applicationProvider/custom"))
- .body("CreatedDate", org.hamcrest.Matchers.notNullValue())
+ .body("CreatedDate", Matchers.notNullValue())
.body("CreatedFrom", equalTo("us-east-1"))
.body("Description", equalTo("Describe application"))
.body("IdentityStoreArn", equalTo("arn:aws:identitystore::000000000000:identitystore/d-9067f2a3c1"))
@@ -358,7 +362,7 @@ class SsoAdminIntegrationTest {
+ "\"ApplicationProvider\":\"arn:aws:sso::aws:applicationProvider/custom\"}}")
.when().post("/")
.then().statusCode(200)
- .body("Applications.ApplicationArn", org.hamcrest.Matchers.hasItem(applicationArn));
+ .body("Applications.ApplicationArn", Matchers.hasItem(applicationArn));
}
@Test
@@ -382,7 +386,7 @@ class SsoAdminIntegrationTest {
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"Name\":\"Updated Integration\","
+ "\"Description\":\"Updated application\",\"Status\":\"DISABLED\"}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -429,7 +433,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -549,7 +553,7 @@ class SsoAdminIntegrationTest {
.header("X-Amz-Target", "SWBExternalService.PutApplicationAssignmentConfiguration")
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"AssignmentRequired\":false}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -581,7 +585,7 @@ class SsoAdminIntegrationTest {
+ "\"AuthorizedTargets\":[\"arn:aws:sso:::instance/ssoins-7223b02a5d9f7c8e\"]}")
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -607,7 +611,7 @@ class SsoAdminIntegrationTest {
.then().statusCode(200)
.extract().path("ApplicationArn");
- for (String scope : java.util.List.of("api:read", "api:write")) {
+ for (String scope : List.of("api:read", "api:write")) {
given()
.contentType("application/x-amz-json-1.1")
.header("Authorization", AUTH_HEADER)
@@ -631,7 +635,7 @@ class SsoAdminIntegrationTest {
.body("Scopes[0].AuthorizedTargets[0]",
equalTo("arn:aws:sso:::instance/ssoins-7223b02a5d9f7c8e"))
.extract().path("NextToken");
- org.junit.jupiter.api.Assertions.assertNotNull(nextToken);
+ Assertions.assertNotNull(nextToken);
given()
.contentType("application/x-amz-json-1.1")
@@ -688,14 +692,14 @@ class SsoAdminIntegrationTest {
.body(assignmentRequest)
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given().contentType("application/x-amz-json-1.1").header("Authorization", AUTH_HEADER)
.header("X-Amz-Target", "SWBExternalService.DeleteApplicationAssignment")
.body(assignmentRequest)
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
}
@Test
@@ -721,7 +725,7 @@ class SsoAdminIntegrationTest {
.header("X-Amz-Target", "SWBExternalService.PutApplicationAuthenticationMethod")
.body(body)
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -786,14 +790,14 @@ class SsoAdminIntegrationTest {
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"AuthenticationMethodType\":\"IAM\"}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
given().contentType("application/x-amz-json-1.1").header("Authorization", AUTH_HEADER)
.header("X-Amz-Target", "SWBExternalService.DeleteApplicationAuthenticationMethod")
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"AuthenticationMethodType\":\"SAML\"}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ValidationException"));
+ .body("__type", Matchers.containsString("ValidationException"));
}
@Test
@@ -825,7 +829,7 @@ class SsoAdminIntegrationTest {
.body("{\"ApplicationArn\":\"" + applicationArn + "\","
+ "\"UserBackgroundSessionApplicationStatus\":\"ENABLED\"}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -858,7 +862,7 @@ class SsoAdminIntegrationTest {
+ "\"GrantType\":\"authorization_code\","
+ "\"Grant\":{\"AuthorizationCode\":{\"RedirectUris\":[\"https://example.com/callback\"]}}}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -923,14 +927,14 @@ class SsoAdminIntegrationTest {
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"GrantType\":\"authorization_code\"}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
given().contentType("application/x-amz-json-1.1").header("Authorization", AUTH_HEADER)
.header("X-Amz-Target", "SWBExternalService.DeleteApplicationGrant")
.body("{\"ApplicationArn\":\"" + applicationArn + "\",\"GrantType\":\"client_credentials\"}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ValidationException"));
+ .body("__type", Matchers.containsString("ValidationException"));
}
@Test
@@ -987,7 +991,7 @@ class SsoAdminIntegrationTest {
.body("{\"TrustedTokenIssuerArn\":\"" + arn + "\",\"Name\":\"IntegrationIssuerUpdated\","
+ "\"TrustedTokenIssuerConfiguration\":{\"OidcJwtConfiguration\":{\"ClaimAttributePath\":\"email\"}}}")
.when().post("/")
- .then().statusCode(200).body(org.hamcrest.Matchers.emptyOrNullString());
+ .then().statusCode(200).body(Matchers.emptyOrNullString());
given()
.contentType("application/x-amz-json-1.1")
@@ -1016,7 +1020,7 @@ class SsoAdminIntegrationTest {
.when().post("/")
.then()
.statusCode(200)
- .body("TrustedTokenIssuers.TrustedTokenIssuerArn", org.hamcrest.Matchers.hasItem(arn))
+ .body("TrustedTokenIssuers.TrustedTokenIssuerArn", Matchers.hasItem(arn))
.body("TrustedTokenIssuers.find { it.TrustedTokenIssuerArn == '" + arn + "' }.Name", equalTo("IntegrationIssuerUpdated"))
.body("TrustedTokenIssuers.find { it.TrustedTokenIssuerArn == '" + arn + "' }.TrustedTokenIssuerType", equalTo("OIDC_JWT"));
}
@@ -1046,7 +1050,7 @@ class SsoAdminIntegrationTest {
.body(deleteRequest)
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -1055,7 +1059,7 @@ class SsoAdminIntegrationTest {
.body(deleteRequest)
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
}
@Test
@@ -1073,7 +1077,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -1105,7 +1109,7 @@ class SsoAdminIntegrationTest {
.when()
.post("/")
.then()
- .statusCode(org.hamcrest.Matchers.anyOf(org.hamcrest.Matchers.is(200), org.hamcrest.Matchers.is(400)));
+ .statusCode(Matchers.anyOf(Matchers.is(200), Matchers.is(400)));
given()
.contentType("application/x-amz-json-1.1")
@@ -1126,7 +1130,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -1137,7 +1141,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
}
@Test
@@ -1184,7 +1188,7 @@ class SsoAdminIntegrationTest {
.body("Status", equalTo("ACTIVE"))
.body("PermissionSetsEnabled", equalTo(false))
.body("IdentityStoreId", matchesPattern("d-[0-9a-f]{10}"))
- .body("CreatedDate", org.hamcrest.Matchers.notNullValue());
+ .body("CreatedDate", Matchers.notNullValue());
given()
.contentType("application/x-amz-json-1.1")
.header("Authorization", auth)
@@ -1199,7 +1203,7 @@ class SsoAdminIntegrationTest {
.body("Instances[0].Name", equalTo("StandaloneInstance"))
.body("Instances[0].OwnerAccountId", equalTo("222233334444"))
.body("Instances[0].PrimaryRegion", equalTo("us-west-2"))
- .body("Instances[0].CreatedDate", org.hamcrest.Matchers.greaterThan(0.0f))
+ .body("Instances[0].CreatedDate", Matchers.greaterThan(0.0f))
.body("Instances[0].Regions.size()", equalTo(1))
.body("Instances[0].Regions[0].RegionName", equalTo("us-west-2"))
.body("Instances[0].Regions[0].IsPrimaryRegion", equalTo(true))
@@ -1224,7 +1228,7 @@ class SsoAdminIntegrationTest {
.body("{\"InstanceArn\":\"" + instanceArn + "\"}")
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given()
.contentType("application/x-amz-json-1.1")
@@ -1255,21 +1259,21 @@ class SsoAdminIntegrationTest {
.body("{\"ApplicationArn\":\"" + applicationArn + "\"}")
.when().post("/")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.is(org.hamcrest.Matchers.emptyOrNullString()));
+ .body(Matchers.is(Matchers.emptyOrNullString()));
given().contentType("application/x-amz-json-1.1").header("Authorization", AUTH_HEADER)
.header("X-Amz-Target", "SWBExternalService.DeleteApplication")
.body("{\"ApplicationArn\":\"" + applicationArn + "\"}")
.when().post("/")
.then().statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("ResourceNotFoundException"));
+ .body("__type", Matchers.containsString("ResourceNotFoundException"));
}
@Test
void listAccountAssignmentsForPrincipalReturnsPrincipalAccessWithPagination() {
String instanceArn = listInstancesArn();
String principalId = "cccccccc-dddd-eeee-ffff-000000000001";
- for (String name : java.util.List.of("PrincipalIntegrationOne", "PrincipalIntegrationTwo")) {
+ for (String name : List.of("PrincipalIntegrationOne", "PrincipalIntegrationTwo")) {
String permissionSetArn = given()
.contentType("application/x-amz-json-1.1")
.header("Authorization", AUTH_HEADER)
@@ -1295,7 +1299,7 @@ class SsoAdminIntegrationTest {
.then().statusCode(200)
.body("AccountAssignments.size()", equalTo(1))
.extract().path("NextToken");
- org.junit.jupiter.api.Assertions.assertNotNull(nextToken);
+ Assertions.assertNotNull(nextToken);
}
@Test
@@ -1335,7 +1339,7 @@ class SsoAdminIntegrationTest {
.body("{\"InstanceArn\":\"" + instanceArn + "\",\"Filter\":{\"Status\":\"SUCCEEDED\"}}")
.when().post("/")
.then().statusCode(200)
- .body("PermissionSetsProvisioningStatus.RequestId", org.hamcrest.Matchers.hasItem(requestId));
+ .body("PermissionSetsProvisioningStatus.RequestId", Matchers.hasItem(requestId));
}
@Test
@@ -1361,7 +1365,7 @@ class SsoAdminIntegrationTest {
+ "\"ProvisioningStatus\":\"LATEST_PERMISSION_SET_PROVISIONED\"}")
.when().post("/")
.then().statusCode(200)
- .body("PermissionSets", org.hamcrest.Matchers.hasItem(permissionSetArn));
+ .body("PermissionSets", Matchers.hasItem(permissionSetArn));
}
@Test
@@ -1387,7 +1391,7 @@ class SsoAdminIntegrationTest {
+ "\"ProvisioningStatus\":\"LATEST_PERMISSION_SET_PROVISIONED\"}")
.when().post("/")
.then().statusCode(200)
- .body("AccountIds", org.hamcrest.Matchers.hasItem("321098765432"));
+ .body("AccountIds", Matchers.hasItem("321098765432"));
}
@Test
@@ -1417,7 +1421,7 @@ class SsoAdminIntegrationTest {
.statusCode(200)
.body("AccountAssignmentDeletionStatus.Status", equalTo("SUCCEEDED"))
.body("AccountAssignmentDeletionStatus.RequestId", matchesPattern("[0-9a-f-]{36}"))
- .body("AccountAssignmentDeletionStatus.CreatedDate", org.hamcrest.Matchers.greaterThan(0.0f))
+ .body("AccountAssignmentDeletionStatus.CreatedDate", Matchers.greaterThan(0.0f))
.extract().path("AccountAssignmentDeletionStatus.RequestId");
given().contentType("application/x-amz-json-1.1").header("Authorization", AUTH_HEADER)
@@ -1433,7 +1437,7 @@ class SsoAdminIntegrationTest {
.body("{\"InstanceArn\":\"" + instanceArn + "\",\"Filter\":{\"Status\":\"SUCCEEDED\"}}")
.when().post("/")
.then().statusCode(200)
- .body("AccountAssignmentsDeletionStatus.RequestId", org.hamcrest.Matchers.hasItem(deletionRequestId));
+ .body("AccountAssignmentsDeletionStatus.RequestId", Matchers.hasItem(deletionRequestId));
}
@Test
@@ -1447,7 +1451,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(400)
- .body("__type", org.hamcrest.Matchers.containsString("UnknownOperationException"));
+ .body("__type", Matchers.containsString("UnknownOperationException"));
}
@Test
@@ -1462,7 +1466,7 @@ class SsoAdminIntegrationTest {
.post("/")
.then()
.statusCode(200)
- .body("Instances.size()", org.hamcrest.Matchers.equalTo(0));
+ .body("Instances.size()", Matchers.equalTo(0));
}
private static String listInstancesArn() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminServiceTest.java
index 0f5b80b871..f1db1ec777 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssoadmin/SsoAdminServiceTest.java
@@ -27,6 +27,7 @@ import io.github.hectorvent.floci.services.ssoadmin.model.SsoInstance;
import io.github.hectorvent.floci.services.ssoadmin.model.TrustedTokenIssuer;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.util.LinkedHashMap;
import java.util.List;
@@ -55,8 +56,8 @@ class SsoAdminServiceTest {
@BeforeEach
void setUp() {
- identityStoreService = org.mockito.Mockito.mock(IdentityStoreService.class);
- organizationsService = org.mockito.Mockito.mock(OrganizationsService.class);
+ identityStoreService = Mockito.mock(IdentityStoreService.class);
+ organizationsService = Mockito.mock(OrganizationsService.class);
applicationAccessScopes = new InMemoryStorage<>();
applicationAuthenticationMethods = new InMemoryStorage<>();
applicationGrants = new InMemoryStorage<>();
@@ -380,7 +381,7 @@ class SsoAdminServiceTest {
request.put("InstanceArn", instance.instanceArn());
emptyService.deleteInstance(request, ACCOUNT_ID);
assertError("ResourceNotFoundException", () -> emptyService.getApplication(createdApplication.applicationArn()));
- org.mockito.Mockito.verify(identityStoreService).deleteIdentityStore(instance.identityStoreId());
+ Mockito.verify(identityStoreService).deleteIdentityStore(instance.identityStoreId());
}
@Test
@@ -505,7 +506,7 @@ class SsoAdminServiceTest {
@Test
void createInstanceRejectsOrganizationsManagementAccounts() {
- org.mockito.Mockito.when(organizationsService.isManagementAccount(ACCOUNT_ID)).thenReturn(true);
+ Mockito.when(organizationsService.isManagementAccount(ACCOUNT_ID)).thenReturn(true);
SsoAdminService emptyService = emptyService();
assertError("AccessDeniedException",
@@ -546,7 +547,7 @@ class SsoAdminServiceTest {
providerFilter.putObject("Filter")
.put("ApplicationProvider", "arn:aws:sso::aws:applicationProvider/custom")
.put("ApplicationAccount", ACCOUNT_ID);
- assertTrue(service.listApplications(providerFilter, ACCOUNT_ID).items().containsAll(java.util.List.of(first, second)));
+ assertTrue(service.listApplications(providerFilter, ACCOUNT_ID).items().containsAll(List.of(first, second)));
ObjectNode memberWithoutFilter = mapper.createObjectNode().put("InstanceArn", service.getInstanceArn());
assertError("AccessDeniedException",
@@ -629,12 +630,12 @@ class SsoAdminServiceTest {
ApplicationAccessScope created = service.putApplicationAccessScope(request);
assertEquals("api:read", created.scope());
- assertEquals(java.util.List.of(service.getInstanceArn()), created.authorizedTargets());
+ assertEquals(List.of(service.getInstanceArn()), created.authorizedTargets());
assertEquals(created, service.getApplicationAccessScope(request));
request.putArray("AuthorizedTargets").add(application.applicationArn());
ApplicationAccessScope updated = service.putApplicationAccessScope(request);
- assertEquals(java.util.List.of(application.applicationArn()), updated.authorizedTargets());
+ assertEquals(List.of(application.applicationArn()), updated.authorizedTargets());
ObjectNode invalid = request.deepCopy();
invalid.putArray("AuthorizedTargets").add("not-an-arn");
@@ -645,7 +646,7 @@ class SsoAdminServiceTest {
void listApplicationAccessScopesPaginatesScopesForTheRequestedApplication() {
SsoApplication application = createApplication("List Scope App", "list-scope-app-token");
SsoApplication otherApplication = createApplication("Other Scope App", "other-scope-app-token");
- for (String scope : java.util.List.of("api:read", "api:write")) {
+ for (String scope : List.of("api:read", "api:write")) {
ObjectNode put = mapper.createObjectNode();
put.put("ApplicationArn", application.applicationArn());
put.put("Scope", scope);
@@ -664,7 +665,7 @@ class SsoAdminServiceTest {
PaginatedResult<ApplicationAccessScope> first = service.listApplicationAccessScopes(request);
assertEquals(1, first.items().size());
assertEquals("api:read", first.items().get(0).scope());
- assertEquals(java.util.List.of(service.getInstanceArn()), first.items().get(0).authorizedTargets());
+ assertEquals(List.of(service.getInstanceArn()), first.items().get(0).authorizedTargets());
assertNotNull(first.nextToken());
request.put("NextToken", first.nextToken());
@@ -690,7 +691,7 @@ class SsoAdminServiceTest {
String scope = "api:read";
String key = SsoAdminService.applicationAccessScopeKey(application.applicationArn(), scope);
applicationAccessScopes.put(key, new ApplicationAccessScope(
- application.applicationArn(), scope, java.util.List.of(service.getInstanceArn())));
+ application.applicationArn(), scope, List.of(service.getInstanceArn())));
ObjectNode request = mapper.createObjectNode();
request.put("ApplicationArn", application.applicationArn());
@@ -1044,7 +1045,7 @@ class SsoAdminServiceTest {
void listApplicationProvidersReturnsCustomProviderAndValidatesPagination() {
ObjectNode request = mapper.createObjectNode();
PaginatedResult<String> page = service.listApplicationProviders(request, "us-east-1");
- assertEquals(java.util.List.of("arn:aws:sso::aws:applicationProvider/custom"), page.items());
+ assertEquals(List.of("arn:aws:sso::aws:applicationProvider/custom"), page.items());
assertEquals(null, page.nextToken());
ObjectNode invalidMaxResults = mapper.createObjectNode().put("MaxResults", 101);
@@ -1090,7 +1091,7 @@ class SsoAdminServiceTest {
groupAssignment.put("PrincipalId", groupId);
groupAssignment.put("PrincipalType", "GROUP");
service.createApplicationAssignment(groupAssignment);
- org.mockito.Mockito.when(identityStoreService.groupIdsForUser(service.getIdentityStoreId(), PRINCIPAL_ID))
+ Mockito.when(identityStoreService.groupIdsForUser(service.getIdentityStoreId(), PRINCIPAL_ID))
.thenReturn(Set.of(groupId));
ObjectNode request = mapper.createObjectNode();
@@ -1298,7 +1299,7 @@ class SsoAdminServiceTest {
@Test
void addRegionEnforcesTheDocumentedSixRegionQuotaIncludingPrimary() {
- for (String region : java.util.List.of("us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1")) {
+ for (String region : List.of("us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1")) {
ObjectNode request = mapper.createObjectNode();
request.put("InstanceArn", service.getInstanceArn());
request.put("RegionName", region);
@@ -1643,7 +1644,7 @@ class SsoAdminServiceTest {
void listPermissionSetsProvisionedToAccountFiltersCurrentAndStaleProvisioning() {
PermissionSet first = createPermissionSet("ProvisionedListOne");
PermissionSet second = createPermissionSet("ProvisionedListTwo");
- for (PermissionSet permissionSet : java.util.List.of(first, second)) {
+ for (PermissionSet permissionSet : List.of(first, second)) {
ObjectNode provision = mapper.createObjectNode();
provision.put("InstanceArn", service.getInstanceArn());
provision.put("PermissionSetArn", permissionSet.arn());
@@ -1673,7 +1674,7 @@ class SsoAdminServiceTest {
assertEquals(1, service.listPermissionSetsProvisionedToAccount(request).items().size());
request.put("ProvisioningStatus", "LATEST_PERMISSION_SET_NOT_PROVISIONED");
- assertEquals(java.util.List.of(first.arn()), service.listPermissionSetsProvisionedToAccount(request).items());
+ assertEquals(List.of(first.arn()), service.listPermissionSetsProvisionedToAccount(request).items());
request.put("ProvisioningStatus", "FAILED");
assertError("ValidationException", () -> service.listPermissionSetsProvisionedToAccount(request));
@@ -1682,7 +1683,7 @@ class SsoAdminServiceTest {
@Test
void listAccountsForProvisionedPermissionSetFiltersCurrentAndStaleAccounts() {
PermissionSet permissionSet = createPermissionSet("ProvisionedAccountsList");
- for (String accountId : java.util.List.of(ACCOUNT_ID, "210987654321")) {
+ for (String accountId : List.of(ACCOUNT_ID, "210987654321")) {
ObjectNode provision = mapper.createObjectNode();
provision.put("InstanceArn", service.getInstanceArn());
provision.put("PermissionSetArn", permissionSet.arn());
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcIntegrationTest.java
index 791b42675a..54fee1a51d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcIntegrationTest.java
@@ -8,9 +8,11 @@ import io.github.hectorvent.floci.services.ssoadmin.SsoAdminService;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;
+import java.util.List;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
@@ -185,7 +187,7 @@ class SsoOidcIntegrationTest {
String verifier = "01234567890123456789012345678901234567890123456789";
String challenge = Base64Url.encode(Digests.sha256(verifier.getBytes(StandardCharsets.US_ASCII)));
String code = ssoOidcService.createIamAuthorizationCode(applicationArn, redirectUri, challenge,
- java.util.List.of(redirectUri)).code();
+ List.of(redirectUri)).code();
String body = "{\"clientId\":\"" + applicationArn + "\",\"grantType\":\"authorization_code\","
+ "\"code\":\"" + code + "\",\"codeVerifier\":\"" + verifier + "\","
+ "\"redirectUri\":\"" + redirectUri + "\",\"scope\":[\"openid\"]}";
@@ -200,8 +202,8 @@ class SsoOidcIntegrationTest {
.body("tokenType", equalTo("Bearer"))
.body("scope[0]", equalTo("openid"))
.body("accessToken", matchesPattern("[0-9a-f]{64}"))
- .body("idToken", org.hamcrest.Matchers.not(org.hamcrest.Matchers.blankOrNullString()))
- .body("awsAdditionalDetails.identityContext", org.hamcrest.Matchers.not(org.hamcrest.Matchers.blankOrNullString()));
+ .body("idToken", Matchers.not(Matchers.blankOrNullString()))
+ .body("awsAdditionalDetails.identityContext", Matchers.not(Matchers.blankOrNullString()));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcServiceTest.java
index 526c8f577b..f40f2f6253 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssooidc/SsoOidcServiceTest.java
@@ -153,15 +153,15 @@ class SsoOidcServiceTest {
refresh.put("grantType", "refresh_token");
refresh.put("refreshToken", source.refreshToken());
assertOidcError("invalid_scope",
- () -> service.createIamToken(refresh, sourceApplication, java.util.List.of("api:write")));
+ () -> service.createIamToken(refresh, sourceApplication, List.of("api:write")));
assertEquals(sourceApplication,
- service.createIamToken(refresh, sourceApplication, java.util.List.of("api:read")).clientId());
+ service.createIamToken(refresh, sourceApplication, List.of("api:read")).clientId());
ObjectNode jwt = mapper.createObjectNode();
jwt.put("grantType", "urn:ietf:params:oauth:grant-type:jwt-bearer");
jwt.put("assertion", "header.payload.signature");
assertEquals(targetApplication,
- service.createIamToken(jwt, targetApplication, java.util.List.of("openid")).clientId());
+ service.createIamToken(jwt, targetApplication, List.of("openid")).clientId());
ObjectNode exchange = mapper.createObjectNode();
exchange.put("grantType", "urn:ietf:params:oauth:grant-type:token-exchange");
@@ -173,7 +173,7 @@ class SsoOidcServiceTest {
assertNull(exchanged.refreshToken());
assertOidcError("invalid_grant",
- () -> service.createIamToken(exchange, sourceApplication, java.util.List.of("openid")));
+ () -> service.createIamToken(exchange, sourceApplication, List.of("openid")));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssoportal/SsoPortalIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssoportal/SsoPortalIntegrationTest.java
index 449a46f935..ca5e794f43 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssoportal/SsoPortalIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssoportal/SsoPortalIntegrationTest.java
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.services.ssooidc.model.DeviceAuthorization;
import io.github.hectorvent.floci.services.ssooidc.model.RegisteredClient;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import java.util.UUID;
@@ -70,8 +71,8 @@ class SsoPortalIntegrationTest {
.queryParam("account_id", "111111111111")
.when().get("/assignment/roles")
.then().statusCode(200)
- .body("roleList[0].accountId", org.hamcrest.Matchers.equalTo("111111111111"))
- .body("roleList[0].roleName", org.hamcrest.Matchers.equalTo("PortalDirect" + suffix));
+ .body("roleList[0].accountId", Matchers.equalTo("111111111111"))
+ .body("roleList[0].roleName", Matchers.equalTo("PortalDirect" + suffix));
given()
.header("x-amz-sso_bearer_token", accessToken)
@@ -85,10 +86,10 @@ class SsoPortalIntegrationTest {
.queryParam("role_name", "PortalDirect" + suffix)
.when().get("/federation/credentials")
.then().statusCode(200)
- .body("roleCredentials.accessKeyId", org.hamcrest.Matchers.startsWith("ASIA"))
- .body("roleCredentials.secretAccessKey", org.hamcrest.Matchers.not(org.hamcrest.Matchers.emptyString()))
- .body("roleCredentials.sessionToken", org.hamcrest.Matchers.not(org.hamcrest.Matchers.emptyString()))
- .body("roleCredentials.expiration", org.hamcrest.Matchers.greaterThan(System.currentTimeMillis()));
+ .body("roleCredentials.accessKeyId", Matchers.startsWith("ASIA"))
+ .body("roleCredentials.secretAccessKey", Matchers.not(Matchers.emptyString()))
+ .body("roleCredentials.sessionToken", Matchers.not(Matchers.emptyString()))
+ .body("roleCredentials.expiration", Matchers.greaterThan(System.currentTimeMillis()));
given()
.header("x-amz-sso_bearer_token", accessToken)
@@ -121,7 +122,7 @@ class SsoPortalIntegrationTest {
.header("x-amz-sso_bearer_token", accessToken)
.when().post("/logout")
.then().statusCode(200)
- .body(org.hamcrest.Matchers.emptyOrNullString());
+ .body(Matchers.emptyOrNullString());
given()
.header("x-amz-sso_bearer_token", accessToken)
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorIntrinsicContextTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorIntrinsicContextTest.java
index 2dab855458..91f0cd5820 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorIntrinsicContextTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorIntrinsicContextTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.stepfunctions;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -57,7 +58,7 @@ class AslExecutorIntrinsicContextTest {
AslExecutor executor = newExecutor();
JsonNode input = mapper.createObjectNode();
JsonNode context = mapper.createObjectNode();
- ((com.fasterxml.jackson.databind.node.ObjectNode) context).putObject("Map")
+ ((ObjectNode) context).putObject("Map")
.putObject("Item").putObject("Value").put("solutionId", "SOLUTION_B");
JsonNode result = executor.resolvePath(
@@ -71,7 +72,7 @@ class AslExecutorIntrinsicContextTest {
AslExecutor executor = newExecutor();
JsonNode input = mapper.createObjectNode();
JsonNode context = mapper.createObjectNode();
- ((com.fasterxml.jackson.databind.node.ObjectNode) context).put("token", "abc");
+ ((ObjectNode) context).put("token", "abc");
// States.JsonToString($$) serializes the whole Context Object.
JsonNode result = executor.resolvePath("States.JsonToString($$)", input, context);
@@ -83,7 +84,7 @@ class AslExecutorIntrinsicContextTest {
void inputArgsStillResolveWithContextPresent() {
AslExecutor executor = newExecutor();
JsonNode input = mapper.createObjectNode();
- ((com.fasterxml.jackson.databind.node.ObjectNode) input).put("a", "X").put("b", "Y");
+ ((ObjectNode) input).put("a", "X").put("b", "Y");
JsonNode context = mapper.createObjectNode();
JsonNode result = executor.resolvePath("States.Format('{}-{}', $.a, $.b)", input, context);
@@ -95,7 +96,7 @@ class AslExecutorIntrinsicContextTest {
void noContext_intrinsicResolutionUnchanged() {
AslExecutor executor = newExecutor();
JsonNode input = mapper.createObjectNode();
- ((com.fasterxml.jackson.databind.node.ObjectNode) input).put("name", "widget");
+ ((ObjectNode) input).put("name", "widget");
// The 2-arg form (context == null) must behave exactly as before: $. args resolve,
// and a stray $$. arg — which has no context to resolve against — yields "null".
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorResultWriterTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorResultWriterTest.java
index 3dde53413f..93d3202afe 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorResultWriterTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/AslExecutorResultWriterTest.java
@@ -16,6 +16,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -553,7 +554,7 @@ class AslExecutorResultWriterTest {
for (int i = 0; i < keys.getAllValues().size(); i++) {
if (keys.getAllValues().get(i).endsWith("SUCCEEDED_0.json")) {
resultKey = keys.getAllValues().get(i);
- String body = new String(bodies.getAllValues().get(i), java.nio.charset.StandardCharsets.UTF_8);
+ String body = new String(bodies.getAllValues().get(i), StandardCharsets.UTF_8);
String[] lines = body.strip().split("\n");
assertEquals(2, lines.length);
assertEquals(1, mapper.readTree(lines[0]).path("a").asInt());
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/JsonataEdgeCaseTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/JsonataEdgeCaseTest.java
index 27d9497083..09bb34a40c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/JsonataEdgeCaseTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/JsonataEdgeCaseTest.java
@@ -83,7 +83,7 @@ class JsonataEdgeCaseTest {
"city", "Springfield",
"zip", "62704"
),
- "tags", java.util.List.of("admin", "active")
+ "tags", List.of("admin", "active")
)
));
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/MapIterationSchedulerTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/MapIterationSchedulerTest.java
index 65571209c7..d603ea7136 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/MapIterationSchedulerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/MapIterationSchedulerTest.java
@@ -14,6 +14,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -33,7 +34,7 @@ class MapIterationSchedulerTest {
@Test
void maxConcurrencyOneStartsEachItemStrictlyInInputOrder() throws Exception {
- List<Integer> starts = new java.util.concurrent.CopyOnWriteArrayList<>();
+ List<Integer> starts = new CopyOnWriteArrayList<>();
List<Integer> results = MapIterationScheduler.execute(5, 1, index -> () -> {
starts.add(index);
@@ -73,7 +74,7 @@ class MapIterationSchedulerTest {
assertEquals(maxConcurrency, started.get(), "queued items must not be submitted early");
release.countDown();
- assertEquals(java.util.stream.IntStream.range(0, itemCount).boxed().toList(),
+ assertEquals(IntStream.range(0, itemCount).boxed().toList(),
execution.get(5, TimeUnit.SECONDS));
assertEquals(maxConcurrency, maxObserved.get());
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java
index e3b2e0c38a..b6cd7f6e52 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java
@@ -30,6 +30,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -113,7 +114,7 @@ class StepFunctionsServicePersistenceTest {
history.add(succeeded);
execution.setStatus("SUCCEEDED");
execution.setOutput("{\"result\":true}");
- invocation.<java.util.function.BiConsumer<Execution, List<HistoryEvent>>>getArgument(4)
+ invocation.<BiConsumer<Execution, List<HistoryEvent>>>getArgument(4)
.accept(execution, history);
return null;
}).when(aslExecutor).executeAsync(any(StateMachine.class), any(Execution.class), anyList(),
@@ -398,7 +399,7 @@ class StepFunctionsServicePersistenceTest {
@Override
public void executeAsync(StateMachine stateMachine, Execution execution,
List<HistoryEvent> history, MockedTestCase mockedTestCase,
- java.util.function.BiConsumer<Execution, List<HistoryEvent>> onUpdate) {
+ BiConsumer<Execution, List<HistoryEvent>> onUpdate) {
super.executeAsync(stateMachine, execution, history, mockedTestCase,
(updatedExecution, updatedHistory) -> {
try {
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServiceStartExecutionRaceTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServiceStartExecutionRaceTest.java
index 45e01c0b83..5f9a5fdff9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServiceStartExecutionRaceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServiceStartExecutionRaceTest.java
@@ -23,6 +23,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.IntConsumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -148,7 +149,7 @@ class StepFunctionsServiceStartExecutionRaceTest {
return new Fixture(service, executor);
}
- private void runConcurrently(java.util.function.IntConsumer body) throws Exception {
+ private void runConcurrently(IntConsumer body) throws Exception {
CyclicBarrier barrier = new CyclicBarrier(N);
ExecutorService pool = Executors.newFixedThreadPool(N);
List<Future<?>> futures = new ArrayList<>();
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsTaskCredentialsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsTaskCredentialsIntegrationTest.java
index 082bc1ca0f..50cae43e35 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsTaskCredentialsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsTaskCredentialsIntegrationTest.java
@@ -13,6 +13,7 @@ import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -154,7 +155,7 @@ class StepFunctionsTaskCredentialsIntegrationTest {
assertEquals("States.Runtime", done.jsonPath().getString("error"));
}
request(TARGET, "ListExecutions", Map.of("stateMachineArn", child)).then()
- .statusCode(200).body("executions.size()", org.hamcrest.Matchers.equalTo(0));
+ .statusCode(200).body("executions.size()", Matchers.equalTo(0));
}
@ParameterizedTest
@@ -177,7 +178,7 @@ class StepFunctionsTaskCredentialsIntegrationTest {
assertEquals("Task Credentials must resolve to an object containing RoleArn",
done.jsonPath().getString("cause"));
request(TARGET, "ListExecutions", Map.of("stateMachineArn", child)).then()
- .statusCode(200).body("executions.size()", org.hamcrest.Matchers.equalTo(0));
+ .statusCode(200).body("executions.size()", Matchers.equalTo(0));
}
@ParameterizedTest
@@ -263,7 +264,7 @@ class StepFunctionsTaskCredentialsIntegrationTest {
assertEquals("FAILED", done.jsonPath().getString("status"), done.asString());
assertEquals("States.Timeout", done.jsonPath().getString("error"));
Response children = request(TARGET, "ListExecutions", Map.of("stateMachineArn", child));
- children.then().statusCode(200).body("executions.size()", org.hamcrest.Matchers.equalTo(1));
+ children.then().statusCode(200).body("executions.size()", Matchers.equalTo(1));
String execution = children.jsonPath().getString("executions[0].executionArn");
assertEquals("ABORTED", terminal(TARGET, execution).jsonPath().getString("status"));
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsVersionsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsVersionsIntegrationTest.java
index 7e44bea458..a556408a1c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsVersionsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsVersionsIntegrationTest.java
@@ -6,6 +6,8 @@ import io.restassured.response.Response;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.Collections;
+
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.emptyOrNullString;
@@ -41,7 +43,7 @@ class StepFunctionsVersionsIntegrationTest {
// No versions published yet -> empty list (the call that previously failed).
call("ListStateMachineVersions", "{\"stateMachineArn\":\"" + arn + "\"}")
- .then().statusCode(200).body("stateMachineVersions", is(java.util.Collections.emptyList()));
+ .then().statusCode(200).body("stateMachineVersions", is(Collections.emptyList()));
// Publish a version.
String versionArn = call("PublishStateMachineVersion", "{\"stateMachineArn\":\"" + arn + "\"}")
@@ -55,7 +57,7 @@ class StepFunctionsVersionsIntegrationTest {
call("DeleteStateMachineVersion", "{\"stateMachineVersionArn\":\"" + versionArn + "\"}")
.then().statusCode(200);
call("ListStateMachineVersions", "{\"stateMachineArn\":\"" + arn + "\"}")
- .then().statusCode(200).body("stateMachineVersions", is(java.util.Collections.emptyList()));
+ .then().statusCode(200).body("stateMachineVersions", is(Collections.emptyList()));
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/swf/SwfIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/swf/SwfIntegrationTest.java
index 324cf1691d..4d62f569e2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/swf/SwfIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/swf/SwfIntegrationTest.java
@@ -3,11 +3,16 @@ package io.github.hectorvent.floci.services.swf;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import java.util.Collections;
import java.util.List;
import static io.restassured.RestAssured.given;
@@ -60,7 +65,7 @@ class SwfIntegrationTest {
.body("domainInfo.status", equalTo("REGISTERED"))
.body("domainInfo.description", equalTo("floci test domain"))
.body("domainInfo.arn", startsWith("arn:aws:swf:us-east-1:"))
- .body("domainInfo.arn", org.hamcrest.Matchers.endsWith(":/domain/" + domain))
+ .body("domainInfo.arn", Matchers.endsWith(":/domain/" + domain))
.body("configuration.workflowExecutionRetentionPeriodInDays", equalTo("7"));
}
@@ -98,7 +103,7 @@ class SwfIntegrationTest {
.then()
.statusCode(400)
.body("__type", equalTo("com.amazon.coral.validate#ValidationException"))
- .body("message", org.hamcrest.Matchers.containsString(
+ .body("message", Matchers.containsString(
"Member must satisfy enum value set: [REGISTERED, DEPRECATED]"));
}
@@ -123,7 +128,7 @@ class SwfIntegrationTest {
""")
.then()
.statusCode(200)
- .body("domainInfos.name", org.hamcrest.Matchers.not(hasItem(domain)));
+ .body("domainInfos.name", Matchers.not(hasItem(domain)));
// Deprecating twice is an error; undeprecating restores REGISTERED.
call("DeprecateDomain", """
@@ -520,7 +525,7 @@ class SwfIntegrationTest {
""".formatted(domain));
deferred.then()
.statusCode(200)
- .body("taskToken", org.hamcrest.Matchers.not(equalTo("")))
+ .body("taskToken", Matchers.not(equalTo("")))
.body("events.eventType", hasItem("WorkflowExecutionSignaled"));
call("RespondDecisionTaskCompleted", """
@@ -761,7 +766,7 @@ class SwfIntegrationTest {
{"domain": "%s", "taskList": {"name": "floci-tl"}, "identity": "d"}
""".formatted(domain))
.then()
- .body("taskToken", org.hamcrest.Matchers.not(equalTo("")));
+ .body("taskToken", Matchers.not(equalTo("")));
}
@Test
@@ -1208,7 +1213,7 @@ class SwfIntegrationTest {
// Page 2 must not repeat page 1.
List<String> firstNames = first.path("typeInfos.workflowType.name");
List<String> secondNames = second.path("typeInfos.workflowType.name");
- assertTrue(java.util.Collections.disjoint(firstNames, secondNames),
+ assertTrue(Collections.disjoint(firstNames, secondNames),
"page 2 repeated page 1: " + firstNames + " / " + secondNames);
// The final page carries no token, even when it is exactly full.
@@ -1469,8 +1474,8 @@ class SwfIntegrationTest {
/** A page-1 continuation token for a task, so a poll resolves that task without claiming. */
private static String encodedFirstPage(String taskToken) {
- return java.util.Base64.getEncoder().encodeToString(
- ("offset=0\ntask=" + taskToken).getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ return Base64.getEncoder().encodeToString(
+ ("offset=0\ntask=" + taskToken).getBytes(StandardCharsets.UTF_8));
}
@Test
@@ -1629,7 +1634,7 @@ class SwfIntegrationTest {
""".formatted(arn))
.then()
.statusCode(200)
- .body("tags.key", org.hamcrest.Matchers.not(hasItem("env")))
+ .body("tags.key", Matchers.not(hasItem("env")))
.body("tags.key", hasItem("team"));
}
@@ -1773,8 +1778,8 @@ class SwfIntegrationTest {
""".formatted(domain));
response.then().statusCode(200);
String token = response.path("taskToken");
- org.junit.jupiter.api.Assertions.assertNotNull(token, "expected a decision task");
- org.junit.jupiter.api.Assertions.assertFalse(token.isEmpty(), "expected a decision task");
+ Assertions.assertNotNull(token, "expected a decision task");
+ Assertions.assertFalse(token.isEmpty(), "expected a decision task");
return token;
}
@@ -1800,7 +1805,7 @@ class SwfIntegrationTest {
{"taskToken": "%s", "decisions": []}
""".formatted(token)).then().statusCode(200);
}
- return org.junit.jupiter.api.Assertions.fail("no decision task for " + workflowId);
+ return Assertions.fail("no decision task for " + workflowId);
}
private static void drainDecisionTasks(String domain) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/swf/SwfLambdaIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/swf/SwfLambdaIntegrationTest.java
index 329856f722..9aafe690ee 100644
--- a/src/test/java/io/github/hectorvent/floci/services/swf/SwfLambdaIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/swf/SwfLambdaIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.swf;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -139,7 +140,7 @@ class SwfLambdaIntegrationTest {
history.then()
.statusCode(200)
- .body("events.eventType", org.hamcrest.Matchers.hasItems(
+ .body("events.eventType", Matchers.hasItems(
"LambdaFunctionScheduled", "LambdaFunctionStarted", "LambdaFunctionCompleted"))
.body("events.find { it.eventType == 'LambdaFunctionScheduled' }"
+ ".lambdaFunctionScheduledEventAttributes.id", equalTo("lam-1"))
@@ -201,7 +202,7 @@ class SwfLambdaIntegrationTest {
""".formatted(domain))
.then()
.statusCode(200)
- .body("events.eventType", org.hamcrest.Matchers.hasItems(
+ .body("events.eventType", Matchers.hasItems(
"LambdaFunctionScheduled", "LambdaFunctionStarted", "LambdaFunctionFailed"))
.body("events.find { it.eventType == 'LambdaFunctionFailed' }"
+ ".lambdaFunctionFailedEventAttributes.reason",
@@ -231,10 +232,10 @@ class SwfLambdaIntegrationTest {
""".formatted(domain))
.then()
.statusCode(200)
- .body("events.eventType", org.hamcrest.Matchers.hasItem("StartLambdaFunctionFailed"))
+ .body("events.eventType", Matchers.hasItem("StartLambdaFunctionFailed"))
// This is the one Lambda path that never reaches Started.
.body("events.eventType",
- org.hamcrest.Matchers.not(org.hamcrest.Matchers.hasItem("LambdaFunctionStarted")))
+ Matchers.not(Matchers.hasItem("LambdaFunctionStarted")))
.body("events.find { it.eventType == 'StartLambdaFunctionFailed' }"
+ ".startLambdaFunctionFailedEventAttributes.cause", equalTo("ASSUME_ROLE_FAILED"))
.body("events.find { it.eventType == 'StartLambdaFunctionFailed' }"
diff --git a/src/test/java/io/github/hectorvent/floci/services/swf/SwfServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/swf/SwfServiceTest.java
index c73954c233..be2c51267f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/swf/SwfServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/swf/SwfServiceTest.java
@@ -41,6 +41,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -1045,7 +1046,7 @@ class SwfServiceTest {
}
@Override
- public List<V> scan(java.util.function.Predicate<String> keyFilter) {
+ public List<V> scan(Predicate<String> keyFilter) {
return inner.scan(keyFilter);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/timestreaminfluxdb/TimestreamInfluxDbIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/timestreaminfluxdb/TimestreamInfluxDbIntegrationTest.java
index 4025554196..3ce060960f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/timestreaminfluxdb/TimestreamInfluxDbIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/timestreaminfluxdb/TimestreamInfluxDbIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.timestreaminfluxdb;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
+import org.hamcrest.Matcher;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -457,7 +458,7 @@ class TimestreamInfluxDbIntegrationTest {
.body("restoredDbResourceId", equalTo(instanceId));
}
- private static org.hamcrest.Matcher<String> endsWithResource(String resourceType) {
+ private static Matcher<String> endsWithResource(String resourceType) {
return matchesPattern("arn:aws:timestream-influxdb:us-east-1:" + ACCOUNT + ":" + resourceType + "/" + ID_PATTERN);
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/transcribe/TranscribeServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/transcribe/TranscribeServiceTest.java
index 80579122d8..fdc07de48d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/transcribe/TranscribeServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/transcribe/TranscribeServiceTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.transcribe;
+import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend;
@@ -8,6 +9,7 @@ import io.github.hectorvent.floci.services.transcribe.model.VocabularyInfo;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -37,7 +39,7 @@ class TranscribeServiceTest {
StorageFactory storageFactory = new StorageFactory(null, null) {
@Override
public <V> AccountAwareStorageBackend<V> create(String serviceName, String fileName,
- com.fasterxml.jackson.core.type.TypeReference<java.util.Map<String, V>> typeReference) {
+ TypeReference<Map<String, V>> typeReference) {
@SuppressWarnings("unchecked")
AccountAwareStorageBackend<V> result =
(AccountAwareStorageBackend<V>) (AccountAwareStorageBackend<?>) TranscribeServiceTest.this.vocabularyStore;
diff --git a/src/test/java/io/github/hectorvent/floci/services/transfer/TransferServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/transfer/TransferServiceTest.java
index d88e1fcfdd..7c33d6ef32 100644
--- a/src/test/java/io/github/hectorvent/floci/services/transfer/TransferServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/transfer/TransferServiceTest.java
@@ -17,6 +17,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -199,7 +200,7 @@ class TransferServiceTest {
Server server = service.createServer("us-east-1", null, null, null, null,
null, null, null, null, Map.of("resource", "tag"));
tagStore.putForAccount("111111111111", "server/" + server.getServerId(),
- new java.util.HashMap<>(Map.of("legacy", "tag")));
+ new HashMap<>(Map.of("legacy", "tag")));
service.tagResource(server.getArn(), Map.of("new", "tag"));
diff --git a/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsIntegrationTest.java
index d3b0ada812..2cb9444f70 100644
--- a/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsIntegrationTest.java
@@ -1,12 +1,18 @@
package io.github.hectorvent.floci.services.verifiedpermissions;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
+import io.restassured.response.Response;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import static io.restassured.RestAssured.given;
@@ -118,7 +124,7 @@ class VerifiedPermissionsIntegrationTest {
.then().statusCode(200).extract().path("policyStoreId");
}
- private static io.restassured.response.Response givenAws(String action, String body) {
+ private static Response givenAws(String action, String body) {
return given().contentType(CONTENT_TYPE).header("Authorization", AUTH)
.header("X-Amz-Target", "VerifiedPermissions." + action).body(body)
.when().post("/");
@@ -208,7 +214,7 @@ class VerifiedPermissionsIntegrationTest {
.body("determiningPolicies.size()", equalTo(1));
String blocked = entities.replace("\"blocked\":false", "\"blocked\":true");
- java.util.LinkedHashMap<String,Object> blockedAuth = new java.util.LinkedHashMap<>(auth);
+ LinkedHashMap<String,Object> blockedAuth = new LinkedHashMap<>(auth);
blockedAuth.put("entities", Map.of("cedarJson", blocked));
givenAws("IsAuthorized", objectJson(blockedAuth)).then().statusCode(200)
.body("decision", equalTo("DENY"))
@@ -226,18 +232,18 @@ class VerifiedPermissionsIntegrationTest {
Map<String,Object> action = Map.of("actionType", "Demo::Action", "actionId", "write");
Map<String,Object> entity = Map.of(
"identifier", principal,
- "parents", java.util.List.of(Map.of("entityType", "Demo::Group", "entityId", "admins")),
+ "parents", List.of(Map.of("entityType", "Demo::Group", "entityId", "admins")),
"attributes", Map.of("department", Map.of("string", "platform")));
Map<String,Object> auth = Map.of("policyStoreId", store, "principal", principal, "action", action, "resource", resource,
- "entities", Map.of("entityList", java.util.List.of(entity)));
+ "entities", Map.of("entityList", List.of(entity)));
givenAws("IsAuthorized", objectJson(auth)).then().statusCode(200).body("decision", equalTo("ALLOW"));
Map<String,Object> item1 = Map.of("principal", principal, "action", action, "resource", resource);
Map<String,Object> item2 = Map.of("principal", principal,
"action", Map.of("actionType", "Demo::Action", "actionId", "read"),
"resource", Map.of("entityType", "Demo::Document", "entityId", "doc2"));
- givenAws("BatchIsAuthorized", objectJson(Map.of("policyStoreId", store, "requests", java.util.List.of(item1, item2),
- "entities", Map.of("entityList", java.util.List.of(entity)))))
+ givenAws("BatchIsAuthorized", objectJson(Map.of("policyStoreId", store, "requests", List.of(item1, item2),
+ "entities", Map.of("entityList", List.of(entity)))))
.then().statusCode(200).body("results.size()", equalTo(2))
.body("results[0].decision", equalTo("ALLOW"))
.body("results[1].decision", equalTo("DENY"));
@@ -249,7 +255,7 @@ class VerifiedPermissionsIntegrationTest {
String body = objectJson(Map.of("clientToken", token, "validationSettings", Map.of("mode", "OFF")));
String first = givenAws("CreatePolicyStore", body).then().statusCode(200).extract().path("policyStoreId");
String second = givenAws("CreatePolicyStore", body).then().statusCode(200).extract().path("policyStoreId");
- org.junit.jupiter.api.Assertions.assertEquals(first, second);
+ Assertions.assertEquals(first, second);
givenAws("CreatePolicyStore", objectJson(Map.of("clientToken", token,
"validationSettings", Map.of("mode", "STRICT"))))
.then().statusCode(400).body("__type", containsString("ConflictException"));
@@ -264,7 +270,7 @@ class VerifiedPermissionsIntegrationTest {
"principalEntityType", "Demo::User",
"configuration", Map.of("cognitoUserPoolConfiguration", Map.of(
"userPoolArn", cognitoArn,
- "clientIds", java.util.List.of("client-1"),
+ "clientIds", List.of("client-1"),
"groupConfiguration", Map.of("groupEntityType", "Demo::Group")))));
String cognitoId = givenAws("CreateIdentitySource", cognitoCreate).then().statusCode(200)
.extract().path("identitySourceId");
@@ -281,11 +287,11 @@ class VerifiedPermissionsIntegrationTest {
"issuer", "https://id.example.com",
"entityIdPrefix", "ext",
"tokenSelection", Map.of("identityTokenOnly", Map.of(
- "clientIds", java.util.List.of("web-client"), "principalIdClaim", "sub"))))));
+ "clientIds", List.of("web-client"), "principalIdClaim", "sub"))))));
String oidcId = givenAws("CreateIdentitySource", oidcCreate).then().statusCode(200)
.extract().path("identitySourceId");
givenAws("ListIdentitySources", objectJson(Map.of("policyStoreId", store,
- "filters", java.util.List.of(Map.of("principalEntityType", "Demo::ExternalUser")))))
+ "filters", List.of(Map.of("principalEntityType", "Demo::ExternalUser")))))
.then().statusCode(200).body("identitySources.size()", equalTo(1))
.body("identitySources[0].identitySourceId", equalTo(oidcId));
@@ -297,7 +303,7 @@ class VerifiedPermissionsIntegrationTest {
"issuer", "https://id2.example.com",
"entityIdPrefix", "partner",
"tokenSelection", Map.of("accessTokenOnly", Map.of(
- "audiences", java.util.List.of("api://demo"), "principalIdClaim", "sub"))))));
+ "audiences", List.of("api://demo"), "principalIdClaim", "sub"))))));
givenAws("UpdateIdentitySource", update).then().statusCode(200);
givenAws("GetIdentitySource", objectJson(Map.of("policyStoreId", store, "identitySourceId", oidcId)))
.then().statusCode(200).body("principalEntityType", equalTo("Demo::Partner"))
@@ -354,7 +360,7 @@ class VerifiedPermissionsIntegrationTest {
@Test
void identitySourceDocumentedCollectionLimits_areEnforced() {
String store = createStore("OFF", "DISABLED");
- java.util.List<String> emptyAudiences = java.util.List.of();
+ List<String> emptyAudiences = List.of();
givenAws("CreateIdentitySource", objectJson(Map.of(
"policyStoreId", store,
"principalEntityType", "Demo::User",
@@ -367,8 +373,8 @@ class VerifiedPermissionsIntegrationTest {
private static String objectJson(Object value) {
try {
- return new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(value);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
+ return new ObjectMapper().writeValueAsString(value);
+ } catch (JsonProcessingException e) {
throw new IllegalStateException(e);
}
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifierTest.java b/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifierTest.java
index a2f0d65e90..14758e0bf3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifierTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifierTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.SsrfProtection;
import org.apache.hc.client5.http.SystemDefaultDnsResolver;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import java.io.ByteArrayInputStream;
import java.net.InetAddress;
@@ -60,7 +61,7 @@ class VerifiedPermissionsOidcSignatureVerifierTest {
@Test
void unknownKidsTriggerAtMostOneRateLimitedRefresh() throws Exception {
- RSAPublicKey key = org.mockito.Mockito.mock(RSAPublicKey.class);
+ RSAPublicKey key = Mockito.mock(RSAPublicKey.class);
class CountingVerifier extends VerifiedPermissionsOidcSignatureVerifier {
int fetches;
@@ -85,8 +86,8 @@ class VerifiedPermissionsOidcSignatureVerifierTest {
@Test
void unknownKidRefreshAllowsRoutineKeyRotation() throws Exception {
- RSAPublicKey oldKey = org.mockito.Mockito.mock(RSAPublicKey.class);
- RSAPublicKey newKey = org.mockito.Mockito.mock(RSAPublicKey.class);
+ RSAPublicKey oldKey = Mockito.mock(RSAPublicKey.class);
+ RSAPublicKey newKey = Mockito.mock(RSAPublicKey.class);
class RotatingVerifier extends VerifiedPermissionsOidcSignatureVerifier {
int fetches;
@@ -113,8 +114,8 @@ class VerifiedPermissionsOidcSignatureVerifierTest {
@Test
void failedUnknownKidRefreshDoesNotStartCooldown() throws Exception {
- RSAPublicKey oldKey = org.mockito.Mockito.mock(RSAPublicKey.class);
- RSAPublicKey newKey = org.mockito.Mockito.mock(RSAPublicKey.class);
+ RSAPublicKey oldKey = Mockito.mock(RSAPublicKey.class);
+ RSAPublicKey newKey = Mockito.mock(RSAPublicKey.class);
class RecoveringVerifier extends VerifiedPermissionsOidcSignatureVerifier {
int fetches;
diff --git a/src/test/java/io/github/hectorvent/floci/services/wafv2/WafV2IntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/wafv2/WafV2IntegrationTest.java
index a6a6839a3d..3e01cd85f8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/wafv2/WafV2IntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/wafv2/WafV2IntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.wafv2;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -166,7 +167,7 @@ class WafV2IntegrationTest {
+ "\"CloudWatchMetricsEnabled\":true,\"MetricName\":\"acl\"}}");
resp.then().statusCode(200).body("NextLockToken", notNullValue());
String next = resp.jsonPath().getString("NextLockToken");
- org.junit.jupiter.api.Assertions.assertNotEquals(webAclLockToken, next);
+ Assertions.assertNotEquals(webAclLockToken, next);
}
@Test
diff --git a/tools/checkstyle/checkstyle.xml b/tools/checkstyle/checkstyle.xml
index c743eb1420..40373a6fa2 100644
--- a/tools/checkstyle/checkstyle.xml
+++ b/tools/checkstyle/checkstyle.xml
@@ -37,5 +37,45 @@
<module name="UnnecessaryFullyQualifiedType">
<property name="id" value="NoFqcn"/>
</module>
+ <!-- UnnecessaryFullyQualifiedType misses a qualified name before a static member, a nested type or .class,
+ and on an annotation. This finds those with the same exemption, and also leaves a name alone in a file
+ with a wildcard import that may bring in another type of that name. A chain that starts with a
+ variable is a field access, not a package.
+ Checkstyle's descendant axis is not in source order, so qualified names are joined in that same order on
+ both sides of each comparison. concat(@text, '') turns an attribute into a string, which a comparison
+ with a variable needs. -->
+ <module name="MatchXpath">
+ <property name="id" value="NoFqcn"/>
+ <property name="query" value="
+ //DOT[not(ancestor::IMPORT or ancestor::STATIC_IMPORT or ancestor::PACKAGE_DEF)]
+ [*[2][self::IDENT][matches(@text, '^[A-Z]')]]
+ [*[1][self::DOT][not(descendant::*[not(self::DOT or self::IDENT)])]
+ [not(descendant::IDENT[not(matches(@text, '^[a-z]'))])]]
+ [not(*[1]/descendant-or-self::DOT[*[1][self::IDENT]]/*[1]
+ [some $v in //*[self::VARIABLE_DEF or self::PARAMETER_DEF or self::PATTERN_VARIABLE_DEF
+ or self::RESOURCE or self::LAMBDA]/IDENT
+ satisfies concat($v/@text, '') = concat(@text, '')])]
+ [let $n := concat(*[2]/@text, ''),
+ $pkg := string-join(for $i in *[1]/descendant::IDENT return concat($i/@text, ''), '.'),
+ $own := string-join(for $i in //PACKAGE_DEF/*[self::DOT or self::IDENT]/descendant-or-self::IDENT
+ return concat($i/@text, ''), '.')
+ return not(
+ //IMPORT/DOT[*[2][concat(@text, '') = $n]]
+ [string-join(for $i in *[1]/descendant::IDENT return concat($i/@text, ''), '.') != $pkg]
+ or //*[self::CLASS_DEF or self::INTERFACE_DEF or self::ENUM_DEF or self::RECORD_DEF
+ or self::ANNOTATION_DEF][IDENT[concat(@text, '') = $n]]
+ or //DOT[not(ancestor::IMPORT or ancestor::STATIC_IMPORT or ancestor::PACKAGE_DEF)]
+ [*[2][self::IDENT][concat(@text, '') = $n]][*[1][self::DOT]]
+ [string-join(for $i in *[1]/descendant::IDENT return concat($i/@text, ''), '.') != $pkg]
+ or (//IMPORT[DOT/STAR]
+ and not(//IMPORT/DOT[*[2][concat(@text, '') = $n]]
+ [string-join(for $i in *[1]/descendant::IDENT return concat($i/@text, ''), '.') = $pkg]))
+ or (//IDENT[concat(@text, '') = $n][not(parent::DOT and preceding-sibling::*)]
+ [not(ancestor::IMPORT or ancestor::STATIC_IMPORT or ancestor::PACKAGE_DEF)]
+ and not(//IMPORT/DOT[*[2][concat(@text, '') = $n]]
+ [string-join(for $i in *[1]/descendant::IDENT return concat($i/@text, ''), '.') = $pkg])
+ and $own != $pkg))]"/>
+ <message key="matchxpath.match" value="Import this type instead of qualifying it."/>
+ </module>
</module>
</module>
diff --git a/tools/checkstyle/suppressions.xml b/tools/checkstyle/suppressions.xml
index 97739950ba..5a5c727159 100644
--- a/tools/checkstyle/suppressions.xml
+++ b/tools/checkstyle/suppressions.xml
@@ -5,376 +5,52 @@
<suppressions>
<!-- Paths start below the Java package root (/services/..., /core/...), so they match under any package name. -->
<!-- Files that still use var. Remove an entry once its file is clean. -->
- <suppress id="NoVar" files="/com/floci/test/ElastiCacheTest\.java$"/>
<suppress id="NoVar" files="/core/common/IamEnforcementFilter\.java$"/>
- <suppress id="NoVar" files="/services/apigateway/ApiGatewayService\.java$"/>
- <suppress id="NoVar" files="/services/bedrockruntime/backend/BedrockOpenAiTranslator\.java$"/>
- <suppress id="NoVar" files="/services/cloudformation/CloudFormationIntegrationTest\.java$"/>
<suppress id="NoVar" files="/services/cloudformation/CloudFormationService\.java$"/>
- <suppress id="NoVar" files="/services/cognito/CognitoLambdaTriggersTest\.java$"/>
- <suppress id="NoVar" files="/services/dynamodb/DynamoDbIntegrationTest\.java$"/>
- <suppress id="NoVar" files="/services/dynamodb/NativeDynamoDbJsonHandler\.java$"/>
- <suppress id="NoVar" files="/services/dynamodb/DynamoDbService\.java$"/>
- <suppress id="NoVar" files="/services/dynamodb/DynamoDbStreamServiceTest\.java$"/>
<suppress id="NoVar" files="/services/ec2/Ec2ContainerManager\.java$"/>
<suppress id="NoVar" files="/services/ec2/Ec2Service\.java$"/>
<suppress id="NoVar" files="/services/eks/EksClusterManager\.java$"/>
<suppress id="NoVar" files="/services/eks/EksServiceTest\.java$"/>
- <suppress id="NoVar" files="/services/eventbridge/EventBridgeInvoker\.java$"/>
- <suppress id="NoVar" files="/services/eventbridge/EventBridgeService\.java$"/>
<suppress id="NoVar" files="/services/iam/StsQueryHandler\.java$"/>
- <suppress id="NoVar" files="/services/lambda/LambdaService\.java$"/>
<suppress id="NoVar" files="/services/s3/S3Controller\.java$"/>
<suppress id="NoVar" files="/services/s3/S3Service\.java$"/>
- <suppress id="NoVar" files="/services/s3/S3ServiceTest\.java$"/>
<!-- Files that still use unnecessary fully qualified type names. Remove an entry once its file is clean. -->
- <suppress id="NoFqcn" files="/com/floci/test/ApiGatewayV2ExecuteTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/BudgetsTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/CloudHsmV2Test\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/DataSyncTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/DetectiveOrganizationAdministrationTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/EcsTests\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/FirehoseTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/KmsFeaturesTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/PipesTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/RamOrganizationSharingTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/RdsControlPlaneTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/SecretsManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/SesConfigurationSetEventDestinationTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/SnsTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/SsoOidcTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/SsoPortalTest\.java$"/>
- <suppress id="NoFqcn" files="/com/floci/test/StsTest\.java$"/>
- <suppress id="NoFqcn" files="/compat/FixtureLoader\.java$"/>
- <suppress id="NoFqcn" files="/compat/RedshiftTest\.java$"/>
- <suppress id="NoFqcn" files="/config/FlociCertificateAuthorityTest\.java$"/>
- <suppress id="NoFqcn" files="/config/TlsProxyServerReservedPortTest\.java$"/>
- <suppress id="NoFqcn" files="/config/TlsProxyServer\.java$"/>
- <suppress id="NoFqcn" files="/core/common/AccountContextFilterTest\.java$"/>
- <suppress id="NoFqcn" files="/core/common/AwsJsonCborController\.java$"/>
- <suppress id="NoFqcn" files="/core/common/AwsQueryController\.java$"/>
- <suppress id="NoFqcn" files="/core/common/BackupWindows\.java$"/>
- <suppress id="NoFqcn" files="/core/common/CidrCanonicalizer\.java$"/>
- <suppress id="NoFqcn" files="/core/common/ResolvedServiceCatalog\.java$"/>
- <suppress id="NoFqcn" files="/core/common/docker/ContainerLogStreamerTest\.java$"/>
- <suppress id="NoFqcn" files="/core/common/docker/ContainerStorageHelperTest\.java$"/>
- <suppress id="NoFqcn" files="/core/common/docker/DockerHostResolver\.java$"/>
- <suppress id="NoFqcn" files="/core/common/port/RuntimeApiPortPoolDefaultTest\.java$"/>
- <suppress id="NoFqcn" files="/lifecycle/EmulatorInfoControllerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/account/AccountAlternateContactIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/amazonmq/container/RabbitMqManager\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayAwsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayController\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayDomainNameIntegrationTest\.java$"/>
+ <suppress id="NoFqcn" files="/core/common/docker/ContainerLifecycleManager\.java$"/>
+ <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayApiKeyRequiredIntegrationTest\.java$"/>
<suppress id="NoFqcn" files="/services/apigateway/ApiGatewayExecuteController\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayIntegrationTransportOptionsTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayService\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ApiGatewayV2DomainNameIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigateway/ExecuteApiSigV4AuthorizerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/ApiGatewayV2JsonHandlerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/ApiGatewayV2JsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/ApiGatewayV2OpenApiImporter\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/ApiGatewayV2Service\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/ApiGatewayV2StageTaggingTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/WebSocketConnectionLifecycleTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/WebSocketLambdaAuthorizerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/WebSocketMockIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/model/Route\.java$"/>
- <suppress id="NoFqcn" files="/services/apigatewayv2/websocket/WebSocketHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/applicationautoscaling/ApplicationAutoScalingIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/applicationautoscaling/ApplicationAutoScalingJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/AppSyncIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/AppSyncJsResolverDockerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/AppSyncService\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/AppSyncDirective\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/AppSyncVtlContextTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/AppSyncVtlEngineTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/AuthMiddlewareTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/CognitoAuthValidator\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/IamAuthValidatorTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/LambdaAuthorizerCacheTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/LambdaAuthorizerValidator\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/auth/OidcAuthValidatorTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/datasource/DynamoDbDataSourceInvokerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/datasource/RelationalDataSourceInvokerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/resolver/ResolverCallbackResourceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/appsync/graphql/util/AppSyncUtilTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/apigateway/ProxyEventPathParametersTest\.java$"/>
<suppress id="NoFqcn" files="/services/autoscaling/AutoScalingReconciler\.java$"/>
<suppress id="NoFqcn" files="/services/backup/BackupController\.java$"/>
- <suppress id="NoFqcn" files="/services/batch/BatchIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/bcmdataexports/BcmDataExportsJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/bcmdataexports/BcmDataExportsService\.java$"/>
- <suppress id="NoFqcn" files="/services/bcmpricingcalculator/BcmPricingCalculatorIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/bcmpricingcalculator/BcmPricingCalculatorJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/budgets/BudgetsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/budgets/BudgetsService\.java$"/>
- <suppress id="NoFqcn" files="/services/ce/GroupAggregator\.java$"/>
- <suppress id="NoFqcn" files="/services/ce/PricingRateLookup\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/ApiGatewayV2CfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationAccountOwnershipIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationBatchIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationLambdaLegacyNameModeTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationResourceConditionIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationS3BucketPropertiesIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationUnsupportedResourceTypeTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationVpcGatewayAttachmentIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CustomResourceProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/CustomResourceResponseStoreTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/RdsCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/SamTransformIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/SamTransformProcessorTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/SamTransformProcessor\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/AppSyncCfnProvisioner\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/BatchCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CloudFrontCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CloudWatchDashboardCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CodeBuildCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CodeBuildCfnProvisioner\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CodePipelineCfnProvisioner\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/CognitoCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/IamInstanceProfileCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/LambdaAddressingCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/LambdaEventInvokeConfigCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/LambdaEventSourceMappingCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/PipesCfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/ProvisionContextTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/RdsCfnProvisioner\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudformation/provisioners/Route53CfnProvisionerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudfront/CloudFrontOriginHttpClientTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationService\.java$"/>
+ <suppress id="NoFqcn" files="/services/cloudformation/CloudFormationTemplateEngineTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/cloudformation/provisioners/Ec2NetworkCfnProvisionerTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/cloudformation/provisioners/Ec2NetworkCfnProvisioner\.java$"/>
<suppress id="NoFqcn" files="/services/cloudfront/CloudFrontServiceTest\.java$"/>
<suppress id="NoFqcn" files="/services/cloudfront/CloudFrontService\.java$"/>
<suppress id="NoFqcn" files="/services/cloudfront/CloudFrontServingController\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudhsmv2/CloudHsmV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudhsmv2/CloudHsmV2Service\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudtrail/CloudTrailAdvancedSelectorsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudtrail/CloudTrailIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudtrail/CloudTrailListingAndTagsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudtrail/CloudTrailLogWriterBoundedRetryIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudwatch/dashboards/CloudWatchDashboardsService\.java$"/>
- <suppress id="NoFqcn" files="/services/cloudwatch/logs/CloudWatchLogsCrossAccountIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/codeartifact/CodeArtifactPypiControllerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/codebuild/CodeBuildRunner\.java$"/>
+ <suppress id="NoFqcn" files="/services/cloudtrail/CloudTrailService\.java$"/>
<suppress id="NoFqcn" files="/services/codedeploy/CodeDeployService\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoAttributeVerificationConcurrencyTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoAuthFlowHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoLambdaTriggersTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cognito/CognitoUserPoolDomainIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cognitoidentity/CognitoIdentityIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/configservice/AggregationAuthorizationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/configservice/AwsConfigServiceEvaluationConcurrencyTest\.java$"/>
- <suppress id="NoFqcn" files="/services/configservice/ConfigServiceJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/controltower/ControlTowerControlControllerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/controltower/ControlTowerControlService\.java$"/>
- <suppress id="NoFqcn" files="/services/cur/CurEmissionScheduler\.java$"/>
- <suppress id="NoFqcn" files="/services/cur/CurService\.java$"/>
- <suppress id="NoFqcn" files="/services/cur/FocusRowProjectorTest\.java$"/>
- <suppress id="NoFqcn" files="/services/cur/FocusRowProjector\.java$"/>
- <suppress id="NoFqcn" files="/services/datasync/DataSyncIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/detective/DetectiveController\.java$"/>
- <suppress id="NoFqcn" files="/services/detective/DetectiveIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/detective/DetectiveService\.java$"/>
- <suppress id="NoFqcn" files="/services/docdb/DocDbQueryHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/docdb/DocDbService\.java$"/>
- <suppress id="NoFqcn" files="/services/docdb/PausingStorageBackend\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/DynamoDbAccessPathIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/DynamoDbGlobalTableIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/DynamoDbImportIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/DynamoDbServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/NativeDynamoDbJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/model/ConditionalCheckFailedException\.java$"/>
- <suppress id="NoFqcn" files="/services/dynamodb/model/LocalSecondaryIndex\.java$"/>
+ <suppress id="NoFqcn" files="/services/dynamodb/backend/DynamoDbFacadeTest\.java$"/>
<suppress id="NoFqcn" files="/services/ec2/Ec2ContainerManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2DuplicateRouteTest\.java$"/>
<suppress id="NoFqcn" files="/services/ec2/Ec2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2Ipv6RouteTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2KeyMaterial\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2NatGatewayAddressIntegrationTest\.java$"/>
<suppress id="NoFqcn" files="/services/ec2/Ec2QueryHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2RouteCidrCanonicalizationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2ServiceConcurrencyTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/Ec2ServicePersistenceTest\.java$"/>
<suppress id="NoFqcn" files="/services/ec2/Ec2ServiceTest\.java$"/>
<suppress id="NoFqcn" files="/services/ec2/Ec2Service\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/FlowLogService\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/net/VpcNetworkManager\.java$"/>
- <suppress id="NoFqcn" files="/services/ec2/portforward/Ec2PortForwardManagerTest\.java$"/>
<suppress id="NoFqcn" files="/services/ecr/EcrServiceTest\.java$"/>
<suppress id="NoFqcn" files="/services/ecr/EcrService\.java$"/>
<suppress id="NoFqcn" files="/services/ecr/registry/EcrRegistryDataPlane\.java$"/>
- <suppress id="NoFqcn" files="/services/ecr/registry/EcrRegistryManager\.java$"/>
- <suppress id="NoFqcn" files="/services/ecs/EcsCreateClusterSettingsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ecs/EcsDescribeServicesIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ecs/EcsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ecs/container/EcsCredentialsProxyTest\.java$"/>
<suppress id="NoFqcn" files="/services/eks/EksClusterManager\.java$"/>
- <suppress id="NoFqcn" files="/services/elasticache/ElastiCacheServiceTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/elasticache/proxy/AbstractRedisAuthProxyRelayTest\.java$"/>
<suppress id="NoFqcn" files="/services/elb/ElbClassicService\.java$"/>
- <suppress id="NoFqcn" files="/services/elbv2/ElbV2DataPlane\.java$"/>
- <suppress id="NoFqcn" files="/services/emr/EmrService\.java$"/>
- <suppress id="NoFqcn" files="/services/emrserverless/EmrServerlessIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/eventbridge/EventBridgeServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/eventbridge/EventBridgeService\.java$"/>
- <suppress id="NoFqcn" files="/services/firehose/FirehoseCompressionDecoder\.java$"/>
- <suppress id="NoFqcn" files="/services/firehose/FirehoseJsonHandler\.java$"/>
+ <suppress id="NoFqcn" files="/services/firehose/FirehoseServiceTest\.java$"/>
<suppress id="NoFqcn" files="/services/firehose/FirehoseService\.java$"/>
- <suppress id="NoFqcn" files="/services/firehose/S3DestinationValidatorTest\.java$"/>
- <suppress id="NoFqcn" files="/services/fis/FisIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/floci/ui/FlociUiManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/floci/ui/FlociUiManager\.java$"/>
- <suppress id="NoFqcn" files="/services/glue/GlueService\.java$"/>
- <suppress id="NoFqcn" files="/services/glue/schemaregistry/GlueSchemaRegistryServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/glue/schemaregistry/GlueSchemaRegistryService\.java$"/>
- <suppress id="NoFqcn" files="/services/glue/schemaregistry/SchemaToColumnsConverterTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/AssumeRoleWithSamlValidationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/CredentialReportIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/GetAccountAuthorizationDetailsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/IamResourceTagsInResponseTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/IamRolePolicyConcurrencyTest\.java$"/>
<suppress id="NoFqcn" files="/services/iam/IamServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/InstanceProfileTagsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/SAMLAssertionVerifier\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/SAMLXml\.java$"/>
- <suppress id="NoFqcn" files="/services/iam/StsWebIdentityEnforcementIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/identitystore/IdentityStoreIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/identitystore/ScimController\.java$"/>
- <suppress id="NoFqcn" files="/services/inspector2/Inspector2Controller\.java$"/>
- <suppress id="NoFqcn" files="/services/inspector2/Inspector2Service\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotDeviceCertificateIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttBrokerDeviceVerificationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttBrokerServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttEnabledIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttMutualTlsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttTlsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotMqttWebSocketContractIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/iot/IotService\.java$"/>
- <suppress id="NoFqcn" files="/services/kinesis/KinesisIntegrationTest\.java$"/>
+ <suppress id="NoFqcn" files="/services/iam/ResourceArnBuilder\.java$"/>
<suppress id="NoFqcn" files="/services/kinesis/KinesisJsonHandlerTest\.java$"/>
<suppress id="NoFqcn" files="/services/kinesis/KinesisJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/kinesis/KinesisServiceTest\.java$"/>
<suppress id="NoFqcn" files="/services/kinesis/KinesisService\.java$"/>
- <suppress id="NoFqcn" files="/services/kinesisanalytics/container/FlinkContainerManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/kms/KmsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/kms/KmsJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/kms/KmsServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/kms/KmsService\.java$"/>
- <suppress id="NoFqcn" files="/services/lakeformation/LakeFormationService\.java$"/>
- <suppress id="NoFqcn" files="/services/lakeformation/MemoryLakeFormationStorage\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/ApiGatewayController\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaAccountScopedCodeTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaController\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaQualifiedReadIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaService\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaStructureSerializationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/LambdaTagController\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/launcher/ContainerLauncherCodeVolumeReuseTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/launcher/ContainerLauncher\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/launcher/ImageCacheService\.java$"/>
<suppress id="NoFqcn" files="/services/lambda/launcher/kubernetes/LambdaPodSpecFactory\.java$"/>
- <suppress id="NoFqcn" files="/services/lambda/runtime/RuntimeApiServerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/lambdamicrovms/LambdaMicrovmsController\.java$"/>
- <suppress id="NoFqcn" files="/services/lambdamicrovms/LambdaNetworkConnectorsController\.java$"/>
- <suppress id="NoFqcn" files="/services/marketplace/MarketplaceAgreementControllerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/marketplace/MarketplaceDeploymentService\.java$"/>
- <suppress id="NoFqcn" files="/services/marketplace/MarketplaceMeteringIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/marketplace/MarketplaceService\.java$"/>
- <suppress id="NoFqcn" files="/services/memorydb/MemoryDbHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/memorydb/MemoryDbService\.java$"/>
- <suppress id="NoFqcn" files="/services/msk/MskService\.java$"/>
- <suppress id="NoFqcn" files="/services/organizations/OrganizationsService\.java$"/>
- <suppress id="NoFqcn" files="/services/pipes/PipesKafkaRestClientTest\.java$"/>
- <suppress id="NoFqcn" files="/services/pipes/PipesPollerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/pricing/PricingService\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/PausingStorageBackend\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsClusterEngineModeStorageEncryptedIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsParameterGroupTagIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsQueryHandlerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsQueryHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/RdsService\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/container/RdsContainerManagerPostgresTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/container/RdsContainerManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/container/RdsContainerManager\.java$"/>
- <suppress id="NoFqcn" files="/services/rds/proxy/RdsProxyTlsCertificates\.java$"/>
- <suppress id="NoFqcn" files="/services/redshift/RedshiftSpectrumIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/redshift/container/RedshiftContainerManagerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/redshiftdata/RedshiftDataFieldMapperTest\.java$"/>
- <suppress id="NoFqcn" files="/services/redshiftserverless/RedshiftServerlessIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/route53/Route53Service\.java$"/>
- <suppress id="NoFqcn" files="/services/route53/Route53VpcAssociationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/route53/Route53VpcAssociationTransientErrorIntegrationTest\.java$"/>
<suppress id="NoFqcn" files="/services/s3/S3Controller\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3CopyObjectSourcePermissionIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3CorsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3EventBridgeNotificationValidationIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3HeaderSignatureFilter\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3MultipartIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3PresignedPostAuthEnforcementIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3SelectIntegrationTest\.java$"/>
<suppress id="NoFqcn" files="/services/s3/S3Service\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/S3VirtualHostIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/s3/model/S3Object\.java$"/>
- <suppress id="NoFqcn" files="/services/s3tables/S3TablesServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/sagemaker/SageMakerDockerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/sagemaker/SageMakerIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/securityhub/SecurityHubService\.java$"/>
- <suppress id="NoFqcn" files="/services/servicecatalog/ServiceCatalogOrgAccessConsumerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/servicecatalog/ServiceCatalogServiceActionConsumerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/servicecatalog/ServiceCatalogService\.java$"/>
- <suppress id="NoFqcn" files="/services/servicequotas/RequestServiceQuotaIncreaseConsumerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesConfigurationSetSendingOptionsV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesContactListV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesContactV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesCustomVerificationEmailTemplateV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesDkimSigningActionsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesEventPayloadTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesIdentityPolicyV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesPolicyService\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesQueryHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesReceiptFilterV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesReceiptRuleSetReorderCloneV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesReceiptRuleSetV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesReceiptRuleV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesSendCustomVerificationEmailV1IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesService\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTemplateServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTemplateService\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTenantAssociationV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTenantSendV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTenantSuppressionV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SesTenantTagV2IntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SmtpRelayServerTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ses/SmtpRelay\.java$"/>
- <suppress id="NoFqcn" files="/services/signin/SigninServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/sns/SnsHttpDeliveryIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/sns/SnsQueryHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/sns/SnsService\.java$"/>
- <suppress id="NoFqcn" files="/services/ssm/SsmIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ssoadmin/SsoAdminAssignmentsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ssoadmin/SsoAdminService\.java$"/>
- <suppress id="NoFqcn" files="/services/ssoadmin/model/PermissionSet\.java$"/>
- <suppress id="NoFqcn" files="/services/ssooidc/SsoOidcIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/ssooidc/SsoOidcServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/stepfunctions/AslExecutorIntrinsicContextTest\.java$"/>
- <suppress id="NoFqcn" files="/services/stepfunctions/MapIterationSchedulerTest\.java$"/>
<suppress id="NoFqcn" files="/services/stepfunctions/StepFunctionsJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/stepfunctions/StepFunctionsServicePersistenceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/stepfunctions/StepFunctionsServiceStartExecutionRaceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/swf/SwfJsonHandler\.java$"/>
- <suppress id="NoFqcn" files="/services/swf/SwfServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/timestreaminfluxdb/TimestreamInfluxDbIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/transcribe/TranscribeServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/transfer/TransferServiceTest\.java$"/>
- <suppress id="NoFqcn" files="/services/verifiedpermissions/VerifiedPermissionsIntegrationTest\.java$"/>
- <suppress id="NoFqcn" files="/services/verifiedpermissions/VerifiedPermissionsOidcSignatureVerifier\.java$"/>
- <suppress id="NoFqcn" files="/services/verifiedpermissions/VerifiedPermissionsTokenService\.java$"/>
- <suppress id="NoFqcn" files="/tools/ami/AmiImageTool\.java$"/>
</suppressions>