SLING-12072: migrate to jakarta.json (#20)
* SLING-12072: migrate to jakarta.json
* SLING-12072: fix integration tests
* SLING-12072: fix integration tests
* SLING-12072: fix integration tests on jdk 17
* SLING-12072: fix code review comments
diff --git a/pom.xml b/pom.xml
index 4c35849..66a1072 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>43</version>
+ <version>52</version>
<relativePath />
</parent>
@@ -34,12 +34,10 @@
<description>Runs JUnit tests in an OSGi framework and provides the JUnit libraries</description>
<properties>
- <junit.version>4.13</junit.version>
+ <junit.version>4.13.2</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<jacoco.version>0.6.2.201302030002</jacoco.version>
- <junit-jupiter.version>5.6.0</junit-jupiter.version>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <junit-jupiter.version>5.10.0</junit-jupiter.version>
</properties>
<scm>
@@ -209,7 +207,18 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
+ <artifactId>org.osgi.resource</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.util.tracker</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -220,26 +229,33 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.framework</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jakarta.json</groupId>
+ <artifactId>jakarta.json-api</artifactId>
+ <version>2.0.2</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.servlets.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
@@ -283,6 +299,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.osgi</artifactId>
<version>2.4.2</version>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -296,7 +313,7 @@
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
- <version>1.6.2</version>
+ <version>1.10.1</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
diff --git a/src/it/annotations-it/.gitignore b/src/it/annotations-it/.gitignore
new file mode 100644
index 0000000..947429b
--- /dev/null
+++ b/src/it/annotations-it/.gitignore
@@ -0,0 +1,18 @@
+target
+.idea
+.classpath
+.metadata
+.project
+.settings
+.externalToolBuilders
+maven-eclipse.xml
+*.swp
+*.iml
+*.ipr
+*.iws
+*.bak
+.vlt
+.DS_Store
+jcr.log
+atlassian-ide-plugin.xml
+.vscode/
diff --git a/src/it/annotations-it/pom.xml b/src/it/annotations-it/pom.xml
index ca0c785..ef2915c 100644
--- a/src/it/annotations-it/pom.xml
+++ b/src/it/annotations-it/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>41</version>
+ <version>52</version>
<relativePath/>
</parent>
@@ -31,7 +31,7 @@
<properties>
<sling.java.version>8</sling.java.version>
<org.ops4j.pax.exam.version>4.13.4</org.ops4j.pax.exam.version>
- <junit.version>4.13</junit.version>
+ <junit.version>4.13.2</junit.version>
<hamcrest.version>1.3</hamcrest.version>
<!-- additional options that can be passed to Pax before executing the tests -->
<pax.vm.options/>
@@ -46,12 +46,10 @@
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
- <version>5.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>3.0.0-M5</version>
<executions>
<execution>
<goals>
@@ -121,6 +119,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.clients</artifactId>
<version>2.0.8</version>
+ <scope>test</scope>
</dependency>
<dependency>
@@ -141,14 +140,18 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- <version>6.0.0</version>
- <scope>test</scope>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.cm</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>6.0.3</version>
+ <version>7.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -156,17 +159,37 @@
<artifactId>pax-logging-api</artifactId>
<version>2.0.6</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-logback</artifactId>
<version>2.0.6</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.paxexam</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/AnnotationsTestSupport.java b/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/AnnotationsTestSupport.java
index 2c77663..de3e559 100644
--- a/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/AnnotationsTestSupport.java
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/AnnotationsTestSupport.java
@@ -82,7 +82,8 @@
mavenBundle().groupId("ch.qos.logback").artifactId("logback-classic").versionAsInProject(),
mavenBundle().groupId("ch.qos.logback").artifactId("logback-core").versionAsInProject(),
mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-api").versionAsInProject(),
- mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-logback").versionAsInProject()
+ mavenBundle().groupId("org.ops4j.pax.logging").artifactId("pax-logging-logback").versionAsInProject(),
+ mavenBundle().groupId("jakarta.json").artifactId("jakarta.json-api").version("2.1.1")
);
}
diff --git a/src/main/java/org/apache/sling/junit/impl/servlet/JsonRenderer.java b/src/main/java/org/apache/sling/junit/impl/servlet/JsonRenderer.java
index 1324bf3..28ec568 100644
--- a/src/main/java/org/apache/sling/junit/impl/servlet/JsonRenderer.java
+++ b/src/main/java/org/apache/sling/junit/impl/servlet/JsonRenderer.java
@@ -21,9 +21,9 @@
import java.util.Collection;
import java.util.Map;
-import javax.json.Json;
-import javax.json.JsonException;
-import javax.json.stream.JsonGenerator;
+import jakarta.json.Json;
+import jakarta.json.JsonException;
+import jakarta.json.stream.JsonGenerator;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.junit.Renderer;