camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zemin Hu <>
Subject HTTP Endpoint construction in CamelSpringTest
Date Wed, 23 Jan 2013 21:35:37 GMT
I am trying to use CamelSpringTestSupport to build my unit tests. Most of my
routes are in Spring XML format. Here is my first test case:
public class SimpeRouteTest extends CamelSpringTestSupport {
	protected AbstractXmlApplicationContext createApplicationContext() {
		return new

	public void testSimpleRoute() throws Exception {
		String response =
"body: Hello World", "MY_HEADER", "my name", String.class);

The Spring XML route:
<routeContext id="test-route-simple"
        <from uri="servlet:///test/simple" />
        	<constant>hello world</constant>

I can see the log that route is started during(before) test run:
[                          main] SpringCamelContext             INFO  Route:
route90 started and consuming from: Endpoint[servlet:///test/simple]

if I use "servlet:///test/simple", I got:
You cannot create producer with servlet endpoint, please consider to use
http or http4 endpoint.

if I use "http://localhost:8080/services/test/simple", or
"http://localhost:80/test/simple" or other versions, I got:
I/O exception ( caught when processing request:
Connection refused: connect
I read Testing with Camel in CamelInAction book, it used "file://" which is
working, but there are no samples for "servlet:///" which is most commonly

What's is correct way for the endpoint? How to test "servlet:///" or "http:"
component without having to start routes in a web server?

I am using camel-core 2.9.1, camel-test 2.9.1.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message