|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.mrunit.TestDriver<K1,V1,K2,V2,T>
org.apache.hadoop.mrunit.MapDriverBase<K1,V1,K2,V2,T>
public abstract class MapDriverBase<K1,V1,K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>>
Harness that allows you to test a Mapper instance. You provide the input (k, v)* pairs that should be sent to the Mapper, and outputs you expect to be sent by the Mapper to the collector for those inputs. By calling runTest(), the harness will deliver the input to the Mapper and will check its outputs against the expected results.
Field Summary | |
---|---|
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
|
Fields inherited from class org.apache.hadoop.mrunit.TestDriver |
---|
counterWrapper, expectedEnumCounters, expectedOutputs, expectedStringCounters |
Constructor Summary | |
---|---|
MapDriverBase()
|
Method Summary | |
---|---|
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() ,
#addInput() , and #addAll() |
void |
setInputValue(V1 val)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v)*. Replaced by #setInput() ,
#addInput() , and #addAll() |
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)
Identical to setInput() but returns self for 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() and
#withAll() |
T |
withInputValue(V1 val)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v)*. Replaced by #withInput() and
#withAll() |
T |
withMapInputPath(org.apache.hadoop.fs.Path mapInputPath)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
protected List<Pair<K1,V1>> inputs
protected org.apache.hadoop.fs.Path mapInputPath
@Deprecated protected K1 inputKey
@Deprecated protected V1 inputVal
protected final org.apache.hadoop.mrunit.internal.output.MockOutputCreator<K2,V2> mockOutputCreator
Constructor Detail |
---|
public MapDriverBase()
Method Detail |
---|
@Deprecated public void setInputKey(K1 key)
#setInput()
,
#addInput()
, and #addAll()
key
- @Deprecated public K1 getInputKey()
@Deprecated public void setInputValue(V1 val)
#setInput()
,
#addInput()
, and #addAll()
val
- @Deprecated public V1 getInputValue()
public void setInput(K1 key, V1 val)
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()
and
#withAll()
@Deprecated public T withInputValue(V1 val)
#withInput()
and
#withAll()
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 mapper
protected void preRunChecks(Object mapper)
public abstract List<Pair<K2,V2>> run() throws IOException
TestDriver
run
in class TestDriver<K1,V1,K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>>
IOException
protected void printPreTestDebugLog()
TestDriver
printPreTestDebugLog
in class TestDriver<K1,V1,K2,V2,T extends MapDriverBase<K1,V1,K2,V2,T>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |