From 47b416b34617cc42b83762221079622a6812b866 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Fri, 17 Jun 2011 22:53:10 +0000 Subject: [PATCH] HADOOP-7402. TestConfiguration doesn't clean up after itself. Contributed by Aaron T. Myers git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1137065 13f79535-47bb-0310-9956-ffa450edef68 --- common/CHANGES.txt | 2 ++ .../org/apache/hadoop/conf/TestConfiguration.java | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/CHANGES.txt b/common/CHANGES.txt index 011d066a7a..ef429796cb 100644 --- a/common/CHANGES.txt +++ b/common/CHANGES.txt @@ -321,6 +321,8 @@ Trunk (unreleased changes) HADOOP-7377. Fix command name handling affecting DFSAdmin. (Daryn Sharp via mattf) + HADOOP-7402. TestConfiguration doesn't clean up after itself. (atm via eli) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/common/src/test/core/org/apache/hadoop/conf/TestConfiguration.java b/common/src/test/core/org/apache/hadoop/conf/TestConfiguration.java index 9faef9f5b7..57dbc57daa 100644 --- a/common/src/test/core/org/apache/hadoop/conf/TestConfiguration.java +++ b/common/src/test/core/org/apache/hadoop/conf/TestConfiguration.java @@ -33,6 +33,7 @@ import junit.framework.TestCase; import static org.junit.Assert.assertArrayEquals; +import org.apache.commons.lang.StringUtils; import org.apache.hadoop.fs.Path; import org.codehaus.jackson.map.ObjectMapper; @@ -246,7 +247,12 @@ public void testTrim() throws IOException { public void testGetLocalPath() throws IOException { Configuration conf = new Configuration(); - conf.set("dirs", "a, b, c "); + String[] dirs = new String[]{"a", "b", "c"}; + for (int i = 0; i < dirs.length; i++) { + dirs[i] = new Path(System.getProperty("test.build.data"), dirs[i]) + .toString(); + } + conf.set("dirs", StringUtils.join(dirs, ",")); for (int i = 0; i < 1000; i++) { String localPath = conf.getLocalPath("dirs", "dir" + i).toString(); assertTrue("Path doesn't end in specified dir: " + localPath, @@ -258,7 +264,12 @@ public void testGetLocalPath() throws IOException { public void testGetFile() throws IOException { Configuration conf = new Configuration(); - conf.set("dirs", "a, b, c "); + String[] dirs = new String[]{"a", "b", "c"}; + for (int i = 0; i < dirs.length; i++) { + dirs[i] = new Path(System.getProperty("test.build.data"), dirs[i]) + .toString(); + } + conf.set("dirs", StringUtils.join(dirs, ",")); for (int i = 0; i < 1000; i++) { String localPath = conf.getFile("dirs", "dir" + i).toString(); assertTrue("Path doesn't end in specified dir: " + localPath,