Java 类org.apache.camel.component.mock.MockComponent 实例源码

项目:Camel    文件:RecipientListInterceptSendToEndpointException.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // simulate ftp/http using mocks
            context.addComponent("ftp", new MockComponent());
            context.addComponent("http", new MockComponent());

            interceptSendToEndpoint("(ftp|http):.*")
                .to("log:intercept")
                .to("mock:intercept");

            from("direct:start")
                .recipientList(header("foo")).parallelProcessing()
                .to("mock:end");
        }
    };
}
项目:Camel    文件:ComponentFoundInRegistryTest.java   
@Test
public void testGuice() throws Exception {
    Hashtable<String, Object> env = new Hashtable<String, Object>();
    env.put(Context.PROVIDER_URL, GuiceInitialContextFactory.class.getName());
    env.put(Injectors.MODULE_CLASS_NAMES, MyModule.class.getName());

    InitialContext context = new InitialContext(env);
    Injector injector = (Injector) context.lookup(Injector.class.getName());
    assertNotNull("Found injector", injector);

    Object value = context.lookup("foo");
    assertNotNull("Should have found a value for foo!", value);

    CamelContext camelContext = injector.getInstance(CamelContext.class);
    Component component = camelContext.getComponent("foo");
    assertThat(component, is(MockComponent.class));

    Endpoint endpoint = camelContext.getEndpoint("foo:cheese");
    assertThat(endpoint, is(MockEndpoint.class));
}
项目:Camel    文件:ManagedCustomComponentNameTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            context.addComponent("foo", new MockComponent());

            from("direct:start")
                .to("foo:foo")
                .to("mock:result");
        }
    };
}
项目:Camel    文件:ComponentFoundInRegistryTest.java   
@Provides
@JndiBind("foo")
MockComponent foo() {
    return new MockComponent();
}
项目:switchyard    文件:InboundHandlerTestBase.java   
@Before
public void startUp() {
    _camelContext = new SwitchYardCamelContextImpl(false);
    _camelContext.addComponent("switchyard", new MockComponent());
    _configuration = mock(Configuration.class);
}