20
20
import java .net .MalformedURLException ;
21
21
import java .net .URI ;
22
22
import org .junit .AfterClass ;
23
+ import org .junit .BeforeClass ;
23
24
import org .junit .Test ;
25
+ import software .amazon .awssdk .auth .credentials .AwsBasicCredentials ;
26
+ import software .amazon .awssdk .auth .credentials .StaticCredentialsProvider ;
24
27
import software .amazon .awssdk .regions .Region ;
25
28
import software .amazon .awssdk .services .s3 .model .GetUrlRequest ;
26
29
@@ -37,11 +40,26 @@ public class S3UtilitiesTest {
37
40
.pathStyleAccessEnabled (true )
38
41
.build ();
39
42
40
- private static final S3Client defaultClient = S3Client .create ();
41
- private static final S3Utilities defaultUtilities = defaultClient .utilities ();
42
-
43
- private static final S3AsyncClient asyncClient = S3AsyncClient .builder ().region (Region .AP_NORTHEAST_2 ).build ();
44
- private static final S3Utilities utilitiesFromAsyncClient = asyncClient .utilities ();
43
+ private static S3Client defaultClient ;
44
+ private static S3Utilities defaultUtilities ;
45
+
46
+ private static S3AsyncClient asyncClient ;
47
+ private static S3Utilities utilitiesFromAsyncClient ;
48
+
49
+ @ BeforeClass
50
+ public static void setup () {
51
+ defaultClient = S3Client .builder ()
52
+ .credentialsProvider (StaticCredentialsProvider .create (AwsBasicCredentials .create ("akid" , "skid" )))
53
+ .region (Region .US_WEST_2 )
54
+ .build ();
55
+ defaultUtilities = defaultClient .utilities ();
56
+
57
+ asyncClient = S3AsyncClient .builder ()
58
+ .credentialsProvider (StaticCredentialsProvider .create (AwsBasicCredentials .create ("akid" , "skid" )))
59
+ .region (Region .AP_NORTHEAST_2 )
60
+ .build ();
61
+ utilitiesFromAsyncClient = asyncClient .utilities ();
62
+ }
45
63
46
64
@ AfterClass
47
65
public static void cleanup () {
0 commit comments