@Test public void propertiesAreBoundToSourcesConfigurer() { CamelContext context = new DefaultCamelContext(); context.getPropertiesComponent().setInitialProperties(asProperties( "camel.k.sources[0].name", "MyRoutesWithBeans", "camel.k.sources[0].location", "classpath:MyRoutesWithBeans.java", "camel.k.sources[1].name", "MyRoutesConfig", "camel.k.sources[1].location", "classpath:MyRoutesConfig.java", "camel.k.sources[1].property-names[0]", "foo", "camel.k.sources[1].property-names[1]", "bar" )); SourcesConfigurer configuration = new SourcesConfigurer(); PropertiesSupport.bindProperties( context, configuration, k -> k.startsWith(SourcesConfigurer.CAMEL_K_SOURCES_PREFIX), SourcesConfigurer.CAMEL_K_PREFIX); assertThat(configuration.getSources()) .hasSize(2) .anyMatch(byNameAndLocation("MyRoutesWithBeans", "classpath:MyRoutesWithBeans.java") .and(d -> d.getPropertyNames() == null)) .anyMatch(byNameAndLocation("MyRoutesConfig", "classpath:MyRoutesConfig.java") .and(d -> d.getPropertyNames() != null && d.getPropertyNames().containsAll(List.of("foo", "bar")))); }
public static <T> T bindProperties(CamelContext context, T target, String prefix) { return bindProperties(context, target, prefix, false); }
PropertiesSupport { public static <T> T bindProperties(CamelContext context, T target, String prefix) { return bindProperties(context, target, prefix, false); } }
PropertiesSupport { public static <T> T bindProperties(CamelContext context, T target, String prefix) { return bindProperties(context, target, prefix, false); } private  PropertiesSupport(); }
PropertiesSupport { public static <T> T bindProperties(CamelContext context, T target, String prefix) { return bindProperties(context, target, prefix, false); } private  PropertiesSupport(); static T bindProperties(CamelContext context, T target, String prefix); static T bindProperties(CamelContext context, T target, String prefix, boolean stripPrefix); static T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix); static T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix, boolean stripPrefix); static String resolveApplicationPropertiesLocation(); static Properties loadApplicationProperties(); static String resolveUserPropertiesLocation(); static Properties loadUserProperties(); static Properties loadProperties(); static Collection<String> resolveUserPropertiesLocations(); }
PropertiesSupport { public static <T> T bindProperties(CamelContext context, T target, String prefix) { return bindProperties(context, target, prefix, false); } private  PropertiesSupport(); static T bindProperties(CamelContext context, T target, String prefix); static T bindProperties(CamelContext context, T target, String prefix, boolean stripPrefix); static T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix); static T bindProperties(CamelContext context, T target, Predicate<String> filter, String prefix, boolean stripPrefix); static String resolveApplicationPropertiesLocation(); static Properties loadApplicationProperties(); static String resolveUserPropertiesLocation(); static Properties loadUserProperties(); static Properties loadProperties(); static Collection<String> resolveUserPropertiesLocations();  }