hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject [24/50] hadoop git commit: HADOOP-13810. Add a test to verify that Configuration handles &-encoded characters. Contributed by Steve Loughran
Date Thu, 17 Nov 2016 02:02:26 GMT
HADOOP-13810. Add a test to verify that Configuration handles &-encoded characters. Contributed
by Steve Loughran

This closes #158


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/04014c4c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/04014c4c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/04014c4c

Branch: refs/heads/YARN-4752
Commit: 04014c4c739bb4e3bc3fdf9299abc0f47521e8fd
Parents: 99c2bbd
Author: Mingliang Liu <liuml07@apache.org>
Authored: Mon Nov 14 19:37:50 2016 -0800
Committer: Mingliang Liu <liuml07@apache.org>
Committed: Mon Nov 14 19:38:10 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/conf/TestConfiguration.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/04014c4c/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
index 17112f5..8a422f7 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
@@ -70,6 +70,9 @@ public class TestConfiguration extends TestCase {
             IBM_JAVA?"<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration>":
   "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><configuration>";
 
+  /** Four apostrophes. */
+  public static final String ESCAPED = "&apos;&#39;&#0039;&#x27;";
+
   @Override
   protected void setUp() throws Exception {
     super.setUp();
@@ -402,7 +405,18 @@ public class TestConfiguration extends TestCase {
     //two spaces one after "this", one before "contains"
     assertEquals("this  contains a comment", conf.get("my.comment"));
   }
-  
+
+  public void testEscapedCharactersInValue() throws IOException {
+    out=new BufferedWriter(new FileWriter(CONFIG));
+    startConfig();
+    appendProperty("my.comment", ESCAPED);
+    endConfig();
+    Path fileResource = new Path(CONFIG);
+    conf.addResource(fileResource);
+    //two spaces one after "this", one before "contains"
+    assertEquals("''''", conf.get("my.comment"));
+  }
+
   public void testTrim() throws IOException {
     out=new BufferedWriter(new FileWriter(CONFIG));
     startConfig();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message