Java 类org.apache.camel.component.log.LogComponent 实例源码

项目:Camel    文件:MultipleLifecycleStrategyTest.java   
public void testMultipleLifecycleStrategies() throws Exception {
    CamelContext context = createCamelContext();
    context.start();

    Component log = new LogComponent();
    context.addComponent("log", log);
    context.addEndpoint("log:/foo", log.createEndpoint("log://foo"));
    context.removeComponent("log");
    context.stop();

    List<String> expectedEvents = Arrays.asList("onContextStart", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd",
            "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onComponentAdd", "onEndpointAdd", "onComponentRemove", "onContextStop");

    assertEquals(expectedEvents, dummy1.getEvents());
    assertEquals(expectedEvents, dummy2.getEvents());
}
项目:camel-cookbook-examples    文件:SimpleCamelApplication.java   
public static void main(String[] args) throws Exception {
    SimpleRegistry registry = new SimpleRegistry();
    // add POJOs to the registry here using registry.put("name", <object reference>)

    CamelContext context = new DefaultCamelContext(registry);

    context.addComponent("mylogger", new LogComponent());
    context.addRoutes(new LogMessageOnTimerEventRoute());

    context.start();

    // let the Camel runtime do its job for 5 seconds
    Thread.sleep(5000);

    // shutdown
    context.stop();
}
项目:Camel    文件:LogComponentAutoConfiguration.java   
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(LogComponent.class)
public LogComponent configureLogComponent(CamelContext camelContext,
        LogComponentConfiguration configuration) throws Exception {
    LogComponent component = new LogComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), component, parameters);
    return component;
}
项目:Camel    文件:DefaultCamelContextTest.java   
public void testHasComponent() {
    DefaultCamelContext ctx = new DefaultCamelContext();
    ctx.disableJMX();
    assertNull(ctx.hasComponent("log"));

    ctx.addComponent("log", new LogComponent());
    assertNotNull(ctx.hasComponent("log"));
}
项目:Camel    文件:DefaultCamelContextTest.java   
public void testGetComponent() {
    DefaultCamelContext ctx = new DefaultCamelContext();
    ctx.disableJMX();
    ctx.addComponent("log", new LogComponent());

    LogComponent log = ctx.getComponent("log", LogComponent.class);
    assertNotNull(log);
    try {
        ctx.addComponent("direct", new DirectComponent());
        ctx.getComponent("log", DirectComponent.class);
        fail("Should have thrown exception");
    } catch (IllegalArgumentException e) {
        // expected
    }
}
项目:eds    文件:EdsCamelConfig.java   
@Bean(name="log")
LogComponent getLogComponent(){
    return new LogComponent();
}