Skip to content

Commit

Permalink
Fix the OSGi Functional Tests for JDK 11
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Supol <[email protected]>
  • Loading branch information
jansupol authored and Cousjava committed Sep 15, 2020
1 parent f6d4489 commit 9152429
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 99 deletions.
25 changes: 9 additions & 16 deletions examples/osgi-helloworld-webapp/functional-test/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -225,24 +225,17 @@

<profiles>
<profile>
<id>testsSkipJdk11</id>
<id>testsJdk11</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Exclude unit tests on jdk 11 for now -->
<excludes>
<exclude>**/WebAppFelixTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>${jakarta.activation.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>release</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -35,6 +35,7 @@

import javax.inject.Inject;

import org.glassfish.jersey.internal.util.JdkVersion;
import org.glassfish.jersey.internal.util.PropertiesHelper;

import org.ops4j.pax.exam.Configuration;
Expand All @@ -54,6 +55,7 @@
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.systemPackage;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.vmOption;

/**
* @author Jakub Podlesak
Expand Down Expand Up @@ -104,6 +106,7 @@ public List<Option> genericOsgiOptions() {

// uncomment for verbose class loading info
// vmOption("-verbose:class"),
getAddOpensForFelixFrameWorkSecurity(),

// bootDelegationPackage("org.glassfish.jersey.client.*"),

Expand Down Expand Up @@ -147,6 +150,7 @@ public List<Option> genericOsgiOptions() {
mavenBundle().groupId("jakarta.xml.bind").artifactId("jakarta.xml.bind-api").versionAsInProject(),
//SUN JAXB IMPL OSGI
mavenBundle().groupId("com.sun.xml.bind").artifactId("jaxb-osgi").versionAsInProject().versionAsInProject(),
getActivationBundle(),
systemPackage("com.sun.source.tree"),
systemPackage("com.sun.source.util"),

Expand Down Expand Up @@ -190,6 +194,18 @@ public List<Option> genericOsgiOptions() {
return options;
}

private static Option getActivationBundle() {
return JdkVersion.getJdkVersion().getMajor() > 8
? mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
: null;
}

private static Option getAddOpensForFelixFrameWorkSecurity() {
return JdkVersion.getJdkVersion().getMajor() > 8
? vmOption("--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED")
: null;
}

public List<Option> jettyOptions() {
return Arrays.asList(options(
mavenBundle().groupId("org.ops4j.pax.web").artifactId("pax-web-jetty-bundle").versionAsInProject(),
Expand Down
7 changes: 6 additions & 1 deletion examples/osgi-helloworld-webapp/war-bundle/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -66,6 +66,11 @@
<artifactId>org.apache.felix.eventadmin</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
7 changes: 6 additions & 1 deletion examples/osgi-http-service/bundle/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -47,6 +47,11 @@
<artifactId>org.apache.felix.eventadmin</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
26 changes: 9 additions & 17 deletions examples/osgi-http-service/functional-test/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -202,25 +202,17 @@

<profiles>
<profile>
<id>testsSkipJdk11</id>
<id>testsJdk11</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Exclude unit tests on jdk 11 for now -->
<excludes>
<exclude>**/GrizzlyHttpServiceFelixTest.java</exclude>
<exclude>**/JettyHttpServiceFelixTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>${jakarta.activation.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>release</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -30,6 +30,7 @@

import javax.inject.Inject;

import org.glassfish.jersey.internal.util.JdkVersion;
import org.glassfish.jersey.internal.util.PropertiesHelper;

import org.ops4j.pax.exam.Configuration;
Expand Down Expand Up @@ -111,6 +112,7 @@ public List<Option> genericOsgiOptions() {
mavenBundle().groupId("jakarta.xml.bind").artifactId("jakarta.xml.bind-api").versionAsInProject(),
//SUN JAXB IMPL OSGI
mavenBundle().groupId("com.sun.xml.bind").artifactId("jaxb-osgi").versionAsInProject().versionAsInProject(),
getActivationBundle(),
systemPackage("com.sun.source.tree"),
systemPackage("com.sun.source.util"),

Expand Down Expand Up @@ -249,4 +251,10 @@ private Dictionary getHandlerServiceProperties(String... topics) {
result.put(EventConstants.EVENT_TOPIC, topics);
return result;
}

private static Option getActivationBundle() {
return JdkVersion.getJdkVersion().getMajor() > 8
? mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
: null;
}
}
16 changes: 4 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1914,13 +1914,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit-extender-impl</artifactId>
Expand Down Expand Up @@ -1997,22 +1990,21 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<!--5.2.0+ does not work with moxy osgi functional tests-->
<version>5.0.1</version>
<version>6.0.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.eventadmin</artifactId>
<version>1.2.2</version>
<version>1.5.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework.security</artifactId>
<version>2.2.0</version>
<version>2.6.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -2141,7 +2133,7 @@
<opentracing.version>0.30.0</opentracing.version>
<osgi.version>6.0.0</osgi.version>
<osgi.compendium.version>5.0.0</osgi.compendium.version>
<pax.exam.version>4.9.1</pax.exam.version>
<pax.exam.version>4.13.1</pax.exam.version>
<pax.web.version>0.7.4</pax.web.version><!-- TODO: UPGRADE! -->
<paxexam.mvn.plugin.version>1.2.4</paxexam.mvn.plugin.version>
<rxjava.version>1.2.5</rxjava.version>
Expand Down
60 changes: 11 additions & 49 deletions tests/osgi/functional/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -144,7 +144,7 @@
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>1.6.0</version>
<version>2.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -178,7 +178,7 @@
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<scope>test</scope>
<version>1.8.3</version>
<version>1.11.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down Expand Up @@ -394,55 +394,17 @@

<profiles>
<profile>
<id>testsSkipJdk11</id>
<id>jdk11dependency</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Exclude unit tests on jdk 11 for now -->
<excludes>
<exclude>org/glassfish/jersey/osgi/test/basic/ApacheOsgiIntegrationTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/BasicOsgiIntegrationTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/BeanValidationTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JaxRsRiBundleTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JsonJackson1Test.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JsonJacksonTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JsonJettisonTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JsonMoxyTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/JsonProcessingTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/MultiPartTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/PackageScanningTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/ResourceBundleTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/SseTest.java</exclude>
<exclude>org/glassfish/jersey/osgi/test/basic/WebResourceFactoryTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>testsSkipJdk6</id>
<activation>
<jdk>1.6</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/PackageScanningTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>${jakarta.activation.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>sonar</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.LinkedList;
import java.util.List;

import org.glassfish.jersey.internal.util.JdkVersion;
import org.glassfish.jersey.internal.util.PropertiesHelper;
import org.glassfish.jersey.test.TestProperties;

Expand Down Expand Up @@ -170,13 +171,19 @@ public static List<Option> getCommonOsgiOptions(final boolean includeJerseyJaxRs
// Jersey Injection provider
mavenBundle().groupId("org.glassfish.jersey.inject").artifactId("jersey-hk2").versionAsInProject(),
// Jaxb - api
mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
getActivationBundle()
));
}

return addPaxExamMavenLocalRepositoryProperty(options);
}

private static Option getActivationBundle() {
return JdkVersion.getJdkVersion().getMajor() > 8
? mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
: null;
}

/**
* Create expanded options list from the supplied options.
*
Expand Down

0 comments on commit 9152429

Please sign in to comment.