diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index d6b083aa..ed6d4059 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -8,6 +8,9 @@ on: - 'src/**' - 'pom.xml' +env: + JAVA_VERSION: '17' + jobs: check-version: runs-on: ubuntu-latest @@ -93,7 +96,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v4 with: - java-version: 11 + java-version: ${{ env.JAVA_VERSION }} distribution: adopt server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/create-snapshot.yml b/.github/workflows/create-snapshot.yml index aeefd745..8412953e 100644 --- a/.github/workflows/create-snapshot.yml +++ b/.github/workflows/create-snapshot.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, edited, synchronize, reopened, labeled] +env: + JAVA_VERSION: '17' + jobs: # begin the snapshot verification before deployment check-version: @@ -47,11 +50,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: "11" + java-version: ${{ env.JAVA_VERSION }} - name: Tests run: mvn test --no-transfer-progress @@ -79,7 +82,7 @@ jobs: - name: Set up Maven Central Repository uses: actions/setup-java@v4 with: - java-version: 11 + java-version: ${{ env.JAVA_VERSION }} distribution: adopt server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 81846b72..9eb80415 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, edited, synchronize, reopened] +env: + JAVA_VERSION: '17' + jobs: test: if: ${{ ! contains(github.event.pull_request.labels.*.name, 'deploy-snapshot') }} @@ -11,11 +14,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: "11" + java-version: ${{ env.JAVA_VERSION }} - name: Tests run: mvn test --no-transfer-progress \ No newline at end of file diff --git a/pom.xml b/pom.xml index dbfff366..7a062239 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ fr.insee.lunatic lunatic-model - 2.6.4 + 2.7.0 jar Lunatic Model @@ -20,9 +20,9 @@ UTF-8 UTF-8 - 11 + 17 - 12.4 + 12.5 @@ -66,7 +66,7 @@ org.eclipse.persistence eclipselink - 4.0.3 + 4.0.4 org.glassfish @@ -89,17 +89,17 @@ commons-io commons-io - 2.16.1 + 2.18.0 org.slf4j slf4j-api - 2.0.13 + 2.0.16 org.xmlunit - xmlunit-matchers + xmlunit-assertj3 2.10.0 test @@ -118,7 +118,7 @@ org.apache.logging.log4j log4j-slf4j-impl - 2.23.1 + 2.24.2 test @@ -129,7 +129,7 @@ org.junit.jupiter junit-jupiter - 5.10.2 + 5.11.3 test @@ -155,7 +155,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.3.1 + 3.5.2 UTF-8 -Dfile.encoding=UTF-8 @@ -305,7 +305,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.8.0 + 3.11.2 attach-javadocs @@ -330,7 +330,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.2.4 + 3.2.7 sign-artifacts diff --git a/src/test/java/fr/insee/lunatic/conversion/data/JsonToXmlDataTest.java b/src/test/java/fr/insee/lunatic/conversion/data/JsonToXmlDataTest.java new file mode 100644 index 00000000..abf01ab6 --- /dev/null +++ b/src/test/java/fr/insee/lunatic/conversion/data/JsonToXmlDataTest.java @@ -0,0 +1,58 @@ +package fr.insee.lunatic.conversion.data; + +import org.junit.jupiter.api.Test; +import org.xmlunit.assertj3.XmlAssert; + +class JsonToXmlDataTest { + + /** + * Lunatic bug: in some cases pairwise data can be inconsistent. + * Yet the data conversion shouldn't fail so as not to break the data extraction of client collection tools + * that uses the json to xml conversion. + */ + @Test + void convertInconsistentPairwiseData() throws Exception { + // Given + String jsonInconsistentData = """ + { + "COLLECTED": { + "LIENS_MISSING": { + "COLLECTED": [ + null, + [null, null] + ] + } + }, + "CALCULATED": {}, + "EXTERNAL": { + "FOO_EXTERNAL": "some value" + } + }"""; + // When + JSONLunaticDataToXML converter = new JSONLunaticDataToXML(); + String result = converter.transform(jsonInconsistentData); + // Then + String expected = """ + + + + + + + + + + + + + + + + some value + + + """; + XmlAssert.assertThat(expected).and(result).ignoreWhitespace().areIdentical(); + } + +}