You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by David MacDonald <da...@cdonald.net.nz> on 2013/10/06 23:49:34 UTC

Testing DSL based on Apache Camel

Hi guys,

I've recently started work on  SOAUnit
<http://uoa-group-applications.github.io/soaunit/>  , a DSL for testing
external (or Camel internal) integration artifacts that uses Apache Camel
components and test framework. Basically our use case is to be able to
automatically 'unit' test mega-vendor enterprise service bus integration
artifacts where we don't have the same flexibility with testing that
something like Camel offers :). For example, if we have a PING web-service
running on the mega-vendor's ESB that simply returns PONG then we can use
the CXF component and Camel URI format:

This will send the requestBody XML to localhost:8080, and check that the XML
returned matches the expectedResponseBody. XML Comparisons are made using
XMLUnit to allow for textual representation variations. Furthermore, the
framework can support asynchronous transports and chaining of expectations
to ensure orchestrated processes function as expected.

I'm interested in getting some feedback as to where it could be improved, or
new features which could be useful. 

Thanks,
David



--
View this message in context: http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Testing DSL based on Apache Camel

Posted by Willem jiang <wi...@gmail.com>.
I think you could add the DSL support for the soap fault message, or some validation of the response code which can tell the difference between the right response or the fault message.

Just my 2 cents.  

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, October 22, 2013 at 1:49 PM, David MacDonald wrote:

> I've received some feedback and refactored it to give an appearance of being
> a Camel-style DSL for testing, i.e.  
>  
>  
> This gets rid of a lot of the bootstrap code there was with JUnit. Any more
> feedback is more than welcome.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992p5742008.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Testing DSL based on Apache Camel

Posted by David MacDonald <da...@cdonald.net.nz>.
I've received some feedback and refactored it to give an appearance of being
a Camel-style DSL for testing, i.e. 


This gets rid of a lot of the bootstrap code there was with JUnit. Any more
feedback is more than welcome.



--
View this message in context: http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992p5742008.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Testing DSL based on Apache Camel

Posted by David MacDonald <da...@cdonald.net.nz>.
Yeah the name can be a bit confusing, especially with regards to unit testing
but it's the closest to a 'unit' that we can achieve with certain service
buses...

You can also test asynchronous services i.e. if we have a message
canonicalizer that takes a target-system message off a JMS destination and
transforms it to a canonical format for broadcast onto another JMS
destination then we can run the following test:





--
View this message in context: http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992p5741019.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Testing DSL based on Apache Camel

Posted by Charles Moulliard <ch...@gmail.com>.
Sorry for my mistake, I din't realize that SOAUnit (should be perhaps
renamed into WebService/REST ...) currently use camel component. So forget
my previous remark.


On Mon, Oct 7, 2013 at 8:41 AM, David MacDonald <da...@cdonald.net.nz>wrote:

> Hi Charles,
>
> I'm not quite sure what you mean; I'm guessing you can set this via the
> standard CXF URI format that Camel follows. E.g.
>
> It might be possible to set WS-Policy like this but I haven't found a way
> yet.
>
> I was hoping to keep the Camel components quite separate to the testing dsl
> so that the versions can change independently of each other.
>
> Cheers,
> David
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992p5741007.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Testing DSL based on Apache Camel

Posted by David MacDonald <da...@cdonald.net.nz>.
Hi Charles,

I'm not quite sure what you mean; I'm guessing you can set this via the
standard CXF URI format that Camel follows. E.g. 

It might be possible to set WS-Policy like this but I haven't found a way
yet.

I was hoping to keep the Camel components quite separate to the testing dsl
so that the versions can change independently of each other.  

Cheers,
David



--
View this message in context: http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992p5741007.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Testing DSL based on Apache Camel

Posted by Charles Moulliard <ch...@gmail.com>.
The approach followed by SOAUnit is excellent. DSL should be nevertheless
improved to allow to set which SOAP, WS-xxx (ws-security, ....) spec will
be used and provide parameters according to the spec / headers


On Sun, Oct 6, 2013 at 11:49 PM, David MacDonald <da...@cdonald.net.nz>wrote:

> Hi guys,
>
> I've recently started work on  SOAUnit
> <http://uoa-group-applications.github.io/soaunit/>  , a DSL for testing
> external (or Camel internal) integration artifacts that uses Apache Camel
> components and test framework. Basically our use case is to be able to
> automatically 'unit' test mega-vendor enterprise service bus integration
> artifacts where we don't have the same flexibility with testing that
> something like Camel offers :). For example, if we have a PING web-service
> running on the mega-vendor's ESB that simply returns PONG then we can use
> the CXF component and Camel URI format:
>
> This will send the requestBody XML to localhost:8080, and check that the
> XML
> returned matches the expectedResponseBody. XML Comparisons are made using
> XMLUnit to allow for textual representation variations. Furthermore, the
> framework can support asynchronous transports and chaining of expectations
> to ensure orchestrated processes function as expected.
>
> I'm interested in getting some feedback as to where it could be improved,
> or
> new features which could be useful.
>
> Thanks,
> David
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Testing-DSL-based-on-Apache-Camel-tp5740992.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io