You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Vanshul.Chawla" <Va...@target.com> on 2016/07/05 14:07:44 UTC

Unit test case for XML DSL context and routes

Hello All,

We have some Camel code which is written in XML DSL. We need to add unit test cases for each context(multiple routes) . Could someone please give a lead to how this can be achieved.

Vanshul

Re: Unit test case for XML DSL context and routes

Posted by souciance <so...@gmail.com>.
In the CamelTestSupport you can do like this:

@Override
protected String getBundleFilter() {
// don't want the normal bundle to start as it causes conflict to our test
return "(!(Bundle-SymbolicName=<original_bundlename>))";
}
@Override
protected String getBlueprintDescriptor() {
return "blueprint/fake_blueprint.xml";
}

On Tue, Jul 5, 2016 at 4:14 PM, Vanshul.Chawla [via Camel] <
ml-node+s465427n5784797h70@n5.nabble.com> wrote:

> Hello All,
>
> We have some Camel code which is written in XML DSL. We need to add unit
> test cases for each context(multiple routes) . Could someone please give a
> lead to how this can be achieved.
>
> Vanshul
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Unit-test-case-for-XML-DSL-context-and-routes-tp5784797.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/Unit-test-case-for-XML-DSL-context-and-routes-tp5784797p5784838.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unit test case for XML DSL context and routes

Posted by Tadayoshi Sato <sa...@gmail.com>.
Hi,

Have you checked CamelSpringTestSupport?
http://camel.apache.org/spring-testing.html

You can specify the Camel context XML under test by simply overriding the
createApplicationContext method:

    protected AbstractXmlApplicationContext createApplicationContext() {
        return new
ClassPathXmlApplicationContext("META-INF/spring/your-context.xml");
    }

If you are using Blueprint XML then you can refer
to CamelBlueprintTestSupport.

On Tue, Jul 5, 2016 at 11:23 PM, Vanshul.Chawla <Va...@target.com>
wrote:

> Thanks.
>
> I have seen this link.
>
> I had some doubts. I have camelcontext.xml which gets message from MQ and
> transforms and sends to a webservice, gets a response and then transforms
> and send back to another queue.
> I can mock the end points and can assert based on conditions etc.
>
> How to tell my test case class that I am using which camelcontext.xml? ie
> how to bind test case and xml together?
>
> -----Original Message-----
> From: Steve Huston [mailto:shuston@riverace.com]
> Sent: Tuesday, July 05, 2016 9:17 AM
> To: users@camel.apache.org
> Subject: RE: Unit test case for XML DSL context and routes
>
> http://camel.apache.org/testing.html
>
> > -----Original Message-----
> > From: Vanshul.Chawla [mailto:Vanshul.Chawla@target.com]
> > Sent: Tuesday, July 05, 2016 10:08 AM
> > To: users@camel.apache.org
> > Subject: Unit test case for XML DSL context and routes
> >
> > Hello All,
> >
> > We have some Camel code which is written in XML DSL. We need to add
> > unit test cases for each context(multiple routes) . Could someone
> > please give a lead to how this can be achieved.
> >
> > Vanshul
>
>

RE: Unit test case for XML DSL context and routes

Posted by "Vanshul.Chawla" <Va...@target.com>.
Thanks.

I have seen this link.

I had some doubts. I have camelcontext.xml which gets message from MQ and transforms and sends to a webservice, gets a response and then transforms and send back to another queue.
I can mock the end points and can assert based on conditions etc.

How to tell my test case class that I am using which camelcontext.xml? ie how to bind test case and xml together?

-----Original Message-----
From: Steve Huston [mailto:shuston@riverace.com] 
Sent: Tuesday, July 05, 2016 9:17 AM
To: users@camel.apache.org
Subject: RE: Unit test case for XML DSL context and routes

http://camel.apache.org/testing.html

> -----Original Message-----
> From: Vanshul.Chawla [mailto:Vanshul.Chawla@target.com]
> Sent: Tuesday, July 05, 2016 10:08 AM
> To: users@camel.apache.org
> Subject: Unit test case for XML DSL context and routes
> 
> Hello All,
> 
> We have some Camel code which is written in XML DSL. We need to add 
> unit test cases for each context(multiple routes) . Could someone 
> please give a lead to how this can be achieved.
> 
> Vanshul


RE: Unit test case for XML DSL context and routes

Posted by Steve Huston <sh...@riverace.com>.
http://camel.apache.org/testing.html

> -----Original Message-----
> From: Vanshul.Chawla [mailto:Vanshul.Chawla@target.com]
> Sent: Tuesday, July 05, 2016 10:08 AM
> To: users@camel.apache.org
> Subject: Unit test case for XML DSL context and routes
> 
> Hello All,
> 
> We have some Camel code which is written in XML DSL. We need to add unit
> test cases for each context(multiple routes) . Could someone please give a
> lead to how this can be achieved.
> 
> Vanshul