camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Testing Restlet endpoints after refactoring to using servlet container
Date Sat, 14 Jul 2012 06:24:31 GMT
Hi

Maybe if its/was possible to setup the host and port on the
RestletComponent, then the endpoint can fallback and use those options
if non specified in the uri. Then for production they can be / to
indicate servlet, and for unit test, you can set it up to a localhost
8080 or whatever.



On Fri, Jul 13, 2012 at 2:50 PM, Magnus Palmér
<magnus.palmer.work@gmail.com> wrote:
> After following the "Using the Restlet servlet within a webapp"
> documentation at http://camel.apache.org/restlet.html I refactored my
> Restlet endpoints by removing protocol, host and port.
> So from "restlet:http://host:port/path/{id}" to "restlet:/path/{id}".
> This works great when running in a servlet container.
>
> However my JUnit tests no longer works since, the reason for this is that
> when using the applicationContext the protocol and host is set to null and
> port is defaulted to 80 in
> the org.apache.camel.component.restlet.RestletComponent.createEndpoint(String
> uri, String remaining, Map parameters).
>
> The only resolution that I know will work is to manipulate the URI by using
> "http://host:port" in test and "" otherwise.
> Any ideas is highly appreciated otherwise I will have to satisfy with
> manipulating the URIs.
> (I am using both the real applicationContext and a test applicationContext
> in my JUnit tests that extends CamelSpringTestSupport, and they have among
> other things a Spring context:property-override definition where I can put
> configuration).
>
> Looking at the JUnit tests in Camel source all routes are configured using
> "restlet:http://host" + portnum + "/path" for the camel-restlet component.
>
>
> Kind regards, Magnus



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message