@Test public void testBeforeProducerFromModel() throws Exception { customizer.customize(getComponent(), new HashMap<>()); Exchange inbound = new DefaultExchange(createCamelContext()); GoogleSpreadsheet model = new GoogleSpreadsheet(); model.setTitle("SyndesisTest"); model.setTimeZone("America/New_York"); model.setLocale("en"); GoogleSheet sheetModel = new GoogleSheet(); sheetModel.setTitle("Sheet1"); sheetModel.setSheetId(1); sheetModel.setIndex(1); model.setSheets(Collections.singletonList(sheetModel)); inbound.getIn().setBody(model); getComponent().getBeforeProducer().process(inbound); Spreadsheet spreadsheet = (Spreadsheet) inbound.getIn().getHeader(GoogleSheetsConstants.PROPERTY_PREFIX + "content"); Assert.assertNull(spreadsheet.getSpreadsheetId()); Assert.assertEquals("SyndesisTest", spreadsheet.getProperties().getTitle()); Assert.assertEquals("America/New_York", spreadsheet.getProperties().getTimeZone()); Assert.assertEquals("en", spreadsheet.getProperties().getLocale()); Assert.assertNotNull(spreadsheet.getSheets()); Assert.assertEquals(1, spreadsheet.getSheets().size()); Assert.assertEquals("Sheet1", spreadsheet.getSheets().get(0).getProperties().getTitle()); }
@Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheetCustomizer::afterProducer); }
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheetCustomizer::afterProducer); } }
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheetCustomizer::afterProducer); }  }
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheetCustomizer::afterProducer); }  @Override void customize(ComponentProxyComponent component, Map<String, Object> options); }
GoogleSheetsCreateSpreadsheetCustomizer implements ComponentProxyCustomizer { @Override public void customize(ComponentProxyComponent component, Map<String, Object> options) { setApiMethod(options); component.setBeforeProducer(this::beforeProducer); component.setAfterProducer(GoogleSheetsCreateSpreadsheetCustomizer::afterProducer); }  @Override void customize(ComponentProxyComponent component, Map<String, Object> options);  }