Repository: camel Updated Branches: refs/heads/master 2a0a9e665 -> 9cbd7c3c9
CAMEL-11414: Added unit test Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9cbd7c3c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9cbd7c3c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9cbd7c3c Branch: refs/heads/master Commit: 9cbd7c3c94a4e8b510bdae785a235587db0b95fc Parents: 2a0a9e6 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Jun 23 15:51:17 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Jun 23 15:51:17 2017 +0200 ---------------------------------------------------------------------- .../restlet/RestRestletNoPathParameterTest.java | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9cbd7c3c/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletNoPathParameterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletNoPathParameterTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletNoPathParameterTest.java new file mode 100644 index 0000000..056677a --- /dev/null +++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletNoPathParameterTest.java @@ -0,0 +1,56 @@ +/** + * 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.restlet; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.junit.Test; + +/** + * @version + */ +public class RestRestletNoPathParameterTest extends RestletTestSupport { + + @Test + public void testRestletProducerGet() throws Exception { + String out = template.requestBody("http://localhost:" + portNum + "/users/info", null, String.class); + assertEquals("There are many users", out); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + // configure to use restlet on localhost with the given port + restConfiguration().component("restlet").host("localhost").port(portNum); + + // use the rest DSL to define the rest services + rest("/users/") + .get("/info") + .route() + .to("mock:input") + .process(new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getOut().setBody("There are many users"); + } + }); + } + }; + } +}