Ver Fonte

HDFS-2233. Add WebUI tests with URI reserved chars. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1158025 13f79535-47bb-0310-9956-ffa450edef68
Eli Collins há 14 anos atrás
pai
commit
2ab3433e0e

+ 2 - 0
hdfs/CHANGES.txt

@@ -663,6 +663,8 @@ Trunk (unreleased changes)
     HDFS-2237. Change UnderReplicatedBlocks from public to package private.
     (szetszwo)
 
+    HDFS-2233. Add WebUI tests with URI reserved chars. (eli)
+
   OPTIMIZATIONS
 
     HDFS-1458. Improve checkpoint performance by avoiding unnecessary image

+ 16 - 25
hdfs/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestDatanodeJsp.java

@@ -82,31 +82,22 @@ public class TestDatanodeJsp {
     try {
       cluster = new MiniDFSCluster.Builder(CONF).build();
       cluster.waitActive();
-      
-      testViewingFile(cluster, "/test-file", false);
-      testViewingFile(cluster, "/tmp/test-file", false);
-      testViewingFile(cluster, "/tmp/test-file%with goofy&characters", false);
-      
-      testViewingFile(cluster, "/test-file", true);
-      testViewingFile(cluster, "/tmp/test-file", true);
-      testViewingFile(cluster, "/tmp/test-file%with goofy&characters", true);
-
-      testViewingFile(cluster, "/foo bar", true);
-      testViewingFile(cluster, "/foo+bar", true);
-      testViewingFile(cluster, "/foo;bar", true);
-      testViewingFile(cluster, "/foo=bar", true);
-      testViewingFile(cluster, "/foo,bar", true);
-      testViewingFile(cluster, "/foo?bar", true);
-      testViewingFile(cluster, "/foo\">bar", true);
-      
-      testViewingFile(cluster, "/foo bar", false);
-      // See HDFS-2233
-      //testViewingFile(cluster, "/foo+bar", false);
-      //testViewingFile(cluster, "/foo;bar", false);
-      testViewingFile(cluster, "/foo=bar", false);
-      testViewingFile(cluster, "/foo,bar", false);
-      testViewingFile(cluster, "/foo?bar", false);
-      testViewingFile(cluster, "/foo\">bar", false);
+      String paths[] = {
+        "/test-file",
+        "/tmp/test-file",
+        "/tmp/test-file%with goofy&characters",
+        "/foo bar/foo bar",
+        "/foo+bar/foo+bar",
+        "/foo;bar/foo;bar",
+        "/foo=bar/foo=bar",
+        "/foo,bar/foo,bar",
+        "/foo?bar/foo?bar",
+        "/foo\">bar/foo\">bar"
+      };
+      for (String p : paths) {
+        testViewingFile(cluster, p, false);
+        testViewingFile(cluster, p, true);
+      }
     } finally {
       if (cluster != null) {
         cluster.shutdown();