You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/07 09:23:49 UTC

camel git commit: Added test based on user forum

Repository: camel
Updated Branches:
  refs/heads/master 3b94e9513 -> 43ddb4b8f


Added test based on user forum


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/43ddb4b8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/43ddb4b8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/43ddb4b8

Branch: refs/heads/master
Commit: 43ddb4b8f5cde3eb2fc4a40e509f62bded8b8274
Parents: 3b94e95
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 09:23:40 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 09:23:40 2016 +0100

----------------------------------------------------------------------
 .../component/servlet/ServletRootPathTest.java  | 47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/43ddb4b8/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletRootPathTest.java
----------------------------------------------------------------------
diff --git a/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletRootPathTest.java b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletRootPathTest.java
new file mode 100644
index 0000000..c021594
--- /dev/null
+++ b/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/ServletRootPathTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.servlet;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.servletunit.ServletUnitClient;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class ServletRootPathTest extends ServletCamelRouterTestSupport {
+
+    @Test
+    public void testRootPath() throws Exception {
+        WebRequest req = new GetMethodWebRequest(CONTEXT_URL + "/services/");
+        ServletUnitClient client = newClient();
+        WebResponse response = client.getResponse(req);
+
+        assertEquals("The response message is wrong ", "Bye World", response.getText());
+    }
+    
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("servlet:/")
+                    .setBody().constant("Bye World");
+            }
+        };
+    }
+
+}