lundi 9 février 2015

Specify port and hostname with camel-restlet during unit test

I'm currently working on a project that uses camel-restlet. I've defined a route using the spring-dsl similar to the following:



<camel:route id="routeId">
<camel:from
uri="restlet:/rest/url?restletMethod=get"/>
<camel:to uri="direct:url/of/direct"/>
</camel:route>


I wish to create a Unit Test for this route to verify that if a Rest call is made to the /rest/url endpoint, the correct routing is done. Using the CamelSpringTestSupport I've succeeded in setting up the test. Everything seems to work as expected but the test call is made to



GET null://null:80


As you can see, the protocol, host and portnumber are missing in this request. If I use the 'old' way of defining my restlet url, restlet:http://localhost:8080everything works as expected. Since the application uses a Servlet to set the protocol, hostname and port, it is not possible to define it like this, since this would work for testing but not when running the application.


So, to summarize, I want to be able to set the port, hostname and protocol when testing a restlet endpoint created using camel-restlet. If someone could give me a pointer where to look or has an example, that would be great. Google hasn't helped me so far :). Or if you know another way I can test the navigation flow of my route, that would be helpfull as wel.


Thx in advance.


Kind regards


Kwinten


Aucun commentaire:

Enregistrer un commentaire