Fix Extended Wadl Example OSGi Test for JDK11 (#4430)
* Fix Extended Wadl Example OSGi Test for JDK11
Signed-off-by: Jan Supol <jan.supol@oracle.com>
diff --git a/examples/extended-wadl-webapp/pom.xml b/examples/extended-wadl-webapp/pom.xml
index ec5b11b..44803fa 100644
--- a/examples/extended-wadl-webapp/pom.xml
+++ b/examples/extended-wadl-webapp/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 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
@@ -235,24 +235,16 @@
<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>**/ExtendedWadlWebappOsgiTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.activation</groupId>
+ <artifactId>jakarta.activation</artifactId>
+ </dependency>
+ </dependencies>
</profile>
<profile>
<id>pre-release</id>
diff --git a/examples/extended-wadl-webapp/src/test/java/org/glassfish/jersey/examples/extendedwadl/ExtendedWadlWebappOsgiTest.java b/examples/extended-wadl-webapp/src/test/java/org/glassfish/jersey/examples/extendedwadl/ExtendedWadlWebappOsgiTest.java
index 23e693b..e315052 100644
--- a/examples/extended-wadl-webapp/src/test/java/org/glassfish/jersey/examples/extendedwadl/ExtendedWadlWebappOsgiTest.java
+++ b/examples/extended-wadl-webapp/src/test/java/org/glassfish/jersey/examples/extendedwadl/ExtendedWadlWebappOsgiTest.java
@@ -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
@@ -36,6 +36,7 @@
import org.glassfish.jersey.examples.extendedwadl.resources.MyApplication;
import org.glassfish.jersey.examples.extendedwadl.util.Examples;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.internal.util.JdkVersion;
import org.glassfish.jersey.internal.util.PropertiesHelper;
import org.glassfish.jersey.internal.util.SimpleNamespaceResolver;
import org.glassfish.jersey.message.internal.MediaTypes;
@@ -129,6 +130,7 @@
//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"),
@@ -180,6 +182,12 @@
return options.toArray(new Option[options.size()]);
}
+ private static Option getActivationBundle() {
+ return JdkVersion.getJdkVersion().getMajor() > 8
+ ? mavenBundle().groupId("com.sun.activation").artifactId("jakarta.activation").versionAsInProject()
+ : null;
+ }
+
private ResourceConfig createResourceConfig() {
final ResourceConfig resourceConfig = new ResourceConfig(new MyApplication().getClasses());
resourceConfig.property(ServerProperties.WADL_GENERATOR_CONFIG, SampleWadlGeneratorConfig.class.getName());