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/06 23:34:09 UTC
svn commit: r1370030 - in
/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit: ./ mapreduce/
Author: dbeech
Date: Mon Aug 6 21:34:08 2012
New Revision: 1370030
URL: http://svn.apache.org/viewvc?rev=1370030&view=rev
Log:
MRUNIT-125: reduce duplicate code related to fluent methods with generics. Contributed by Bertrand Dechoux
Modified:
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriver.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriverBase.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriver.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/ReduceDriver.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriverBase.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/TestDriver.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java
mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java
Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriver.java?rev=1370030&r1=1370029&r2=1370030&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapDriver.java Mon Aug 6 21:34:08 2012
@@ -24,7 +24,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.mapred.Counters;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.JobConf;
@@ -107,156 +106,6 @@ public class MapDriver<K1, V1, K2, V2> e
return myMapper;
}
- /**
- * Identical to setInputKey() but with fluent programming style
- *
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v)*. Replaced by {@link #withInput()} and
- * {@link #withAll()}
- */
- @Deprecated
- public MapDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
- setInputKey(key);
- return this;
- }
-
- /**
- * Identical to setInputValue() but with fluent programming style
- *
- * @param val
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v)*. Replaced by {@link #withInput()} and
- * {@link #withAll()}
- */
- @Deprecated
- public MapDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
- setInputValue(val);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withInput(final K1 key, final V1 val) {
- setInput(key, val);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @param inputRecord
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withInput(final Pair<K1, V1> inputRecord) {
- setInput(inputRecord);
- return this;
- }
-
- /**
- * Identical to addAll() but returns self for fluent programming style
- *
- * @param inputRecords
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withAll(final List<Pair<K1, V1>> inputRecords) {
- addAll(inputRecords);
- return this;
- }
-
- /**
- * Works like addOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
- addOutput(outputRecord);
- return this;
- }
-
- /**
- * Functions like addOutput() but returns self for fluent programming style
- *
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
- addOutput(key, val);
- return this;
- }
-
- /**
- * Functions like addAllOutput() but returns self for fluent programming style
- *
- * @param outputRecords
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withAllOutput(
- final List<Pair<K2, V2>> outputRecords) {
- addAllOutput(outputRecords);
- return this;
- }
-
- /**
- * Identical to setInputFromString, but with a fluent programming style
- *
- * @param input
- * 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 MapDriver<K1, V1, K2, V2> withInputFromString(final String input) {
- setInputFromString(input);
- return this;
- }
-
- /**
- * 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 MapDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
- addOutputFromString(output);
- return this;
- }
-
- @Override
- public MapDriver<K1, V1, K2, V2> withCounter(final Enum<?> e,
- final long expectedValue) {
- super.withCounter(e, expectedValue);
- return this;
- }
-
- @Override
- public MapDriver<K1, V1, K2, V2> withCounter(final String g, final String n,
- final long expectedValue) {
- super.withCounter(g, n, expectedValue);
- return this;
- }
-
- @Override
- public MapDriver<K1, V1, K2, V2> withStrictCounterChecking() {
- super.withStrictCounterChecking();
- return this;
- }
-
- public MapDriver<K1, V1, K2, V2> withOutputCopyingOrInputFormatConfiguration(
- Configuration configuration) {
- setOutputCopyingOrInputFormatConfiguration(configuration);
- return this;
- }
-
@SuppressWarnings("rawtypes")
public MapDriver<K1, V1, K2, V2> withOutputFormat(
final Class<? extends OutputFormat> outputFormatClass,
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=1370030&r1=1370029&r2=1370030&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 Mon Aug 6 21:34:08 2012
@@ -24,7 +24,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;
import org.apache.hadoop.mrunit.types.Pair;
@@ -216,6 +215,9 @@ public abstract class MapDriverBase<K1,
* Identical to setInputKey() but with fluent programming style
*
* @return this
+ * @deprecated MRUNIT-64. Moved to list implementation to support multiple
+ * input (k, v)*. Replaced by {@link #withInput()} and
+ * {@link #withAll()}
*/
public T withInputKey(final K1 key) {
setInputKey(key);
@@ -227,6 +229,9 @@ public abstract class MapDriverBase<K1,
*
* @param val
* @return this
+ * @deprecated MRUNIT-64. Moved to list implementation to support multiple
+ * input (k, v)*. Replaced by {@link #withInput()} and
+ * {@link #withAll()}
*/
public T withInputValue(final V1 val) {
setInputValue(val);
@@ -333,28 +338,7 @@ public abstract class MapDriverBase<K1,
addAllOutput(outputRecords);
return thisAsMapDriver();
}
-
- /**
- * @param configuration
- * The configuration object that will given to the mapper associated
- * with the driver
- * @return this object for fluent coding
- */
- public T withConfiguration(
- final Configuration configuration) {
- setConfiguration(configuration);
- return thisAsMapDriver();
- }
- /**
- * @param mapInputPath
- * The Path object which will be given to the mapper
- * @return
- */
- public T withMapInputPath(Path mapInputPath) {
- setMapInputPath(mapInputPath);
- return thisAsMapDriver();
- }
-
+
/**
* Handle inputKey and inputVal for backwards compatibility.
*/
Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriver.java?rev=1370030&r1=1370029&r2=1370030&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/MapReduceDriver.java Mon Aug 6 21:34:08 2012
@@ -25,7 +25,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.io.RawComparator;
import org.apache.hadoop.mapred.Counters;
import org.apache.hadoop.mapred.InputFormat;
@@ -188,120 +187,6 @@ public class MapReduceDriver<K1, V1, K2,
return myCombiner;
}
- /**
- * Identical to addInput() but returns self for fluent programming style
- *
- * @param key
- * @param val
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInput(final K1 key,
- final V1 val) {
- addInput(key, val);
- return this;
- }
-
- /**
- * Identical to addInput() but returns self for fluent programming style
- *
- * @param input
- * The (k, v) pair to add
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withInput(
- final Pair<K1, V1> input) {
- addInput(input);
- return this;
- }
-
- /**
- * Identical to addAll() but returns self for fluent programming style
- *
- * @param inputs
- * List of (k, v) pairs to add
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withAll(
- final List<Pair<K1, V1>> inputs) {
- addAll(inputs);
- return this;
- }
-
- /**
- * Works like addAllOutput(), but returns self for fluent style
- *
- * @param outputRecords
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withAllOutput(
- final List<Pair<K3, V3>> outputRecords) {
- addAllOutput(outputRecords);
- return this;
- }
-
- /**
- * Works like addOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutput(
- final Pair<K3, V3> outputRecord) {
- addOutput(outputRecord);
- return this;
- }
-
- /**
- * Functions like addOutput() but returns self for fluent programming style
- *
- * @param key
- * @param val
- * @return this
- */
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutput(final K3 key,
- final V3 val) {
- addOutput(key, val);
- return this;
- }
-
- /**
- * Identical to addInputFromString, but with a fluent programming style
- *
- * @param input
- * 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 MapReduceDriver<K1, V1, K2, V2, K3, V3> withInputFromString(
- final String input) {
- addInputFromString(input);
- return this;
- }
-
- /**
- * 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 MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutputFromString(
- final String output) {
- addOutputFromString(output);
- return this;
- }
-
- public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutputCopyingOrInputFormatConfiguration(
- Configuration configuration) {
- setOutputCopyingOrInputFormatConfiguration(configuration);
- return this;
- }
-
@SuppressWarnings("rawtypes")
public MapReduceDriver<K1, V1, K2, V2, K3, V3> withOutputFormat(
final Class<? extends OutputFormat> outputFormatClass,
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=1370030&r1=1370029&r2=1370030&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 Mon Aug 6 21:34:08 2012
@@ -29,7 +29,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;
import org.apache.hadoop.mapreduce.Job;
@@ -271,28 +270,6 @@ public abstract class MapReduceDriverBas
addAllOutput(outputRecords);
return thisAsMapReduceDriver();
}
-
- /**
- * @param configuration
- * The configuration object that will given to the mapper and reducer
- * associated with the driver
- * @return this driver object for fluent coding
- */
- public T withConfiguration(
- final Configuration configuration) {
- setConfiguration(configuration);
- return thisAsMapReduceDriver();
- }
-
- /**
- * @param mapInputPath
- * The Path object which will be given to the mapper
- * @return
- */
- public T withMapInputPath(Path mapInputPath) {
- setMapInputPath(mapInputPath);
- return thisAsMapReduceDriver();
- }
protected void preRunChecks(Object mapper, Object reducer) {
if (inputList.isEmpty()) {
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=1370030&r1=1370029&r2=1370030&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 Mon Aug 6 21:34:08 2012
@@ -25,7 +25,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.mapred.Counters;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.Reducer;
@@ -349,18 +348,6 @@ public class PipelineMapReduceDriver<K1,
}
/**
- * @param configuration
- * The configuration object that will given to the mappers and
- * reducers associated with the driver
- * @return this driver object for fluent coding
- */
- public PipelineMapReduceDriver<K1, V1, K2, V2> withConfiguration(
- final Configuration configuration) {
- setConfiguration(configuration);
- return this;
- }
-
- /**
* Returns a new PipelineMapReduceDriver without having to specify the generic
* types on the right hand side of the object create statement.
*
Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriver.java?rev=1370030&r1=1370029&r2=1370030&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/ReduceDriver.java Mon Aug 6 21:34:08 2012
@@ -24,7 +24,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.mapred.Counters;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.JobConf;
@@ -110,177 +109,6 @@ public class ReduceDriver<K1, V1, K2, V2
return myReducer;
}
- /**
- * Identical to setInputKey() but with fluent programming style
- *
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
- setInputKey(key);
- return this;
- }
-
- /**
- * Identical to addInputValue() but with fluent programming style
- *
- * @param val
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
- addInputValue(val);
- return this;
- }
-
- /**
- * Identical to addInputValues() but with fluent programming style
- *
- * @param values
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputValues(final List<V1> values) {
- addInputValues(values);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withInput(final K1 key,
- final List<V1> values) {
- setInput(key, values);
- return this;
- }
-
- /**
- * Identical to addInput() but returns self for fluent programming style
- *
- * @param input
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withInput(final Pair<K1, List<V1>> input) {
- addInput(input);
- return this;
- }
-
- /**
- * Identical to addAll() but returns self for fluent programming style
- *
- * @param inputs
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withAll(
- final List<Pair<K1, List<V1>>> inputs) {
- addAll(inputs);
- return this;
- }
-
- /**
- * Works like addOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
- addOutput(outputRecord);
- return this;
- }
-
- /**
- * 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 ReduceDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
- addOutput(key, val);
- return this;
- }
-
- /**
- * Works like addAllOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withAllOutput(
- final List<Pair<K2, V2>> outputRecords) {
- addAllOutput(outputRecords);
- return this;
- }
-
- /**
- * Identical to setInput, but with a fluent programming style
- *
- * @param input
- * 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 ReduceDriver<K1, V1, K2, V2> withInputFromString(final String input) {
- setInputFromString(input);
- return this;
- }
-
- /**
- * 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 ReduceDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
- addOutputFromString(output);
- return this;
- }
-
- @Override
- public ReduceDriver<K1, V1, K2, V2> withCounter(final Enum<?> e,
- final long expectedValue) {
- super.withCounter(e, expectedValue);
- return this;
- }
-
- @Override
- public ReduceDriver<K1, V1, K2, V2> withCounter(final String g,
- final String n, final long e) {
- super.withCounter(g, n, e);
- return this;
- }
-
- @Override
- public ReduceDriver<K1, V1, K2, V2> withStrictCounterChecking() {
- super.withStrictCounterChecking();
- return this;
- }
-
- public ReduceDriver<K1, V1, K2, V2> withOutputCopyingOrInputFormatConfiguration(
- Configuration configuration) {
- setOutputCopyingOrInputFormatConfiguration(configuration);
- return this;
- }
-
@SuppressWarnings("rawtypes")
public ReduceDriver<K1, V1, K2, V2> withOutputFormat(
final Class<? extends OutputFormat> outputFormatClass,
@@ -317,18 +145,6 @@ public class ReduceDriver<K1, V1, K2, V2
}
/**
- * @param configuration
- * The configuration object that will given to the reducer associated
- * with the driver
- * @return this object for fluent coding
- */
- public ReduceDriver<K1, V1, K2, V2> withConfiguration(
- final Configuration configuration) {
- setConfiguration(configuration);
- return this;
- }
-
- /**
* Returns a new ReduceDriver without having to specify the generic types on
* the right hand side of the object create statement.
*
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=1370030&r1=1370029&r2=1370030&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 Mon Aug 6 21:34:08 2012
@@ -269,6 +269,9 @@ public abstract class ReduceDriverBase<K
* Identical to setInputKey() but with fluent programming style
*
* @return this
+ * @deprecated MRUNIT-64. Moved to list implementation to support multiple
+ * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
+ * {@link #withAll(List)}, and {@link #withInput(Pair)}
*/
public T withInputKey(final K1 key) {
setInputKey(key);
@@ -280,6 +283,9 @@ public abstract class ReduceDriverBase<K
*
* @param val
* @return this
+ * @deprecated MRUNIT-64. Moved to list implementation to support multiple
+ * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
+ * {@link #withAll(List)}, and {@link #withInput(Pair)}
*/
public T withInputValue(final V1 val) {
addInputValue(val);
@@ -291,6 +297,9 @@ public abstract class ReduceDriverBase<K
*
* @param values
* @return this
+ * @deprecated MRUNIT-64. Moved to list implementation to support multiple
+ * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
+ * {@link #withAll(List)}, and {@link #withInput(Pair)}
*/
public T withInputValues(final List<V1> values) {
addInputValues(values);
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=1370030&r1=1370029&r2=1370030&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 Mon Aug 6 21:34:08 2012
@@ -167,6 +167,18 @@ public abstract class TestDriver<K1, V1,
this.configuration = returnNonNull(configuration);
}
+ /**
+ * @param configuration
+ * The configuration object that will given to the mapper associated
+ * with the driver
+ * @return this object for fluent coding
+ */
+ public T withConfiguration(
+ final Configuration configuration) {
+ setConfiguration(configuration);
+ return thisAsTestDriver();
+ }
+
public Configuration getOutputCopyingOrInputFormatConfiguration() {
return outputCopyingOrInputFormatConf;
}
@@ -182,12 +194,23 @@ public abstract class TestDriver<K1, V1,
public Path getMapInputPath() {
return mapInputPath;
}
+
/**
* @param mapInputPath Path which is to be passed to the mappers InputSplit
*/
public void setMapInputPath(Path mapInputPath) {
this.mapInputPath = mapInputPath;
}
+
+ /**
+ * @param mapInputPath
+ * The Path object which will be given to the mapper
+ * @return
+ */
+ public final T withMapInputPath(Path mapInputPath) {
+ setMapInputPath(mapInputPath);
+ return thisAsTestDriver();
+ }
/**
* Runs the test but returns the result set instead of validating it (ignores
Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java?rev=1370030&r1=1370029&r2=1370030&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/MapDriver.java Mon Aug 6 21:34:08 2012
@@ -25,7 +25,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.mapreduce.Counters;
import org.apache.hadoop.mapreduce.InputFormat;
import org.apache.hadoop.mapreduce.Mapper;
@@ -110,136 +109,6 @@ extends MapDriverBase<K1, V1, K2, V2, Ma
return this;
}
- /**
- * Identical to setInputKey() but with fluent programming style
- *
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v)*. Replaced by {@link #withInput()} and
- * {@link #withAll()}
- */
- @Deprecated
- public MapDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
- setInputKey(key);
- return this;
- }
-
- /**
- * Identical to setInputValue() but with fluent programming style
- *
- * @param val
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v)*. Replaced by {@link #withInput()} and
- * {@link #withAll()}
- */
- @Deprecated
- public MapDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
- setInputValue(val);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withInput(final K1 key, final V1 val) {
- setInput(key, val);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @param inputRecord
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withInput(final Pair<K1, V1> inputRecord) {
- setInput(inputRecord);
- return this;
- }
-
- /**
- * Identical to addAll() but returns self for fluent programming style
- *
- * @param inputRecords
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withAll(final List<Pair<K1, V1>> inputRecords) {
- addAll(inputRecords);
- return this;
- }
-
- /**
- * Works like addOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
- addOutput(outputRecord);
- return this;
- }
-
- /**
- * Functions like addOutput() but returns self for fluent programming style
- *
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
- addOutput(key, val);
- return this;
- }
-
- /**
- * Functions like addAllOutput() but returns self for fluent programming style
- *
- * @param outputRecords
- * @return this
- */
- public MapDriver<K1, V1, K2, V2> withAllOutput(
- final List<Pair<K2, V2>> outputRecords) {
- addAllOutput(outputRecords);
- return this;
- }
-
- /**
- * Identical to setInputFromString, but with a fluent programming style
- *
- * @param input
- * 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 MapDriver<K1, V1, K2, V2> withInputFromString(final String input) {
- setInputFromString(input);
- return this;
- }
-
- /**
- * 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 MapDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
- addOutputFromString(output);
- return this;
- }
-
- public MapDriver<K1, V1, K2, V2> withOutputCopyingOrInputFormatConfiguration(
- Configuration configuration) {
- setOutputCopyingOrInputFormatConfiguration(configuration);
- return this;
- }
-
@SuppressWarnings("rawtypes")
public MapDriver<K1, V1, K2, V2> withOutputFormat(
final Class<? extends OutputFormat> outputFormatClass,
Modified: mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java
URL: http://svn.apache.org/viewvc/mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java?rev=1370030&r1=1370029&r2=1370030&view=diff
==============================================================================
--- mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java (original)
+++ mrunit/trunk/src/main/java/org/apache/hadoop/mrunit/mapreduce/ReduceDriver.java Mon Aug 6 21:34:08 2012
@@ -116,160 +116,6 @@ public class ReduceDriver<K1, V1, K2, V2
return this;
}
- /**
- * Identical to setInputKey() but with fluent programming style
- *
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputKey(final K1 key) {
- setInputKey(key);
- return this;
- }
-
- /**
- * Identical to addInputValue() but with fluent programming style
- *
- * @param val
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputValue(final V1 val) {
- addInputValue(val);
- return this;
- }
-
- /**
- * Identical to addInputValues() but with fluent programming style
- *
- * @param values
- * @return this
- * @deprecated MRUNIT-64. Moved to list implementation to support multiple
- * input (k, v*)*. Replaced by {@link #withInput(Object, List)},
- * {@link #withAll(List)}, and {@link #withInput(Pair)}
- */
- @Deprecated
- public ReduceDriver<K1, V1, K2, V2> withInputValues(final List<V1> values) {
- addInputValues(values);
- return this;
- }
-
- /**
- * Identical to setInput() but returns self for fluent programming style
- *
- * @param key
- * @param values
- *
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withInput(final K1 key,
- final List<V1> values) {
- setInput(key, values);
- return this;
- }
-
- /**
- * Identical to addInput() but returns self for fluent programming style
- *
- * @param input
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withInput(final Pair<K1, List<V1>> input) {
- addInput(input);
- return this;
- }
-
- /**
- * Identical to addAll() but returns self for fluent programming style
- *
- * @param inputs
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withAll(
- final List<Pair<K1, List<V1>>> inputs) {
- addAll(inputs);
- return this;
- }
-
- /**
- * Works like addOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withOutput(final Pair<K2, V2> outputRecord) {
- addOutput(outputRecord);
- return this;
- }
-
- /**
- * 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 ReduceDriver<K1, V1, K2, V2> withOutput(final K2 key, final V2 val) {
- addOutput(key, val);
- return this;
- }
-
- /**
- * Works like addAllOutput(), but returns self for fluent style
- *
- * @param outputRecord
- * @return this
- */
- public ReduceDriver<K1, V1, K2, V2> withAllOutput(
- final List<Pair<K2, V2>> outputRecords) {
- addAllOutput(outputRecords);
- return this;
- }
-
- /**
- * Identical to setInput, but with a fluent programming style
- *
- * @param input
- * 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 ReduceDriver<K1, V1, K2, V2> withInputFromString(final String input) {
- setInputFromString(input);
- return this;
- }
-
- /**
- * 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 ReduceDriver<K1, V1, K2, V2> withOutputFromString(final String output) {
- addOutputFromString(output);
- return this;
- }
-
- public ReduceDriver<K1, V1, K2, V2> withOutputCopyingOrInputFormatConfiguration(
- Configuration configuration) {
- setOutputCopyingOrInputFormatConfiguration(configuration);
- return this;
- }
-
@SuppressWarnings("rawtypes")
public ReduceDriver<K1, V1, K2, V2> withOutputFormat(
final Class<? extends OutputFormat> outputFormatClass,
@@ -296,18 +142,6 @@ public class ReduceDriver<K1, V1, K2, V2
}
/**
- * @param configuration
- * The configuration object that will given to the reducer associated
- * with the driver
- * @return this object for fluent coding
- */
- public ReduceDriver<K1, V1, K2, V2> withConfiguration(
- final Configuration configuration) {
- setConfiguration(configuration);
- return this;
- }
-
- /**
* <p>Obtain Context object for furthering mocking with Mockito.
* For example, causing write() to throw an exception:</p>
*