/**
 * Test class for {@linkplain WordCountJobRunner}
 *
 * @author Tom
 */
@RunWith(MockitoJUnitRunner.class)
public class WordCountJobRunnerTest {

  private final MapReduceDriver<LongWritable, Text, Text, IntWritable, Text, IntWritable>
      wordCountMapReduce = MapReduceDriver.newMapReduceDriver();

  @Before
  public void setUp() {
    wordCountMapReduce.withMapper(new WordCountMapper());
    wordCountMapReduce.withReducer(new WordCountReducer());
  }

  @Test
  public void testMapReduce() {
    wordCountMapReduce //
        .withInput(new LongWritable(1), new Text("word1 word2 word2 word1")) //
        .withOutput(buildExpectedOutput(new Text("word1"), new IntWritable(2))) //
        .withOutput(buildExpectedOutput(new Text("word2"), new IntWritable(2))) //
        .runTest();
  }

  @Test
  public void testMapReduceWithCombiner() {
    wordCountMapReduce //
        .withInput(new LongWritable(1), new Text("word1 word2 word2 word1")) //
        .withCombiner(new WordCountReducer()) //
        .withOutput(buildExpectedOutput(new Text("word1"), new IntWritable(2))) //
        .withOutput(buildExpectedOutput(new Text("word2"), new IntWritable(2))) //
        .runTest();
  }
}
 @Before
 public void setUp() throws Exception {
   MyMapper mapper = new MyMapper();
   MyReducer reducer = new MyReducer();
   mapDriver = MapDriver.newMapDriver(mapper);
   reduceDriver = ReduceDriver.newReduceDriver(reducer);
   mapReduceDriver = MapReduceDriver.newMapReduceDriver(mapper, reducer);
 }
Example #3
0
 @Before
 public void setUp() {
   IpMapper mapper = new IpMapper();
   IpReducer reducer = new IpReducer();
   mapDriver = MapDriver.newMapDriver(mapper);
   reduceDriver = ReduceDriver.newReduceDriver(reducer);
   mapReduceDriver = MapReduceDriver.newMapReduceDriver(mapper, reducer);
 }
Example #4
0
  @Before
  public void setUp() throws Exception {
    PymkMapper mapper = new PymkMapper();
    mapDriver = MapDriver.newMapDriver(mapper);

    PymkReducer reducer = new PymkReducer();
    reducerDriver = ReduceDriver.newReduceDriver(reducer);

    mapRedDriver = MapReduceDriver.newMapReduceDriver(mapper, reducer);
  }
 @Before
 public void setUp() {
   WHUidAppListRollingMapper map = new WHUidAppListRollingMapper();
   WHUidAppListRollingReducer reduce = new WHUidAppListRollingReducer();
   mapReduceDriver = MapReduceDriver.newMapReduceDriver(map, reduce);
 }
Example #6
0
 @Before
 public void setUp() {
   WHUidHourMapper map = new WHUidHourMapper();
   WHUidHourReducer reduce = new WHUidHourReducer();
   mapReduceDriver = MapReduceDriver.newMapReduceDriver(map, reduce);
 }
Example #7
0
 @Before
 public void setUp() {
   PaymentStatDayMapper map = new PaymentStatDayMapper();
   PaymentStatDayReducer reduce = new PaymentStatDayReducer();
   mapReduceDriver = MapReduceDriver.newMapReduceDriver(map, reduce);
 }