Search in sources :

Example 41 with DefaultExchange

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());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 42 with DefaultExchange

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());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 43 with DefaultExchange

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());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) Endpoint(org.apache.camel.Endpoint)

Example 44 with DefaultExchange

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);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 45 with DefaultExchange

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);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) StreamSource(javax.xml.transform.stream.StreamSource) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Aggregations

DefaultExchange (org.apache.camel.impl.DefaultExchange)473 Exchange (org.apache.camel.Exchange)381 Test (org.junit.Test)254 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)127 CamelContext (org.apache.camel.CamelContext)54 RegisteredDelivery (org.jsmpp.bean.RegisteredDelivery)39 HashMap (java.util.HashMap)33 Message (org.apache.camel.Message)32 Before (org.junit.Before)32 Tx (org.nhindirect.common.tx.model.Tx)31 ESMClass (org.jsmpp.bean.ESMClass)30 Processor (org.apache.camel.Processor)22 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)22 Expression (org.apache.camel.Expression)21 File (java.io.File)20 DefaultMessage (org.apache.camel.impl.DefaultMessage)20 ArrayList (java.util.ArrayList)18 ByteArrayInputStream (java.io.ByteArrayInputStream)17 URL (java.net.URL)16 Date (java.util.Date)16