Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 60B05EBBC for ; Wed, 23 Jan 2013 21:36:03 +0000 (UTC) Received: (qmail 1449 invoked by uid 500); 23 Jan 2013 21:36:03 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 1280 invoked by uid 500); 23 Jan 2013 21:36:02 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 1270 invoked by uid 99); 23 Jan 2013 21:36:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jan 2013 21:36:02 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of zemin_hu@hotmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Jan 2013 21:35:57 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Ty7yr-0002Mu-1x for users@camel.apache.org; Wed, 23 Jan 2013 13:35:37 -0800 Date: Wed, 23 Jan 2013 13:35:37 -0800 (PST) From: Zemin Hu To: users@camel.apache.org Message-ID: <1358976937052-5726090.post@n5.nabble.com> Subject: HTTP Endpoint construction in CamelSpringTest MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext.xml"); } @Test public void testSimpleRoute() throws Exception { String response = template.requestBodyAndHeader("http://localhost:8080/services/test/simple", "body: Hello World", "MY_HEADER", "my name", String.class); System.err.println(response); } } The Spring XML route: hello world 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 (java.net.ConnectException) 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 used. 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. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Endpoint-construction-in-CamelSpringTest-tp5726090.html Sent from the Camel - Users mailing list archive at Nabble.com.