23
23
import java .util .List ;
24
24
import java .util .UUID ;
25
25
import org .junit .AfterClass ;
26
+ import org .junit .BeforeClass ;
26
27
import org .junit .Test ;
27
28
import software .amazon .awssdk .awscore .exception .AwsServiceException ;
28
29
import software .amazon .awssdk .core .SdkGlobalTime ;
55
56
import software .amazon .awssdk .services .route53 .model .RRType ;
56
57
import software .amazon .awssdk .services .route53 .model .ResourceRecord ;
57
58
import software .amazon .awssdk .services .route53 .model .ResourceRecordSet ;
59
+ import software .amazon .awssdk .testutils .service .AwsIntegrationTestBase ;
58
60
59
61
/**
60
62
* Integration tests that run through the various operations available in the
61
63
* Route 53 API.
62
64
*/
63
- public class Route53IntegrationTest extends IntegrationTestBase {
65
+ public class Route53IntegrationTest extends AwsIntegrationTestBase {
64
66
65
67
private static final String COMMENT = "comment" ;
66
68
private static final String ZONE_NAME = "java.sdk.com." ;
@@ -69,6 +71,8 @@ public class Route53IntegrationTest extends IntegrationTestBase {
69
71
private static final String TYPE = "TCP" ;
70
72
private static final String IP_ADDRESS = "12.12.12.12" ;
71
73
74
+ private static Route53Client route53 ;
75
+
72
76
/**
73
77
* The ID of the zone we created in this test.
74
78
*/
@@ -77,13 +81,30 @@ public class Route53IntegrationTest extends IntegrationTestBase {
77
81
/**
78
82
* The ID of the change that created our test zone.
79
83
*/
80
- private String createdZoneChangeId ;
84
+ private static String createdZoneChangeId ;
81
85
82
86
/**
83
87
* the ID of the health check.
84
88
*/
85
89
private String healthCheckId ;
86
90
91
+ @ BeforeClass
92
+ public static void setup () {
93
+ route53 = Route53Client .builder ()
94
+ .credentialsProvider (CREDENTIALS_PROVIDER_CHAIN )
95
+ .region (Region .AWS_GLOBAL )
96
+ .build ();
97
+ // Create Hosted Zone
98
+ CreateHostedZoneResponse result = route53 .createHostedZone (CreateHostedZoneRequest .builder ()
99
+ .name (ZONE_NAME )
100
+ .callerReference (CALLER_REFERENCE )
101
+ .hostedZoneConfig (HostedZoneConfig .builder ()
102
+ .comment (COMMENT ).build ()).build ()
103
+ );
104
+
105
+ createdZoneId = result .hostedZone ().id ();
106
+ createdZoneChangeId = result .changeInfo ().id ();
107
+ }
87
108
88
109
/**
89
110
* Ensures the HostedZone we create during this test is correctly released.
@@ -103,22 +124,6 @@ public static void tearDown() {
103
124
*/
104
125
@ Test
105
126
public void testRoute53 () throws Exception {
106
- // Create Hosted Zone
107
- CreateHostedZoneResponse result = route53 .createHostedZone (CreateHostedZoneRequest .builder ()
108
- .name (ZONE_NAME )
109
- .callerReference (CALLER_REFERENCE )
110
- .hostedZoneConfig (HostedZoneConfig .builder ()
111
- .comment (COMMENT ).build ()).build ()
112
- );
113
-
114
- createdZoneId = result .hostedZone ().id ();
115
- createdZoneChangeId = result .changeInfo ().id ();
116
-
117
- assertValidCreatedHostedZone (result .hostedZone ());
118
- assertValidDelegationSet (result .delegationSet ());
119
- assertValidChangeInfo (result .changeInfo ());
120
- assertNotNull (result .location ());
121
-
122
127
123
128
// Get Hosted Zone
124
129
GetHostedZoneRequest hostedZoneRequest = GetHostedZoneRequest .builder ().id (createdZoneId ).build ();
0 commit comments