1515package com .cloudant .tests ;
1616
1717import static com .cloudant .tests .HttpTest .takeN ;
18- import static com .cloudant .tests .util .MockWebServerResources .EXPECTED_OK_COOKIE ;
19- import static com .cloudant .tests .util .MockWebServerResources .EXPECTED_OK_COOKIE_2 ;
18+ import static com .cloudant .tests .util .MockWebServerResources .IAM_API_KEY ;
19+ import static com .cloudant .tests .util .MockWebServerResources .IAM_API_KEY_2 ;
2020import static com .cloudant .tests .util .MockWebServerResources .JSON_OK ;
2121import static org .hamcrest .CoreMatchers .containsString ;
2222import static org .hamcrest .MatcherAssert .assertThat ;
@@ -52,17 +52,17 @@ public void createReplicationDocumentReconfigureSource() throws Exception {
5252 rep .setSource (sourceDbUrl );
5353 assertEquals (rep .getSource (), sourceDbUrl );
5454
55- rep .setSourceIamApiKey (EXPECTED_OK_COOKIE );
55+ rep .setSourceIamApiKey (IAM_API_KEY );
5656 assertEquals (rep .getSource (), sourceDbUrl );
57- assertEquals (rep .getSourceIamApiKey (), EXPECTED_OK_COOKIE );
57+ assertEquals (rep .getSourceIamApiKey (), IAM_API_KEY );
5858
5959 // reconfigure source
6060
6161 rep .setSource (targetDbUrl );
6262 assertEquals (rep .getSource (), targetDbUrl );
6363
64- rep .setSourceIamApiKey (EXPECTED_OK_COOKIE_2 );
65- assertEquals (rep .getSourceIamApiKey (), EXPECTED_OK_COOKIE_2 );
64+ rep .setSourceIamApiKey (IAM_API_KEY_2 );
65+ assertEquals (rep .getSourceIamApiKey (), IAM_API_KEY_2 );
6666 }
6767
6868 @ Test
@@ -72,34 +72,34 @@ public void createReplicationDocumentReconfigureTarget() throws Exception {
7272 rep .setTarget (targetDbUrl );
7373 assertEquals (rep .getTarget (), targetDbUrl );
7474
75- rep .setTargetIamApiKey (EXPECTED_OK_COOKIE );
75+ rep .setTargetIamApiKey (IAM_API_KEY );
7676 assertEquals (rep .getTarget (), targetDbUrl );
77- assertEquals (rep .getTargetIamApiKey (), EXPECTED_OK_COOKIE );
77+ assertEquals (rep .getTargetIamApiKey (), IAM_API_KEY );
7878
7979 // reconfigure target
8080
8181 rep .setTarget (sourceDbUrl );
8282 assertEquals (rep .getTarget (), sourceDbUrl );
8383
84- rep .setTargetIamApiKey (EXPECTED_OK_COOKIE_2 );
85- assertEquals (rep .getTargetIamApiKey (), EXPECTED_OK_COOKIE_2 );
84+ rep .setTargetIamApiKey (IAM_API_KEY_2 );
85+ assertEquals (rep .getTargetIamApiKey (), IAM_API_KEY_2 );
8686 }
8787
8888 @ Test
8989 public void createReplicationReconfigureSourceSetIamApiKeyFirst () throws Exception {
9090 ReplicatorDocument rep = new ReplicatorDocument ();
9191
92- rep .setSourceIamApiKey (EXPECTED_OK_COOKIE );
93- assertEquals (rep .getSourceIamApiKey (), EXPECTED_OK_COOKIE );
92+ rep .setSourceIamApiKey (IAM_API_KEY );
93+ assertEquals (rep .getSourceIamApiKey (), IAM_API_KEY );
9494
9595 rep .setSource (sourceDbUrl );
9696 assertEquals (rep .getSource (), sourceDbUrl );
97- assertEquals (rep .getSourceIamApiKey (), EXPECTED_OK_COOKIE );
97+ assertEquals (rep .getSourceIamApiKey (), IAM_API_KEY );
9898
9999 // reconfigure source
100100
101- rep .setSourceIamApiKey (EXPECTED_OK_COOKIE_2 );
102- assertEquals (rep .getSourceIamApiKey (), EXPECTED_OK_COOKIE_2 );
101+ rep .setSourceIamApiKey (IAM_API_KEY_2 );
102+ assertEquals (rep .getSourceIamApiKey (), IAM_API_KEY_2 );
103103
104104 rep .setSource (targetDbUrl );
105105 assertEquals (rep .getSource (), targetDbUrl );
@@ -109,20 +109,20 @@ public void createReplicationReconfigureSourceSetIamApiKeyFirst() throws Excepti
109109 public void createReplicationReconfigureTargetSetIamApiKeyFirst () throws Exception {
110110 ReplicatorDocument rep = new ReplicatorDocument ();
111111
112- rep .setTargetIamApiKey (EXPECTED_OK_COOKIE );
113- assertEquals (rep .getTargetIamApiKey (), EXPECTED_OK_COOKIE );
112+ rep .setTargetIamApiKey (IAM_API_KEY );
113+ assertEquals (rep .getTargetIamApiKey (), IAM_API_KEY );
114114
115115 rep .setTarget (targetDbUrl );
116116 assertEquals (rep .getTarget (), targetDbUrl );
117- assertEquals (rep .getTargetIamApiKey (), EXPECTED_OK_COOKIE );
117+ assertEquals (rep .getTargetIamApiKey (), IAM_API_KEY );
118118
119119 // reconfigure target
120120
121121 rep .setTarget (sourceDbUrl );
122122 assertEquals (rep .getTarget (), sourceDbUrl );
123123
124- rep .setTargetIamApiKey (EXPECTED_OK_COOKIE_2 );
125- assertEquals (rep .getTargetIamApiKey (), EXPECTED_OK_COOKIE_2 );
124+ rep .setTargetIamApiKey (IAM_API_KEY_2 );
125+ assertEquals (rep .getTargetIamApiKey (), IAM_API_KEY_2 );
126126 }
127127
128128 @ Test
@@ -161,7 +161,7 @@ public void createAndSaveReplicatorDocumentWithSourceIamAuth() throws Exception
161161 c .replicator ()
162162 .replicatorDocId (replicatorDocId )
163163 .source (sourceDbUrl )
164- .sourceIamApiKey (EXPECTED_OK_COOKIE )
164+ .sourceIamApiKey (IAM_API_KEY )
165165 .target (targetDbUrl )
166166 .save ();
167167
@@ -172,7 +172,7 @@ public void createAndSaveReplicatorDocumentWithSourceIamAuth() throws Exception
172172 String body = requests [0 ].getBody ().readUtf8 ();
173173
174174 assertThat ("The replication document should contain the source IAM API key" ,
175- body , containsString (authJson + EXPECTED_OK_COOKIE ));
175+ body , containsString (authJson + IAM_API_KEY ));
176176
177177 assertThat ("The replication document should contain the correct target" ,
178178 body , containsString ("\" target\" :\" " + targetDbUrl + "\" " ));
@@ -189,7 +189,7 @@ public void createAndSaveReplicatorDocumentWithTargetIamAuth() throws Exception
189189 .replicatorDocId (replicatorDocId )
190190 .source (sourceDbUrl )
191191 .target (targetDbUrl )
192- .targetIamApiKey (EXPECTED_OK_COOKIE_2 )
192+ .targetIamApiKey (IAM_API_KEY_2 )
193193 .save ();
194194
195195 RecordedRequest [] requests = takeN (server , 1 );
@@ -202,7 +202,7 @@ public void createAndSaveReplicatorDocumentWithTargetIamAuth() throws Exception
202202 body , containsString ("\" source\" :\" " + sourceDbUrl + "\" " ));
203203
204204 assertThat ("The replication document should contain the correct target" ,
205- body , containsString (authJson + EXPECTED_OK_COOKIE_2 ));
205+ body , containsString (authJson + IAM_API_KEY_2 ));
206206 }
207207
208208 @ Test
@@ -215,9 +215,9 @@ public void createAndSaveReplicatorDocumentWithSourceAndTargetIamAuth() throws E
215215 c .replicator ()
216216 .replicatorDocId (replicatorDocId )
217217 .source (sourceDbUrl )
218- .sourceIamApiKey (EXPECTED_OK_COOKIE )
218+ .sourceIamApiKey (IAM_API_KEY )
219219 .target (targetDbUrl )
220- .targetIamApiKey (EXPECTED_OK_COOKIE_2 )
220+ .targetIamApiKey (IAM_API_KEY_2 )
221221 .save ();
222222
223223 RecordedRequest [] requests = takeN (server , 1 );
@@ -227,9 +227,9 @@ public void createAndSaveReplicatorDocumentWithSourceAndTargetIamAuth() throws E
227227 String body = requests [0 ].getBody ().readUtf8 ();
228228
229229 assertThat ("The replication document should contain the source IAM API key" ,
230- body , containsString (authJson + EXPECTED_OK_COOKIE ));
230+ body , containsString (authJson + IAM_API_KEY ));
231231
232232 assertThat ("The replication document should contain the target IAM API key" ,
233- body , containsString (authJson + EXPECTED_OK_COOKIE_2 ));
233+ body , containsString (authJson + IAM_API_KEY_2 ));
234234 }
235235}
0 commit comments