MAPREDUCE-2882. TestLineRecordReader depends on ant jars. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1165448 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
574aa2b2f5
commit
c076b3c758
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue