JSONB tck re-enabled (#538)
JSONB tck re-enabled
Signed-off-by: David Kral <david.k.kral@oracle.com>
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index fb8c541..0ea3485 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -53,7 +53,6 @@
distribution: 'adopt'
java-version: ${{ matrix.java_version }}
- name: Yasson tests
- run: mvn -U -C -Dmaven.javadoc.skip=true -Pstaging verify
-# TMP removal
-# - name: JSONB-API TCK
-# run: cd yasson-tck && mvn -U -B test
+ run: mvn -U -B -C -Dmaven.javadoc.skip=true -Pstaging verify
+ - name: JSONB-API TCK
+ run: cd yasson-tck && mvn -U -B test -DargLine="-Djava.locale.providers=COMPAT"
diff --git a/pom.xml b/pom.xml
index af5f3b0..d60d21b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <jakarta.json.version>2.0.1</jakarta.json.version>
+ <jakarta.json.version>2.1.0</jakarta.json.version>
+ <parson.version>2.1.0</parson.version>
<jakarta.json.bind.version>3.0.0-RC1</jakarta.json.bind.version>
<jakarta.enterprise.cdi-api.version>4.0.0-RC2</jakarta.enterprise.cdi-api.version>
<netbeans.hint.jdkPlatform>JDK_9</netbeans.hint.jdkPlatform>
@@ -53,10 +54,9 @@
<version>${jakarta.json.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish</groupId>
- <artifactId>jakarta.json</artifactId>
- <version>${jakarta.json.version}</version>
- <classifier>module</classifier>
+ <groupId>org.eclipse.parsson</groupId>
+ <artifactId>parsson</artifactId>
+ <version>1.1.0</version>
</dependency>
<!-- Test/Provided dependencies -->
<dependency>
diff --git a/src/test/resources/test.policy b/src/test/resources/test.policy
index 98f0a53..fe7d101 100644
--- a/src/test/resources/test.policy
+++ b/src/test/resources/test.policy
@@ -1,13 +1,16 @@
grant {
+ //needed to be able to read all files including META-INF entries
+ permission "java.io.FilePermission" "<<ALL FILES>>", "read";
- permission java.io.FilePermission "${build.directory}/-", "read";
permission "java.lang.reflect.ReflectPermission" "suppressAccessChecks";
permission "java.lang.RuntimePermission" "accessDeclaredMembers";
permission "java.lang.RuntimePermission" "createSecurityManager";
permission java.lang.RuntimePermission "setSecurityManager";
permission "java.lang.RuntimePermission" "getProtectionDomain";
+ permission "java.lang.RuntimePermission" "getClassLoader";
permission "java.util.PropertyPermission" "*", "write";
permission "java.util.PropertyPermission" "jsonb.creator-parameters-required", "read";
+ permission "java.util.PropertyPermission" "jakarta.json.provider", "read";
};
\ No newline at end of file
diff --git a/yasson-tck/pom.xml b/yasson-tck/pom.xml
index b3b5088..3bce315 100644
--- a/yasson-tck/pom.xml
+++ b/yasson-tck/pom.xml
@@ -30,23 +30,13 @@
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-tck</artifactId>
<version>${jsonb.tck.version}</version>
-<!-- Limitation to the test scope has been temporarily removed due to NumberFormatCustomizationTest, once it is removed,
- test scope will be enabled again-->
- <!-- <scope>test</scope>-->
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>${yasson.version}</version>
- <!-- Limitation to the test scope has been temporarily removed due to NumberFormatCustomizationTest, once it is removed,
- test scope will be enabled again-->
-<!-- <scope>test</scope>-->
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-weld-embedded</artifactId>
- <version>3.0.0.Alpha1</version>
- <scope>test</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.se</groupId>
@@ -60,11 +50,15 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0-M4</version>
+ <version>3.0.0-M5</version>
<configuration>
<dependenciesToScan>
<dependency>jakarta.json.bind:jakarta.json.bind-tck</dependency>
</dependenciesToScan>
+ <!-- Temporal removal until it is properly set-->
+ <excludes>
+ <exclude>**/*JSONBSigTest.*</exclude>
+ </excludes>
<trimStackTrace>false</trimStackTrace>
<failIfNoTests>true</failIfNoTests>
</configuration>
diff --git a/yasson-tck/src/main/java/ee/jakarta/tck/json/bind/customizedmapping/numberformat/NumberFormatCustomizationTest.java b/yasson-tck/src/main/java/ee/jakarta/tck/json/bind/customizedmapping/numberformat/NumberFormatCustomizationTest.java
deleted file mode 100644
index a49d251..0000000
--- a/yasson-tck/src/main/java/ee/jakarta/tck/json/bind/customizedmapping/numberformat/NumberFormatCustomizationTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2017, 2022 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
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-/*
- * $Id$
- */
-
-package ee.jakarta.tck.json.bind.customizedmapping.numberformat;
-
-import java.text.DecimalFormatSymbols;
-import java.util.Locale;
-
-import jakarta.json.bind.Jsonb;
-import jakarta.json.bind.JsonbBuilder;
-
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.AccessorCustomizedDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.FieldCustomizedDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.TypeCustomizedDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.TypeCustomizedFieldOverriddenDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.customized.PackageCustomizedDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.customized.PackageCustomizedTypeOverriddenDoubleContainer;
-import ee.jakarta.tck.json.bind.customizedmapping.numberformat.model.customized.PackageCustomizedTypeOverriddenFieldOverriddenDoubleContainer;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.matchesPattern;
-
-/**
- * @test
- * @sources NumberFormatCustomizationTest.java
- * @executeClass com.sun.ts.tests.jsonb.customizedmapping.numberformat.NumberFormatCustomizationTest
- **/
-public class NumberFormatCustomizationTest {
-
- private static final String FRENCH_NUMBER = "\"123\\u00a0456,789\"";
-
- private final Jsonb jsonb = JsonbBuilder.create();
-
- /*
- * @testName: testNumberFormatPackage
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1
- *
- * @test_Strategy: Assert that package annotation with JsonbNumberFormat is
- * correctly applied
- */
- @Test
- public void testNumberFormatPackage() {
- String jsonString = jsonb.toJson(new PackageCustomizedDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly customize number format during marshalling using JsonbNumberFormat annotation on "
- + "package.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123.456,8\"\\s*\\}"));
-
- PackageCustomizedDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : \"123.456,789\" }",
- PackageCustomizedDoubleContainer.class);
-
- assertThat(
- "Failed to correctly customize number format during unmarshalling using JsonbNumberFormat annotation on package.",
- unmarshalledObject.getInstance(),
- is(123456.789));
- }
-
- /*
- * @testName: testNumberFormatType
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1
- *
- * @test_Strategy: Assert that type annotation with JsonbNumberFormat is
- * correctly applied
- */
- @Test
- public void testNumberFormatType() {
- String jsonString = jsonb.toJson(new TypeCustomizedDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly customize number format during marshalling using JsonbNumberFormat annotation on type.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123,456.79\"\\s*\\}"));
-
- TypeCustomizedDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : \"123,456.789\" }",
- TypeCustomizedDoubleContainer.class);
- assertThat("Failed to correctly customize number format during unmarshalling using JsonbNumberFormat annotation on type.",
- unmarshalledObject.getInstance(), is(123456.789));
-
- }
-
- /*
- * @testName: testNumberFormatField
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1
- *
- * @test_Strategy: Assert that field annotation with JsonbNumberFormat is
- * correctly applied
- */
- @Test
- public void testNumberFormatField() {
- char separator = DecimalFormatSymbols.getInstance(Locale.FRENCH).getGroupingSeparator();
- String jsonString = jsonb.toJson(new FieldCustomizedDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly customize number format during marshalling using JsonbNumberFormat annotation on field.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123" + separator + "456,789\"\\s*\\}"));
-
- FieldCustomizedDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : " + FRENCH_NUMBER + " }",
- FieldCustomizedDoubleContainer.class);
- assertThat("Failed to correctly customize number format during unmarshalling using JsonbNumberFormat annotation on "
- + "field.",
- unmarshalledObject.getInstance(), is(123456.789));
- }
-
- /*
- * @testName: testNumberFormatAccessors
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1
- *
- * @test_Strategy: Assert that accessor annotation with JsonbNumberFormat is
- * correctly individually applied for marshalling and unmarshalling
- */
- @Test
- public void testNumberFormatAccessors() {
- String jsonString = jsonb.toJson(new AccessorCustomizedDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly customize number format during marshalling using JsonbNumberFormat annotation on getter.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123,456.79\"\\s*\\}"));
-
- AccessorCustomizedDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : " + FRENCH_NUMBER + " }",
- AccessorCustomizedDoubleContainer.class);
- assertThat(
- "Failed to correctly customize number format during unmarshalling using JsonbNumberFormat annotation on setter.",
- unmarshalledObject.getInstance(),
- is(123456.789));
- }
-
- /*
- * @testName: testNumberFormatPackageTypeOverride
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1; JSONB:SPEC:JSB-4.9-2
- *
- * @test_Strategy: Assert that package annotation with JsonbNumberFormat is
- * correctly overridden by type annotation with JsonbNumberFormat
- */
- @Test
- public void testNumberFormatPackageTypeOverride() {
- String jsonString = jsonb.toJson(new PackageCustomizedTypeOverriddenDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly override number format customization using JsonbNumberFormat annotation on "
- + "package during marshalling using JsonbNumberFormat annotation on type.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123,456.79\"\\s*\\}"));
-
- PackageCustomizedTypeOverriddenDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : \"123,456.789\" }",
- PackageCustomizedTypeOverriddenDoubleContainer.class);
- assertThat("Failed to correctly override number format customization using JsonbNumberFormat annotation on "
- + "package during unmarshalling using JsonbNumberFormat annotation on type.",
- unmarshalledObject.getInstance(), is(123456.789));
- }
-
- /*
- * @testName: testNumberFormatTypeFieldOverride
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1; JSONB:SPEC:JSB-4.9-2
- *
- * @test_Strategy: Assert that type annotation with JsonbNumberFormat is
- * correctly overridden by field annotation with JsonbNumberFormat
- */
- @Test
- public void testNumberFormatTypeFieldOverride() {
- String jsonString = jsonb.toJson(new TypeCustomizedFieldOverriddenDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly customize number format during marshalling using JsonbNumberFormat annotation on type.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123,456.8\"\\s*\\}"));
-
- TypeCustomizedFieldOverriddenDoubleContainer unmarshalledObject = jsonb.fromJson("{ \"instance\" : \"123,456.789\" }",
- TypeCustomizedFieldOverriddenDoubleContainer.class);
- assertThat("Failed to correctly customize number format during unmarshalling using JsonbNumberFormat annotation on type.",
- unmarshalledObject.getInstance(), is(123456.789));
- }
-
- /*
- * @testName: testNumberFormatPackageTypeOverrideFieldOverride
- *
- * @assertion_ids: JSONB:SPEC:JSB-4.9-1; JSONB:SPEC:JSB-4.9-2
- *
- * @test_Strategy: Assert that package and type annotation with
- * JsonbNumberFormat is correctly overridden by field annotation with
- * JsonbNumberFormat
- */
- @Test
- public void testNumberFormatPackageTypeOverrideFieldOverride() {
- String jsonString = jsonb.toJson(new PackageCustomizedTypeOverriddenFieldOverriddenDoubleContainer() {{
- setInstance(123456.789);
- }});
- assertThat("Failed to correctly override number format customization using JsonbNumberFormat annotation on "
- + "package during marshalling using JsonbNumberFormat annotation on type.",
- jsonString, matchesPattern("\\{\\s*\"instance\"\\s*:\\s*\"123.456,789\"\\s*\\}"));
-
- PackageCustomizedTypeOverriddenFieldOverriddenDoubleContainer unmarshalledObject =
- jsonb.fromJson("{ \"instance\" : \"123.456,789\" }",
- PackageCustomizedTypeOverriddenFieldOverriddenDoubleContainer.class);
- assertThat("Failed to correctly override number format customization using JsonbNumberFormat annotation on "
- + "package during unmarshalling using JsonbNumberFormat annotation on type.",
- unmarshalledObject.getInstance(), is(123456.789));
- }
-
-}