|
28 | 28 | import org.springframework.boot.test.context.FilteredClassLoader;
|
29 | 29 | import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
30 | 30 | import org.springframework.test.util.ReflectionTestUtils;
|
| 31 | +import software.amazon.awssdk.core.client.config.SdkClientConfiguration; |
| 32 | +import software.amazon.awssdk.core.client.config.SdkClientOption; |
31 | 33 | import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
|
32 | 34 | import software.amazon.awssdk.services.s3.S3AsyncClient;
|
| 35 | +import software.amazon.awssdk.services.s3.endpoints.S3ClientContextParams; |
33 | 36 | import software.amazon.awssdk.services.s3.internal.crt.S3NativeClientConfiguration;
|
| 37 | +import software.amazon.awssdk.utils.AttributeMap; |
34 | 38 |
|
35 | 39 | /**
|
36 | 40 | * Tests for {@link S3CrtAsyncClientAutoConfiguration}.
|
@@ -78,6 +82,17 @@ void withCustomGlobalEndpointAndS3Endpoint() {
|
78 | 82 | }
|
79 | 83 | }
|
80 | 84 |
|
| 85 | + @Test |
| 86 | + void withPathStyleAccessEnabled() { |
| 87 | + contextRunner.withPropertyValues("spring.cloud.aws.s3.path-style-access-enabled:true").run(context -> { |
| 88 | + S3AsyncClient client = context.getBean(S3AsyncClient.class); |
| 89 | + S3AsyncClient delegate = (S3AsyncClient) ReflectionTestUtils.getField(client, "delegate"); |
| 90 | + SdkClientConfiguration clientConfiguration = (SdkClientConfiguration) ReflectionTestUtils.getField(delegate, "clientConfiguration"); |
| 91 | + AttributeMap contextParams = clientConfiguration.option(SdkClientOption.CLIENT_CONTEXT_PARAMS); |
| 92 | + assertThat(contextParams.get(S3ClientContextParams.FORCE_PATH_STYLE)).isTrue(); |
| 93 | + }); |
| 94 | + } |
| 95 | + |
81 | 96 | @Test
|
82 | 97 | void setsPropertiesOnClient() {
|
83 | 98 | contextRunner.withPropertyValues("spring.cloud.aws.s3.crt.minimum-part-size-in-bytes=50",
|
|
0 commit comments