Pārlūkot izejas kodu

HADOOP-3031. Fix javac warnings in test classes.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@653544 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 17 gadi atpakaļ
vecāks
revīzija
5e940305ee

+ 2 - 0
CHANGES.txt

@@ -145,6 +145,8 @@ Trunk (unreleased changes)
     HADOOP-3101. Prevent JobClient from throwing an exception when printing
     usage. (Edward J. Yoon via cdouglas)
 
+    HADOOP-3031. Fix javac warnings in test classes. (cdouglas)
+
 Release 0.17.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 15 - 5
src/test/org/apache/hadoop/mapred/EmptyInputFormat.java

@@ -25,13 +25,23 @@ import org.apache.hadoop.fs.FileSystem;
   * InputFormat which simulates the absence of input data
   * by returning zero split.
   */
-public class EmptyInputFormat<K, V> extends FileInputFormat<K, V> {
+public class EmptyInputFormat<K, V> implements InputFormat<K, V> {
 
-  public FileSplit[] getSplits(FileSystem fs, JobConf job, int numSplits) throws IOException {
-    return new FileSplit[0];
+  public void validateInput(JobConf job) { }
+
+  public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
+    return new InputSplit[0];
   }
 
-  public RecordReader<K, V> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException {
-    return new SequenceFileRecordReader(job, (FileSplit) split);
+  public RecordReader<K, V> getRecordReader(InputSplit split, JobConf job,
+                              Reporter reporter) throws IOException {
+    return new RecordReader<K,V>() {
+      public boolean next(K key, V value) throws IOException { return false; }
+      public K createKey() { return null; }
+      public V createValue() { return null; }
+      public long getPos() throws IOException { return 0L; }
+      public void close() throws IOException { }
+      public float getProgress() throws IOException { return 0.0f; }
+    };
   }
 }

+ 4 - 3
src/test/org/apache/hadoop/mapred/TestReduceTask.java

@@ -87,10 +87,11 @@ public class TestReduceTask extends TestCase {
                                                          Text.class, conf);
     SequenceFile.Sorter.RawKeyValueIterator rawItr = 
       sorter.merge(new Path[]{path}, false, tmpDir);
+    @SuppressWarnings("unchecked") // WritableComparators are not generic
     ReduceTask.ValuesIterator valItr = 
-      new ReduceTask.ValuesIterator(rawItr, WritableComparator.get(Text.class), 
-                                    Text.class, Text.class,
-                                    conf, new NullProgress());
+      new ReduceTask.ValuesIterator<Text,Text>(rawItr,
+          WritableComparator.get(Text.class), Text.class, Text.class,
+          conf, new NullProgress());
     int i = 0;
     while (valItr.more()) {
       Object key = valItr.getKey();