Bug 529877: make test-osgi tests runnable on jdk 9

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/moxy/eclipselink.moxy.test/antbuild.xml b/moxy/eclipselink.moxy.test/antbuild.xml
index 46b9130..3e0309c 100644
--- a/moxy/eclipselink.moxy.test/antbuild.xml
+++ b/moxy/eclipselink.moxy.test/antbuild.xml
@@ -366,6 +366,7 @@
             <arg line="-Djaxb-api.jar=${jaxb-api.jar}"/>
             <arg line="-Djaxrs.jar=${jaxrs.jar}"/>
             <arg line="-Dasm.jar=${asm.jar}"/>
+            <arg line="-Dtest.junit.jvm=${test.junit.jvm}"/>
             <classpath>
                 <fileset dir="${M2_HOME}/boot">
                     <include name="plexus-classworlds-*.jar"/>
diff --git a/moxy/eclipselink.moxy.test/pom.xml b/moxy/eclipselink.moxy.test/pom.xml
index edcf7fe..67a8271 100644
--- a/moxy/eclipselink.moxy.test/pom.xml
+++ b/moxy/eclipselink.moxy.test/pom.xml
@@ -10,8 +10,8 @@
     <version>3.0.0-SNAPSHOT</version>
 
     <properties>
-        <exam.version>4.5.0</exam.version>
-        <url.version>2.4.1</url.version>
+        <exam.version>4.11.0</exam.version>
+        <url.version>2.5.2</url.version>
         <logback.version>1.1.3</logback.version>
         <eclipselink.version>3.0.0-SNAPSHOT</eclipselink.version>
     </properties>
@@ -20,10 +20,18 @@
         <!-- EclipseLink -->
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
-            <artifactId>eclipselink</artifactId>
+            <artifactId>core</artifactId>
             <version>${eclipselink.version}</version>
             <scope>system</scope>
-            <systemPath>${basedir}/../../eclipselink.jar</systemPath>
+            <systemPath>${basedir}/../../plugins/org.eclipse.persistence.core_3.0.0.qualifier.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>org.eclipse.persistence</groupId>
+            <artifactId>moxy</artifactId>
+            <version>${eclipselink.version}</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/../../plugins/org.eclipse.persistence.moxy_3.0.0.qualifier.jar</systemPath>
         </dependency>
 
         <!-- Bean validation API -->
@@ -40,11 +48,13 @@
             <groupId>org.hibernate.validator</groupId>
             <artifactId>hibernate-validator</artifactId>
             <version>6.0.7.Final</version>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-api</artifactId>
             <version>2.3</version>
+            <scope>test</scope>
         </dependency>
 
         <!-- javax.inject -->
@@ -58,7 +68,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
-            <version>5.0.0</version>
+            <version>5.6.10</version>
             <scope>test</scope>
         </dependency>
 
@@ -71,7 +81,7 @@
         </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
-            <artifactId>pax-exam-container-native</artifactId>
+            <artifactId>pax-exam-container-forked</artifactId>
             <version>${exam.version}</version>
             <scope>test</scope>
         </dependency>
@@ -115,7 +125,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.3</version>
+                <version>3.7.0</version>
                 <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
@@ -141,7 +151,12 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.13</version>
+                <version>2.20.1</version>
+                <configuration>
+                    <environmentVariables>
+                        <JAVA_HOME>${test.junit.jvm}</JAVA_HOME>
+                    </environmentVariables>
+                </configuration>
             </plugin>
         </plugins>
     </build>
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/osgi/OSGITestHelper.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/osgi/OSGITestHelper.java
index 326f4d4..de0e3b9 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/osgi/OSGITestHelper.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/osgi/OSGITestHelper.java
@@ -19,6 +19,10 @@
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.vmOptions;
+import static org.ops4j.pax.exam.CoreOptions.when;
+
+import org.eclipse.persistence.internal.helper.JavaSEPlatform;
 
 /**
  * Helper class with PAX options for different kind of OSGi tests.
@@ -38,6 +42,7 @@ public class OSGITestHelper {
 
     public static Option[] getDefaultOptions() {
         return options(
+                when(JavaSEPlatform.CURRENT.getMajor() >= 9).useOptions(vmOptions("--add-modules", "java.sql,java.xml.bind")),
                 // JAXB API
                 bundle("file:" + PLUGINS_DIR + JAXB_API_JAR),
 
@@ -55,12 +60,11 @@ public class OSGITestHelper {
 
     public static Option[] getOptionsWithBeanValidation() {
         return options(
+                when(JavaSEPlatform.CURRENT.getMajor() >= 9).useOptions(vmOptions("--add-modules", "java.sql,java.xml.bind")),
                 mavenBundle().groupId("org.hibernate.validator").artifactId("hibernate-validator").version("6.0.7.Final"),
                 mavenBundle().groupId("com.fasterxml").artifactId("classmate").version("1.3.1"),
                 mavenBundle().groupId("org.glassfish").artifactId("javax.el").version("3.0.1-b08"),
                 mavenBundle().groupId("org.jboss.logging").artifactId("jboss-logging").version("3.3.0.Final"),
-                mavenBundle().groupId("org.apache.logging.log4j").artifactId("log4j-api").version("2.3"),
-                mavenBundle().groupId("org.apache.logging.log4j").artifactId("log4j-core").version("2.3"),
 
                 // JAXB API
                 bundle("file:" + PLUGINS_DIR + JAXB_API_JAR),