|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.mrunit.TestDriver<K1,V1,K2,V2,T> org.apache.hadoop.mrunit.ReduceDriverBase<K1,V1,K2,V2,T>
public abstract class ReduceDriverBase<K1,V1,K2,V2,T extends ReduceDriverBase<K1,V1,K2,V2,T>>
Harness that allows you to test a Reducer instance. You provide a key and a set of intermediate values for that key that represent inputs that should be sent to the Reducer (as if they came from a Mapper), and outputs you expect to be sent by the Reducer to the collector. By calling runTest(), the harness will deliver the input to the Reducer and will check its outputs against the expected results.
Nested Class Summary | |
---|---|
protected static class |
ReduceDriverBase.ValueClassInstanceReuseList<T>
|
Field Summary | |
---|---|
protected K1 |
inputKey
Deprecated. |
protected List<Pair<K1,List<V1>>> |
inputs
|
protected org.apache.hadoop.mrunit.internal.output.MockOutputCreator<K2,V2> |
mockOutputCreator
|
Fields inherited from class org.apache.hadoop.mrunit.TestDriver |
---|
counterWrapper, expectedEnumCounters, expectedOutputs, expectedStringCounters, LOG |
Constructor Summary | |
---|---|
ReduceDriverBase()
|
Method Summary | |
---|---|
void |
addAll(List<Pair<K1,List<V1>>> inputs)
Adds input to send to the Reducer |
void |
addInput(K1 key,
List<V1> values)
Add input (K, V*) to send to the Reducer |
void |
addInput(Pair<K1,List<V1>> input)
Add input (K, V*) to send to the Reducer |
void |
addInputValue(V1 val)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by #setInput() ,
#addInput() , and #addAll() |
void |
addInputValues(List<V1> values)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by #setInput() ,
#addInput() , and #addAll() |
void |
clearInput()
Clears the input to be sent to the Reducer |
List<V1> |
getInputValues()
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by getInputValues(Object) |
List<V1> |
getInputValues(K1 key)
Returns a list of values for the given key |
protected void |
preRunChecks(Object reducer)
Handle inputKey and inputValues 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,
List<V1> values)
Sets the input to send to the reducer |
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 |
setInputValues(List<V1> values)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by #setInput() ,
#addInput() , and #addAll() |
T |
withAll(List<Pair<K1,List<V1>>> inputs)
Identical to addAll() but returns self for fluent programming style |
T |
withInput(K1 key,
List<V1> values)
Identical to setInput() but returns self for fluent programming style |
T |
withInput(Pair<K1,List<V1>> input)
Identical to addInput() 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(Object, List) ,
withAll(List) , and withInput(Pair) |
T |
withInputValue(V1 val)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by withInput(Object, List) ,
withAll(List) , and withInput(Pair) |
T |
withInputValues(List<V1> values)
Deprecated. MRUNIT-64. Moved to list implementation to support multiple input (k, v*)*. Replaced by withInput(Object, List) ,
withAll(List) , and withInput(Pair) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<Pair<K1,List<V1>>> inputs
@Deprecated protected K1 inputKey
protected final org.apache.hadoop.mrunit.internal.output.MockOutputCreator<K2,V2> mockOutputCreator
Constructor Detail |
---|
public ReduceDriverBase()
Method Detail |
---|
@Deprecated public List<V1> getInputValues()
getInputValues(Object)
public List<V1> getInputValues(K1 key)
key
-
@Deprecated public void setInputKey(K1 key)
#setInput()
,
#addInput()
, and #addAll()
@Deprecated public void addInputValue(V1 val)
#setInput()
,
#addInput()
, and #addAll()
val
- @Deprecated public void setInputValues(List<V1> values)
#setInput()
,
#addInput()
, and #addAll()
values
- @Deprecated public void addInputValues(List<V1> values)
#setInput()
,
#addInput()
, and #addAll()
values
- public void setInput(K1 key, List<V1> values)
key
- values
- public void clearInput()
public void addInput(K1 key, List<V1> values)
key
- The key too addvalues
- The list of values to addpublic void addInput(Pair<K1,List<V1>> input)
input
- input pairpublic void addAll(List<Pair<K1,List<V1>>> inputs)
inputs
- list of (K, V*) pairs@Deprecated public void setInputFromString(String input)
input
- A string of the form "key \t val,val,val". Trims any whitespace.@Deprecated public T withInputKey(K1 key)
withInput(Object, List)
,
withAll(List)
, and withInput(Pair)
@Deprecated public T withInputValue(V1 val)
withInput(Object, List)
,
withAll(List)
, and withInput(Pair)
val
-
@Deprecated public T withInputValues(List<V1> values)
withInput(Object, List)
,
withAll(List)
, and withInput(Pair)
values
-
public T withInput(K1 key, List<V1> values)
@Deprecated public T withInputFromString(String input)
input
- A string of the form "key \t val". Trims any whitespace.
public T withInput(Pair<K1,List<V1>> input)
input
-
public T withAll(List<Pair<K1,List<V1>>> inputs)
inputs
-
protected void preRunChecks(Object reducer)
public abstract List<Pair<K2,V2>> run() throws IOException
TestDriver
run
in class TestDriver<K1,V1,K2,V2,T extends ReduceDriverBase<K1,V1,K2,V2,T>>
IOException
protected void printPreTestDebugLog()
TestDriver
printPreTestDebugLog
in class TestDriver<K1,V1,K2,V2,T extends ReduceDriverBase<K1,V1,K2,V2,T>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |