Examples of Counters


Examples of org.apache.hadoop.mapreduce.Counters

  @Test
  public final void testMapperValidValues() throws IOException,
      InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    Counters counters = new Counters();
    Counter counter = counters
        .findCounter(DedupRecordCounter.TOTAL_RECORDS_READ);
    when(context.getCounter(DedupRecordCounter.TOTAL_RECORDS_READ))
        .thenReturn(counter);
    DedupKeyMapper<Text, String> mapper = new DedupKeyMapper<Text, String>();
    Text key = new Text("abc123");
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

  @Test(expected = IOException.class)
  public final void testMapperForNullKeyValue() throws IOException,
      InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.BAD_RECORD);
    when(context.getCounter(DedupRecordCounter.BAD_RECORD)).thenReturn(
        counter);
    DedupKeyMapper mapper = new DedupKeyMapper();
    String val = "valueOfKey";
    mapper.map(null, val, context);
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

  @Test
  public final void testMapperValidValues() throws IOException,
      InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    Counters counters = new Counters();
    Counter counter = counters
        .findCounter(DedupRecordCounter.TOTAL_RECORDS_READ);
    when(context.getCounter(DedupRecordCounter.TOTAL_RECORDS_READ))
        .thenReturn(counter);
    DedupValueMapper mapper = new DedupValueMapper();
    Text key = new Text("abc123");
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

  @Test(expected = IOException.class)
  public final void testMapperForNullKeyValue() throws IOException,
      InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.BAD_RECORD);
    when(context.getCounter(DedupRecordCounter.BAD_RECORD)).thenReturn(
        counter);
    DedupValueMapper mapper = new DedupValueMapper();
    Text val = new Text("valueOfKey");
    mapper.map(null, val, context);
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

    values.add(value1);
    values.add(value2);
    values.add(value3);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.OUTPUT);
    when(context.getCounter(DedupRecordCounter.OUTPUT)).thenReturn(counter);
    DedupKeyReducer dedupReducer = new DedupKeyReducer();
    dedupReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value1);
    assertEquals(1, context.getCounter(DedupRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

    Text value1 = new Text("value1");
    ArrayList<Text> values = new ArrayList<Text>();
    values.add(value1);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.OUTPUT);
    when(context.getCounter(DedupRecordCounter.OUTPUT)).thenReturn(counter);
    DedupKeyReducer dedupReducer = new DedupKeyReducer();
    dedupReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value1);
    assertEquals(1, context.getCounter(DedupRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

    BytesWritable value1 = new BytesWritable("value1".getBytes());
    ArrayList<BytesWritable> values = new ArrayList<BytesWritable>();
    values.add(value1);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.OUTPUT);
    when(context.getCounter(DedupRecordCounter.OUTPUT)).thenReturn(counter);
    DedupKeyReducer dedupReducer = new DedupKeyReducer();
    dedupReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value1);
    assertEquals(1, context.getCounter(DedupRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

    IntWritable value1 = new IntWritable(456);
    ArrayList<IntWritable> values = new ArrayList<IntWritable>();
    values.add(value1);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.OUTPUT);
    when(context.getCounter(DedupRecordCounter.OUTPUT)).thenReturn(counter);
    DedupKeyReducer dedupReducer = new DedupKeyReducer();
    dedupReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value1);
    assertEquals(1, context.getCounter(DedupRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

    String value1 = null;
    ArrayList<String> values = new ArrayList<String>();
    values.add(value1);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(DedupRecordCounter.OUTPUT);
    when(context.getCounter(DedupRecordCounter.OUTPUT)).thenReturn(counter);
    DedupKeyReducer dedupReducer = new DedupKeyReducer();
    dedupReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value1);
    assertEquals(1, context.getCounter(DedupRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counters

public class TestMergeValueMapper {
  @Test(expected = IOException.class)
  public final void testMapperForNullKeyValue() throws IOException,
      InterruptedException {
    Mapper.Context context = mock(Mapper.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(MergeRecordCounter.BAD_RECORD);
    when(context.getCounter(MergeRecordCounter.BAD_RECORD)).thenReturn(
        counter);
    MergeValueMapper mapper = new MergeValueMapper();
    Text val = new Text("valueOfKey");
    mapper.map(null, val, context);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.