4141import software .amazon .awssdk .services .s3 .model .LocationInfo ;
4242import software .amazon .awssdk .services .s3 .model .LocationType ;
4343import software .amazon .awssdk .services .s3 .model .S3Exception ;
44+ import software .amazon .awssdk .services .s3 .regression .upload .FlattenUploadConfig ;
4445import software .amazon .awssdk .services .s3control .S3ControlClient ;
4546import software .amazon .awssdk .services .s3control .model .CreateMultiRegionAccessPointRequest ;
4647import software .amazon .awssdk .services .s3control .model .GetMultiRegionAccessPointResponse ;
@@ -89,7 +90,7 @@ public static void createBucket(S3Client s3, String bucketName, int retryCount,
8990 }
9091 } else if ("OperationAborted" .equals (e .awsErrorDetails ().errorCode ())) {
9192 log .warn (() -> e .awsErrorDetails ().errorMessage () + " --- Likely another operation is creating the bucket, "
92- + "just wait for the bucket to be available" );
93+ + "just wait for the bucket to be available" );
9394 } else {
9495 throw e ;
9596 }
@@ -194,6 +195,12 @@ public static void assumeNotAccessPointWithPathStyle(TestConfig config) {
194195 "Path style doesn't work with ARN type buckets" );
195196 }
196197
198+ public static void assumeNotAccessPointWithPathStyle (FlattenUploadConfig config ) {
199+ BucketType bucketType = config .getBucketType ();
200+ Assumptions .assumeFalse (config .isForcePathStyle () && bucketType .isArnType (),
201+ "Path style doesn't work with ARN type buckets" );
202+ }
203+
197204 public static String crc32 (String s ) {
198205 return crc32 (s .getBytes (StandardCharsets .UTF_8 ));
199206 }
@@ -266,25 +273,22 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, Region region, Aw
266273 }
267274 }
268275
269- public static S3Client makeSyncClient (TestConfig config , ClientOverrideConfiguration overrideConfiguration ,
270- Region region , AwsCredentialsProvider provider ) {
271- switch (config .getFlavor ()) {
272- case STANDARD_SYNC :
273- return S3Client .builder ()
274- .overrideConfiguration (overrideConfiguration )
275- .forcePathStyle (config .isForcePathStyle ())
276- .requestChecksumCalculation (config .getRequestChecksumValidation ())
277- .region (region )
278- .credentialsProvider (provider )
279- .build ();
280- default :
281- throw new RuntimeException ("Unsupported sync flavor: " + config .getFlavor ());
282- }
276+ public static S3Client makeSyncClient (FlattenUploadConfig config , ClientOverrideConfiguration overrideConfiguration ,
277+ Region region , AwsCredentialsProvider provider ) {
278+ return S3Client .builder ()
279+ .overrideConfiguration (overrideConfiguration )
280+ .forcePathStyle (config .isForcePathStyle ())
281+ .requestChecksumCalculation (config .getRequestChecksumValidation ())
282+ .region (region )
283+ .credentialsProvider (provider )
284+ .build ();
283285 }
284286
285- public static S3AsyncClient makeAsyncClient (TestConfig config , ClientOverrideConfiguration overrideConfiguration ,
286- Region region , AwsCredentialsProvider provider ) {
287- switch (config .getFlavor ()) {
287+ public static S3AsyncClient makeAsyncClient (FlattenUploadConfig config ,
288+ S3ClientFlavor flavor ,
289+ ClientOverrideConfiguration overrideConfiguration ,
290+ Region region , AwsCredentialsProvider provider ) {
291+ switch (flavor ) {
288292 case STANDARD_ASYNC :
289293 return S3AsyncClient .builder ()
290294 .overrideConfiguration (overrideConfiguration )
@@ -311,13 +315,15 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, ClientOverrideCon
311315 .build ();
312316 }
313317 default :
314- throw new RuntimeException ("Unsupported async flavor: " + config . getFlavor () );
318+ throw new RuntimeException ("Unsupported async flavor: " + flavor );
315319 }
316320 }
317321
318- public static S3TransferManager makeTm (TestConfig config , ClientOverrideConfiguration overrideConfiguration ,
319- Region region , AwsCredentialsProvider provider ) {
320- S3AsyncClient s3AsyncClient = makeAsyncClient (config , overrideConfiguration , region , provider );
322+ public static S3TransferManager makeTm (FlattenUploadConfig config ,
323+ S3ClientFlavor flavor ,
324+ ClientOverrideConfiguration overrideConfiguration ,
325+ Region region , AwsCredentialsProvider provider ) {
326+ S3AsyncClient s3AsyncClient = makeAsyncClient (config , flavor , overrideConfiguration , region , provider );
321327 return S3TransferManager .builder ().s3Client (s3AsyncClient ).build ();
322328 }
323329
0 commit comments