Search in sources :

Example 16 with Method

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();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Method(java.lang.reflect.Method)

Example 17 with Method

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());
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Method(java.lang.reflect.Method)

Example 18 with Method

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();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Method(java.lang.reflect.Method)

Example 19 with Method

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();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Method(java.lang.reflect.Method)

Example 20 with Method

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();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)7234 Test (org.junit.Test)1402 InvocationTargetException (java.lang.reflect.InvocationTargetException)935 ArrayList (java.util.ArrayList)557 Field (java.lang.reflect.Field)498 IOException (java.io.IOException)463 HashMap (java.util.HashMap)279 Map (java.util.Map)232 PropertyDescriptor (java.beans.PropertyDescriptor)230 List (java.util.List)221 Annotation (java.lang.annotation.Annotation)174 Type (java.lang.reflect.Type)174 IndexedPropertyDescriptor (java.beans.IndexedPropertyDescriptor)168 BeanInfo (java.beans.BeanInfo)155 HashSet (java.util.HashSet)147 File (java.io.File)138 SimpleBeanInfo (java.beans.SimpleBeanInfo)128 FakeFox01BeanInfo (org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo)128 URL (java.net.URL)114 ParameterizedType (java.lang.reflect.ParameterizedType)113