Search in sources :

Example 76 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange in project camel by apache.

the class BodyAndHeaderConvertTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.setProperty("foo", 1234);
    Message message = exchange.getIn();
    message.setBody("<hello>world!</hello>");
    message.setHeader("bar", 567);
    message.addAttachmentObject("att", new DefaultAttachment(new URLDataSource(new URL("http://camel.apache.org/message.html"))));
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) URLDataSource(javax.activation.URLDataSource) DefaultAttachment(org.apache.camel.impl.DefaultAttachment) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) URL(java.net.URL)

Example 77 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange in project camel by apache.

the class CamelExceptionsTest method testValidationException.

public void testValidationException() {
    Exchange exchange = new DefaultExchange(context);
    ValidationException e = new ValidationException(exchange, "Forced");
    assertNotNull(e.getMessage());
    assertSame(exchange, e.getExchange());
    ValidationException e2 = new ValidationException("Forced", exchange, new IllegalAccessException("Damn"));
    assertNotNull(e2.getMessage());
    assertSame(exchange, e2.getExchange());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 78 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange in project camel by apache.

the class CamelExceptionsTest method testNoSuchHeaderException.

public void testNoSuchHeaderException() {
    Exchange exchange = new DefaultExchange(context);
    NoSuchHeaderException e = new NoSuchHeaderException(exchange, "foo", Integer.class);
    assertEquals(Integer.class, e.getType());
    assertEquals("foo", e.getHeaderName());
    assertSame(exchange, e.getExchange());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 79 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange in project camel by apache.

the class CamelExceptionsTest method testCamelExchangeException.

public void testCamelExchangeException() {
    Exchange exchange = new DefaultExchange(context);
    CamelExchangeException e = new CamelExchangeException("Forced", exchange);
    assertNotNull(e.getMessage());
    assertSame(exchange, e.getExchange());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

Example 80 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange in project camel by apache.

the class CamelExceptionsTest method testCamelExecutionException.

public void testCamelExecutionException() {
    Exchange exchange = new DefaultExchange(context);
    CamelExecutionException e = new CamelExecutionException("Forced", exchange);
    assertNotNull(e.getMessage());
    assertSame(exchange, e.getExchange());
    assertNull(e.getCause());
    CamelExecutionException e2 = new CamelExecutionException("Forced", exchange, new IllegalArgumentException("Damn"));
    assertNotNull(e2.getMessage());
    assertSame(exchange, e2.getExchange());
    assertNotNull(e2.getCause());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange)

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