@Test public void testExcelInputReader() throws Exception { Map<String, String> sourceProperties = new ImmutableMap.Builder<String, String>() .put(Constants.Reference.REFERENCE_NAME, "TestCase-testExcel") .put("filePath", sourceFolderUri) .put("filePattern", ".*") .put("sheet", "Sheet Name") .put("sheetValue", "Sheet1") .put("memoryTableName", "trackMemoryTable") .put("tableExpiryPeriod", "30") .put("reprocess", "false") .put("columnList", "") .put("columnMapping", "") .put("skipFirstRow", "false") .put("terminateIfEmptyRow", "false") .put("rowsLimit", "") .put("outputSchema", "A:string,B:string,C:String,D:String,E:String,F:String") .put("ifErrorRecord", "Ignore error and continue") .put("errorDatasetName", "") .build(); ETLStage source = new ETLStage("ExcelInputtest", new ETLPlugin("Excel", BatchSource.PLUGIN_TYPE, sourceProperties, null)); String outputDatasetName = "output-testExcel"; ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputDatasetName)); ApplicationManager appManager = deployApp(source, sink, "ExcelTests"); startWorkflow(appManager, ProgramRunStatus.COMPLETED); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Map<String, String> nameIdMap = new HashMap<String, String>(); nameIdMap.put("john", "3.0"); nameIdMap.put("romy", "1.0"); nameIdMap.put("Paulo", "11.0"); nameIdMap.put("Ruskin", "10.0"); nameIdMap.put("Alan", "8.0"); nameIdMap.put("Bill", "13.0"); nameIdMap.put("Ada", "14.0"); nameIdMap.put("kelly", "9.0"); nameIdMap.put("name", "id"); Assert.assertEquals(nameIdMap.get(output.get(0).get("B")), output.get(0).get("A")); Assert.assertEquals(nameIdMap.get(output.get(1).get("B")), output.get(1).get("A")); Assert.assertEquals(nameIdMap.get(output.get(2).get("B")), output.get(2).get("A")); Assert.assertEquals(nameIdMap.get(output.get(3).get("B")), output.get(3).get("A")); Assert.assertEquals("Expected records", 9, output.size()); }
public ExcelInputReader(ExcelInputReaderConfig excelReaderConfig) { this.excelInputreaderConfig = excelReaderConfig; }
ExcelInputReader extends BatchSource<LongWritable, Object, StructuredRecord> { public ExcelInputReader(ExcelInputReaderConfig excelReaderConfig) { this.excelInputreaderConfig = excelReaderConfig; } }
ExcelInputReader extends BatchSource<LongWritable, Object, StructuredRecord> { public ExcelInputReader(ExcelInputReaderConfig excelReaderConfig) { this.excelInputreaderConfig = excelReaderConfig; } ExcelInputReader(ExcelInputReaderConfig excelReaderConfig); }
ExcelInputReader extends BatchSource<LongWritable, Object, StructuredRecord> { public ExcelInputReader(ExcelInputReaderConfig excelReaderConfig) { this.excelInputreaderConfig = excelReaderConfig; } ExcelInputReader(ExcelInputReaderConfig excelReaderConfig); @Override void initialize(BatchRuntimeContext context); @Override void transform(KeyValue<LongWritable, Object> input, Emitter<StructuredRecord> emitter); @Override void configurePipeline(PipelineConfigurer pipelineConfigurer); @Override void prepareRun(BatchSourceContext batchSourceContext); }
ExcelInputReader extends BatchSource<LongWritable, Object, StructuredRecord> { public ExcelInputReader(ExcelInputReaderConfig excelReaderConfig) { this.excelInputreaderConfig = excelReaderConfig; } ExcelInputReader(ExcelInputReaderConfig excelReaderConfig); @Override void initialize(BatchRuntimeContext context); @Override void transform(KeyValue<LongWritable, Object> input, Emitter<StructuredRecord> emitter); @Override void configurePipeline(PipelineConfigurer pipelineConfigurer); @Override void prepareRun(BatchSourceContext batchSourceContext);  }