You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Lukasz Lichota <Lu...@sabre.com> on 2010/02/05 14:35:01 UTC

Testing Camel context in case of war deployment

Hi,

Suppose I have camel context containing cxf endpoints which is to be used
within WAR on tomcat.
In web.xml I have CXFServlet configured plus ContextLoaderListener which
will read the camel context.
Within camel context I have camel cxf endpoint 
<cxfEndpoint id="myEndpoint" address="/MyContext" ../>
and other stuff so I'd like to test the whole context using junit with e.g.
CamelSpringTestSupport (not just the route builder).
What's the best way to test it? I know I could test using embeded
jetty/tomcat and pointing to the exploded war directory but that's testing
the whole war. Is there an easy way to test just the context using e.g.
CamelSpringTestSupport? 

best regards
-- 
View this message in context: http://old.nabble.com/Testing-Camel-context-in-case-of-war-deployment-tp27467820p27467820.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Testing Camel context in case of war deployment

Posted by Willem Jiang <wi...@gmail.com>.
Yes.
If you are using cxfEndpoint tag within Spring Configuration, you just 
need to set the cxfEndpoint's address with a properties variable.

Willem

Lukasz Lichota wrote:
> so you mean I just need to use other url in endpoint configuration e.g.
> through properties so that it can be replaced in the context?
> 
> and the code you refer to is just this? :
> 
>         // We should use the related path to publish the service, when using
> the ServletTransport
>         String cxfEndpointAddress = "cxf:/incident";
>         // Using the full http address for stand alone running
>         if (!usingServletTransport) {
>             cxfEndpointAddress =
> "cxf://http://localhost:9080/camel-example-reportincident/webservices/incident";
>         }
> 
> 
> willem.jiang wrote:
>> Hi,
>>
>> You can take a look at the camel-example-reportinstance[1]
>> It shows a way for how to write the unit test for you case.
>> Basically , it just uses the jetty tranpsort instead of the servlet one 
>> to do the unit test.
>>
>> [1]https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-reportincident
>>
>> Willem
>> Lukasz Lichota wrote:
>>> Hi,
>>>
>>> Suppose I have camel context containing cxf endpoints which is to be used
>>> within WAR on tomcat.
>>> In web.xml I have CXFServlet configured plus ContextLoaderListener which
>>> will read the camel context.
>>> Within camel context I have camel cxf endpoint 
>>> <cxfEndpoint id="myEndpoint" address="/MyContext" ../>
>>> and other stuff so I'd like to test the whole context using junit with
>>> e.g.
>>> CamelSpringTestSupport (not just the route builder).
>>> What's the best way to test it? I know I could test using embeded
>>> jetty/tomcat and pointing to the exploded war directory but that's
>>> testing
>>> the whole war. Is there an easy way to test just the context using e.g.
>>> CamelSpringTestSupport? 
>>>
>>> best regards
>>
>>
> 


Re: Testing Camel context in case of war deployment

Posted by Lukasz Lichota <Lu...@sabre.com>.
so you mean I just need to use other url in endpoint configuration e.g.
through properties so that it can be replaced in the context?

and the code you refer to is just this? :

        // We should use the related path to publish the service, when using
the ServletTransport
        String cxfEndpointAddress = "cxf:/incident";
        // Using the full http address for stand alone running
        if (!usingServletTransport) {
            cxfEndpointAddress =
"cxf://http://localhost:9080/camel-example-reportincident/webservices/incident";
        }


willem.jiang wrote:
> 
> Hi,
> 
> You can take a look at the camel-example-reportinstance[1]
> It shows a way for how to write the unit test for you case.
> Basically , it just uses the jetty tranpsort instead of the servlet one 
> to do the unit test.
> 
> [1]https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-reportincident
> 
> Willem
> Lukasz Lichota wrote:
>> Hi,
>> 
>> Suppose I have camel context containing cxf endpoints which is to be used
>> within WAR on tomcat.
>> In web.xml I have CXFServlet configured plus ContextLoaderListener which
>> will read the camel context.
>> Within camel context I have camel cxf endpoint 
>> <cxfEndpoint id="myEndpoint" address="/MyContext" ../>
>> and other stuff so I'd like to test the whole context using junit with
>> e.g.
>> CamelSpringTestSupport (not just the route builder).
>> What's the best way to test it? I know I could test using embeded
>> jetty/tomcat and pointing to the exploded war directory but that's
>> testing
>> the whole war. Is there an easy way to test just the context using e.g.
>> CamelSpringTestSupport? 
>> 
>> best regards
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Testing-Camel-context-in-case-of-war-deployment-tp27467820p27470006.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Testing Camel context in case of war deployment

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You can take a look at the camel-example-reportinstance[1]
It shows a way for how to write the unit test for you case.
Basically , it just uses the jetty tranpsort instead of the servlet one 
to do the unit test.

[1]https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-reportincident

Willem
Lukasz Lichota wrote:
> Hi,
> 
> Suppose I have camel context containing cxf endpoints which is to be used
> within WAR on tomcat.
> In web.xml I have CXFServlet configured plus ContextLoaderListener which
> will read the camel context.
> Within camel context I have camel cxf endpoint 
> <cxfEndpoint id="myEndpoint" address="/MyContext" ../>
> and other stuff so I'd like to test the whole context using junit with e.g.
> CamelSpringTestSupport (not just the route builder).
> What's the best way to test it? I know I could test using embeded
> jetty/tomcat and pointing to the exploded war directory but that's testing
> the whole war. Is there an easy way to test just the context using e.g.
> CamelSpringTestSupport? 
> 
> best regards