mrunit-使用mrunit.mapreduce.MapDriver不调用自定义记录读取器

mrunit-使用mrunit.mapreduce.MapDriver不调用自定义记录读取器,mapreduce,mrunit,Mapreduce,Mrunit,我正在修改记录读取器中的MapReduce程序,并希望为mapper编写一个测试用例,以调用定制的InputFormat或记录读取器。我已经为记录阅读器修改了测试用例,但是记录阅读器测试用例不是mrunit 1 如何从Mapper调用自定义记录读取器,因为MapDriver.newMapDriver下未列出InputFormat函数 请查找我的代码的快照: @Before public void setUp(){ MapDriver<Object, Text, Text, Text>

我正在修改记录读取器中的MapReduce程序,并希望为mapper编写一个测试用例,以调用定制的InputFormat或记录读取器。我已经为记录阅读器修改了测试用例,但是记录阅读器测试用例不是mrunit 1

如何从Mapper调用自定义记录读取器,因为MapDriver.newMapDriver下未列出InputFormat函数

请查找我的代码的快照:

@Before
public void setUp(){
MapDriver<Object, Text, Text, Text> mapDriver = MapDriver.newMapDriver(new myMapper());
}

@Test
public void testFunction1() throws IOException {
mapDriver.withInput(...).withOutput(...).runTest();
}
@之前
公共作废设置(){
MapDriver MapDriver=MapDriver.newMapDriver(newmymapper());
}
@试验
public void testFunction1()引发IOException{
mapDriver.withInput(…).withOutput(…).runTest();
}

谢谢

我正在检查
MRUnit
API,所以。如果你想添加一个自定义的
RecordReader
我猜你必须有一个自定义的
InputFormat
,因为你必须将自定义的RecordReader分配到自定义
InputFormat
类的
createRecordReader
方法中

因此,
MRUnit
API允许您使用自定义
OutputFormat
分配自定义
InputFormat

public MapDriver<K1,V1,K2,V2> withOutputFormat(Class<? extends org.apache.hadoop.mapreduce.OutputFormat> outputFormatClass,
                                      Class<? extends org.apache.hadoop.mapreduce.InputFormat> inputFormatClass)

Configure Mapper to output with a real OutputFormat. Set InputFormat to read 
output back in for use with run* methods

Parameters:
outputFormatClass -
inputFormatClass -

Returns:
this for fluent style

withOutputFormat公共映射驱动程序(Classwell,
MRUnit
在其API
withOutputFormat
方法中有。我猜将会有
withInputFormat
。这是一个好问题!!