anmolanmol1234 commented on code in PR #5109:
URL: https://github.com/apache/hadoop/pull/5109#discussion_r1015227331


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestPartialRead.java:
##########
@@ -0,0 +1,260 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.azurebfs;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.SocketException;
+import java.util.Random;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.azurebfs.services.AbfsClientThrottlingIntercept;
+import 
org.apache.hadoop.fs.azurebfs.services.AbfsClientThrottlingInterceptTestUtil;
+import org.apache.hadoop.fs.azurebfs.services.MockAbfsClient;
+import org.apache.hadoop.fs.azurebfs.services.MockAbfsClientThrottlingAnalyzer;
+import org.apache.hadoop.fs.azurebfs.services.MockHttpOperation;
+import org.apache.hadoop.fs.azurebfs.services.MockHttpOperationTestIntercept;
+import 
org.apache.hadoop.fs.azurebfs.services.MockHttpOperationTestInterceptResult;
+
+import static java.net.HttpURLConnection.HTTP_PARTIAL;
+import static 
org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.CONNECTION_RESET;
+import static 
org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.ONE_MB;
+
+public class ITestPartialRead extends AbstractAbfsIntegrationTest {
+
+  private static final String TEST_PATH = "/testfile";
+
+  private Logger LOG =
+      LoggerFactory.getLogger(ITestPartialRead.class);
+
+  public ITestPartialRead() throws Exception {
+  }
+
+
+  /**
+   * Test1: Execute read for 4 MB, but httpOperation will read for only 1MB.:
+   * retry with the remaining data, add data in throttlingIntercept.
+   * Test2: Execute read for 4 MB, but httpOperation will throw 
connection-rest exception + read 1 MB:
+   * retry with remaining data + add data in throttlingIntercept.
+   * */
+
+
+  private byte[] setup(final Path testPath, final int fileSize)
+      throws IOException {
+    final AzureBlobFileSystem fs = getFileSystem();
+    final AbfsConfiguration abfsConfiguration = fs.getAbfsStore()
+        .getAbfsConfiguration();
+    final int bufferSize = 4 * ONE_MB;
+    abfsConfiguration.setWriteBufferSize(bufferSize);
+    abfsConfiguration.setReadBufferSize(bufferSize);
+    abfsConfiguration.setReadAheadQueueDepth(0);
+
+    final byte[] b = new byte[fileSize];
+    new Random().nextBytes(b);
+
+

Review Comment:
   Remove extra line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to