File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
modules/localstack/src/test/java/org/testcontainers/containers/localstack Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ public LocalStackContainer localstack = new LocalStackContainer()
13
13
14
14
@Test
15
15
public void someTestMethod() {
16
+ // AWS SDK v1
16
17
AmazonS3 s3 = AmazonS3ClientBuilder
17
18
.standard()
18
19
.withEndpointConfiguration(localstack. getEndpointConfiguration(S3 ))
@@ -21,6 +22,19 @@ public void someTestMethod() {
21
22
22
23
s3. createBucket(" foo" );
23
24
s3. putObject(" foo" , " bar" , " baz" );
25
+
26
+ // AWS SDK v2
27
+ S3Client s3 = S3Client
28
+ .builder()
29
+ .endpointOverride(localstack. getEndpointOverride(LocalStackContainer . Service . S3 ))
30
+ .credentialsProvider(StaticCredentialsProvider . create(AwsBasicCredentials . create(
31
+ localstack. getAccessKey(), localstack. getSecretKey()
32
+ )))
33
+ .region(Region . of(localstack. getRegion()))
34
+ .build();
35
+
36
+ s3. createBucket(b - > b. bucket(" foo" ));
37
+ s3. putObject(b - > b. bucket(" foo" ). key(" bar" ), RequestBody . fromBytes(" baz" . getBytes()));
24
38
```
25
39
26
40
Environment variables listed in [Localstack ' s README](https://github.com/localstack/localstack#configurations) may be used to customize Localstack' s configuration.
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public void s3TestOverBridgeNetwork() throws IOException {
93
93
}
94
94
95
95
@ Test
96
- public void s3TestOverBridgeNetworkV2 () throws IOException {
96
+ public void s3TestOverBridgeNetworkV2 () {
97
97
S3Client s3 = S3Client
98
98
.builder ()
99
99
.endpointOverride (localstack .getEndpointOverride (LocalStackContainer .Service .S3 ))
You can’t perform that action at this time.
0 commit comments