mrunit-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brock Noland <br...@cloudera.com>
Subject Re: Unable to provide input to MapDriver as file Path (mrunit-1.0.0-hadoop1.jar)
Date Mon, 15 Jul 2013 14:15:12 GMT
Hi,

mapInputPath doesn't actually cause that file to be read. It simply means
that filename is passed to the mapper so it thinks it's processing the
file. You with withInput() or setInput().

Brock


On Mon, Jul 15, 2013 at 8:20 AM, Vineet Mittal
<vineetmittal.iit@gmail.com>wrote:

> Hi,
> I am using MR Unit 1.0.0 hadoop1.
> I am trying to provide a file as input to MapDriver using the API
>
> *MapDriver.setMapInputPath()  *     //which is implemented in
> MapDriverBase.java
>
>
>
> My test code looks like -
>
> *@BeforeClass
>     public void setUp() throws URISyntaxException, IOException {
>         super.setUp();
>         mapDriver.setMapInputPath(new
> Path(this.getClass().getClassLoader().getResource(rollupInPutDatafile).getPath()));
>     }
>
>     @Test
>     public void testMapperRollupFileInputDEVICEFOUND() throws IOException,
> URISyntaxException {
>         mapDriver.runTest();
>     }
> *
>
> Looks like it just sets the path but doesnt read the input file from this
> path.
> When I run the test case using mvn it throws exception . A little stack
> trace pasted below -
>             *  <![CDATA[java.lang.IllegalStateException: No input was
> provided
>         at
> org.apache.hadoop.mrunit.MapDriverBase.preRunChecks(MapDriverBase.java:282)
>         at
> org.apache.hadoop.mrunit.mapreduce.MapDriver.run(MapDriver.java:134)
>         at org.apache.hadoop.mrunit.TestDriver.runTest(TestDriver.java:574)
> *
>
> Please guide me if I am doing some thing wrong in my test case.
>
> Warm Regards,
> Vineet.
>



-- 
Apache MRUnit - Unit testing MapReduce - http://mrunit.apache.org

Mime
View raw message