liuml07 commented on a change in pull request #1992:
URL: https://github.com/apache/hadoop/pull/1992#discussion_r418732282



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestHostRestrictingAuthorizationFilter.java
##########
@@ -243,6 +243,34 @@ public void doFilter(ServletRequest servletRequest,
     filter.destroy();
   }
 
+  /*
+   * Test acceptable behavior to malformed requests

Review comment:
       nit: use `/**` as javadoc

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestHostRestrictingAuthorizationFilter.java
##########
@@ -243,6 +243,34 @@ public void doFilter(ServletRequest servletRequest,
     filter.destroy();
   }
 
+  /*
+   * Test acceptable behavior to malformed requests
+   * Case: the request URI does not start with "/webhdfs/v1"
+   */
+  @Test
+  public void testInvalidURI() throws Exception {
+    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+    Mockito.when(request.getRemoteAddr()).thenReturn(null);
+    Mockito.when(request.getMethod()).thenReturn("GET");
+    Mockito.when(request.getRequestURI()).thenReturn("/InvalidURI");
+    Mockito.when(request.getQueryString()).thenReturn(null);

Review comment:
       nit: this seems not required?

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestHostRestrictingAuthorizationFilter.java
##########
@@ -243,6 +243,34 @@ public void doFilter(ServletRequest servletRequest,
     filter.destroy();
   }
 
+  /*
+   * Test acceptable behavior to malformed requests
+   * Case: the request URI does not start with "/webhdfs/v1"
+   */
+  @Test
+  public void testInvalidURI() throws Exception {
+    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+    Mockito.when(request.getRemoteAddr()).thenReturn(null);

Review comment:
       nit: this seems not required?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to