mrunit-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Bernico <mike.bern...@gmail.com>
Subject Help testing a reducer with MRUnit 1.0.0 Hadoop2
Date Wed, 24 Jul 2013 22:25:59 GMT
Hi Everyone,

I'm experiencing some odd behavior, that's likely my fault, with MRUnit.
 Would someone mind taking a look?   It seems like no matter what I do the
reducer test harness is just echoing back whatever I send to the reducer.
I made a really simple/dumb recreate of the issue here.

Many thanks in advance...


*import* java.io.IOException;
*import* org.apache.hadoop.mapreduce.Reducer;
*import* org.apache.hadoop.io.IntWritable;

*public* *class* TestReducer
                *extends*
                Reducer<IntWritable, IntWritable, IntWritable, IntWritable>
{

        *public* *void* Reduce(IntWritable key,
                        Iterable<IntWritable> values, Context context)
                        *throws* IOException, InterruptedException {

                *int* *i*;
                *for* (IntWritable value : values) {
                        i = value.get();
                }
                context.write(*new* IntWritable(7), *new* IntWritable(11));

        }
}

*import* java.io.IOException;
*import* java.util.ArrayList;
*import* java.util.List;

*import* org.apache.hadoop.io.IntWritable;
*import* org.apache.hadoop.mrunit.mapreduce.ReduceDriver;
*import* org.junit.Test;



*public* *class* TestReducerTest {

        @Test
        *public* *void* testReducer()
                        *throws* IOException, InterruptedException {

                List<IntWritable> theList = *new* ArrayList <IntWritable>();
                theList.add(*new* IntWritable(5));

                *new*
 ReduceDriver<IntWritable,IntWritable,IntWritable,IntWritable>()
                        .withReducer(*new* TestReducer())
                        .withInput(*new* IntWritable(1), theList)
                        .withOutput(*new* IntWritable(7), *new*
 IntWritable(11))
                        .runTest();

        }

}

13/07/24 17:16:13 ERROR mrunit.TestDriver: Missing expected output (7, 11)
at position 0.
13/07/24 17:16:13 ERROR mrunit.TestDriver: Received unexpected output (1,
5) at position 0.

Mime
View raw message