ARTEMIS-2354 Improve compatibillity of tests with JDK 11
This commit is contained in:
parent
a53855a948
commit
f8d3a8f2f2
|
@ -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>
|
||||
|
@ -83,6 +84,11 @@
|
|||
<groupId>javax.inject</groupId>
|
||||
<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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -127,6 +127,12 @@
|
|||
<artifactId>jaxb-api</artifactId>
|
||||
<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>
|
||||
|
|
|
@ -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>
|
||||
|
@ -94,16 +136,6 @@
|
|||
</resource>
|
||||
</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>
|
||||
|
|
|
@ -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>
|
||||
|
@ -129,6 +131,15 @@
|
|||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk11</id>
|
||||
<activation>
|
||||
<jdk>11</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<forceHtml4>-html4</forceHtml4>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
|
|
104
pom.xml
104
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>
|
||||
|
@ -1334,40 +1400,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</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>
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue