This is an automated email from the ASF dual-hosted git repository.
jbertram pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new f8d3a8f ARTEMIS-2354 Improve compatibillity of tests with JDK 11
new b771a2a This closes #2717
f8d3a8f is described below
commit f8d3a8f2f2e81f80189d2ab4149a6228e70d3425
Author: Francesco Nigro <[email protected]>
AuthorDate: Fri Mar 15 15:46:46 2019 +0100
ARTEMIS-2354 Improve compatibillity of tests with JDK 11
---
artemis-cdi-client/pom.xml | 6 ++
artemis-dto/pom.xml | 8 ++
.../apache/activemq/artemis/dto/package-info.java | 1 +
artemis-features/pom.xml | 2 +-
artemis-rest/pom.xml | 6 ++
artemis-selector/pom.xml | 52 +++++++++--
artemis-website/pom.xml | 13 ++-
pom.xml | 104 ++++++++++++++-------
.../artemis/tests/smoke/jmx/JmxConnectionTest.java | 40 ++++++--
9 files changed, 174 insertions(+), 58 deletions(-)
diff --git a/artemis-cdi-client/pom.xml b/artemis-cdi-client/pom.xml
index 9cc3fa8..53350e7 100644
--- a/artemis-cdi-client/pom.xml
+++ b/artemis-cdi-client/pom.xml
@@ -29,6 +29,7 @@
<properties>
<activemq.basedir>${project.basedir}/..</activemq.basedir>
+ <javax.annotation.version>1.3.2</javax.annotation.version>
</properties>
<artifactId>artemis-cdi-client</artifactId>
@@ -84,6 +85,11 @@
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>${javax.annotation.version}</version>
+ </dependency>
+ <dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
diff --git a/artemis-dto/pom.xml b/artemis-dto/pom.xml
index 27fecd9..f0780dd 100644
--- a/artemis-dto/pom.xml
+++ b/artemis-dto/pom.xml
@@ -99,6 +99,9 @@
<exclude name="**/.git/**" />
<exclude name="**/.svn/**" />
</schemagen>
+ <replace
file="${project.build.directory}/schema/org.apache.activemq/dto/activemq.xsd"
+
token="xmlns:xs="http://www.w3.org/2001/XMLSchema""
+
value="xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema""/>
<copy todir="${project.build.directory}/classes">
<fileset dir="${project.build.directory}/schema" />
</copy>
@@ -125,6 +128,11 @@
<artifactId>jaxb-jxc</artifactId>
<version>${version.jaxb}</version>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ <version>2.3.2</version>
+ </dependency>
</dependencies>
</plugin>
</plugins>
diff --git
a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java
b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java
index 0a8b297..7055bfb 100644
---
a/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java
+++
b/artemis-dto/src/main/java/org/apache/activemq/artemis/dto/package-info.java
@@ -18,6 +18,7 @@
* The JAXB POJOs for the XML configuration of ActiveMQ Artemis broker
*/
@javax.xml.bind.annotation.XmlSchema(
+ xmlns = {@javax.xml.bind.annotation.XmlNs(prefix = "xs", namespaceURI =
"http://www.w3.org/2001/XMLSchema")},
namespace = "http://activemq.org/schema",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.apache.activemq.artemis.dto;
diff --git a/artemis-features/pom.xml b/artemis-features/pom.xml
index 283608c..7afbbf6 100644
--- a/artemis-features/pom.xml
+++ b/artemis-features/pom.xml
@@ -26,7 +26,7 @@
<name>ActiveMQ Artemis Features</name>
<properties>
- <karaf.version>4.1.1</karaf.version>
+ <karaf.version>4.2.3</karaf.version>
</properties>
<dependencies>
diff --git a/artemis-rest/pom.xml b/artemis-rest/pom.xml
index 96796a0..5af0fc6 100644
--- a/artemis-rest/pom.xml
+++ b/artemis-rest/pom.xml
@@ -128,6 +128,12 @@
<version>2.2.7</version>
</dependency>
<dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-runtime</artifactId>
+ <version>2.3.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
diff --git a/artemis-selector/pom.xml b/artemis-selector/pom.xml
index fc267c3..4a61be5 100644
--- a/artemis-selector/pom.xml
+++ b/artemis-selector/pom.xml
@@ -84,6 +84,48 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>jdk8</id>
+ <activation>
+ <jdk>1.8</jdk>
+ <property>
+ <name>java.vendor</name>
+ <value>!IBM Corporation</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgs>
+ <!-- TODO: do this only for generated-sources -->
+ <arg>-Xep:MissingOverride:WARN</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jdk11</id>
+ <activation>
+ <jdk>11</jdk>
+ <property>
+ <name>java.vendor</name>
+ <value>!IBM Corporation</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<build>
@@ -95,16 +137,6 @@
</resources>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <compilerArgs>
- <!-- TODO: do this only for generated-sources -->
- <arg>-Xep:MissingOverride:WARN</arg>
- </compilerArgs>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.6</version>
diff --git a/artemis-website/pom.xml b/artemis-website/pom.xml
index 3ceda36..7ee2087 100644
--- a/artemis-website/pom.xml
+++ b/artemis-website/pom.xml
@@ -92,7 +92,7 @@
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.1</version>
+ <version>3.1.0</version>
<executions>
<execution>
<id>javadoc-jar</id>
@@ -101,6 +101,8 @@
<goal>jar</goal>
</goals>
<configuration>
+ <doclint>none</doclint>
+ <additionalOptions>${forceHtml4}</additionalOptions>
<useStandardDocletOptions>true</useStandardDocletOptions>
<minmemory>128m</minmemory>
<maxmemory>512m</maxmemory>
@@ -130,6 +132,15 @@
<profiles>
<profile>
+ <id>jdk11</id>
+ <activation>
+ <jdk>11</jdk>
+ </activation>
+ <properties>
+ <forceHtml4>-html4</forceHtml4>
+ </properties>
+ </profile>
+ <profile>
<id>release</id>
<build>
<plugins>
diff --git a/pom.xml b/pom.xml
index 436adf3..c1125b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -75,7 +75,7 @@
<staging.siteURL>scp://people.apache.org/x1/www/activemq.apache.org</staging.siteURL>
<activemq-artemis-native-version>1.0.0</activemq-artemis-native-version>
- <karaf.version>4.0.6</karaf.version>
+ <karaf.version>4.2.3</karaf.version>
<pax.exam.version>4.9.1</pax.exam.version>
<commons.config.version>2.4</commons.config.version>
<commons.lang.version>3.0</commons.lang.version>
@@ -89,7 +89,7 @@
<jetty.version>9.4.3.v20170317</jetty.version>
<jgroups.version>3.6.13.Final</jgroups.version>
<maven.assembly.plugin.version>2.4</maven.assembly.plugin.version>
- <mockito.version>2.8.47</mockito.version>
+ <mockito.version>2.25.0</mockito.version>
<netty.version>4.1.34.Final</netty.version>
<netty-tcnative-version>2.0.22.Final</netty-tcnative-version>
<proton.version>0.33.1</proton.version>
@@ -867,6 +867,10 @@
<id>jdk18</id>
<activation>
<jdk>1.8</jdk>
+ <property>
+ <name>java.vendor</name>
+ <value>!IBM Corporation</value>
+ </property>
</activation>
<build>
<plugins>
@@ -877,6 +881,68 @@
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- version 3.2 is having problems with the APT processor
resulting in
+ java.lang.IllegalStateException: endPosTable already
set -->
+ <version>3.1</version>
+ <!-- Enable Google's Error-Prone
https://github.com/google/error-prone -->
+ <configuration>
+ <showWarnings>true</showWarnings>
+ <forceJavacCompilerUse>true</forceJavacCompilerUse>
+ <compilerId>${javac-compiler-id}</compilerId>
+ <compilerArgs>
+ <arg>-Xep:MissingOverride:ERROR</arg>
+ <arg>-Xep:NonAtomicVolatileUpdate:ERROR</arg>
+ <arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
+ <arg>-Xep:StaticAccessedFromInstance:ERROR</arg>
+ <arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
+ <arg>-Xep:WaitNotInLoop:ERROR</arg>
+ <arg>-Xdiags:verbose</arg>
+ </compilerArgs>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+
<artifactId>plexus-compiler-javac-errorprone</artifactId>
+ <version>2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.errorprone</groupId>
+ <artifactId>error_prone_core</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jdk11</id>
+ <activation>
+ <jdk>11</jdk>
+ <property>
+ <name>java.vendor</name>
+ <value>!IBM Corporation</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <additionalparam>-Xdoclint:none</additionalparam>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- version 3.2 is having problems with the APT processor
resulting in
+ java.lang.IllegalStateException: endPosTable already
set -->
+ <version>3.1</version>
+ </plugin>
</plugins>
</build>
</profile>
@@ -1336,40 +1402,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <!-- version 3.2 is having problems with the APT processor
resulting in
- java.lang.IllegalStateException: endPosTable already set
-->
- <version>3.1</version>
- <!-- Enable Google's Error-Prone
https://github.com/google/error-prone -->
- <configuration>
- <showWarnings>true</showWarnings>
- <forceJavacCompilerUse>true</forceJavacCompilerUse>
- <compilerId>${javac-compiler-id}</compilerId>
- <compilerArgs>
- <arg>-Xep:MissingOverride:ERROR</arg>
- <arg>-Xep:NonAtomicVolatileUpdate:ERROR</arg>
- <arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
- <arg>-Xep:StaticAccessedFromInstance:ERROR</arg>
- <arg>-Xep:SynchronizeOnNonFinalField:ERROR</arg>
- <arg>-Xep:WaitNotInLoop:ERROR</arg>
- <arg>-Xdiags:verbose</arg>
- </compilerArgs>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-javac-errorprone</artifactId>
- <version>2.8</version>
- </dependency>
- <dependency>
- <groupId>com.google.errorprone</groupId>
- <artifactId>error_prone_core</artifactId>
- <version>2.0.9</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
</plugin>
diff --git
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
index bb21c92..c9ec140 100644
---
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
+++
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/jmx/JmxConnectionTest.java
@@ -26,9 +26,11 @@ import java.lang.reflect.Field;
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef;
-import com.sun.jmx.remote.internal.ProxyRef;
+import io.netty.util.internal.PlatformDependent;
+import io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess;
import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import sun.rmi.server.UnicastRef;
@@ -47,16 +49,30 @@ public class JmxConnectionTest extends SmokeTestBase {
private static final int RMI_REGISTRY_PORT = 10098;
public static final String SERVER_NAME_0 = "jmx";
+ private Class<?> proxyRefClass;
@Before
public void before() throws Exception {
cleanupData(SERVER_NAME_0);
disableCheckThread();
startServer(SERVER_NAME_0, 0, 30000);
+ try {
+ final Class<?> aClass =
Class.forName("com.sun.jmx.remote.internal.ProxyRef");
+ proxyRefClass = aClass;
+ } catch (ClassNotFoundException ex) {
+ //try with a shiny new version
+ try {
+ final Class<?> aClass =
Class.forName("com.sun.jmx.remote.internal.rmi.ProxyRef");
+ proxyRefClass = aClass;
+ } catch (ClassNotFoundException ex2) {
+ //no op
+ }
+ }
}
@Test
public void testJmxConnection() throws Throwable {
+ Assert.assertNotNull(proxyRefClass);
try {
// Without this, the RMI server would bind to the default interface
IP (the user's local IP mostly)
@@ -96,17 +112,22 @@ public class JmxConnectionTest extends SmokeTestBase {
// 3. RemoteObject::getRef is hereby expected to return ProxyRef
RemoteRef remoteRef = remoteObject.getRef();
- Assert.assertTrue(remoteRef instanceof ProxyRef);
- ProxyRef proxyRef = (ProxyRef) remoteRef;
-
+ Assert.assertTrue(proxyRefClass.isInstance(remoteRef));
// 4. ProxyRef::ref is expected to contain UnicastRef (UnicastRef2
resp.)
- Field refField = ProxyRef.class.getDeclaredField("ref");
- refField.setAccessible(true);
- remoteRef = (RemoteRef) refField.get(proxyRef);
- Assert.assertTrue(remoteRef instanceof UnicastRef);
+ Field refField = proxyRefClass.getDeclaredField("ref");
+ RemoteRef remoteRefField;
+ try {
+ refField.setAccessible(true);
+ remoteRefField = (RemoteRef) refField.get(remoteRef);
+ } catch (Throwable error) {
+ Assume.assumeTrue("Unsafe must be available to continue the
test", PlatformDependent.hasUnsafe());
+ remoteRefField = (RemoteRef)
UnsafeAccess.UNSAFE.getObject(remoteRef,
UnsafeAccess.UNSAFE.objectFieldOffset(refField));
+ }
+ Assert.assertNotNull(remoteRefField);
+ Assert.assertTrue(remoteRefField instanceof UnicastRef);
// 5. UnicastRef::getLiveRef returns LiveRef
- LiveRef liveRef = ((UnicastRef) remoteRef).getLiveRef();
+ LiveRef liveRef = ((UnicastRef) remoteRefField).getLiveRef();
Assert.assertEquals(RMI_REGISTRY_PORT, liveRef.getPort());
@@ -119,5 +140,4 @@ public class JmxConnectionTest extends SmokeTestBase {
}
}
-
}