Browse Source

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
Eli Collins 14 years ago
parent
commit
47b416b346

+ 2 - 0
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

+ 13 - 2
common/src/test/core/org/apache/hadoop/conf/TestConfiguration.java

@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
 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 class TestConfiguration extends TestCase {
 
   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 class TestConfiguration extends TestCase {
   
   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,