Author: davsclaus
Date: Mon Jun 27 11:11:39 2011
New Revision: 1140109
URL: http://svn.apache.org/viewvc?rev=1140109&view=rev
Log:
CAMEL-3284: Added unit test
Added:
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletTwoEndpointsTest.java
- copied, changed from r1140104,
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetResponseCodeTest.java
Copied:
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletTwoEndpointsTest.java
(from r1140104,
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetResponseCodeTest.java)
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletTwoEndpointsTest.java?p2=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletTwoEndpointsTest.java&p1=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetResponseCodeTest.java&r1=1140104&r2=1140109&rev=1140109&view=diff
==============================================================================
---
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletProducerGetResponseCodeTest.java
(original)
+++
camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletTwoEndpointsTest.java
Mon Jun 27 11:11:39 2011
@@ -24,7 +24,7 @@ import org.junit.Test;
/**
* @version
*/
-public class RestletProducerGetResponseCodeTest extends RestletTestSupport {
+public class RestletTwoEndpointsTest extends RestletTestSupport {
@Test
public void testRestletProducerGet() throws Exception {
@@ -32,6 +32,12 @@ public class RestletProducerGetResponseC
assertEquals("123;Donald Duck", out);
}
+ @Test
+ public void testRestletProducerGetMore() throws Exception {
+ String out = template.requestBodyAndHeader("direct:more", null, "id",
123, String.class);
+ assertEquals("123;Donald Duck;Disney", out);
+ }
+
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@@ -53,6 +59,23 @@ public class RestletProducerGetResponseC
exchange.getOut().setBody(id + ";Donald Duck");
}
});
+
+ from("direct:more")
+ .to("restlet:http://localhost:" + portNum +
"/users/123/more")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws
Exception {
+ assertEquals(200,
exchange.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE));
+ assertEquals("text/plain",
exchange.getIn().getHeader(Exchange.CONTENT_TYPE));
+ }
+ });
+
+ from("restlet:http://localhost:" + portNum +
"/users/{id}/more")
+ .process(new Processor() {
+ public void process(Exchange exchange) throws
Exception {
+ String id = exchange.getIn().getHeader("id",
String.class);
+ exchange.getOut().setBody(id + ";Donald
Duck;Disney");
+ }
+ });
}
};
}