@Test public void testBeforeProducerFromModel() throws Exception { customizer.customize(getComponent(), new HashMap<>()); Exchange inbound = new DefaultExchange(createCamelContext()); GoogleChart model = new GoogleChart(); model.setSpreadsheetId(getSpreadsheetId()); model.setTitle("SyndesisChart"); model.setSubtitle("Some subtitle"); model.setSourceSheetId(0); model.setSheetId(1); model.setOverlayPosition("D2"); GoogleChart.BasicChart basicChart = new GoogleChart.BasicChart(); basicChart.setAxisTitleBottom("Product Names"); basicChart.setAxisTitleLeft("Sales Numbers"); basicChart.setDomainRange("A1:A10"); basicChart.setDataRange("B1:B10"); model.setBasicChart(basicChart); inbound.getIn().setBody(model); getComponent().getBeforeProducer().process(inbound); Assert.assertNotNull(inbound.getIn().getHeader(GoogleSheetsStreamConstants.SPREADSHEET_ID)); Assert.assertEquals(model.getSpreadsheetId(), inbound.getIn().getHeader(GoogleSheetsStreamConstants.SPREADSHEET_ID)); BatchUpdateSpreadsheetRequest batchUpdateRequest = (BatchUpdateSpreadsheetRequest) inbound.getIn().getHeader(GoogleSheetsConstants.PROPERTY_PREFIX + "batchUpdateSpreadsheetRequest"); Assert.assertEquals(1, batchUpdateRequest.getRequests().size()); AddChartRequest addChartRequest = batchUpdateRequest.getRequests().get(0).getAddChart(); EmbeddedChart chart = addChartRequest.getChart(); Assert.assertEquals("SyndesisChart", chart.getSpec().getTitle()); Assert.assertEquals("Some subtitle", chart.getSpec().getSubtitle()); Assert.assertEquals(Integer.valueOf(1), chart.getPosition().getOverlayPosition().getAnchorCell().getSheetId()); Assert.assertEquals(Integer.valueOf(1), chart.getPosition().getOverlayPosition().getAnchorCell().getRowIndex()); Assert.assertEquals(Integer.valueOf(3), chart.getPosition().getOverlayPosition().getAnchorCell().getColumnIndex()); BasicChartSpec chartSpec = chart.getSpec().getBasicChart(); Assert.assertNotNull(chartSpec); Assert.assertEquals(2, chartSpec.getAxis().size()); Assert.assertEquals("Product Names", chartSpec.getAxis().get(0).getTitle()); Assert.assertEquals("BOTTOM_AXIS", chartSpec.getAxis().get(0).getPosition()); Assert.assertEquals("Sales Numbers", chartSpec.getAxis().get(1).getTitle()); Assert.assertEquals("LEFT_AXIS", chartSpec.getAxis().get(1).getPosition()); Assert.assertEquals(1, chartSpec.getDomains().size()); Assert.assertEquals(1, chartSpec.getDomains().get(0).getDomain().getSourceRange().getSources().size()); Assert.assertEquals(Integer.valueOf(0), chartSpec.getDomains().get(0).getDomain().getSourceRange().getSources().get(0).getStartRowIndex()); Assert.assertEquals(Integer.valueOf(10), chartSpec.getDomains().get(0).getDomain().getSourceRange().getSources().get(0).getEndRowIndex()); Assert.assertEquals(Integer.valueOf(0), chartSpec.getDomains().get(0).getDomain().getSourceRange().getSources().get(0).getStartColumnIndex()); Assert.assertEquals(Integer.valueOf(1), chartSpec.getDomains().get(0).getDomain().getSourceRange().getSources().get(0).getEndColumnIndex()); Assert.assertEquals(1, chartSpec.getSeries().size()); Assert.assertEquals("LEFT_AXIS", chartSpec.getSeries().get(0).getTargetAxis()); BasicChartSeries basicChartSeries = chartSpec.getSeries().get(0); Assert.assertEquals(1, basicChartSeries.getSeries().getSourceRange().getSources().size()); GridRange gridRange = basicChartSeries.getSeries().getSourceRange().getSources().get(0); Assert.assertEquals(Integer.valueOf(0), gridRange.getStartRowIndex()); Assert.assertEquals(Integer.valueOf(10), gridRange.getEndRowIndex()); Assert.assertEquals(Integer.valueOf(1), gridRange.getStartColumnIndex()); Assert.assertEquals(Integer.valueOf(2), gridRange.getEndColumnIndex()); }
@Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }
GoogleSheetsAddChartCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); } }
GoogleSheetsAddChartCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); }  }
GoogleSheetsAddChartCustomizer 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); }
GoogleSheetsAddChartCustomizer 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);  }