@Test public void testBeforeProducerFromOptions() throws Exception { Map<String, Object> options = new HashMap<>(); options.put("spreadsheetId", getSpreadsheetId()); customizer.customize(getComponent(), options); Exchange inbound = new DefaultExchange(createCamelContext()); getComponent().getBeforeProducer().process(inbound); Assert.assertEquals(GoogleSheetsApiCollection.getCollection().getApiName(SheetsSpreadsheetsApiMethod.class).getName(), ConnectorOptions.extractOption(options, "apiName")); Assert.assertEquals("batchUpdate", ConnectorOptions.extractOption(options, "methodName")); Assert.assertNotNull(inbound.getIn().getHeader(GoogleSheetsStreamConstants.SPREADSHEET_ID)); Assert.assertEquals(getSpreadsheetId(), inbound.getIn().getHeader(GoogleSheetsStreamConstants.SPREADSHEET_ID)); BatchUpdateSpreadsheetRequest batchUpdateRequest = (BatchUpdateSpreadsheetRequest) inbound.getIn().getHeader(GoogleSheetsConstants.PROPERTY_PREFIX + "batchUpdateSpreadsheetRequest"); Assert.assertEquals(1, batchUpdateRequest.getRequests().size()); UpdateCellsRequest updateCellsRequest = batchUpdateRequest.getRequests().get(0).getUpdateCells(); Assert.assertEquals("pivotTable", updateCellsRequest.getFields()); Assert.assertNotNull(updateCellsRequest.getStart()); Assert.assertEquals(Integer.valueOf(0), updateCellsRequest.getStart().getSheetId()); Assert.assertEquals(Integer.valueOf(0), updateCellsRequest.getStart().getColumnIndex()); Assert.assertEquals(Integer.valueOf(0), updateCellsRequest.getStart().getRowIndex()); PivotTable pivotTable = updateCellsRequest.getRows().get(0).getValues().get(0).getPivotTable(); Assert.assertNotNull(pivotTable); Assert.assertNull(pivotTable.getSource()); Assert.assertNull(pivotTable.getRows()); Assert.assertNull(pivotTable.getColumns()); Assert.assertNull(pivotTable.getValues()); }
@Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }
GoogleSheetsAddPivotTableCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); } }
GoogleSheetsAddPivotTableCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }  }
GoogleSheetsAddPivotTableCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }  @Override void customize(ComponentProxyComponent component, Map<String, Object> options); }
GoogleSheetsAddPivotTableCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }  @Override void customize(ComponentProxyComponent component, Map<String, Object> options);  }