[ https://issues.apache.org/jira/browse/MRUNIT-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136246#comment-14136246 ]
Dave Beech commented on MRUNIT-215: ----------------------------------- Hi Ken. The mapInputPath property is used, just not for the purpose you were expecting. It isn't for providing input to the mapper under test (the setInput / addInput / addAll methods do this). Some mappers need to know the path of the input split currently being processed, and setMapInputPath allows you to set this path on the mock split used during the tests. It is used by MockReporter and MockMapContextWrapper when constructing this mock input split. I will admit that the javadoc description of these methods could be clearer so I'll leave the bug open for that reason. > setMapInputPath() doesn't serve any purpose? > -------------------------------------------- > > Key: MRUNIT-215 > URL: https://issues.apache.org/jira/browse/MRUNIT-215 > Project: MRUnit > Issue Type: Bug > Affects Versions: 1.0.0, 1.1.0 > Reporter: Ken Williams > > If I call {{MapDriver.setMapInputPath(...)}} in my test code, it seems to > have no effect, and the specified path doesn't get added to the input for the > mapper. Example: > {code} > import org.apache.hadoop.mrunit.mapreduce.MapDriver; > ... > MapDriver<LongWritable, Text, Text, Text> mapDriver = > MapDriver.newMapDriver(new myMapper()); > mapDriver.setMapInputPath(new Path("my/data/path")); > mapDriver.run(); > java.lang.IllegalStateException: No input was provided > at > org.apache.hadoop.mrunit.MapDriverBase.preRunChecks(MapDriverBase.java:286) > at org.apache.hadoop.mrunit.mapreduce.MapDriver.run(MapDriver.java:142) > at com.myPackage.testIncrementals(MyTest.java:77) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) > at org.junit.runners.ParentRunner.run(ParentRunner.java:300) > at > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) > {code} > This is using MRUnit 1.1.0, but I got the same results with 1.0.0. Looking > in the MRUnit code, it doesn't look like the {{MapDriverBase.mapInputPath}} > member variable actually gets used anywhere. -- This message was sent by Atlassian JIRA (v6.3.4#6332)