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"))));
}
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());
}
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());
}
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());
}
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());
}
Aggregations