use of org.apache.camel.component.bean.BeanComponent in project camel by apache.
the class BeanComponentAutoConfiguration method configureBeanComponent.
@Lazy
@Bean(name = "bean-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BeanComponent.class)
public BeanComponent configureBeanComponent(CamelContext camelContext) throws Exception {
BeanComponent component = new BeanComponent();
component.setCamelContext(camelContext);
return component;
}
use of org.apache.camel.component.bean.BeanComponent in project camel by apache.
the class BeanComponentConfigurationAndDocumentationTest method testComponentConfiguration.
@Test
public void testComponentConfiguration() throws Exception {
BeanComponent comp = context.getComponent("bean", BeanComponent.class);
EndpointConfiguration conf = comp.createConfiguration("bean:foo?method=bar");
assertEquals("bar", conf.getParameter("method"));
ComponentConfiguration compConf = comp.createComponentConfiguration();
String json = compConf.createParameterJsonSchema();
assertNotNull(json);
assertTrue(json.contains("\"method\": { \"kind\": \"parameter\", \"displayName\": \"Method\", \"group\": \"producer\", \"type\": \"string\""));
assertTrue(json.contains("\"cache\": { \"kind\": \"parameter\", \"displayName\": \"Cache\", \"group\": \"advanced\", \"label\": \"advanced\", \"type\": \"boolean\""));
}
use of org.apache.camel.component.bean.BeanComponent in project camel by apache.
the class DefaultCamelContextTest method testAutoStartComponentsOn.
public void testAutoStartComponentsOn() throws Exception {
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.disableJMX();
ctx.start();
BeanComponent component = (BeanComponent) ctx.getComponent("bean", true, true);
// should be started
assertTrue(component.getStatus().isStarted());
}
use of org.apache.camel.component.bean.BeanComponent in project camel by apache.
the class DefaultCamelContextTest method testAutoStartComponentsOff.
public void testAutoStartComponentsOff() throws Exception {
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.disableJMX();
ctx.start();
BeanComponent component = (BeanComponent) ctx.getComponent("bean", true, false);
// should be stopped
assertTrue(component.getStatus().isStopped());
}
Aggregations