@Test(expected=IOException.class) public void testSetupWithoutInputSchema() throws Exception { Configuration conf = new Configuration(); conf.set(CollapserReducer.RECORD_COLLAPSER, DummyDocumentToProjectCollapser.class.getCanonicalName()); doReturn(conf).when(context).getConfiguration(); reducer.setup(context); }
@SuppressWarnings("unchecked") @Override protected void setup(Context context) throws IOException, InterruptedException { try { recordCollapser = (RecordCollapser<IndexedRecord, IndexedRecord>) getCollapserInstance(context, RECORD_COLLAPSER); recordCollapser.setup(context); String inputSchemaPath = context.getConfiguration().get(INPUT_SCHEMA); inputSchema = AvroUtils.toSchema(inputSchemaPath); inputSchemaClass = (Class<IndexedRecord>) Class.forName(inputSchemaPath); } catch (Exception ex) { throw new IOException("Cannot set up collapser reducer!", ex); } }
CollapserReducer extends Reducer<AvroKey<String>, AvroValue<IndexedRecord>, AvroKey<IndexedRecord>, NullWritable> { @SuppressWarnings("unchecked") @Override protected void setup(Context context) throws IOException, InterruptedException { try { recordCollapser = (RecordCollapser<IndexedRecord, IndexedRecord>) getCollapserInstance(context, RECORD_COLLAPSER); recordCollapser.setup(context); String inputSchemaPath = context.getConfiguration().get(INPUT_SCHEMA); inputSchema = AvroUtils.toSchema(inputSchemaPath); inputSchemaClass = (Class<IndexedRecord>) Class.forName(inputSchemaPath); } catch (Exception ex) { throw new IOException("Cannot set up collapser reducer!", ex); } } }
CollapserReducer extends Reducer<AvroKey<String>, AvroValue<IndexedRecord>, AvroKey<IndexedRecord>, NullWritable> { @SuppressWarnings("unchecked") @Override protected void setup(Context context) throws IOException, InterruptedException { try { recordCollapser = (RecordCollapser<IndexedRecord, IndexedRecord>) getCollapserInstance(context, RECORD_COLLAPSER); recordCollapser.setup(context); String inputSchemaPath = context.getConfiguration().get(INPUT_SCHEMA); inputSchema = AvroUtils.toSchema(inputSchemaPath); inputSchemaClass = (Class<IndexedRecord>) Class.forName(inputSchemaPath); } catch (Exception ex) { throw new IOException("Cannot set up collapser reducer!", ex); } }  }
CollapserReducer extends Reducer<AvroKey<String>, AvroValue<IndexedRecord>, AvroKey<IndexedRecord>, NullWritable> { @SuppressWarnings("unchecked") @Override protected void setup(Context context) throws IOException, InterruptedException { try { recordCollapser = (RecordCollapser<IndexedRecord, IndexedRecord>) getCollapserInstance(context, RECORD_COLLAPSER); recordCollapser.setup(context); String inputSchemaPath = context.getConfiguration().get(INPUT_SCHEMA); inputSchema = AvroUtils.toSchema(inputSchemaPath); inputSchemaClass = (Class<IndexedRecord>) Class.forName(inputSchemaPath); } catch (Exception ex) { throw new IOException("Cannot set up collapser reducer!", ex); } }  @Override void reduce(AvroKey<String> key, Iterable<AvroValue<IndexedRecord>> values, Context context); }
CollapserReducer extends Reducer<AvroKey<String>, AvroValue<IndexedRecord>, AvroKey<IndexedRecord>, NullWritable> { @SuppressWarnings("unchecked") @Override protected void setup(Context context) throws IOException, InterruptedException { try { recordCollapser = (RecordCollapser<IndexedRecord, IndexedRecord>) getCollapserInstance(context, RECORD_COLLAPSER); recordCollapser.setup(context); String inputSchemaPath = context.getConfiguration().get(INPUT_SCHEMA); inputSchema = AvroUtils.toSchema(inputSchemaPath); inputSchemaClass = (Class<IndexedRecord>) Class.forName(inputSchemaPath); } catch (Exception ex) { throw new IOException("Cannot set up collapser reducer!", ex); } }  @Override void reduce(AvroKey<String> key, Iterable<AvroValue<IndexedRecord>> values, Context context); static final String RECORD_COLLAPSER; static final String INPUT_SCHEMA; }