camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Burkard <>
Subject Re: Question about using message headers/Exchange properties and route testing
Date Fri, 03 Jan 2014 16:27:36 GMT
Thank you very much Claus, great hints!

I found the ExchangeBuilder in Camel 2.11 and later, so it is not available
in my version, but I have to keep that in mind.

However, I found a CamelTestSupport.createExchangeWithBody() method that
seems to create an Exchange from my body object. Then I could add my
headers and properties and use the send-method that takes an Exchange. Or I
use the send-method that takes a processor as you also suggested.


On Fri, Jan 3, 2014 at 1:40 PM, Henryk Konsek <> wrote:

> > There is also an ExchangeBuilder AFAIR that you may use as well. Then
> > you can use that to create an exchange, to send with the produce
> > template.
> ExchangeBuilder is cool indeed, I forgot about it. :)
> BTW Probably having bean mocking API similar to the one presented
> below would be a nice addition to our testing API. However creating
> such API is not as trivial as it might look like, because of the rich
> bean binding capabilities that it should support.
> @Bean // Spring Java config Example
> MyBean myBean() {
>   return MockBean.createMockBean(MyBean.class).
>     removeHeader("foo"). // this mock will remove given header from
> exchange
>     addProperty("prop"). // add property that couldn't be added before
>     assertHeader("bar").isEqualTo("baz"); // and make some assertions
> }
> from(...).bean("myBean", "myMethod").to(...);
> --
> Henryk Konsek

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message