Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
0.5.0
-
None
-
None
Description
Some time we need to test reduce/mapreduce which used MultipleOutputs to output,mrunit not support this yet.so, I writed some code support this;
improvement which make mrunit nicer to use:load test dataset from text and some usefull annotation
example:
public void testReduce () {
List<TimeInfo> values = new ArrayList<TimeInfo>();
values.add(new TimeInfo(1, 3));
values.add(new TimeInfo(2, 5));
values.add(new TimeInfo(3, 7));
reduceDriver.withReducer(reducer)
.withInput(new Text("444"), values)
. withMutiOutput ("somePrefix"+444%8,new Text("444"),new LongWritable(2))
.runTest();
}
load test data from text and use annotation:
@RunWith(MRUnitJunit4TestClassRunner.class)
public class XXXMRUseAnnotationTest {
@MapInputSet
@MapReduce(mapper = Map.class, reducer = Reduce.class)
private MapReduceDriver<LongWritable, Text, Text, TimeInfo, Text, LongWritable> mrDriver;
@Test
@MapInputSet("ConsignTimeMRUseAnnotationTest.txt")
public void testMapReduce_3record_1user()
}