@Test public void testBeforeProducerFromOptions() throws Exception { Map<String, Object> options = new HashMap<>(); options.put("title", "SyndesisTest"); options.put("timeZone", "America/New_York"); options.put("locale", "en"); 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("create", ConnectorOptions.extractOption(options, "methodName")); 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.assertNull(spreadsheet.getSheets()); }
@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);  }