1919
2020package com .aliyun .oss .integrationtests ;
2121
22- import static com .aliyun .oss .integrationtests .TestConstants .BUCKET_ACCESS_DENIED_ERR ;
22+ import static com .aliyun .oss .integrationtests .TestConstants .ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ;
2323import static com .aliyun .oss .integrationtests .TestUtils .genFixedLengthInputStream ;
2424import java .io .File ;
2525import java .io .FileInputStream ;
@@ -109,7 +109,7 @@ public void testPutObject() {
109109 Assert .fail ("no RequestPayer, should not be successful" );
110110 } catch (OSSException e ) {
111111 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
112- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
112+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
113113 }
114114
115115 // Put object with payer setting, should be successful.
@@ -142,7 +142,7 @@ public void testGetObject() throws Throwable {
142142 Assert .fail ("no RequestPayer, should not be successful" );
143143 } catch (OSSException e ) {
144144 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
145- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
145+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
146146 }
147147
148148 // Get object with payer setting, should be successful.
@@ -172,7 +172,7 @@ public void testDeleteObject() {
172172 Assert .fail ("no RequestPayer, should not be successful" );
173173 } catch (OSSException e ) {
174174 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
175- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
175+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
176176 }
177177
178178 // Delete object with payer setting, should be successful.
@@ -205,7 +205,7 @@ public void testDeleteObjects() {
205205 Assert .fail ("no RequestPayer, should not be successful" );
206206 } catch (OSSException e ) {
207207 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
208- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
208+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
209209 }
210210
211211 // Delete objects with payer setting, should be successful.
@@ -235,7 +235,7 @@ public void testListObjects() {
235235 Assert .fail ("no RequestPayer, should not be successful" );
236236 } catch (OSSException e ) {
237237 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
238- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
238+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
239239 }
240240
241241 // List objects with payer setting, should be successful.
@@ -266,7 +266,7 @@ public void testSetObjectAcl() {
266266 Assert .fail ("no RequestPayer, should not be successful" );
267267 } catch (OSSException e ) {
268268 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
269- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
269+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
270270 }
271271
272272 // Set object acl with payer setting, should be successful.
@@ -300,7 +300,7 @@ public void testGetObjectAcl() {
300300 Assert .fail ("no RequestPayer, should not be successful" );
301301 } catch (OSSException e ) {
302302 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
303- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
303+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
304304 }
305305
306306 // Get object acl with payer setting, should be successful.
@@ -336,7 +336,7 @@ public void testAppendObject() {
336336 Assert .fail ("no RequestPayer, should not be successful" );
337337 } catch (OSSException e ) {
338338 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
339- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
339+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
340340 }
341341
342342 // Append object with payer setting, should be successful.
@@ -368,7 +368,7 @@ public void testCopyObject() {
368368 Assert .fail ("no RequestPayer, should not be successful" );
369369 } catch (OSSException e ) {
370370 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
371- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
371+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
372372 }
373373
374374 // Copy object with payer setting payer setting, should be successful.
@@ -404,7 +404,7 @@ public void testCreateSymlink() {
404404 Assert .fail ("no RequestPayer, should not be successful" );
405405 } catch (OSSException e ) {
406406 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
407- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
407+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
408408 }
409409
410410 // Create symlink with payer setting payer setting, should be successful.
@@ -439,7 +439,7 @@ public void testGetSymlink() {
439439 Assert .fail ("no RequestPayer, should not be successful" );
440440 } catch (OSSException e ) {
441441 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
442- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
442+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
443443 }
444444
445445 // Get symlink with payer setting payer setting, should be successful.
@@ -611,7 +611,7 @@ public void testUploadFile() throws Throwable {
611611 Assert .fail ("no RequestPayer, should not be successful" );
612612 } catch (OSSException e ) {
613613 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
614- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
614+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
615615 }
616616
617617 // Upload file with payer setting, should be successful.
@@ -679,7 +679,7 @@ public void testUploadPart() throws Throwable {
679679 Assert .fail ("no RequestPayer, should not be successful" );
680680 } catch (OSSException e ) {
681681 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
682- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
682+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
683683 }
684684
685685 // Upload part with payer setting, should be successful.
@@ -751,7 +751,7 @@ public void testUploadPartCopy() {
751751 Assert .fail ("no RequestPayer, should not be successful" );
752752 } catch (OSSException e ) {
753753 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
754- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
754+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
755755 }
756756
757757 // Upload part with payer setting, should be successful.
@@ -825,7 +825,7 @@ public void testListParts() {
825825 Assert .fail ("no RequestPayer, should not be successful" );
826826 } catch (OSSException e ) {
827827 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
828- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
828+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
829829 }
830830
831831 // List parts with payer setting, should be successful.
@@ -855,7 +855,7 @@ public void testAbortMultipartUpload() {
855855 Assert .fail ("no RequestPayer, should not be successful" );
856856 } catch (OSSException e ) {
857857 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
858- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
858+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
859859 }
860860
861861 // Abort multi part with payer setting, should be successful.
@@ -881,7 +881,7 @@ public void testListMultiUploads() {
881881 Assert .fail ("no RequestPayer, should not be successful" );
882882 } catch (OSSException e ) {
883883 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
884- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
884+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
885885 }
886886
887887 // List multi uploads with payer setting, should be successful.
@@ -920,7 +920,7 @@ public void testRestoreObject() {
920920 Assert .fail ("no RequestPayer, should not be successful" );
921921 } catch (OSSException e ) {
922922 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
923- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
923+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
924924 }
925925
926926 // Restore object with payer setting, should be successful.
@@ -966,7 +966,7 @@ public void testProcessObject() {
966966 Assert .fail ("no RequestPayer, should not be successful" );
967967 } catch (OSSException e ) {
968968 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
969- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
969+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
970970 }
971971
972972 // Process object with payer setting, should be successful.
@@ -999,7 +999,7 @@ public void testSetObjectTagging() throws Throwable {
999999 Assert .fail ("no RequestPayer, should not be successful" );
10001000 } catch (OSSException e ) {
10011001 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
1002- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
1002+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
10031003 }
10041004
10051005 // Set object tagging with payer setting, should be successful.
@@ -1040,7 +1040,7 @@ public void testGetObjectTagging() {
10401040 Assert .fail ("no RequestPayer, should not be successful" );
10411041 } catch (OSSException e ) {
10421042 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
1043- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
1043+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
10441044 }
10451045
10461046 // Set object tagging with payer setting, should be successful.
@@ -1079,7 +1079,7 @@ public void testDeleteObjectTagging() {
10791079 Assert .fail ("no RequestPayer, should not be successful" );
10801080 } catch (OSSException e ) {
10811081 Assert .assertEquals (OSSErrorCode .ACCESS_DENIED , e .getErrorCode ());
1082- Assert .assertTrue (e .getMessage ().startsWith (BUCKET_ACCESS_DENIED_ERR ));
1082+ Assert .assertTrue (e .getMessage ().startsWith (ACCESS_DENIED_MSG_REQUESTER_PAY_BUCKET ));
10831083 }
10841084
10851085 // Delete object tagging with payer setting, should be successful.
0 commit comments