소스 검색

HADOOP-2733. Fix compiler warnings in test code.
Contributed by Tsz Wo (Nicholas), SZE



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@620679 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 년 전
부모
커밋
0b1058f5c1

+ 3 - 0
CHANGES.txt

@@ -57,6 +57,9 @@ Release 0.16.1 - Unrelease
     HADOOP-2754. Filter out .crc files from local file system listing.
     (Hairong Kuang via shv)
 
+    HADOOP-2733. Fix compiler warnings in test code.
+    (Tsz Wo (Nicholas), SZE via cdouglas)
+
 Release 0.16.0 - 2008-02-07
 
   INCOMPATIBLE CHANGES

+ 2 - 39
src/test/org/apache/hadoop/mapred/TestClusterMapReduceTestCase.java

@@ -17,51 +17,14 @@
  */
 package org.apache.hadoop.mapred;
 
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
 
 import java.io.*;
-import java.util.Iterator;
 import java.util.Properties;
 
 public class TestClusterMapReduceTestCase extends ClusterMapReduceTestCase {
-
-  public static class EchoMap implements Mapper {
-
-    public void configure(JobConf conf) {
-    }
-
-    public void close() {
-    }
-
-    public void map(WritableComparable key, Writable value,
-                    OutputCollector collector, Reporter reporter) throws IOException {
-      collector.collect(key, value);
-    }
-  }
-
-  public static class EchoReduce implements Reducer {
-
-    public void configure(JobConf conf) {
-    }
-
-    public void close() {
-    }
-
-    public void reduce(WritableComparable key, Iterator values,
-                       OutputCollector collector, Reporter reporter) throws IOException {
-      while (values.hasNext()) {
-        Writable value = (Writable) values.next();
-        collector.collect(key, value);
-      }
-    }
-
-  }
-
   public void _testMapReduce(boolean restart) throws Exception {
     OutputStream os = getFileSystem().create(new Path(getInputDir(), "text.txt"));
     Writer wr = new OutputStreamWriter(os);
@@ -88,8 +51,8 @@ public class TestClusterMapReduceTestCase extends ClusterMapReduceTestCase {
     conf.setOutputKeyClass(LongWritable.class);
     conf.setOutputValueClass(Text.class);
 
-    conf.setMapperClass(TestClusterMapReduceTestCase.EchoMap.class);
-    conf.setReducerClass(TestClusterMapReduceTestCase.EchoReduce.class);
+    conf.setMapperClass(org.apache.hadoop.mapred.lib.IdentityMapper.class);
+    conf.setReducerClass(org.apache.hadoop.mapred.lib.IdentityReducer.class);
 
     conf.setInputPath(getInputDir());
 

+ 2 - 39
src/test/org/apache/hadoop/mapred/TestJobStatusPersistency.java

@@ -17,51 +17,14 @@
  */
 package org.apache.hadoop.mapred;
 
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.fs.Path;
 
 import java.io.*;
-import java.util.Iterator;
 import java.util.Properties;
 
 public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
-
-  public static class EchoMap implements Mapper {
-
-    public void configure(JobConf conf) {
-    }
-
-    public void close() {
-    }
-
-    public void map(WritableComparable key, Writable value,
-                    OutputCollector collector, Reporter reporter) throws IOException {
-      collector.collect(key, value);
-    }
-  }
-
-  public static class EchoReduce implements Reducer {
-
-    public void configure(JobConf conf) {
-    }
-
-    public void close() {
-    }
-
-    public void reduce(WritableComparable key, Iterator values,
-                       OutputCollector collector, Reporter reporter) throws IOException {
-      while (values.hasNext()) {
-        Writable value = (Writable) values.next();
-        collector.collect(key, value);
-      }
-    }
-
-  }
-
   private String runJob() throws Exception {
     OutputStream os = getFileSystem().create(new Path(getInputDir(), "text.txt"));
     Writer wr = new OutputStreamWriter(os);
@@ -83,8 +46,8 @@ public class TestJobStatusPersistency extends ClusterMapReduceTestCase {
     conf.setOutputKeyClass(LongWritable.class);
     conf.setOutputValueClass(Text.class);
 
-    conf.setMapperClass(TestJobStatusPersistency.EchoMap.class);
-    conf.setReducerClass(TestJobStatusPersistency.EchoReduce.class);
+    conf.setMapperClass(org.apache.hadoop.mapred.lib.IdentityMapper.class);
+    conf.setReducerClass(org.apache.hadoop.mapred.lib.IdentityReducer.class);
 
     conf.setInputPath(getInputDir());