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 2013/09/09 17:49:38 UTC
[2/2] git commit: vertx should test with dynamic assigned port number.
vertx should test with dynamic assigned port number.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/424035b7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/424035b7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/424035b7
Branch: refs/heads/camel-2.12.x
Commit: 424035b719c274665a6ced574c1a91785c256efe
Parents: af878df
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Sep 9 17:48:46 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Sep 9 17:49:02 2013 +0200
----------------------------------------------------------------------
.../component/vertx/VertxBaseTestSupport.java | 36 ++++++++++++++++++++
.../camel/component/vertx/VertxRouteTest.java | 10 +++---
2 files changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/424035b7/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxBaseTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxBaseTestSupport.java b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxBaseTestSupport.java
new file mode 100644
index 0000000..c5f3e09
--- /dev/null
+++ b/components/camel-vertx/src/test/java/org/apache/camel/component/vertx/VertxBaseTestSupport.java
@@ -0,0 +1,36 @@
+/**
+ * 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.vertx;
+
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.BeforeClass;
+
+public class VertxBaseTestSupport extends CamelTestSupport {
+
+ protected static int port;
+
+ @BeforeClass
+ public static void initPort() throws Exception {
+ port = AvailablePortFinder.getNextAvailable(24000);
+ }
+
+ protected int getPort() {
+ return port;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/424035b7/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 a509578..1d3485a 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
@@ -21,14 +21,12 @@ import java.util.List;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version
*/
-public class VertxRouteTest extends CamelTestSupport {
- private static final String HEADER_NAME = "TODO";
+public class VertxRouteTest extends VertxBaseTestSupport {
protected String startUri = "vertx:foo.start";
protected String middleUri = "vertx:foo.middle";
@@ -37,11 +35,9 @@ public class VertxRouteTest extends CamelTestSupport {
protected MockEndpoint resultEndpoint;
protected String body1 = "{\"id\":1,\"description\":\"Message One\"}";
protected String body2 = "{\"id\":2,\"description\":\"Message Two\"}";
-
@Test
public void testVertxMessages() throws Exception {
-
resultEndpoint = context.getEndpoint(resultUri, MockEndpoint.class);
resultEndpoint.expectedBodiesReceivedInAnyOrder(body1, body2);
@@ -61,6 +57,10 @@ public class VertxRouteTest extends CamelTestSupport {
public void configure() throws Exception {
// camel-vertx cannot be ran with JDK 1.6
org.junit.Assume.assumeTrue(!isJava16());
+
+ VertxComponent vertx = getContext().getComponent("vertx", VertxComponent.class);
+ vertx.setPort(getPort());
+
from(startUri).to(middleUri);
from(middleUri).to(resultUri);
}