This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 83e269d Dropped JDK 8 itests infrastructure for Kudu extension #1157
83e269d is described below
commit 83e269d731d3403d5c2cf479adf7efbcd1e21f1e
Author: aldettinger <[email protected]>
AuthorDate: Mon May 4 10:33:52 2020 +0200
Dropped JDK 8 itests infrastructure for Kudu extension #1157
---
.../kudu/it/KuduInfrastructureTestHelper.java | 39 +++-------------------
.../camel/quarkus/component/kudu/it/KuduIT.java | 4 +--
.../camel/quarkus/component/kudu/it/KuduTest.java | 4 +--
3 files changed, 9 insertions(+), 38 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 9e9625d..7ebaef0 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
@@ -37,23 +37,22 @@ import org.jboss.logging.Logger;
* {@code KuduTestResource}.
*
* A) How to run integration tests against a custom setup:
- * Comment @Disabled and @DisabledOnNativeImage annotations from {@code
KuduTest} and {@code KuduIT}.
+ * Comment @EnabledIfSystemProperty annotations from {@code KuduTest} and
{@code KuduIT}.
* Install Kudu master and tablet servers on the same network than integration
tests.
* Configure "camel.kudu.test.master.rpc-authority" in
"application.properties", for instance:
* camel.kudu.test.master.rpc-authority=kudu-master-hostname:7051
* Run integration tests with mvn clean integration-test -P native
*
* B) How to run integration tests against the container based setup when NOT
running on top of OpenJDK:
- * Comment @Disabled and @DisabledOnNativeImage annotations from {@code
KuduTest} and {@code KuduIT}.
+ * Comment @EnabledIfSystemProperty annotations from {@code KuduTest} and
{@code KuduIT}.
* Override the ip resolution of the host "kudu-tserver" to 127.0.0.1, e.g. by
adding an entry in /etc/hosts file as
* below:
* 127.0.0.1 kudu-tserver
* Run integration tests with mvn clean integration-test -P native
*
- * C) How to run integration tests against the container based setup when
running on top of OpenJDK:
- * Comment @Disabled and @DisabledOnNativeImage annotations from {@code
KuduTest} and {@code KuduIT}.
- * No extra setup is needed as {@code
overrideKuduTabletServerResolutionInInetAddressCache} takes care of redirecting
- * the Kudu tablet server traffic toward localhost
+ * C) How to run integration tests against the container based setup when
running on top of OpenJDK 9 onward:
+ * No extra setup is needed as {@code overrideTabletServerHostnameResolution}
takes care of redirecting
+ * the Kudu tablet server traffic toward localhost.
* Run integration tests with mvn clean integration-test -P native
*/
@ApplicationScoped
@@ -69,19 +68,6 @@ public class KuduInfrastructureTestHelper {
}
public static void overrideTabletServerHostnameResolution() {
- int javaMajorVersion =
Integer.parseInt(System.getProperty("java.version").replaceFirst("([0-9]+)[.].*",
"$1"));
-
- if (javaMajorVersion == 1) {
- attemptOverideTabletServerHostnameResolutionOpenJdk8();
- } else if (javaMajorVersion >= 9) {
- attemptOverideTabletServerHostnameResolutionOpenJdk9Onward();
- } else {
- attemptOverideTabletServerHostnameResolutionOpenJdk8();
- attemptOverideTabletServerHostnameResolutionOpenJdk9Onward();
- }
- }
-
- public static void
attemptOverideTabletServerHostnameResolutionOpenJdk9Onward() {
try {
// Warm up the InetAddress cache
InetAddress.getByName("localhost");
@@ -99,19 +85,4 @@ public class KuduInfrastructureTestHelper {
LOG.warn(msg, ex);
}
}
-
- public static void attemptOverideTabletServerHostnameResolutionOpenJdk8() {
- try {
- Field addressCacheField =
InetAddress.class.getDeclaredField("addressCache");
- addressCacheField.setAccessible(true);
- Object addressCache = addressCacheField.get(null);
-
- Method put = addressCache.getClass().getMethod("put",
String.class, InetAddress[].class);
- put.setAccessible(true);
- put.invoke(addressCache, KUDU_TABLET_SERVER_HOSTNAME, (Object[])
InetAddress.getAllByName("localhost"));
- } catch (Exception ex) {
- final String msg = "An issue occurred while attempting the Open
JDK8 override of the kudu tablet server hostname resolution";
- LOG.warn(msg, ex);
- }
- }
}
diff --git
a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduIT.java
b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduIT.java
index 7cc22f6..66f71af 100644
---
a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduIT.java
+++
b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduIT.java
@@ -16,11 +16,11 @@
*/
package org.apache.camel.quarkus.component.kudu.it;
-import io.quarkus.test.junit.DisabledOnNativeImage;
import io.quarkus.test.junit.NativeImageTest;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
@NativeImageTest
-@DisabledOnNativeImage("Manual setup could be needed, please look at
KuduInfrastructureTestHelper")
+@EnabledIfSystemProperty(named = "java.runtime.name", matches = ".*OpenJDK.*")
class KuduIT extends KuduTest {
}
diff --git
a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTest.java
b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTest.java
index 003d209..46d858e 100644
---
a/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTest.java
+++
b/integration-tests/kudu/src/test/java/org/apache/camel/quarkus/component/kudu/it/KuduTest.java
@@ -28,11 +28,11 @@ import org.apache.kudu.client.KuduException;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import static
org.apache.camel.quarkus.component.kudu.it.KuduInfrastructureTestHelper.KUDU_AUTHORITY_CONFIG_KEY;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
@QuarkusTestResource(KuduTestResource.class)
@QuarkusTest
@TestMethodOrder(OrderAnnotation.class)
-@Disabled("Manual setup could be needed, please look at
KuduInfrastructureTestHelper")
+@EnabledIfSystemProperty(named = "java.runtime.name", matches = ".*OpenJDK.*")
class KuduTest {
private static final Logger LOG = Logger.getLogger(KuduTest.class);