You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mrunit.apache.org by db...@apache.org on 2012/08/09 22:26:30 UTC

svn commit: r1371440 - in /mrunit/trunk/src/main/java/org/apache/hadoop/mrunit: MapDriverBase.java MapReduceDriverBase.java PipelineMapReduceDriver.java ReduceDriverBase.java TestDriver.java

Author: dbeech
Date: Thu Aug  9 20:26:29 2012
New Revision: 1371440

URL: http://svn.apache.org/viewvc?rev=1371440&view=rev
Log:
MRUNIT-137: Remove duplicated set/add/withOutput methods

Modified:
    mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java
    mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
    mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
    mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java
    mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java

Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java?rev=1371440&r1=1371439&r2=1371440&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java Thu Aug  9 20:26:29 2012
@@ -23,7 +23,6 @@ import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mrunit.internal.output.MockOutputCreator;
@@ -49,7 +48,7 @@ public abstract class MapDriverBase<K1, 
   protected K1 inputKey;
   @Deprecated
   protected V1 inputVal;
-  
+
   protected final MockOutputCreator<K2, V2> mockOutputCreator = new MockOutputCreator<K2, V2>();
 
   /**
@@ -118,7 +117,7 @@ public abstract class MapDriverBase<K1, 
   public void addInput(final K1 key, final V1 val) {
     inputs.add(copyPair(key, val));
   }
-  
+
   /**
    * Adds an input to send to the mapper
    * 
@@ -128,7 +127,7 @@ public abstract class MapDriverBase<K1, 
   public void addInput(final Pair<K1, V1> input) {
     addInput(input.getFirst(), input.getSecond());
   }
-  
+
   /**
    * Adds list of inputs to send to the mapper
    * 
@@ -140,43 +139,13 @@ public abstract class MapDriverBase<K1, 
       addInput(input);
     }
   }
-  
+
   /**
    * Clears the list of inputs to send to the mapper
    */
   public void clearInput() {
     inputs.clear();
   }
-  
-  /**
-   * Adds output (k, v)* pairs we expect from the Mapper
-   * 
-   * @param outputRecords
-   *          The (k, v)* pairs to add
-   */
-  public void addAllOutput(final List<Pair<K2, V2>> outputRecords) {
-    for (Pair<K2, V2> output : outputRecords) {
-      addOutput(output);
-    }
-  }
-  
-  /**
-   * Adds an output (k, v) pair we expect from the Mapper
-   * 
-   * @param outputRecord
-   *          The (k, v) pair to add
-   */
-  public void addOutput(final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord.getFirst(), outputRecord.getSecond());
-  }
-
-  /**
-   * Adds a (k, v) pair we expect as output from the mapper
-   * 
-   */
-  public void addOutput(final K2 key, final V2 val) {
-    expectedOutputs.add(copyPair(key, val));
-  }
 
   /**
    * Expects an input of the form "key \t val" Forces the Mapper input types to
@@ -195,26 +164,11 @@ public abstract class MapDriverBase<K1, 
     setInputValue((V1) inputPair.getSecond());
   }
 
-  /**
-   * Expects an input of the form "key \t val" Forces the Mapper output types to
-   * Text.
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  @SuppressWarnings("unchecked")
-  public void addOutputFromString(final String output) {
-    addOutput((Pair<K2, V2>) parseTabbedPair(output));
-  }
-  
   @SuppressWarnings("unchecked")
   private T thisAsMapDriver() {
     return (T) this;
   }
-  
+
   /**
    * Identical to setInputKey() but with fluent programming style
    * 
@@ -264,27 +218,6 @@ public abstract class MapDriverBase<K1, 
   }
 
   /**
-   * Works like addOutput(), but returns self for fluent style
-   * 
-   * @param outputRecord
-   * @return this
-   */
-  public T withOutput(final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord);
-    return thisAsMapDriver();
-  }
-
-  /**
-   * Functions like addOutput() but returns self for fluent programming style
-   * 
-   * @return this
-   */
-  public T withOutput(final K2 key, final V2 val) {
-    addOutput(key, val);
-    return thisAsMapDriver();
-  }
-
-  /**
    * Identical to setInputFromString, but with a fluent programming style
    * 
    * @param input
@@ -300,27 +233,6 @@ public abstract class MapDriverBase<K1, 
   }
 
   /**
-   * Identical to addOutputFromString, but with a fluent programming style
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  public T withOutputFromString(final String output) {
-    addOutputFromString(output);
-    return thisAsMapDriver();
-  }
-
-  public T withOutputCopyingOrInputFormatConfiguration(
-      Configuration configuration) {
-    setOutputCopyingOrInputFormatConfiguration(configuration);
-    return thisAsMapDriver();
-  }
-  
-  /**
    * Identical to addAll() but returns self for fluent programming style
    * 
    * @param inputRecords
@@ -332,18 +244,6 @@ public abstract class MapDriverBase<K1, 
   }
 
   /**
-   * Functions like addAllOutput() but returns self for fluent programming style
-   * 
-   * @param outputRecords
-   * @return this
-   */
-  public T withAllOutput(
-      final List<Pair<K2, V2>> outputRecords) {
-    addAllOutput(outputRecords);
-    return thisAsMapDriver();
-  }
-
-  /**
    * @return the path passed to the mapper InputSplit
    */
   public Path getMapInputPath() {
@@ -356,7 +256,7 @@ public abstract class MapDriverBase<K1, 
   public void setMapInputPath(Path mapInputPath) {
     this.mapInputPath = mapInputPath;
   }
-  
+
   /**
    * @param mapInputPath
    *       The Path object which will be given to the mapper
@@ -366,7 +266,7 @@ public abstract class MapDriverBase<K1, 
     setMapInputPath(mapInputPath);
     return thisAsTestDriver();
   }
-  
+
   /**
    * Handle inputKey and inputVal for backwards compatibility.
    */

Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java?rev=1371440&r1=1371439&r2=1371440&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriverBase.java Thu Aug  9 20:26:29 2012
@@ -28,7 +28,6 @@ import java.util.Map.Entry;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.RawComparator;
 import org.apache.hadoop.mapred.JobConf;
@@ -52,7 +51,7 @@ public abstract class MapReduceDriverBas
   public static final Log LOG = LogFactory.getLog(MapReduceDriverBase.class);
 
   protected List<Pair<K1, V1>> inputList = new ArrayList<Pair<K1, V1>>();
-  
+
   protected Path mapInputPath = new Path("somefile");
 
   /** Key group comparator */
@@ -92,38 +91,6 @@ public abstract class MapReduceDriverBas
       addInput(input);
     }
   }
-  
-  /**
-   * Adds output (k, v)* pairs we expect from the Reducer
-   * 
-   * @param outputRecords
-   *          List of (k, v) pairs to add
-   */
-  public void addAllOutput(final List<Pair<K3, V3>> outputRecords) {
-    for (Pair<K3, V3> output : outputRecords) {
-      addOutput(output);
-    }
-  }
-  
-  /**
-   * Adds an output (k, v) pair we expect from the Reducer
-   * 
-   * @param outputRecord
-   *          The (k, v) pair to add
-   */
-  public void addOutput(final Pair<K3, V3> outputRecord) {
-    addOutput(outputRecord.getFirst(), outputRecord.getSecond());
-  }
-
-  /**
-   * Adds a (k, v) pair we expect as output from the Reducer
-   * 
-   * @param key
-   * @param val
-   */
-  public void addOutput(final K3 key, final V3 val) {
-    expectedOutputs.add(copyPair(key, val));
-  }
 
   /**
    * Expects an input of the form "key \t val" Forces the Mapper input types to
@@ -140,26 +107,11 @@ public abstract class MapReduceDriverBas
     addInput((Pair<K1, V1>) parseTabbedPair(input));
   }
 
-  /**
-   * Expects an input of the form "key \t val" Forces the Reducer output types
-   * to Text.
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  @SuppressWarnings("unchecked")
-  public void addOutputFromString(final String output) {
-    addOutput((Pair<K3, V3>) parseTabbedPair(output));
-  }
-  
   @SuppressWarnings("unchecked")
   private T thisAsMapReduceDriver() {
     return (T) this;
   }
-  
+
   /**
    * Identical to addInput() but returns self for fluent programming style
    * 
@@ -187,31 +139,6 @@ public abstract class MapReduceDriverBas
   }
 
   /**
-   * Works like addOutput(), but returns self for fluent style
-   * 
-   * @param outputRecord
-   * @return this
-   */
-  public T withOutput(
-      final Pair<K3, V3> outputRecord) {
-    addOutput(outputRecord);
-    return thisAsMapReduceDriver();
-  }
-
-  /**
-   * Functions like addOutput() but returns self for fluent programming style
-   * 
-   * @param key
-   * @param val
-   * @return this
-   */
-  public T withOutput(final K3 key,
-      final V3 val) {
-    addOutput(key, val);
-    return thisAsMapReduceDriver();
-  }
-
-  /**
    * Identical to addInputFromString, but with a fluent programming style
    * 
    * @param input
@@ -228,28 +155,6 @@ public abstract class MapReduceDriverBas
   }
 
   /**
-   * Identical to addOutputFromString, but with a fluent programming style
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  public T withOutputFromString(
-      final String output) {
-    addOutputFromString(output);
-    return thisAsMapReduceDriver();
-  }
-
-  public T withOutputCopyingOrInputFormatConfiguration(
-      Configuration configuration) {
-    setOutputCopyingOrInputFormatConfiguration(configuration);
-    return thisAsMapReduceDriver();
-  }
-  
-  /**
    * Identical to addAll() but returns self for fluent programming style
    * 
    * @param inputs
@@ -261,19 +166,7 @@ public abstract class MapReduceDriverBas
     addAll(inputs);
     return thisAsMapReduceDriver();
   }
-  
-  /**
-   * Works like addAllOutput(), but returns self for fluent style
-   * 
-   * @param outputRecords
-   * @return this
-   */
-  public T withAllOutput(
-      final List<Pair<K3, V3>> outputRecords) {
-    addAllOutput(outputRecords);
-    return thisAsMapReduceDriver();
-  }
-  
+
   /**
    * @return the path passed to the mapper InputSplit
    */
@@ -287,7 +180,7 @@ public abstract class MapReduceDriverBas
   public void setMapInputPath(Path mapInputPath) {
     this.mapInputPath = mapInputPath;
   }
-  
+
   /**
    * @param mapInputPath
    *       The Path object which will be given to the mapper
@@ -309,7 +202,7 @@ public abstract class MapReduceDriverBas
       throw new IllegalStateException("No Reducer class was provided");
     }
   }
-  
+
   @Override
   public abstract List<Pair<K3, V3>> run() throws IOException;
 

Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java?rev=1371440&r1=1371439&r2=1371440&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/PipelineMapReduceDriver.java Thu Aug  9 20:26:29 2012
@@ -62,7 +62,7 @@ public class PipelineMapReduceDriver<K1,
   private List<Pair<Mapper, Reducer>> mapReducePipeline;
   private final List<Pair<K1, V1>> inputList;
   private Counters counters;
-  
+
   protected Path mapInputPath = new Path("somefile");
 
   public PipelineMapReduceDriver(final List<Pair<Mapper, Reducer>> pipeline) {
@@ -205,51 +205,6 @@ public class PipelineMapReduceDriver<K1,
   }
 
   /**
-   * Adds an output (k, v) pair we expect from the Reducer
-   * 
-   * @param outputRecord
-   *          The (k, v) pair to add
-   */
-  public void addOutput(final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord.getFirst(), outputRecord.getSecond());
-  }
-
-  /**
-   * Works like addOutput(), but returns self for fluent style
-   * 
-   * @param outputRecord
-   * @return this
-   */
-  public PipelineMapReduceDriver<K1, V1, K2, V2> withOutput(
-      final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord);
-    return this;
-  }
-
-  /**
-   * Adds a (k, v) pair we expect as output from the Reducer
-   * 
-   * @param key
-   * @param val
-   */
-  public void addOutput(final K2 key, final V2 val) {
-    expectedOutputs.add(copyPair(key, val));
-  }
-
-  /**
-   * Functions like addOutput() but returns self for fluent programming style
-   * 
-   * @param key
-   * @param val
-   * @return this
-   */
-  public PipelineMapReduceDriver<K1, V1, K2, V2> withOutput(final K2 key,
-      final V2 val) {
-    addOutput(key, val);
-    return this;
-  }
-
-  /**
    * Expects an input of the form "key \t val" Forces the Mapper input types to
    * Text.
    * 
@@ -281,38 +236,6 @@ public class PipelineMapReduceDriver<K1,
   }
 
   /**
-   * Expects an input of the form "key \t val" Forces the Reducer output types
-   * to Text.
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * 
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  @SuppressWarnings("unchecked")
-  public void addOutputFromString(final String output) {
-    addOutput((Pair<K2, V2>) parseTabbedPair(output));
-  }
-
-  /**
-   * Identical to addOutputFromString, but with a fluent programming style
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  public PipelineMapReduceDriver<K1, V1, K2, V2> withOutputFromString(
-      final String output) {
-    addOutputFromString(output);
-    return this;
-  }
-  
-  /**
    * @return the path passed to the mapper InputSplit
    */
   public Path getMapInputPath() {
@@ -325,7 +248,7 @@ public class PipelineMapReduceDriver<K1,
   public void setMapInputPath(Path mapInputPath) {
     this.mapInputPath = mapInputPath;
   }
-  
+
   /**
    * @param mapInputPath
    *       The Path object which will be given to the mapper

Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java?rev=1371440&r1=1371439&r2=1371440&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java Thu Aug  9 20:26:29 2012
@@ -44,7 +44,7 @@ public abstract class ReduceDriverBase<K
   protected K1 inputKey;
   @Deprecated
   private final List<V1> inputValues;
-  
+
   protected final MockOutputCreator<K2, V2> mockOutputCreator = new MockOutputCreator<K2, V2>();
 
   public ReduceDriverBase() {
@@ -77,7 +77,7 @@ public abstract class ReduceDriverBase<K
     }
     return null;
   }
-  
+
   /**
    * Sets the input key to send to the Reducer
    * 
@@ -145,14 +145,14 @@ public abstract class ReduceDriverBase<K
     clearInput();
     addInput(key, values);
   }
-  
+
   /**
    * Clears the input to be sent to the Reducer
    */
   public void clearInput() {
     inputs.clear();
   }
-  
+
   /**
    * Add input (K, V*) to send to the Reducer
    * 
@@ -170,7 +170,7 @@ public abstract class ReduceDriverBase<K
     inputs.add(new Pair<K1, List<V1>>(copy(key),
         new ValueClassInstanceReuseList<V1>(copyVals, getConfiguration())));
   }
-  
+
   /**
    * Add input (K, V*) to send to the Reducer
    * 
@@ -192,40 +192,6 @@ public abstract class ReduceDriverBase<K
       addInput(input);
     }
   }
-  
-  /**
-   * Adds output (k, v)* pairs we expect from the Reducer
-   * 
-   * @param outputRecords
-   *          The (k, v)* pairs to add
-   */
-  public void addAllOutput(final List<Pair<K2, V2>> outputRecords) {
-    for (Pair<K2, V2> output : outputRecords) {
-      addOutput(output);
-    }
-  }
-  
-  /**
-   * Adds an output (k, v) pair we expect from the Reducer
-   * 
-   * @param outputRecord
-   *          The (k, v) pair to add
-   */
-  public void addOutput(final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord.getFirst(), outputRecord.getSecond());
-  }
-
-  /**
-   * Adds an output (k, v) pair we expect from the Reducer
-   * 
-   * @param key
-   *          The key part of a (k, v) pair to add
-   * @param val
-   *          The val part of a (k, v) pair to add
-   */
-  public void addOutput(final K2 key, final V2 val) {
-    expectedOutputs.add(copyPair(key, val));
-  }
 
   /**
    * Expects an input of the form "key \t val, val, val..." Forces the Reducer
@@ -245,26 +211,11 @@ public abstract class ReduceDriverBase<K
         .toString()));
   }
 
-  /**
-   * Expects an input of the form "key \t val" Forces the Reducer output types
-   * to Text.
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  @SuppressWarnings("unchecked")
-  public void addOutputFromString(final String output) {
-    addOutput((Pair<K2, V2>) parseTabbedPair(output));
-  }
-  
   @SuppressWarnings("unchecked")
   private T thisAsReduceDriver() {
     return (T) this;
   }
-  
+
   /**
    * Identical to setInputKey() but with fluent programming style
    * 
@@ -318,31 +269,6 @@ public abstract class ReduceDriverBase<K
   }
 
   /**
-   * Works like addOutput(), but returns self for fluent style
-   * 
-   * @param outputRecord
-   * @return this
-   */
-  public T withOutput(final Pair<K2, V2> outputRecord) {
-    addOutput(outputRecord);
-    return thisAsReduceDriver();
-  }
-
-  /**
-   * Works like addOutput(), but returns self for fluent style
-   * 
-   * @param key
-   *          The key part of a (k, v) pair to add
-   * @param val
-   *          The val part of a (k, v) pair to add
-   * @return this
-   */
-  public T withOutput(final K2 key, final V2 val) {
-    addOutput(key, val);
-    return thisAsReduceDriver();
-  }
-
-  /**
    * Identical to setInput, but with a fluent programming style
    * 
    * @param input
@@ -358,27 +284,6 @@ public abstract class ReduceDriverBase<K
   }
 
   /**
-   * Identical to addOutput, but with a fluent programming style
-   * 
-   * @param output
-   *          A string of the form "key \t val". Trims any whitespace.
-   * @return this
-   * @deprecated No replacement due to lack of type safety and incompatibility
-   *             with non Text Writables
-   */
-  @Deprecated
-  public T withOutputFromString(final String output) {
-    addOutputFromString(output);
-    return thisAsReduceDriver();
-  }
-
-  public T withOutputCopyingOrInputFormatConfiguration(
-      Configuration configuration) {
-    setOutputCopyingOrInputFormatConfiguration(configuration);
-    return thisAsReduceDriver();
-  }
-  
-  /**
    * Identical to addInput() but returns self for fluent programming style
    * 
    * @param input
@@ -402,19 +307,6 @@ public abstract class ReduceDriverBase<K
   }
 
   /**
-   * Works like addAllOutput(), but returns self for fluent style
-   * 
-   * @param outputRecord
-   * @return this
-   */
-  public T withAllOutput(
-      final List<Pair<K2, V2>> outputRecords) {
-    addAllOutput(outputRecords);
-    return thisAsReduceDriver();
-  }
-  
-
-  /**
    * Handle inputKey and inputValues for backwards compatibility.
    */
   protected void preRunChecks(Object reducer) {

Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java?rev=1371440&r1=1371439&r2=1371440&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java Thu Aug  9 20:26:29 2012
@@ -66,6 +66,100 @@ public abstract class TestDriver<K1, V1,
   }
 
   /**
+   * Adds output (k, v)* pairs we expect
+   * 
+   * @param outputRecords
+   *          The (k, v)* pairs to add
+   */
+  public void addAllOutput(final List<Pair<K2, V2>> outputRecords) {
+    for (Pair<K2, V2> output : outputRecords) {
+      addOutput(output);
+    }
+  }
+
+  /**
+   * Functions like addAllOutput() but returns self for fluent programming style
+   * 
+   * @param outputRecords
+   * @return this
+   */
+  public T withAllOutput(
+      final List<Pair<K2, V2>> outputRecords) {
+    addAllOutput(outputRecords);
+    return thisAsTestDriver();
+  }
+
+  /**
+   * Adds an output (k, v) pair we expect
+   * 
+   * @param outputRecord
+   *          The (k, v) pair to add
+   */
+  public void addOutput(final Pair<K2, V2> outputRecord) {
+    addOutput(outputRecord.getFirst(), outputRecord.getSecond());
+  }
+
+  /**
+   * Adds a (k, v) pair we expect as output
+   * @param key the key
+   * @param val the value
+   */
+  public void addOutput(final K2 key, final V2 val) {
+    expectedOutputs.add(copyPair(key, val));
+  }
+
+  /**
+   * Works like addOutput(), but returns self for fluent style
+   * 
+   * @param outputRecord
+   * @return this
+   */
+  public T withOutput(final Pair<K2, V2> outputRecord) {
+    addOutput(outputRecord);
+    return thisAsTestDriver();
+  }
+
+  /**
+   * Works like addOutput() but returns self for fluent programming style
+   * 
+   * @return this
+   */
+  public T withOutput(final K2 key, final V2 val) {
+    addOutput(key, val);
+    return thisAsTestDriver();
+  }
+
+  /**
+   * Expects an input of the form "key \t val" Forces the output types to
+   * Text.
+   * 
+   * @param output
+   *          A string of the form "key \t val". Trims any whitespace.
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
+   */
+  @Deprecated
+  @SuppressWarnings("unchecked")
+  public void addOutputFromString(final String output) {
+    addOutput((Pair<K2, V2>) parseTabbedPair(output));
+  }
+
+  /**
+   * Identical to addOutputFromString, but with a fluent programming style
+   * 
+   * @param output
+   *          A string of the form "key \t val". Trims any whitespace.
+   * @return this
+   * @deprecated No replacement due to lack of type safety and incompatibility
+   *             with non Text Writables
+   */
+  @Deprecated
+  public T withOutputFromString(final String output) {
+    addOutputFromString(output);
+    return thisAsTestDriver();
+  }
+
+  /**
    * @return the list of (k, v) pairs expected as output from this driver
    */
   public List<Pair<K2, V2>> getExpectedOutputs() {
@@ -190,6 +284,12 @@ public abstract class TestDriver<K1, V1,
     this.outputCopyingOrInputFormatConf = returnNonNull(configuration);
   }
 
+  public T withOutputCopyingOrInputFormatConfiguration(
+      Configuration configuration) {
+    setOutputCopyingOrInputFormatConfiguration(configuration);
+    return thisAsTestDriver();
+  }
+
   /**
    * Adds a file to be put on the distributed cache. 
    * The path may be relative and will try to be resolved from