diff --git a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java index 09574f4daee..200989a2471 100644 --- a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java +++ b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java @@ -300,8 +300,8 @@ public Response get( @PathParam("path") String keyPath, @QueryParam("uploadId") String uploadId, @QueryParam("max-parts") @DefaultValue("1000") int maxParts, - @QueryParam("part-number-marker") String partNumberMarker, - InputStream body) throws IOException, OS3Exception { + @QueryParam("part-number-marker") String partNumberMarker) + throws IOException, OS3Exception { S3GAction s3GAction = S3GAction.GET_KEY; boolean auditSuccess = true; diff --git a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestListParts.java b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestListParts.java index 26e574147b2..d6b02a3f4a9 100644 --- a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestListParts.java +++ b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestListParts.java @@ -94,7 +94,7 @@ public static void setUp() throws Exception { @Test public void testListParts() throws Exception { Response response = REST.get(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, - uploadID, 3, "0", null); + uploadID, 3, "0"); ListPartsResponse listPartsResponse = (ListPartsResponse) response.getEntity(); @@ -107,7 +107,7 @@ public void testListParts() throws Exception { @Test public void testListPartsContinuation() throws Exception { Response response = REST.get(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, - uploadID, 2, "0", null); + uploadID, 2, "0"); ListPartsResponse listPartsResponse = (ListPartsResponse) response.getEntity(); @@ -116,7 +116,7 @@ public void testListPartsContinuation() throws Exception { // Continue response = REST.get(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, uploadID, 2, - Integer.toString(listPartsResponse.getNextPartNumberMarker()), null); + Integer.toString(listPartsResponse.getNextPartNumberMarker())); listPartsResponse = (ListPartsResponse) response.getEntity(); Assert.assertFalse(listPartsResponse.getTruncated()); @@ -128,7 +128,7 @@ public void testListPartsContinuation() throws Exception { public void testListPartsWithUnknownUploadID() throws Exception { try { REST.get(OzoneConsts.S3_BUCKET, OzoneConsts.KEY, - uploadID, 2, "0", null); + uploadID, 2, "0"); } catch (OS3Exception ex) { Assert.assertEquals(S3ErrorTable.NO_SUCH_UPLOAD.getErrorMessage(), ex.getErrorMessage()); diff --git a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java index 47f52633fb8..03c0751dde7 100644 --- a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java +++ b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestObjectGet.java @@ -25,7 +25,6 @@ import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import java.io.ByteArrayInputStream; import java.io.IOException; import java.time.format.DateTimeFormatter; @@ -70,7 +69,6 @@ public class TestObjectGet { private HttpHeaders headers; private ObjectEndpoint rest; private OzoneClient client; - private ByteArrayInputStream body; private ContainerRequestContext context; @Before @@ -89,7 +87,6 @@ public void init() throws IOException { rest.setOzoneConfiguration(new OzoneConfiguration()); headers = Mockito.mock(HttpHeaders.class); rest.setHeaders(headers); - body = new ByteArrayInputStream(CONTENT.getBytes(UTF_8)); context = Mockito.mock(ContainerRequestContext.class); Mockito.when(context.getUriInfo()).thenReturn(Mockito.mock(UriInfo.class)); @@ -101,7 +98,7 @@ public void init() throws IOException { @Test public void get() throws IOException, OS3Exception { //WHEN - Response response = rest.get("b1", "key1", null, 0, null, body); + Response response = rest.get("b1", "key1", null, 0, null); //THEN OzoneInputStream ozoneInputStream = @@ -123,7 +120,7 @@ public void get() throws IOException, OS3Exception { public void inheritRequestHeader() throws IOException, OS3Exception { setDefaultHeader(); - Response response = rest.get("b1", "key1", null, 0, null, body); + Response response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals(CONTENT_TYPE1, response.getHeaderString("Content-Type")); @@ -156,8 +153,7 @@ public void overrideResponseHeader() throws IOException, OS3Exception { Mockito.when(context.getUriInfo().getQueryParameters()) .thenReturn(queryParameter); - body = new ByteArrayInputStream(CONTENT.getBytes(UTF_8)); - Response response = rest.get("b1", "key1", null, 0, null, body); + Response response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals(CONTENT_TYPE2, response.getHeaderString("Content-Type")); @@ -177,15 +173,14 @@ public void overrideResponseHeader() throws IOException, OS3Exception { public void getRangeHeader() throws IOException, OS3Exception { Response response; Mockito.when(headers.getHeaderString(RANGE_HEADER)).thenReturn("bytes=0-0"); - body = new ByteArrayInputStream(CONTENT.getBytes(UTF_8)); - response = rest.get("b1", "key1", null, 0, null, body); + response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals("1", response.getHeaderString("Content-Length")); Assert.assertEquals(String.format("bytes 0-0/%s", CONTENT.length()), response.getHeaderString("Content-Range")); Mockito.when(headers.getHeaderString(RANGE_HEADER)).thenReturn("bytes=0-"); - response = rest.get("b1", "key1", null, 0, null, body); + response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals(String.valueOf(CONTENT.length()), response.getHeaderString("Content-Length")); Assert.assertEquals( @@ -196,8 +191,7 @@ public void getRangeHeader() throws IOException, OS3Exception { @Test public void getStatusCode() throws IOException, OS3Exception { Response response; - body = new ByteArrayInputStream(CONTENT.getBytes(UTF_8)); - response = rest.get("b1", "key1", null, 0, null, body); + response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); @@ -205,7 +199,7 @@ public void getStatusCode() throws IOException, OS3Exception { // The 206 (Partial Content) status code indicates that the server is // successfully fulfilling a range request for the target resource Mockito.when(headers.getHeaderString(RANGE_HEADER)).thenReturn("bytes=0-1"); - response = rest.get("b1", "key1", null, 0, null, body); + response = rest.get("b1", "key1", null, 0, null); Assert.assertEquals(response.getStatus(), Response.Status.PARTIAL_CONTENT.getStatusCode()); } diff --git a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPermissionCheck.java b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPermissionCheck.java index 835e032e7eb..edf1488f168 100644 --- a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPermissionCheck.java +++ b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestPermissionCheck.java @@ -263,8 +263,7 @@ public void testGetKey() throws IOException { objectEndpoint.setOzoneConfiguration(conf); try { - objectEndpoint.get("bucketName", "keyPath", null, 1000, "marker", - null); + objectEndpoint.get("bucketName", "keyPath", null, 1000, "marker"); Assert.fail("Should fail"); } catch (Exception e) { e.printStackTrace(); diff --git a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/metrics/TestS3GatewayMetrics.java b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/metrics/TestS3GatewayMetrics.java index 3763fb2fd1c..28a449a31fd 100644 --- a/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/metrics/TestS3GatewayMetrics.java +++ b/hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/metrics/TestS3GatewayMetrics.java @@ -377,7 +377,7 @@ public void testGetKeySuccess() throws Exception { .length(), 1, null, body); // GET the key from the bucket keyEndpoint.get(bucketName, keyName, null, 0, - null, body); + null); long curMetric = metrics.getGetKeySuccess(); assertEquals(1L, curMetric - oriMetric); } @@ -388,7 +388,7 @@ public void testGetKeyFailure() throws Exception { // Fetching a non-existent key try { keyEndpoint.get(bucketName, "unknownKey", null, 0, - null, null); + null); fail(); } catch (OS3Exception ex) { assertEquals(S3ErrorTable.NO_SUCH_KEY.getCode(), ex.getCode()); @@ -520,7 +520,7 @@ public void testListPartsSuccess() throws Exception { // Listing out the parts by providing the uploadID keyEndpoint.get(bucketName, keyName, - uploadID, 3, null, null); + uploadID, 3, null); long curMetric = metrics.getListPartsSuccess(); assertEquals(1L, curMetric - oriMetric); } @@ -532,7 +532,7 @@ public void testListPartsFailure() throws Exception { try { // Listing out the parts by providing the uploadID after aborting keyEndpoint.get(bucketName, keyName, - "wrong_id", 3, null, null); + "wrong_id", 3, null); fail(); } catch (OS3Exception ex) { assertEquals(S3ErrorTable.NO_SUCH_UPLOAD.getCode(), ex.getCode());