This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 31b1d5d kudu: remove the useless test harness logic dedicated to Java
8 #2885
31b1d5d is described below
commit 31b1d5d20740ad572637570309bab4af6055778c
Author: aldettinger <[email protected]>
AuthorDate: Wed Jul 7 19:02:14 2021 +0200
kudu: remove the useless test harness logic dedicated to Java 8 #2885
---
.../kudu/it/KuduInfrastructureTestHelper.java | 36 ++++++++--------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git
a/integration-tests/kudu/src/main/java/org/apache/camel/quarkus/component/kudu/it/KuduInfrastructureTestHelper.java
b/integration-tests/kudu/src/main/java/org/apache/camel/quarkus/component/kudu/it/KuduInfrastructureTestHelper.java
index 0e3308c..5c7f22f 100644
---
a/integration-tests/kudu/src/main/java/org/apache/camel/quarkus/component/kudu/it/KuduInfrastructureTestHelper.java
+++
b/integration-tests/kudu/src/main/java/org/apache/camel/quarkus/component/kudu/it/KuduInfrastructureTestHelper.java
@@ -44,11 +44,10 @@ import org.jboss.logging.Logger;
* Run integration tests with mvn clean integration-test -P native
*
* B) How to run integration tests against the container based setup:
- * The container based setup is activated by default when running on top of
OpenJDK and should run out of the box as
- * {@code KuduTestResource} runs master and tablet server containers in a
shared network.
- * When NOT running on top of OpenJDK, you can have a try by commenting
@EnabledIfSystemProperty statements in
- * {@code KuduTest} and {@code KuduIT}.
- * Run integration tests with mvn clean integration-test -P native
+ * The container based setup should run out of the box as {@code
KuduTestResource} runs master and tablet server
+ * containers in a shared network.
+ * Simply run integration tests with mvn clean integration-test -P native
+ * Note that the test harness is NOT guaranteed to work when NOT running on
top of OpenJDK.
*
* Troubleshooting the container based setup:
* If a message like "Unknown host kudu-tserver" is issued, it may be that
@@ -75,24 +74,15 @@ public class KuduInfrastructureTestHelper {
public static void overrideTabletServerHostnameResolution() {
try {
- if (System.getProperty("java.version").startsWith("1.8")) {
- /* Warm up the InetAddress cache and get localhost addresses */
- final InetAddress[] localHostCachedAddresses =
InetAddress.getAllByName("localhost");
- final Method cacheAddressesMethod =
InetAddress.class.getDeclaredMethod("cacheAddresses", String.class,
- InetAddress[].class, boolean.class);
- cacheAddressesMethod.setAccessible(true);
- cacheAddressesMethod.invoke(null, KUDU_TABLET_SERVER_HOSTNAME,
localHostCachedAddresses, true);
- } else {
- // Warm up the InetAddress cache
- InetAddress.getByName("localhost");
- final Field cacheField =
InetAddress.class.getDeclaredField("cache");
- cacheField.setAccessible(true);
- final Object cache = cacheField.get(null);
- final Method get = ConcurrentHashMap.class.getMethod("get",
Object.class);
- final Object localHostCachedAddresses = get.invoke(cache,
"localhost");
- final Method put = ConcurrentHashMap.class.getMethod("put",
Object.class, Object.class);
- put.invoke(cache, KUDU_TABLET_SERVER_HOSTNAME,
localHostCachedAddresses);
- }
+ // Warm up the InetAddress cache
+ InetAddress.getByName("localhost");
+ final Field cacheField =
InetAddress.class.getDeclaredField("cache");
+ cacheField.setAccessible(true);
+ final Object cache = cacheField.get(null);
+ final Method get = ConcurrentHashMap.class.getMethod("get",
Object.class);
+ final Object localHostCachedAddresses = get.invoke(cache,
"localhost");
+ final Method put = ConcurrentHashMap.class.getMethod("put",
Object.class, Object.class);
+ put.invoke(cache, KUDU_TABLET_SERVER_HOSTNAME,
localHostCachedAddresses);
} catch (Exception e) {
throw new IllegalStateException("Could not hack the kudu tablet
server hostname resolution", e);
}