diff --git a/build.gradle.kts b/build.gradle.kts index ebc751b7f..6b6393705 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ java { allprojects { group = "fr.insee.eno" - version = "3.32.0-SNAPSHOT.1" + version = "3.32.1-SNAPSHOT" } subprojects { diff --git a/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogic.java b/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogic.java index 2beb01d3d..5280eea89 100644 --- a/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogic.java +++ b/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogic.java @@ -8,10 +8,7 @@ import fr.insee.lunatic.model.flat.variable.VariableType; import fr.insee.lunatic.model.flat.variable.VariableTypeEnum; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import static fr.insee.eno.core.processing.out.steps.lunatic.resizing.LunaticLoopResizingLogic.insertIterationEntry; @@ -48,7 +45,10 @@ public void buildResizingEntries(RosterForLoop lunaticRoster, ResizingType lunat // Concerned variables to be resized: responses of the roster component List resizedVariableNames = lunaticRoster.getComponents().stream() - .map(BodyCell::getResponse).map(ResponseType::getName).toList(); + .map(BodyCell::getResponse) + .filter(Objects::nonNull) + .map(ResponseType::getName) + .toList(); // Insert resizing entries (the logic is the same as for loops) resizingVariableNames.forEach(variableName -> insertIterationEntry( diff --git a/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogicTest.java b/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogicTest.java index aa55b5fa6..07cbdbb11 100644 --- a/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogicTest.java +++ b/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticRosterResizingLogicTest.java @@ -1,6 +1,7 @@ package fr.insee.eno.core.processing.out.steps.lunatic.resizing; import fr.insee.eno.core.DDIToEno; +import fr.insee.eno.core.DDIToLunatic; import fr.insee.eno.core.exceptions.business.DDIParsingException; import fr.insee.eno.core.mappers.LunaticMapper; import fr.insee.eno.core.model.EnoQuestionnaire; @@ -8,6 +9,7 @@ import fr.insee.eno.core.model.calculated.CalculatedExpression; import fr.insee.eno.core.model.question.DynamicTableQuestion; import fr.insee.eno.core.parameter.EnoParameters; +import fr.insee.eno.core.parameter.Format; import fr.insee.eno.core.processing.out.steps.lunatic.LunaticLoopResolution; import fr.insee.eno.core.processing.out.steps.lunatic.LunaticSortComponents; import fr.insee.eno.core.processing.out.steps.lunatic.table.LunaticTableProcessing; @@ -16,9 +18,11 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import java.io.InputStream; import java.math.BigInteger; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; class LunaticRosterResizingLogicTest { @@ -125,4 +129,16 @@ void integrationTest() throws DDIParsingException { lunaticResizing.getResizingEntry("HOW_MANY").getVariables()); } + @Test + void nonCollectedColumnCase_functionalTest() { + // Given + EnoParameters enoParameters = EnoParameters.of( + EnoParameters.Context.HOUSEHOLD, EnoParameters.ModeParameter.CAWI, Format.LUNATIC); + InputStream ddiInputStream = this.getClass().getClassLoader().getResourceAsStream( + "functional/ddi/ddi-m5o3qhu0.xml"); // DDI with non-collected column within a dynamic table + // When + then + DDIToLunatic ddiToLunatic = new DDIToLunatic(); + assertDoesNotThrow(() -> ddiToLunatic.transform(ddiInputStream, enoParameters)); + } + } diff --git a/eno-core/src/test/resources/functional/ddi/ddi-m5o3qhu0.xml b/eno-core/src/test/resources/functional/ddi/ddi-m5o3qhu0.xml new file mode 100644 index 000000000..3e8d75a6f --- /dev/null +++ b/eno-core/src/test/resources/functional/ddi/ddi-m5o3qhu0.xml @@ -0,0 +1,663 @@ + + + fr.insee + INSEE-m5o3qhu0 + 1 + + + testmath + + + + fr.insee + RessourcePackage-m5o3qhu0 + 1 + + fr.insee + InterviewerInstructionScheme-m5o3qhu0 + 1 + + A définir + + + + fr.insee + ControlConstructScheme-m5o3qhu0 + 1 + + fr.insee + Sequence-m5o3qhu0 + 1 + + testmath + + template + + fr.insee + m5o3pcl4 + 1 + Sequence + + + + fr.insee + m5o3pcl4 + 1 + + SEQUENCEMA + + + sequencemat + + module + + fr.insee + m5o4159y-QC + 1 + QuestionConstruct + + + + fr.insee + m5o4159y-QC + 1 + + MAQUESTION + + + fr.insee + m5o4159y + 1 + QuestionGrid + + + + + fr.insee + QuestionScheme-m5o3qhu0 + 1 + + A définir + + + fr.insee + m5o4159y + 1 + + MAQUESTION + + + fr.insee + m5o4159y-QOP-m5qwxh68 + 1 + + MAQUESTION2 + + + + fr.insee + m5o4159y-QOP-m5qx4x9q + 1 + + MAQUESTION3 + + + + + fr.insee + m5o4159y-RDOP-m5qwxh68 + 1 + OutParameter + + + fr.insee + m5o4159y-QOP-m5qwxh68 + 1 + OutParameter + + + + + fr.insee + m5o4159y-RDOP-m5qx4x9q + 1 + OutParameter + + + fr.insee + m5o4159y-QOP-m5qx4x9q + 1 + OutParameter + + + + + "Ma question" + + + + + + + vtl + + fr.insee + m5o4159y-DIM1-ITE-IP-1 + 1 + + CODE + + + + + fr.insee + CODE + 1 + InParameter + + + fr.insee + m5o4159y-DIM1-ITE-IP-1 + 1 + InParameter + + + count(m5o4159y-DIM1-ITE-IP-1) + + + + + + + + fr.insee + m5o4159y-secondDimension-fakeCL-1 + 1 + CodeList + + + + + + + + + + + + + + 0 + 100 + + Decimal + + fr.insee + m5o4159y-RDOP-m5qwxh68 + 1 + + + + + + + + + + + + + fr.insee + m5o4159y-RDOP-m5qx4x9q + 1 + + + + + + + + + + + + + ¤CODE¤ + fixedcell + + + + + + + + + + + fr.insee + CategoryScheme-m5o4159y-secondDimension-fakeCL-1 + 1 + + FAKE-CODELIST-m5o4159y-secondDimension-fakeCL-1 + + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-1 + 1 + + "code" + + + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-2 + 1 + + "montant" + + + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-3 + 1 + + AUtre var static + + + + + fr.insee + CategoryScheme-m5o3qhu0 + 1 + + A définir + + + fr.insee + INSEE-COMMUN-CA-Booleen-1 + 1 + + + + + + + fr.insee + TESTMATH-CLS + 1 + + TESTMATH + + + fr.insee + m5o4159y-secondDimension-fakeCL-1 + 1 + + FAKE-CODELIST-m5o4159y-secondDimension-fakeCL-1 + + Regular + + Ordinal + + + fr.insee + m5o4159y-secondDimension-fakeCL-1-1 + 1 + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-1 + 1 + Category + + 1 + + + fr.insee + m5o4159y-secondDimension-fakeCL-1-2 + 1 + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-2 + 1 + Category + + 2 + + + fr.insee + m5o4159y-secondDimension-fakeCL-1-3 + 1 + + fr.insee + CA-m5o4159y-secondDimension-fakeCL-1-3 + 1 + Category + + 3 + + + + fr.insee + INSEE-COMMUN-CL-Booleen + 1 + + Booleen + + Regular + + Ordinal + + + fr.insee + INSEE-COMMUN-CL-Booleen-1 + 1 + + fr.insee + INSEE-COMMUN-CA-Booleen-1 + 1 + Category + + 1 + + + + + fr.insee + VariableScheme-m5o3qhu0 + 1 + + Variable Scheme for the survey + + + fr.insee + m5o3v9m6 + 1 + + NB_LIGNES + + + "Nombre ligne" + + + fr.insee + m5o3v9m6-VROP + 1 + + + + fr.insee + m5o3v9m6-GI + 1 + GenerationInstruction + + + fr.insee + m5o3v9m6-GOP + 1 + OutParameter + + + fr.insee + m5o3v9m6-VROP + 1 + OutParameter + + + + + + 0 + 10 + + Decimal + + + + + fr.insee + m5o3md8d + 1 + + CODE + + + code + + + + + + + fr.insee + m5qx3r16 + 1 + + MAQUESTION2 + + + montant + + + fr.insee + m5o4159y-QOP-m5qwxh68 + 1 + OutParameter + + + fr.insee + m5o4159y + 1 + QuestionGrid + + + + + 0 + 100 + + Decimal + + + + + fr.insee + m5qx0jds + 1 + + MAQUESTION3 + + + AUtre var static + + + fr.insee + m5o4159y-QOP-m5qx4x9q + 1 + OutParameter + + + fr.insee + m5o4159y + 1 + QuestionGrid + + + + + + + fr.insee + m5o4159y-vg + 1 + + + fr.insee + m5o4159y + 1 + QuestionGrid + + + Loop + + MAQUESTION + + + fr.insee + m5o3md8d + 1 + Variable + + + fr.insee + m5qx3r16 + 1 + Variable + + + fr.insee + m5qx0jds + 1 + Variable + + + + fr.insee + INSEE-Instrument-m5o3qhu0-vg + 1 + + + fr.insee + Instrument-m5o3qhu0 + 1 + Instrument + + + Questionnaire + + TESTMATH + + + fr.insee + m5o3v9m6 + 1 + Variable + + + fr.insee + m5o4159y-vg + 1 + VariableGroup + + + + + fr.insee + INSEE-SIMPSONS-PIS-1 + 1 + + SIMPSONS + + + Processing instructions of the Simpsons questionnaire + + + fr.insee + m5o3v9m6-GI + 1 + + + vtl + + fr.insee + m5o3v9m6-GOP + 1 + + if "1"="1" then 2 else 4 + + + + fr.insee + Sequence-m5o3qhu0 + 1 + Sequence + + + + + fr.insee + INSEE-SIMPSONS-MRS + 1 + + Liste de formats numériques et dates de + l'enquête + Numeric and DateTime list for the survey + + + + + fr.insee + StudyUnit-m5o3qhu0 + 1 + + + fr.insee + DataCollection-m5o3qhu0 + 1 + + fr.insee + QuestionScheme-m5o3qhu0 + 1 + QuestionScheme + + + fr.insee + ControlConstructScheme-m5o3qhu0 + 1 + ControlConstructScheme + + + fr.insee + InterviewerInstructionScheme-m5o3qhu0 + 1 + InterviewerInstructionScheme + + + fr.insee + InstrumentScheme-m5o3qhu0 + 1 + + fr.insee + Instrument-m5o3qhu0 + 1 + + TESTMATH + + + testmath questionnaire + + A définir + + fr.insee + Sequence-m5o3qhu0 + 1 + Sequence + + + + + +