You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ac...@apache.org on 2008/08/02 00:44:19 UTC
svn commit: r681885 - in /hadoop/core/trunk: CHANGES.txt
src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java
Author: acmurthy
Date: Fri Aug 1 15:44:19 2008
New Revision: 681885
URL: http://svn.apache.org/viewvc?rev=681885&view=rev
Log:
HADOOP-3836. Fix TestMultipleOutputs to correctly clean up. Contributed by Alejandro Abdelnur.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java
Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=681885&r1=681884&r2=681885&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Aug 1 15:44:19 2008
@@ -208,6 +208,9 @@
HADOOP-3796. fuse-dfs configuration is implemented as file system
mount options. (Pete Wyckoff via dhruba)
+ HADOOP-3836. Fix TestMultipleOutputs to correctly clean up. (Alejandro
+ Abdelnur via acmurthy)
+
Release 0.18.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java?rev=681885&r1=681884&r2=681885&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/mapred/lib/TestMultipleOutputs.java Fri Aug 1 15:44:19 2008
@@ -45,27 +45,48 @@
_testMultipleOutputs(true);
}
- @SuppressWarnings({"unchecked"})
- protected void _testMultipleOutputs(boolean withCounters) throws Exception {
- Path inDir = new Path("testing/mo/input");
- Path outDir = new Path("testing/mo/output");
+ private static final Path ROOT_DIR = new Path("testing/mo");
+ private static final Path IN_DIR = new Path(ROOT_DIR, "input");
+ private static final Path OUT_DIR = new Path(ROOT_DIR, "output");
+ private Path getDir(Path dir) {
// Hack for local FS that does not have the concept of a 'mounting point'
if (isLocalFS()) {
String localPathRoot = System.getProperty("test.build.data", "/tmp")
.replace(' ', '+');
- inDir = new Path(localPathRoot, inDir);
- outDir = new Path(localPathRoot, outDir);
+ dir = new Path(localPathRoot, dir);
}
+ return dir;
+ }
+ public void setUp() throws Exception {
+ super.setUp();
+ Path rootDir = getDir(ROOT_DIR);
+ Path inDir = getDir(IN_DIR);
JobConf conf = createJobConf();
FileSystem fs = FileSystem.get(conf);
-
- fs.delete(outDir, true);
+ fs.delete(rootDir, true);
if (!fs.mkdirs(inDir)) {
throw new IOException("Mkdirs failed to create " + inDir.toString());
}
+ }
+
+ public void tearDown() throws Exception {
+ Path rootDir = getDir(ROOT_DIR);
+
+ JobConf conf = createJobConf();
+ FileSystem fs = FileSystem.get(conf);
+ fs.delete(rootDir, true);
+ super.tearDown();
+ }
+
+ protected void _testMultipleOutputs(boolean withCounters) throws Exception {
+ Path inDir = getDir(IN_DIR);
+ Path outDir = getDir(OUT_DIR);
+
+ JobConf conf = createJobConf();
+ FileSystem fs = FileSystem.get(conf);
DataOutputStream file = fs.create(new Path(inDir, "part-0"));
file.writeBytes("a\nb\n\nc\nd\ne");
@@ -154,7 +175,7 @@
assertEquals("sequence", value.toString());
count++;
}
- reader.close();
+ seqReader.close();
assertFalse(count == 0);
Counters.Group counters =