public abstract class MapDriverBase<K1,V1,K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>> extends TestDriver<K2,V2,T>
Modifier and Type | Field and Description |
---|---|
protected K1 |
inputKey
Deprecated.
|
protected List<Pair<K1,V1>> |
inputs |
protected V1 |
inputVal
Deprecated.
|
static org.apache.commons.logging.Log |
LOG |
protected org.apache.hadoop.fs.Path |
mapInputPath |
protected org.apache.hadoop.mrunit.internal.output.MockOutputCreator<K2,V2> |
mockOutputCreator |
counterWrapper, expectedEnumCounters, expectedMultipleOutputs, expectedOutputs, expectedPathOutputs, expectedStringCounters, mos
Constructor and Description |
---|
MapDriverBase() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(List<Pair<K1,V1>> inputs)
Adds list of inputs to send to the mapper
|
void |
addInput(K1 key,
V1 val)
Adds an input to send to the mapper
|
void |
addInput(Pair<K1,V1> input)
Adds an input to send to the mapper
|
void |
clearInput()
Clears the list of inputs to send to the mapper
|
K1 |
getInputKey()
Deprecated.
|
V1 |
getInputValue()
Deprecated.
|
org.apache.hadoop.fs.Path |
getMapInputPath() |
protected void |
preRunChecks(Object mapper)
Handle inputKey and inputVal for backwards compatibility.
|
protected void |
printPreTestDebugLog()
Overridable hook for printing pre-test debug information
|
abstract List<Pair<K2,V2>> |
run()
Runs the test but returns the result set instead of validating it (ignores
any addOutput(), etc calls made before this)
|
void |
setInput(K1 key,
V1 val)
Sets the input to send to the mapper
|
void |
setInput(Pair<K1,V1> inputRecord)
Sets the input to send to the mapper
|
void |
setInputFromString(String input)
Deprecated.
No replacement due to lack of type safety and incompatibility
with non Text Writables
|
void |
setInputKey(K1 key)
Deprecated.
MRUNIT-64. Moved to list implementation to support multiple
input (k, v)*. Replaced by
setInput(K1, V1) , addInput(K1, V1)
, and addAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>) |
void |
setInputValue(V1 val)
Deprecated.
MRUNIT-64. Moved to list implementation to support multiple
input (k, v)*. Replaced by
setInput(K1, V1) , addInput(K1, V1)
, and addAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>) |
void |
setMapInputPath(org.apache.hadoop.fs.Path mapInputPath) |
T |
withAll(List<Pair<K1,V1>> inputRecords)
Identical to addAll() but returns self for fluent programming style
|
T |
withInput(K1 key,
V1 val)
Similar to setInput() but uses addInput() instead so accumulates values,
and returns the class instance, conforming to the fluent programming style
|
T |
withInput(Pair<K1,V1> inputRecord)
Identical to setInput() but returns self for fluent programming style
|
T |
withInputFromString(String input)
Deprecated.
No replacement due to lack of type safety and incompatibility
with non Text Writables
|
T |
withInputKey(K1 key)
Deprecated.
MRUNIT-64. Moved to list implementation to support multiple
input (k, v)*. Replaced by
withInput(K1, V1) and
withAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>) |
T |
withInputValue(V1 val)
Deprecated.
MRUNIT-64. Moved to list implementation to support multiple
input (k, v)*. Replaced by
withInput(K1, V1) and
withAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>) |
T |
withMapInputPath(org.apache.hadoop.fs.Path mapInputPath) |
addAllOutput, addCacheArchive, addCacheArchive, addCacheFile, addCacheFile, addMultiOutput, addMultiOutput, addOutput, addOutput, addOutputFromString, cleanupDistributedCache, copy, copyPair, driverReused, formatPairList, formatValueList, getConfiguration, getExpectedEnumCounters, getExpectedOutputs, getExpectedStringCounters, getKeyComparator, getOutputSerializationConfiguration, getValueComparator, initDistributedCache, parseCommaDelimitedList, parseTabbedPair, resetExpectedCounters, resetOutput, run, runTest, runTest, setCacheArchives, setCacheFiles, setConfiguration, setKeyComparator, setOutputSerializationConfiguration, setUsedOnceStatus, setValueComparator, thisAsTestDriver, validate, validate, validate, validateOutputList, withAllOutput, withCacheArchive, withCacheArchive, withCacheFile, withCacheFile, withConfiguration, withCounter, withCounter, withMultiOutput, withMultiOutput, withOutput, withOutput, withOutputFromString, withOutputSerializationConfiguration, withPathOutput, withPathOutput, withStrictCounterChecking
public static final org.apache.commons.logging.Log LOG
protected org.apache.hadoop.fs.Path mapInputPath
@Deprecated protected K1 inputKey
@Deprecated protected V1 inputVal
@Deprecated public void setInputKey(K1 key)
setInput(K1, V1)
, addInput(K1, V1)
, and addAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>)
key
- @Deprecated public K1 getInputKey()
@Deprecated public void setInputValue(V1 val)
setInput(K1, V1)
, addInput(K1, V1)
, and addAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>)
val
- @Deprecated public V1 getInputValue()
public void setInput(Pair<K1,V1> inputRecord)
inputRecord
- a (key, val) pairpublic void addInput(K1 key, V1 val)
key
- val
- public void addInput(Pair<K1,V1> input)
input
- a (K, V) pairpublic void addAll(List<Pair<K1,V1>> inputs)
inputs
- list of (K, V) pairspublic void clearInput()
@Deprecated public void setInputFromString(String input)
input
- A string of the form "key \t val".@Deprecated public T withInputKey(K1 key)
withInput(K1, V1)
and
withAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>)
@Deprecated public T withInputValue(V1 val)
withInput(K1, V1)
and
withAll(java.util.List<org.apache.hadoop.mrunit.types.Pair<K1, V1>>)
val
- public T withInput(K1 key, V1 val)
public T withInput(Pair<K1,V1> inputRecord)
inputRecord
- @Deprecated public T withInputFromString(String input)
input
- A string of the form "key \t val". Trims any whitespace.public T withAll(List<Pair<K1,V1>> inputRecords)
inputRecords
- public org.apache.hadoop.fs.Path getMapInputPath()
public void setMapInputPath(org.apache.hadoop.fs.Path mapInputPath)
mapInputPath
- Path which is to be passed to the mappers InputSplitpublic final T withMapInputPath(org.apache.hadoop.fs.Path mapInputPath)
mapInputPath
- The Path object which will be given to the mapperprotected void preRunChecks(Object mapper)
public abstract List<Pair<K2,V2>> run() throws IOException
TestDriver
run
in class TestDriver<K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>>
IOException
protected void printPreTestDebugLog()
TestDriver
printPreTestDebugLog
in class TestDriver<K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>>
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.