3636import org .apache .hadoop .ozone .client .OzoneClientStub ;
3737import org .apache .hadoop .ozone .client .OzoneVolume ;
3838import org .apache .hadoop .ozone .s3 .exception .OS3Exception ;
39+ import org .apache .hadoop .ozone .s3 .util .S3Consts .QueryParams ;
3940import org .apache .hadoop .ozone .security .acl .IAccessAuthorizer ;
4041import org .junit .jupiter .api .AfterEach ;
4142import org .junit .jupiter .api .BeforeEach ;
@@ -68,6 +69,7 @@ public void setup() throws IOException {
6869 .setClient (client )
6970 .setHeaders (headers )
7071 .build ();
72+ bucketEndpoint .getQueryParameters ().add (QueryParams .ACL , ACL_MARKER );
7173 }
7274
7375 @ AfterEach
@@ -81,8 +83,7 @@ public void clean() throws IOException {
8183 public void testGetAcl () throws Exception {
8284 when (parameterMap .containsKey (ACL_MARKER )).thenReturn (true );
8385 Response response =
84- bucketEndpoint .get (BUCKET_NAME , null , null , null , 0 , null ,
85- null , null , null , ACL_MARKER , null , null , 0 );
86+ bucketEndpoint .get (BUCKET_NAME , 0 , 0 );
8687 assertEquals (HTTP_OK , response .getStatus ());
8788 System .out .println (response .getEntity ());
8889 }
@@ -93,7 +94,7 @@ public void testSetAclWithNotSupportedGranteeType() throws Exception {
9394 .thenReturn (S3Acl .ACLIdentityType .GROUP .getHeaderType () + "=root" );
9495 when (parameterMap .containsKey (ACL_MARKER )).thenReturn (true );
9596 OS3Exception e = assertThrows (OS3Exception .class , () ->
96- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null ));
97+ bucketEndpoint .put (BUCKET_NAME , null ));
9798 assertEquals (e .getHttpCode (), HTTP_NOT_IMPLEMENTED );
9899 }
99100
@@ -103,7 +104,7 @@ public void testRead() throws Exception {
103104 when (headers .getHeaderString (S3Acl .GRANT_READ ))
104105 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
105106 Response response =
106- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
107+ bucketEndpoint .put (BUCKET_NAME , null );
107108 assertEquals (HTTP_OK , response .getStatus ());
108109 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
109110 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -117,7 +118,7 @@ public void testWrite() throws Exception {
117118 when (headers .getHeaderString (S3Acl .GRANT_WRITE ))
118119 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
119120 Response response =
120- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
121+ bucketEndpoint .put (BUCKET_NAME , null );
121122 assertEquals (HTTP_OK , response .getStatus ());
122123 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
123124 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -131,7 +132,7 @@ public void testReadACP() throws Exception {
131132 when (headers .getHeaderString (S3Acl .GRANT_READ_CAP ))
132133 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
133134 Response response =
134- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
135+ bucketEndpoint .put (BUCKET_NAME , null );
135136 assertEquals (HTTP_OK , response .getStatus ());
136137 S3BucketAcl getResponse =
137138 bucketEndpoint .getAcl (BUCKET_NAME );
@@ -146,7 +147,7 @@ public void testWriteACP() throws Exception {
146147 when (headers .getHeaderString (S3Acl .GRANT_WRITE_CAP ))
147148 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
148149 Response response =
149- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
150+ bucketEndpoint .put (BUCKET_NAME , null );
150151 assertEquals (HTTP_OK , response .getStatus ());
151152 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
152153 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -160,7 +161,7 @@ public void testFullControl() throws Exception {
160161 when (headers .getHeaderString (S3Acl .GRANT_FULL_CONTROL ))
161162 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
162163 Response response =
163- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
164+ bucketEndpoint .put (BUCKET_NAME , null );
164165 assertEquals (HTTP_OK , response .getStatus ());
165166 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
166167 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -182,7 +183,7 @@ public void testCombination() throws Exception {
182183 when (headers .getHeaderString (S3Acl .GRANT_FULL_CONTROL ))
183184 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
184185 Response response =
185- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
186+ bucketEndpoint .put (BUCKET_NAME , null );
186187 assertEquals (HTTP_OK , response .getStatus ());
187188 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
188189 assertEquals (5 , getResponse .getAclList ().getGrantList ().size ());
@@ -195,7 +196,7 @@ public void testPutClearOldAcls() throws Exception {
195196 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
196197 // Put READ
197198 Response response =
198- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
199+ bucketEndpoint .put (BUCKET_NAME , null );
199200 assertEquals (HTTP_OK , response .getStatus ());
200201 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
201202 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -212,7 +213,7 @@ public void testPutClearOldAcls() throws Exception {
212213 .thenReturn (S3Acl .ACLIdentityType .USER .getHeaderType () + "=root" );
213214 //Put WRITE
214215 response =
215- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , null );
216+ bucketEndpoint .put (BUCKET_NAME , null );
216217 assertEquals (HTTP_OK , response .getStatus ());
217218 getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
218219 assertEquals (1 , getResponse .getAclList ().getGrantList ().size ());
@@ -230,7 +231,7 @@ public void testAclInBodyWithGroupUser() {
230231 .getResourceAsStream ("groupAccessControlList.xml" );
231232 when (parameterMap .containsKey (ACL_MARKER )).thenReturn (true );
232233 assertThrows (OS3Exception .class , () -> bucketEndpoint .put (
233- BUCKET_NAME , ACL_MARKER , inputBody ));
234+ BUCKET_NAME , inputBody ));
234235 }
235236
236237 @ Test
@@ -239,7 +240,7 @@ public void testAclInBody() throws Exception {
239240 .getResourceAsStream ("userAccessControlList.xml" );
240241 when (parameterMap .containsKey (ACL_MARKER )).thenReturn (true );
241242 Response response =
242- bucketEndpoint .put (BUCKET_NAME , ACL_MARKER , inputBody );
243+ bucketEndpoint .put (BUCKET_NAME , inputBody );
243244 assertEquals (HTTP_OK , response .getStatus ());
244245 S3BucketAcl getResponse = bucketEndpoint .getAcl (BUCKET_NAME );
245246 assertEquals (2 , getResponse .getAclList ().getGrantList ().size ());
0 commit comments