/** * Identical to setInput() but returns self for fluent programming style * * @return this */ public MapDriver<K1, V1, K2, V2> withInput(K1 key, V1 val) { setInput(key, val); return this; }
/** * Identical to setInput() but returns self for fluent programming style * * @param inputRecord * @return this */ public MapDriver<K1, V1, K2, V2> withInput(Pair<K1, V1> inputRecord) { setInput(inputRecord); return this; }
@Test public void shouldNotWriteMetricsByDefault() throws IOException { driver.setInput(new LongWritable(1), record); driver.run(); Multimap<BulkIngestKey,Value> written = TestContextWriter.getWritten(); // two fields mutations + LOAD_DATE + ORIG_FILE + RAW_FILE assertEquals(5, written.size()); for (Map.Entry<BulkIngestKey,Value> entry : written.entries()) { assertEquals(SimpleDataTypeHandler.TABLE, entry.getKey().getTableName()); } }
@Test public void shouldHandleNullRawData() throws IOException { // some RecordReaders may null out raw data entirely because they pass data to their // handlers in other ways. Verify that the EventMapper can handle this case. record.setRawData(null); driver.setInput(new LongWritable(1), record); driver.run(); Multimap<BulkIngestKey,Value> written = TestContextWriter.getWritten(); // two fields mutations + LOAD_DATE + ORIG_FILE + RAW_FILE assertEquals(5, written.size()); }
@Test public void shouldNotWriteRawFile() throws IOException { record.setRawFileName(""); driver.setInput(new LongWritable(1), record); driver.run(); Multimap<BulkIngestKey,Value> written = TestContextWriter.getWritten(); // two fields mutations + LOAD_DATE + ORIG_FILE assertEquals(4, written.size()); }
conf.set(MetricsConfiguration.RECEIVERS_CONFIG, TestEventCountMetricsReceiver.class.getName()); driver.setInput(new LongWritable(1), record); driver.run();