|
||||||||||
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>
public abstract class TestDriver<K1,V1,K2,V2>
Field Summary | |
---|---|
protected org.apache.hadoop.conf.Configuration |
configuration
|
protected CounterWrapper |
counterWrapper
|
protected List<Pair<Enum,Long>> |
expectedEnumCounters
|
protected List<Pair<K2,V2>> |
expectedOutputs
|
protected List<Pair<Pair<String,String>,Long>> |
expectedStringCounters
|
static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
TestDriver()
|
Method Summary | |
---|---|
protected static void |
formatValueList(List<?> values,
StringBuilder sb)
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
|
List<Pair<Enum,Long>> |
getExpectedEnumCounters()
|
List<Pair<K2,V2>> |
getExpectedOutputs()
|
List<Pair<Pair<String,String>,Long>> |
getExpectedStringCounters()
|
protected static List<org.apache.hadoop.io.Text> |
parseCommaDelimitedList(String commaDelimList)
Split "val,val,val,val..." into a List of Text(val) objects. |
static Pair<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text> |
parseTabbedPair(String tabSeparatedPair)
Split "key \t val" into Pair(Text(key), Text(val)) |
void |
resetExpectedCounters()
Clears the list of expected counters from this driver |
void |
resetOutput()
Clears the list of outputs expected from this driver |
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 |
runTest()
Runs the test and validates the results |
abstract void |
runTest(boolean orderMatters)
Runs the test and validates the results |
void |
setConfiguration(org.apache.hadoop.conf.Configuration configuration)
|
protected void |
validate(CounterWrapper counterWrapper)
Check that passed counter do contain all expected counters with proper values. |
protected void |
validate(List<Pair<K2,V2>> outputs,
boolean orderMatters)
check the outputs against the expected inputs in record |
TestDriver<K1,V1,K2,V2> |
withCounter(Enum e,
long expectedValue)
Register expected enumeration based counter value |
TestDriver<K1,V1,K2,V2> |
withCounter(String group,
String name,
long expectedValue)
Register expected name based counter value |
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<K2,V2>> expectedOutputs
protected List<Pair<Enum,Long>> expectedEnumCounters
protected List<Pair<Pair<String,String>,Long>> expectedStringCounters
protected org.apache.hadoop.conf.Configuration configuration
protected CounterWrapper counterWrapper
Constructor Detail |
---|
public TestDriver()
Method Detail |
---|
public List<Pair<K2,V2>> getExpectedOutputs()
public void resetOutput()
public List<Pair<Enum,Long>> getExpectedEnumCounters()
public List<Pair<Pair<String,String>,Long>> getExpectedStringCounters()
public void resetExpectedCounters()
public TestDriver<K1,V1,K2,V2> withCounter(Enum e, long expectedValue)
e
- Enumeration based counterexpectedValue
- Expected value
public TestDriver<K1,V1,K2,V2> withCounter(String group, String name, long expectedValue)
group
- Counter groupname
- Counter nameexpectedValue
- Expected value
public abstract List<Pair<K2,V2>> run() throws IOException
IOException
public void runTest()
public abstract void runTest(boolean orderMatters)
orderMatters
- Whether or not output ordering is importantpublic static Pair<org.apache.hadoop.io.Text,org.apache.hadoop.io.Text> parseTabbedPair(String tabSeparatedPair)
tabSeparatedPair
-
protected static List<org.apache.hadoop.io.Text> parseCommaDelimitedList(String commaDelimList)
commaDelimList
- A list of values separated by commasprotected void validate(List<Pair<K2,V2>> outputs, boolean orderMatters)
outputs
- The actual output (k, v) pairsorderMatters
- Whether or not output ordering is important when validating test
resultprotected void validate(CounterWrapper counterWrapper)
counterWrapper
- protected static void formatValueList(List<?> values, StringBuilder sb)
public org.apache.hadoop.conf.Configuration getConfiguration()
public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
configuration
- The configuration object that will given to the mapper and/or
reducer associated with the driver (new API only)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |