You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by deepaktaker <de...@gmail.com> on 2016/06/08 08:51:26 UTC
How to add Service on before camel route start
Hi,
I have written junits which mocks the endpoints.
but my problem is my code uses a service. so if i start the route i always
get nullpointer exception
because the service is not initialized.
So my question is there a way to mock a service or add a service before a
route starts.
Regards,
Deepak
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-add-Service-on-before-camel-route-start-tp5783616.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to add Service on before camel route start
Posted by souciance <so...@gmail.com>.
What is the service?
On Wed, Jun 8, 2016 at 11:11 AM, Steve973 [via Camel] <
ml-node+s465427n5783617h90@n5.nabble.com> wrote:
> Hi, Deepak. When you say "service", are you referring to a bean that you
> need to reference, by name, within the CamelContext that your route needs
> to invoke a method on? You can bind a bean to the registry of the context
> before you start it. How are you initializing the context for your tests?
> If you can include your setup/initialization code, I can help you with it.
>
> On Wed, Jun 8, 2016 at 4:51 AM, deepaktaker <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5783617&i=0>> wrote:
>
> > Hi,
> > I have written junits which mocks the endpoints.
> > but my problem is my code uses a service. so if i start the route i
> always
> > get nullpointer exception
> > because the service is not initialized.
> > So my question is there a way to mock a service or add a service before
> a
> > route starts.
> >
> > Regards,
> >
> > Deepak
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/How-to-add-Service-on-before-camel-route-start-tp5783616.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/How-to-add-Service-on-before-camel-route-start-tp5783616p5783617.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-add-Service-on-before-camel-route-start-tp5783616p5783622.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to add Service on before camel route start
Posted by Steve973 <st...@gmail.com>.
Hi, Deepak. When you say "service", are you referring to a bean that you
need to reference, by name, within the CamelContext that your route needs
to invoke a method on? You can bind a bean to the registry of the context
before you start it. How are you initializing the context for your tests?
If you can include your setup/initialization code, I can help you with it.
On Wed, Jun 8, 2016 at 4:51 AM, deepaktaker <de...@gmail.com> wrote:
> Hi,
> I have written junits which mocks the endpoints.
> but my problem is my code uses a service. so if i start the route i always
> get nullpointer exception
> because the service is not initialized.
> So my question is there a way to mock a service or add a service before a
> route starts.
>
> Regards,
>
> Deepak
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-add-Service-on-before-camel-route-start-tp5783616.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>