You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2016/07/14 05:24:23 UTC
camel git commit: Add JSonArry test case
Repository: camel
Updated Branches:
refs/heads/eventbus 9aafe35f3 -> 9f5ea33c4
Add JSonArry test case
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9f5ea33c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9f5ea33c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9f5ea33c
Branch: refs/heads/eventbus
Commit: 9f5ea33c4709923f72a830fa708b60f3a43a8dfe
Parents: 9aafe35
Author: Charles Moulliard <cm...@apache.org>
Authored: Thu Jul 14 07:24:14 2016 +0200
Committer: Charles Moulliard <cm...@apache.org>
Committed: Thu Jul 14 07:24:14 2016 +0200
----------------------------------------------------------------------
.../camel/component/vertx/VertxRouteTest.java | 23 ++++++++++++++++++++
1 file changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9f5ea33c/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxRouteTest.java b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxRouteTest.java
index 1a331ab..6688f65 100644
--- a/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxRouteTest.java
+++ b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxRouteTest.java
@@ -18,6 +18,8 @@ package org.apache.camel.component.vertx;
import java.util.List;
+import io.vertx.core.json.JsonArray;
+import io.vertx.core.json.JsonObject;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -35,6 +37,8 @@ public class VertxRouteTest extends VertxBaseTestSupport {
protected MockEndpoint resultEndpoint;
protected String body1 = "{\"id\":1,\"description\":\"Message One\"}";
protected String body2 = "{\"id\":2,\"description\":\"Message Two\"}";
+ protected JsonArray body;
+ protected String result = "[{\"foo\":\"bar\"}]";
@Test
public void testVertxMessages() throws Exception {
@@ -52,6 +56,25 @@ public class VertxRouteTest extends VertxBaseTestSupport {
}
}
+ @Test
+ public void testVertxWithJSonArray() throws Exception {
+ resultEndpoint = context.getEndpoint(resultUri, MockEndpoint.class);
+ resultEndpoint.expectedBodiesReceived(result);
+
+ body = new JsonArray();
+ JsonObject obj = new JsonObject().put("foo", "bar");
+ body.add(obj);
+
+ template.sendBody(startUri, body);
+
+ resultEndpoint.assertIsSatisfied();
+
+ List<Exchange> list = resultEndpoint.getReceivedExchanges();
+ for (Exchange exchange : list) {
+ log.info("Received exchange: " + exchange + " headers: " + exchange.getIn().getHeaders());
+ }
+ }
+
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {