本文整理汇总了Java中org.apache.camel.component.mock.MockComponent类的典型用法代码示例。如果您正苦于以下问题:Java MockComponent类的具体用法?Java MockComponent怎么用?Java MockComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MockComponent类属于org.apache.camel.component.mock包,在下文中一共展示了MockComponent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRouteBuilder
import org.apache.camel.component.mock.MockComponent; //导入依赖的package包/类
@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");
}
};
}
示例2: testGuice
import org.apache.camel.component.mock.MockComponent; //导入依赖的package包/类
@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));
}
示例3: createRouteBuilder
import org.apache.camel.component.mock.MockComponent; //导入依赖的package包/类
@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");
}
};
}
示例4: foo
import org.apache.camel.component.mock.MockComponent; //导入依赖的package包/类
@Provides
@JndiBind("foo")
MockComponent foo() {
return new MockComponent();
}
示例5: startUp
import org.apache.camel.component.mock.MockComponent; //导入依赖的package包/类
@Before
public void startUp() {
_camelContext = new SwitchYardCamelContextImpl(false);
_camelContext.addComponent("switchyard", new MockComponent());
_configuration = mock(Configuration.class);
}