From 00dd843a1a6c9d8b616631cdcf24c00e82498dab Mon Sep 17 00:00:00 2001 From: Masatake Iwasaki Date: Thu, 11 Jul 2019 17:40:25 +0900 Subject: [PATCH] HDFS-14466. Add a regression test for HDFS-14323. Signed-off-by: Akira Ajisaka --- .../org/apache/hadoop/hdfs/web/TestWebHdfsUrl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsUrl.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsUrl.java index 449f2c6089..a4ae871fca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsUrl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsUrl.java @@ -494,4 +494,18 @@ public void testWebHdfsBackwardCompatibleSpecialCharacterFile() } } + @Test + public void testWebHdfsUrlEncoding() throws Exception { + final WebHdfsFileSystem fs = + (WebHdfsFileSystem) FileSystem.get(uri, WebHdfsTestUtil.createConf()); + + // characters which should not be urlencoded. + final String unreserved = "_-!.~'()*"; + final String punct = ",:$&="; + String path = "/testWebHdfsUrlEncoding" + unreserved + punct; + URL url = + WebHdfsTestUtil.toUrl(fs, GetOpParam.Op.LISTSTATUS, new Path(path)); + WebHdfsTestUtil.LOG.info(url.getPath()); + assertEquals(WebHdfsFileSystem.PATH_PREFIX + path, url.getPath()); + } }