Quantcast

Test Case - Quartz to a Custom bean

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Test Case - Quartz to a Custom bean

dgallagher
Hi

My camel route kicks off via quartz and I call a method on a custom bean.
I was trying to mock the custom bean but was running into difficulty.
Could anyone direct me to a sample within the camel code samples that shows how to effectively mock a custom bean?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Test Case - Quartz to a Custom bean

dgallagher
Would it be recommend to use the following section in the url below
http://camel.apache.org/mock.html and section
Mocking endpoints and skip sending to original endpoint

If i mock my custom bean and then call the mock and ignore the original would that be a sufficient use case?
Obviously the bean would then be tested in isolation, similar to what would be done using other mocking frameworks



Thanks
Damien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Test Case - Quartz to a Custom bean

Claus Ibsen-2
On Mon, Jun 25, 2012 at 11:29 PM, dgallagher <[hidden email]> wrote:
> Would it be recommend to use the following section in the url below
> http://camel.apache.org/mock.html and section
> Mocking endpoints and skip sending to original endpoint
>
> If i mock my custom bean and then call the mock and ignore the original
> would that be a sufficient use case?
> Obviously the bean would then be tested in isolation, similar to what would
> be done using other mocking frameworks
>

Yes this is a way to do this.
And from Camel 2.10 onwards its even easier, as you can do this from
the Camel Test Kit without using the advice with.

You may also consider if possible to plugin a different bean, then you
can just have a noop bean to plugin instead of the actual bean.

Or use advice with to modify the route before testing, and replace the
bean part with something else, like sending to a mock
http://camel.apache.org/advicewith.html

And others may use property placeholders, then you can use a different
.properties file for unit testing, that instead of using a bean
endpoint, use a mock endpoint.



>
>
> Thanks
> Damien
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Test-Case-Quartz-to-a-Custom-bean-tp5715085p5715086.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
FuseSource
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Test Case - Quartz to a Custom bean

dgallagher
In reply to this post by dgallagher
Thanks Claus i used the AdbiceWith and it has satisfied my requirements

Thanks
Damien
Loading...