org.apache.hadoop.mrunit.mapreduce.mock
Class MockReduceContextWrapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>

java.lang.Object
  extended by org.apache.hadoop.mrunit.mapreduce.mock.MockContextWrapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
      extended by org.apache.hadoop.mrunit.mapreduce.mock.MockReduceContextWrapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>

public class MockReduceContextWrapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>
extends MockContextWrapper<KEYIN,VALUEIN,KEYOUT,VALUEOUT>

o.a.h.mapreduce.Reducer.reduce() expects to use a Reducer.Context object as a parameter. We want to override the functionality of a lot of Context to have it send the results back to us, etc. But since Reducer.Context is an inner class of Reducer, we need to put any subclasses of Reducer.Context in a subclass of Reducer. This wrapper class exists for that purpose.


Field Summary
protected  org.apache.hadoop.mapreduce.Reducer.Context context
           
protected  Pair<KEYIN,List<VALUEIN>> currentKeyValue
           
protected  List<Pair<KEYIN,List<VALUEIN>>> inputs
           
protected static org.apache.commons.logging.Log LOG
           
 
Fields inherited from class org.apache.hadoop.mrunit.mapreduce.mock.MockContextWrapper
conf, counters, outputs
 
Constructor Summary
MockReduceContextWrapper(List<Pair<KEYIN,List<VALUEIN>>> inputs, org.apache.hadoop.mapreduce.Counters counters, org.apache.hadoop.conf.Configuration conf)
           
 
Method Summary
 org.apache.hadoop.mapreduce.Reducer.Context getMockContext()
           
 List<Pair<KEYOUT,VALUEOUT>> getOutputs()
           
protected static
<V> Iterable<V>
makeOneUseIterator(Iterator<V> parent)
           
 
Methods inherited from class org.apache.hadoop.mrunit.mapreduce.mock.MockContextWrapper
createCommon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

inputs

protected final List<Pair<KEYIN,List<VALUEIN>>> inputs

currentKeyValue

protected Pair<KEYIN,List<VALUEIN>> currentKeyValue

context

protected final org.apache.hadoop.mapreduce.Reducer.Context context
Constructor Detail

MockReduceContextWrapper

public MockReduceContextWrapper(List<Pair<KEYIN,List<VALUEIN>>> inputs,
                                org.apache.hadoop.mapreduce.Counters counters,
                                org.apache.hadoop.conf.Configuration conf)
                         throws IOException,
                                InterruptedException
Throws:
IOException
InterruptedException
Method Detail

getOutputs

public List<Pair<KEYOUT,VALUEOUT>> getOutputs()
Returns:
the outputs from the MockOutputCollector back to the test harness.

makeOneUseIterator

protected static <V> Iterable<V> makeOneUseIterator(Iterator<V> parent)

getMockContext

public org.apache.hadoop.mapreduce.Reducer.Context getMockContext()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.