@Test public void testGetRecordWriter() throws Exception { DBCollection mockCollection = Mockito.mock(DBCollection.class); UserGroupInformation ugi = Mockito.mock(UserGroupInformation.class); PowerMockito.mockStatic(UserGroupInformation.class); Mockito.when(UserGroupInformation.getCurrentUser()).thenReturn(ugi); TaskAttemptContext c = new MockTaskAttemptContext(); Configuration config = c.getConfiguration(); PowerMockito.mockStatic(MongoConfigUtil.class); Mockito.when(MongoConfigUtil.getOutputCollection(config)).thenReturn(mockCollection); MongoAggFormatter f = new MongoAggFormatter(); assertTrue(f.getRecordWriter(new MockTaskAttemptContext()) instanceof MongoAggWriter); }
@Override public RecordWriter<EmittableKey, BSONWritable> getRecordWriter( org.apache.hadoop.mapreduce.TaskAttemptContext context) { Configuration config = context.getConfiguration(); return new MongoAggWriter(MongoConfigUtil.getOutputCollection(config), context); }
MongoAggFormatter extends MongoOutputFormat<EmittableKey, BSONWritable> { @Override public RecordWriter<EmittableKey, BSONWritable> getRecordWriter( org.apache.hadoop.mapreduce.TaskAttemptContext context) { Configuration config = context.getConfiguration(); return new MongoAggWriter(MongoConfigUtil.getOutputCollection(config), context); } }
MongoAggFormatter extends MongoOutputFormat<EmittableKey, BSONWritable> { @Override public RecordWriter<EmittableKey, BSONWritable> getRecordWriter( org.apache.hadoop.mapreduce.TaskAttemptContext context) { Configuration config = context.getConfiguration(); return new MongoAggWriter(MongoConfigUtil.getOutputCollection(config), context); }  }
MongoAggFormatter extends MongoOutputFormat<EmittableKey, BSONWritable> { @Override public RecordWriter<EmittableKey, BSONWritable> getRecordWriter( org.apache.hadoop.mapreduce.TaskAttemptContext context) { Configuration config = context.getConfiguration(); return new MongoAggWriter(MongoConfigUtil.getOutputCollection(config), context); }  @Override RecordWriter<EmittableKey, BSONWritable> getRecordWriter(
        org.apache.hadoop.mapreduce.TaskAttemptContext context); }
MongoAggFormatter extends MongoOutputFormat<EmittableKey, BSONWritable> { @Override public RecordWriter<EmittableKey, BSONWritable> getRecordWriter( org.apache.hadoop.mapreduce.TaskAttemptContext context) { Configuration config = context.getConfiguration(); return new MongoAggWriter(MongoConfigUtil.getOutputCollection(config), context); }  @Override RecordWriter<EmittableKey, BSONWritable> getRecordWriter(
        org.apache.hadoop.mapreduce.TaskAttemptContext context); static final String KEY_FIELD; static final String UPDATE_FIELD; }