Browse Source

HADOOP-3031. Fix javac warnings in test classes.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.17@655591 13f79535-47bb-0310-9956-ffa450edef68
Christopher Douglas 17 years ago
parent
commit
4ee655f4e8

+ 2 - 0
CHANGES.txt

@@ -582,6 +582,8 @@ Release 0.17.0 - Unreleased
     HADOOP-3372. Fix heap management in streaming tests. (Arun Murthy via
     cdouglas)
 
+    HADOOP-3031. Fix javac warnings in test classes. (cdouglas)
+
 Release 0.16.4 - 2008-05-05
 
   BUG FIXES

+ 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();