use of org.apache.camel.impl.DefaultExchange in project camel by apache.
the class BeanHandlerMethodTest method testNoHandleMethod.
public void testNoHandleMethod() throws Exception {
BeanInfo info = new BeanInfo(context, MyNoDummyBean.class);
Exchange exchange = new DefaultExchange(context);
MyNoDummyBean pojo = new MyNoDummyBean();
MethodInvocation mi = info.createInvocation(pojo, exchange);
assertNotNull(mi);
assertEquals("hello", mi.getMethod().getName());
}
use of org.apache.camel.impl.DefaultExchange in project camel by apache.
the class BeanHandlerMethodTest method testHandleAndBodyMethod.
public void testHandleAndBodyMethod() throws Exception {
BeanInfo info = new BeanInfo(context, MyOtherDummyBean.class);
Exchange exchange = new DefaultExchange(context);
MyOtherDummyBean pojo = new MyOtherDummyBean();
MethodInvocation mi = info.createInvocation(pojo, exchange);
assertNotNull(mi);
assertEquals("hello", mi.getMethod().getName());
}
use of org.apache.camel.impl.DefaultExchange in project camel by apache.
the class CollectionProducerTest method testCollectionProducer.
public void testCollectionProducer() throws Exception {
Queue<Exchange> queue = new ArrayBlockingQueue<Exchange>(10);
Endpoint endpoint = context.getEndpoint("seda://foo");
MyProducer my = new MyProducer(endpoint, queue);
my.start();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody("Hello World");
my.process(exchange);
Exchange top = queue.poll();
assertNotNull(top);
assertEquals("Hello World", top.getIn().getBody());
}
use of org.apache.camel.impl.DefaultExchange in project camel by apache.
the class StreamCacheConverterTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
this.exchange = new DefaultExchange(context);
}
use of org.apache.camel.impl.DefaultExchange in project camel by apache.
the class StreamSourceCacheTest method testStreamSourceCache.
public void testStreamSourceCache() throws Exception {
Exchange exchange = new DefaultExchange(context);
StreamSource source = context.getTypeConverter().convertTo(StreamSource.class, "<foo>bar</foo>");
StreamSourceCache cache = new StreamSourceCache(source, exchange);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
cache.writeTo(bos);
String s = context.getTypeConverter().convertTo(String.class, bos);
assertEquals("<foo>bar</foo>", s);
}
Aggregations