use of java.lang.reflect.Method in project camel by apache.
the class CamelPostProcessorHelperTest method testConsume.
public void testConsume() throws Exception {
CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);
MyConsumeBean my = new MyConsumeBean();
Method method = my.getClass().getMethod("consumeSomething", String.class);
helper.consumerInjection(method, my, "foo");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
}
use of java.lang.reflect.Method in project camel by apache.
the class CamelPostProcessorHelperTest method testConsumeSynchronization.
public void testConsumeSynchronization() throws Exception {
CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);
MyConsumeAndSynchronizationBean my = new MyConsumeAndSynchronizationBean();
Method method = my.getClass().getMethod("consumeSomething", String.class, Exchange.class);
helper.consumerInjection(method, my, "foo");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
// give UoW a bit of time
Thread.sleep(500);
assertTrue("Should have invoked onDone", mySynchronization.isOnDone());
}
use of java.lang.reflect.Method in project camel by apache.
the class CamelPostProcessorHelperConsumePropertyTest method testConsumePropertyOnImplicit.
public void testConsumePropertyOnImplicit() throws Exception {
CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);
MyConsumeBean my = new MyConsumeBean();
my.setFoo("seda:foo");
Method method = my.getClass().getMethod("onFoo", String.class);
helper.consumerInjection(method, my, "foo");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
}
use of java.lang.reflect.Method in project camel by apache.
the class CamelPostProcessorHelperConsumePropertyTest method testConsumePropertyImplicit.
public void testConsumePropertyImplicit() throws Exception {
CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);
MyConsumeBean my = new MyConsumeBean();
my.setFoo("seda:foo");
Method method = my.getClass().getMethod("foo", String.class);
helper.consumerInjection(method, my, "foo");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo", "Hello World");
assertMockEndpointsSatisfied();
}
use of java.lang.reflect.Method in project camel by apache.
the class CamelPostProcessorHelperConsumePropertyTest method testConsumePropertyEndpointImplicit.
public void testConsumePropertyEndpointImplicit() throws Exception {
CamelPostProcessorHelper helper = new CamelPostProcessorHelper(context);
MyConsumeBean my = new MyConsumeBean();
my.setBarEndpoint("seda:bar");
Method method = my.getClass().getMethod("bar", String.class);
helper.consumerInjection(method, my, "bar");
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:bar", "Hello World");
assertMockEndpointsSatisfied();
}
Aggregations