Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Integrates with Spring Data, Spring Data REST and Apache Solr</description>
<elasticsearch-rest-high-level-client.version>7.17.18</elasticsearch-rest-high-level-client.version>

<!-- Test dependencies -->
<test-containers.version>1.17.6</test-containers.version>
<test-containers.version>1.19.7</test-containers.version>
<mockito.version>3.12.4</mockito.version>

<docs.output.dir>../target/generated-docs/refs/${env.BUILD_TYPE}/</docs.output.dir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.net.URI;
import java.net.URISyntaxException;

import net.bytebuddy.asm.Advice;
import org.testcontainers.containers.localstack.LocalStackContainer;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -14,6 +15,8 @@
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.core.ServiceConfiguration;
import software.amazon.awssdk.services.s3.S3Client;

Expand All @@ -38,9 +41,13 @@ public static LocalStack singleton() {

public static S3Client getAmazonS3Client() throws URISyntaxException {
return S3Client.builder()
.endpointOverride(new URI(LocalStack.singleton().getEndpointConfiguration(LocalStackContainer.Service.S3).getServiceEndpoint()))
.credentialsProvider(new LocalStack.CrossAwsCredentialsProvider(LocalStack.singleton().getDefaultCredentialsProvider()))
.serviceConfiguration((serviceBldr) -> {serviceBldr.pathStyleAccessEnabled(true);})
.endpointOverride(LocalStack.singleton().getEndpoint())
.credentialsProvider(
StaticCredentialsProvider.create(
AwsBasicCredentials.create(LocalStack.singleton().getAccessKey(), LocalStack.singleton().getSecretKey())
)
)
.region(Region.of(LocalStack.singleton().getRegion()))
.build();
}

Expand Down