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
This commit is contained in:
Eli Collins 2011-06-17 22:53:10 +00:00
parent 5f81b0f421
commit 47b416b346
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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,