You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "kraythe ." <kr...@gmail.com> on 2013/10/30 17:29:14 UTC

createRegistry() No longer Called in CamelTestSupport, Docs Wrong

In reading this url <http://camel.apache.org/camel-test.html> it says that
we should override createRegistry() in order to bind additional objects
into the registry in a test. unfortunately this doesn't work as the old
startup has been changed in favor of the option to initialize per class or
per method. Now I have to do the following code to get something in the
registry. In my createRouteBuilder method I write:

*final* SimpleRegistry reg = (SimpleRegistry)
((PropertyPlaceholderDelegateRegistry)
getContext().getRegistry()).getRegistry();

reg.put("testdb", dataSource);

The documentation needs to be updated or, better yet, createRegistry needs
to be put back into the loop. If you override it now and put inside a trace
println, it will never get printed.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*

Re: createRegistry() No longer Called in CamelTestSupport, Docs Wrong

Posted by "kraythe ." <kr...@gmail.com>.
Actually this was my mistake. I overrode creation of the camel context in
which I created the registry myself.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Wed, Oct 30, 2013 at 12:13 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> What Camel version do you use from -> to in the upgrade.
>
> What test case do you use. Can you post some code.
> createRegistry is called in the Java CamelTestSupport class which works
> fine.
>
>
> On Wed, Oct 30, 2013 at 5:29 PM, kraythe . <kr...@gmail.com> wrote:
> > In reading this url <http://camel.apache.org/camel-test.html> it says
> that
> > we should override createRegistry() in order to bind additional objects
> > into the registry in a test. unfortunately this doesn't work as the old
> > startup has been changed in favor of the option to initialize per class
> or
> > per method. Now I have to do the following code to get something in the
> > registry. In my createRouteBuilder method I write:
> >
> > *final* SimpleRegistry reg = (SimpleRegistry)
> > ((PropertyPlaceholderDelegateRegistry)
> > getContext().getRegistry()).getRegistry();
> >
> > reg.put("testdb", dataSource);
> >
> > The documentation needs to be updated or, better yet, createRegistry
> needs
> > to be put back into the loop. If you override it now and put inside a
> trace
> > println, it will never get printed.
> >
> > *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> > *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> > *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: createRegistry() No longer Called in CamelTestSupport, Docs Wrong

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What Camel version do you use from -> to in the upgrade.

What test case do you use. Can you post some code.
createRegistry is called in the Java CamelTestSupport class which works fine.


On Wed, Oct 30, 2013 at 5:29 PM, kraythe . <kr...@gmail.com> wrote:
> In reading this url <http://camel.apache.org/camel-test.html> it says that
> we should override createRegistry() in order to bind additional objects
> into the registry in a test. unfortunately this doesn't work as the old
> startup has been changed in favor of the option to initialize per class or
> per method. Now I have to do the following code to get something in the
> registry. In my createRouteBuilder method I write:
>
> *final* SimpleRegistry reg = (SimpleRegistry)
> ((PropertyPlaceholderDelegateRegistry)
> getContext().getRegistry()).getRegistry();
>
> reg.put("testdb", dataSource);
>
> The documentation needs to be updated or, better yet, createRegistry needs
> to be put back into the loop. If you override it now and put inside a trace
> println, it will never get printed.
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen