HADOOP-13810. Add a test to verify that Configuration handles &-encoded characters. Contributed by Steve Loughran
This closes #158
This commit is contained in:
parent
99c2bbd337
commit
04014c4c73
@ -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 = "''''";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@ -402,7 +405,18 @@ public void testCommentsInValue() throws IOException {
|
||||
//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();
|
||||
|
Loading…
Reference in New Issue
Block a user