diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index acf924db1c1..c7f810d30dc 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1196,6 +1196,8 @@ Release 0.23.0 - Unreleased MAPREDUCE-2716. MRReliabilityTest job fails because of missing job-file. (Jeffrey Naisbitt via vinodkv) + MAPREDUCE-2882. TestLineRecordReader depends on ant jars. (todd) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestLineRecordReader.java b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestLineRecordReader.java index 472da68c8af..17bf9cff257 100644 --- a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestLineRecordReader.java +++ b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/TestLineRecordReader.java @@ -18,9 +18,7 @@ package org.apache.hadoop.mapred; import java.io.IOException; -import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.Reader; import java.io.Writer; import junit.framework.TestCase; @@ -32,7 +30,6 @@ import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.Reducer; import org.apache.hadoop.mapred.lib.IdentityMapper; import org.apache.hadoop.mapred.lib.IdentityReducer; -import org.apache.tools.ant.util.FileUtils; import org.junit.Test; public class TestLineRecordReader extends TestCase { @@ -66,10 +63,7 @@ public class TestLineRecordReader extends TestCase { public String readOutputFile(Configuration conf) throws IOException { FileSystem localFs = FileSystem.getLocal(conf); Path file = new Path(outputDir, "part-00000"); - Reader reader = new InputStreamReader(localFs.open(file)); - String r = FileUtils.readFully(reader); - reader.close(); - return r; + return UtilsForTests.slurpHadoop(file, localFs); } /** diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/UtilsForTests.java b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/UtilsForTests.java index aa5f47ee2d1..fc3c61720aa 100644 --- a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/UtilsForTests.java +++ b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapred/UtilsForTests.java @@ -172,7 +172,7 @@ public class UtilsForTests { return contents; } - static String slurpHadoop(Path p, FileSystem fs) throws IOException { + public static String slurpHadoop(Path p, FileSystem fs) throws IOException { int len = (int) fs.getFileStatus(p).getLen(); byte[] buf = new byte[len]; InputStream in = fs.open(p); diff --git a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapreduce/lib/input/TestLineRecordReader.java b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapreduce/lib/input/TestLineRecordReader.java index 55937b2508f..dd51ab39076 100644 --- a/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapreduce/lib/input/TestLineRecordReader.java +++ b/hadoop-mapreduce-project/src/test/mapred/org/apache/hadoop/mapreduce/lib/input/TestLineRecordReader.java @@ -19,9 +19,7 @@ package org.apache.hadoop.mapreduce.lib.input; import java.io.IOException; -import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.Reader; import java.io.Writer; import junit.framework.TestCase; @@ -29,11 +27,11 @@ import junit.framework.TestCase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.mapred.UtilsForTests; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; -import org.apache.tools.ant.util.FileUtils; import org.junit.Test; public class TestLineRecordReader extends TestCase { @@ -67,10 +65,7 @@ public class TestLineRecordReader extends TestCase { public String readOutputFile(Configuration conf) throws IOException { FileSystem localFs = FileSystem.getLocal(conf); Path file = new Path(outputDir, "part-r-00000"); - Reader reader = new InputStreamReader(localFs.open(file)); - String r = FileUtils.readFully(reader); - reader.close(); - return r; + return UtilsForTests.slurpHadoop(file, localFs); } /**