Skip to content

Commit 2e27339

Browse files
committed
Use edge endpoint for Localstack services
* Upgrade to Testcontainers `1.18.3` * Simplify `LocalstackContainerTest` to rely on the `LocalStackContainer.getEndpoint()` for all the AWS services requested
1 parent 31a4dc6 commit 2e27339

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ext {
4040
springIntegrationVersion = '6.0.5'
4141
kinesisClientVersion = '2.5.0'
4242
kinesisProducerVersion = '0.15.7'
43-
testcontainersVersion = '1.18.2'
43+
testcontainersVersion = '1.18.3'
4444

4545
idPrefix = 'aws'
4646

src/test/java/org/springframework/integration/aws/LocalstackContainerTest.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,40 @@ static void startContainer() {
5656
}
5757

5858
static DynamoDbAsyncClient dynamoDbClient() {
59-
return applyAwsClientOptions(DynamoDbAsyncClient.builder(), LocalStackContainer.Service.DYNAMODB);
59+
return applyAwsClientOptions(DynamoDbAsyncClient.builder());
6060
}
6161

6262
static KinesisAsyncClient kinesisClient() {
63-
return applyAwsClientOptions(KinesisAsyncClient.builder(), LocalStackContainer.Service.KINESIS);
63+
return applyAwsClientOptions(KinesisAsyncClient.builder());
6464
}
6565

6666
static CloudWatchAsyncClient cloudWatchClient() {
67-
return applyAwsClientOptions(CloudWatchAsyncClient.builder(), LocalStackContainer.Service.CLOUDWATCH);
67+
return applyAwsClientOptions(CloudWatchAsyncClient.builder());
6868
}
6969

7070
static S3AsyncClient s3AsyncClient() {
71-
return applyAwsClientOptions(S3AsyncClient.builder(), LocalStackContainer.Service.S3);
71+
return applyAwsClientOptions(S3AsyncClient.builder());
7272
}
7373

7474
static S3Client s3Client() {
75-
return applyAwsClientOptions(S3Client.builder().httpClient(ApacheHttpClient.create()),
76-
LocalStackContainer.Service.S3);
75+
return applyAwsClientOptions(S3Client.builder().httpClient(ApacheHttpClient.create()));
7776
}
7877

7978
static SqsAsyncClient sqsClient() {
80-
return applyAwsClientOptions(SqsAsyncClient.builder(), LocalStackContainer.Service.SQS);
79+
return applyAwsClientOptions(SqsAsyncClient.builder());
8180
}
8281

8382
static AwsCredentialsProvider credentialsProvider() {
8483
return StaticCredentialsProvider.create(
8584
AwsBasicCredentials.create(LOCAL_STACK_CONTAINER.getAccessKey(), LOCAL_STACK_CONTAINER.getSecretKey()));
8685
}
8786

88-
private static <B extends AwsClientBuilder<B, T>, T> T applyAwsClientOptions(B clientBuilder,
89-
LocalStackContainer.Service serviceToBuild) {
90-
87+
private static <B extends AwsClientBuilder<B, T>, T> T applyAwsClientOptions(B clientBuilder) {
9188
return clientBuilder
9289
.region(Region.of(LOCAL_STACK_CONTAINER.getRegion()))
9390
.credentialsProvider(credentialsProvider())
94-
.endpointOverride(LOCAL_STACK_CONTAINER.getEndpointOverride(serviceToBuild))
91+
.endpointOverride(LOCAL_STACK_CONTAINER.getEndpoint())
9592
.build();
9693
}
94+
9795
}

0 commit comments

Comments
 (0)