Skip to content

Commit

Permalink
Merge pull request #35 from hamnis/jpms-tests
Browse files Browse the repository at this point in the history
Jpms improvements and dependency upgrades
  • Loading branch information
hamnis authored Sep 11, 2024
2 parents 869ba45 + 32b5f42 commit 0440a33
Show file tree
Hide file tree
Showing 21 changed files with 104 additions and 622 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: CI

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B test --file pom.xml
12 changes: 0 additions & 12 deletions .travis-settings.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: AST</name>
<artifactId>immutable-json-ast</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ast/src/test/java/net/hamnaberg/json/JsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void jString() {
public void jNumber() {
Json.JNumber n1 = Json.jNumber(1);
assertEquals(n1, Json.jNumber(1L));
assertEquals(n1, Json.jNumber(new Long(1L)));
assertEquals(n1, Json.jNumber(Long.valueOf(1L)));
assertEquals(n1, Json.jNumber(new BigDecimal(1)));
assertEquals(1, n1.asInt());
assertEquals(1L, n1.asLong());
Expand Down
2 changes: 1 addition & 1 deletion codec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: Codec</name>
<artifactId>immutable-json-codec</artifactId>
Expand Down
22 changes: 3 additions & 19 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: Core</name>
<artifactId>immutable-json-core</artifactId>
Expand All @@ -46,21 +47,4 @@
<artifactId>junit</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
23 changes: 4 additions & 19 deletions javax-json/pom.xml → glassfish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: javax.json</name>
<artifactId>immutable-json-javax</artifactId>
<name>Immutable JSON :: glassfish</name>
<artifactId>immutable-json-glassfish</artifactId>
<packaging>jar</packaging>

<dependencies>
Expand All @@ -50,26 +50,11 @@
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>1.1.6</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>--patch-module</arg>
<arg>immutable.json.core=${settings.localRepository}/net/hamnaberg/json/immutable-json-core/${project.version}/immutable-json-core-${project.version}-tests.jar</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module immutable.json.glassfish {
requires immutable.json.core;
requires immutable.json.codec;
requires java.json;
requires jakarta.json;
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package net.hamnaberg.json.javax;
package net.hamnaberg.json.glassfish;

import net.hamnaberg.json.Json;
import net.hamnaberg.json.io.JsonParseException;

import java.io.Reader;
import java.util.*;
import javax.json.stream.JsonParser;

public final class JavaxJsonParser extends net.hamnaberg.json.io.JsonParser {
import jakarta.json.stream.JsonParser;

public final class GlassfishJsonParser extends net.hamnaberg.json.io.JsonParser {
private final EnumSet<JsonParser.Event> scalarSet =
EnumSet.of(
JsonParser.Event.VALUE_STRING,
Expand All @@ -19,7 +20,7 @@ public final class JavaxJsonParser extends net.hamnaberg.json.io.JsonParser {

@Override
protected Json.JValue parseImpl(Reader reader) {
JsonParser parser = javax.json.Json.createParser(reader);
JsonParser parser = jakarta.json.Json.createParser(reader);
try {
JsonParser.Event event;

Expand Down Expand Up @@ -63,14 +64,12 @@ private boolean isScalar(JsonParser.Event event) {
private Json.JArray handleArray(JsonParser parser) {
JsonParser.Event event;
List<Json.JValue> list = new ArrayList<>();
while((event = parser.next())!= JsonParser.Event.END_ARRAY) {
while ((event = parser.next()) != JsonParser.Event.END_ARRAY) {
if (isScalar(event)) {
list.add(handleScalarValue(event, parser));
}
else if (event == JsonParser.Event.START_OBJECT) {
} else if (event == JsonParser.Event.START_OBJECT) {
list.add(handleObject(parser));
}
else if (event == JsonParser.Event.START_ARRAY) {
} else if (event == JsonParser.Event.START_ARRAY) {
list.add(handleArray(parser));
}
}
Expand All @@ -81,7 +80,7 @@ private Json.JObject handleObject(JsonParser parser) {
Map<String, Json.JValue> map = new LinkedHashMap<>();
JsonParser.Event event;
String name = null;
while((event = parser.next()) != JsonParser.Event.END_OBJECT) {
while ((event = parser.next()) != JsonParser.Event.END_OBJECT) {
if (event == JsonParser.Event.KEY_NAME) {
name = parser.getString();
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.hamnaberg.json.glassfish;

import net.hamnaberg.json.io.JsonParser;
import net.hamnaberg.json.io.JsonParserAbstractTest;

public class GlassfishStreamingJsonParserTest extends JsonParserAbstractTest {
@Override
protected JsonParser getParser() {
return new GlassfishJsonParser();
}
}
18 changes: 2 additions & 16 deletions gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: GSON parser</name>
<artifactId>immutable-json-gson</artifactId>
Expand Down Expand Up @@ -50,25 +50,11 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>--patch-module</arg>
<arg>immutable.json.core=${settings.localRepository}/net/hamnaberg/json/immutable-json-core/${project.version}/immutable-json-core-${project.version}-tests.jar</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
23 changes: 6 additions & 17 deletions jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>net.hamnaberg.json</groupId>
<artifactId>immutable-json</artifactId>
<version>7.2.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<name>Immutable JSON :: Jackson parser</name>
<artifactId>immutable-json-jackson</artifactId>
Expand Down Expand Up @@ -64,25 +64,14 @@
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<!--
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>&#45;&#45;patch-module</arg>
<arg>immutable.json.core=${settings.localRepository}/net/hamnaberg/json/immutable-json-core/${project.version}/immutable-json-core-${project.version}-tests.jar</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
-->
</project>
1 change: 1 addition & 0 deletions jackson/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
requires immutable.json.core;
requires immutable.json.codec;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.annotation;
}
Loading

0 comments on commit 0440a33

Please sign in to comment.