You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2019/08/13 23:16:51 UTC
[camel] 02/02: CAMEL-13853: fix tests
This is an automated email from the ASF dual-hosted git repository.
janbednar pushed a commit to branch CAMEL-13853
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 091c4b442a158e58fef8133903264335a6f362ac
Author: Jan Bednář <ma...@janbednar.eu>
AuthorDate: Wed Aug 14 00:55:19 2019 +0200
CAMEL-13853: fix tests
---
.../camel/component/elasticsearch/ElasticsearchBaseTest.java | 7 ++++++-
.../component/elasticsearch/ElasticsearchClusterBaseTest.java | 8 ++++++--
.../resources/org/apache/camel/component/jetty/jetty-https.xml | 5 -----
.../camel/component/jetty/jetty-noconnection-redelivery.xml | 5 -----
.../org/apache/camel/component/jetty/jetty-noconnection.xml | 5 -----
.../org/apache/camel/component/netty4/http/BaseNettyTest.java | 2 +-
.../camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml | 5 -----
.../apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml | 5 -----
.../java/org/apache/camel/component/netty4/BaseNettyTest.java | 2 +-
components/camel-undertow/src/test/resources/SpringTest.xml | 5 -----
10 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
index a715284..605981f 100644
--- a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
+++ b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
@@ -46,9 +46,13 @@ public class ElasticsearchBaseTest extends CamelTestSupport {
@BeforeClass
public static void cleanupOnce() throws Exception {
deleteDirectory("target/testcluster/");
+
clusterName = "es-cl-run-" + System.currentTimeMillis();
runner = new ElasticsearchClusterRunner();
+ runner.setMaxHttpPort(-1);
+ runner.setMaxTransportPort(-1);
+
// create ES nodes
runner.onBuild((number, settingsBuilder) -> {
settingsBuilder.put("http.cors.enabled", true);
@@ -56,7 +60,8 @@ public class ElasticsearchBaseTest extends CamelTestSupport {
}).build(newConfigs()
.clusterName(clusterName)
.numOfNode(1)
- .baseHttpPort(ES_BASE_TRANSPORT_PORT)
+ .baseHttpPort(ES_BASE_HTTP_PORT - 1) // ElasticsearchClusterRunner add node id to port, so set it to ES_BASE_HTTP_PORT-1 to start node 1 exactly on ES_BASE_HTTP_PORT
+ .baseTransportPort(ES_BASE_TRANSPORT_PORT - 1) // ElasticsearchClusterRunner add node id to port, so set it to ES_BASE_TRANSPORT_PORT-1 to start node 1 exactly on ES_BASE_TRANSPORT_PORT
.basePath("target/testcluster/"));
// wait for green status
diff --git a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterBaseTest.java b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterBaseTest.java
index 9a74519..6a3705a 100644
--- a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterBaseTest.java
+++ b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterBaseTest.java
@@ -51,6 +51,9 @@ public class ElasticsearchClusterBaseTest extends CamelTestSupport {
// create runner instance
runner = new ElasticsearchClusterRunner();
+ runner.setMaxHttpPort(-1);
+ runner.setMaxTransportPort(-1);
+
// create ES nodes
runner.onBuild((number, settingsBuilder) -> {
settingsBuilder.put("http.cors.enabled", true);
@@ -58,12 +61,13 @@ public class ElasticsearchClusterBaseTest extends CamelTestSupport {
}).build(newConfigs()
.clusterName(clusterName)
.numOfNode(1)
- .baseHttpPort(ES_BASE_HTTP_PORT)
+ .baseHttpPort(ES_BASE_HTTP_PORT - 1) // ElasticsearchClusterRunner add node id to port, so set it to ES_BASE_HTTP_PORT-1 to start node 1 exactly on ES_BASE_HTTP_PORT
+ .baseTransportPort(ES_FIRST_NODE_TRANSPORT_PORT - 1) // ElasticsearchClusterRunner add node id to port, so set it to ES_FIRST_NODE_TRANSPORT_PORT-1 to start node 1 exactly on ES_FIRST_NODE_TRANSPORT_PORT
.basePath("target/testcluster/"));
// wait for green status
runner.ensureGreen();
- restclientbuilder = RestClient.builder(new HttpHost(InetAddress.getByName("127.0.0.1"), ES_FIRST_NODE_TRANSPORT_PORT));
+ restclientbuilder = RestClient.builder(new HttpHost(InetAddress.getByName("127.0.0.1"), ES_BASE_HTTP_PORT));
client = new RestHighLevelClient(restclientbuilder);
restClient = client.getLowLevelClient();
}
diff --git a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-https.xml b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-https.xml
index df959fb..604abf2 100644
--- a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-https.xml
+++ b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-https.xml
@@ -42,11 +42,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>9000</value>
- </list>
- </property>
</bean>
diff --git a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
index 7f9113b..4dc5e87 100644
--- a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
+++ b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection-redelivery.xml
@@ -31,11 +31,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>9000</value>
- </list>
- </property>
</bean>
diff --git a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
index 6cee164..8c6fe59 100644
--- a/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
+++ b/components/camel-jetty/src/test/resources/org/apache/camel/component/jetty/jetty-noconnection.xml
@@ -32,11 +32,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>5000</value>
- </list>
- </property>
</bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty4/http/BaseNettyTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty4/http/BaseNettyTest.java
index 2342ecc..837bb8b 100644
--- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty4/http/BaseNettyTest.java
+++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty4/http/BaseNettyTest.java
@@ -44,7 +44,7 @@ public class BaseNettyTest extends CamelTestSupport {
private static volatile int port;
- @Before
+ @BeforeClass
public static void initPort() throws Exception {
port = AvailablePortFinder.getNextAvailable();
}
diff --git a/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml b/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
index eec97c1..5c04667 100644
--- a/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
+++ b/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpBasicAuthTest.xml
@@ -31,11 +31,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>9000</value>
- </list>
- </property>
</bean>
<bean id="constraint" class="org.apache.camel.component.netty4.http.SecurityConstraintMapping">
diff --git a/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml b/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
index a62abb4..7a44ad1 100644
--- a/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
+++ b/components/camel-netty-http/src/test/resources/org/apache/camel/component/netty4/http/SpringNettyHttpSSLTest.xml
@@ -32,11 +32,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>9000</value>
- </list>
- </property>
</bean>
<camel:sslContextParameters id="mySsl">
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty4/BaseNettyTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty4/BaseNettyTest.java
index 7453ba6..f933e73 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty4/BaseNettyTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty4/BaseNettyTest.java
@@ -45,7 +45,7 @@ public class BaseNettyTest extends CamelTestSupport {
private static volatile int port;
- @Before
+ @BeforeClass
public static void initPort() throws Exception {
port = AvailablePortFinder.getNextAvailable();
}
diff --git a/components/camel-undertow/src/test/resources/SpringTest.xml b/components/camel-undertow/src/test/resources/SpringTest.xml
index 32177f9..6730454 100644
--- a/components/camel-undertow/src/test/resources/SpringTest.xml
+++ b/components/camel-undertow/src/test/resources/SpringTest.xml
@@ -43,11 +43,6 @@
<property name="targetMethod">
<value>getNextAvailable</value>
</property>
- <property name="arguments">
- <list>
- <value>8800</value>
- </list>
- </property>
</bean>
<bean id="accessLogReceiver" class="io.undertow.server.handlers.accesslog.JBossLoggingAccessLogReceiver"/>