Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Stephan Burkard
Hi Henryk Are you sure? :) Exchange properties are propagated as well as headers. Can you show me an example, where the properties are not propagated down the route? Wow, I just realized that there are producer methods to send a body and a property. I never noticed them before because I

Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Claus Ibsen
Just use the send/request method that takes a processor, and then use an inlined processor to set the headers/properties/body on the exchange in message. 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

Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Henryk Konsek
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

Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Stephan Burkard
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

Re: Question about using message headers/Exchange properties and route testing

2013-12-31 Thread Henryk Konsek
@Henryk: Yes, that works fine for message headers, I use it a lot to pass expected message headers. But it is not possible for Exchange properties. Are you sure? :) Exchange properties are propagated as well as headers. Can you show me an example, where the properties are not propagated down

Question about using message headers/Exchange properties and route testing

2013-12-30 Thread Stephan Burkard
Hi Camel users To process arbitrary logic in my Camel routes, I use simple bean calls. That is fine because I can test all these pieces of logic with standard unit tests. However, often the bean calls produce results that are saved in the message header (if I need to save it for later) or

Re: Question about using message headers/Exchange properties and route testing

2013-12-30 Thread Willem Jiang
Hi, I don’t think you need to use mock framework to mock the bean. You can just write a simple bean which implement the bean’s interface to setup the message headers and exchange properties for you camel route. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog:

Re: Question about using message headers/Exchange properties and route testing

2013-12-30 Thread Henryk Konsek
Hi Stephan, My problem arised in the route tests where I mock away the whole bean. I can mock the method call, but I cannot add entries to the header- or property-maps. So if the header or property entry is expected later in the route, it fails. Keep in mind that in tests you can send

Re: Question about using message headers/Exchange properties and route testing

2013-12-30 Thread Stephan Burkard
@Henryk: Yes, that works fine for message headers, I use it a lot to pass expected message headers. But it is not possible for Exchange properties. @Willem: Yes, that's true. It feels a bit cumbersome, but it works. Based on your answers, I guess there is no fundamental Camel concept I am