Skip to content

Commit

Permalink
Merge branch 'v2-next' into renovate/v2-main-all-minor-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
nsenave committed Dec 10, 2024
2 parents 82f4be2 + f36a123 commit 58c3f1b
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- 'src/**'
- 'pom.xml'

env:
JAVA_VERSION: '17'

jobs:
check-version:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/create-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ on:
pull_request:
types: [opened, edited, synchronize, reopened]

env:
JAVA_VERSION: '17'

jobs:
test:
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'deploy-snapshot') }}
runs-on: ubuntu-latest
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
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>fr.insee.lunatic</groupId>
<artifactId>lunatic-model</artifactId>
<version>2.6.5</version>
<version>2.7.0</version>
<packaging>jar</packaging>

<name>Lunatic Model</name>
Expand All @@ -20,7 +20,7 @@
<!-- Build properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.release>17</maven.compiler.release>
<!-- Version properties -->
<saxon.version>12.5</saxon.version>
</properties>
Expand Down Expand Up @@ -99,7 +99,7 @@

<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-matchers</artifactId>
<artifactId>xmlunit-assertj3</artifactId>
<version>2.10.0</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = """
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<COLLECTED>
<LIENS_MISSING>
<COLLECTED>
<COLLECTED type="null"/>
<COLLECTED>
<COLLECTED type="null"/>
<COLLECTED type="null"/>
</COLLECTED>
</COLLECTED>
</LIENS_MISSING>
</COLLECTED>
<CALCULATED/>
<EXTERNAL>
<FOO_EXTERNAL type="string">some value</FOO_EXTERNAL>
</EXTERNAL>
</Data>
""";
XmlAssert.assertThat(expected).and(result).ignoreWhitespace().areIdentical();
}

}

0 comments on commit 58c3f1b

Please sign in to comment.