Skip to content

Commit

Permalink
Merge pull request #106 from InseeFr/hotFixNoCollectedData
Browse files Browse the repository at this point in the history
Hot fix no collected data
  • Loading branch information
alicela authored Oct 8, 2024
2 parents d2dfc56 + c93f3ae commit 869ac43
Show file tree
Hide file tree
Showing 6 changed files with 1,165 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class LunaticXmlData {

private List<LunaticXmlCollectedData> collected;
private List<LunaticXmlOtherData> calculated;
private List<LunaticXmlOtherData> external;
private List<LunaticXmlCollectedData> collected=new ArrayList<>();
private List<LunaticXmlOtherData> calculated=new ArrayList<>();
private List<LunaticXmlOtherData> external=new ArrayList<>();


}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,31 @@ void reset() throws IOException {
.resolve("data.complete.validated.STPDv2.20231122164209.xml")
);
}
//SAMPLETEST-NO-COLLECTED
if (!testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("differential")
.resolve("data")
.resolve("data_diff_no_collected.xml")
.toFile().exists()
){
Files.copy(
testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("data_diff_no_collected.xml")
, testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("differential")
.resolve("data")
.resolve("data_diff_no_collected.xml")
);
}
}


Expand All @@ -227,6 +252,17 @@ void saveResponseFromXMLFileTest() throws Exception {
Assertions.assertThat(surveyUnitPersistencePortStub.getMongoStub()).isNotEmpty();
}

@Test
void saveOneFileNoCollected_NoNullPointerException(){
Assertions.assertThatCode(() -> responseControllerStatic.saveResponsesFromXmlFile(
Path.of(TestConstants.TEST_RESOURCES_DIRECTORY, "IN/WEB/SAMPLETEST-NO-COLLECTED/differential/data/data_diff_no_collected.xml").toString()
, Path.of(TestConstants.TEST_RESOURCES_DIRECTORY, "specs/SAMPLETEST-NO-COLLECTED/WEB/ddi_response_simple.xml").toString()
, Mode.WEB
, true
)).doesNotThrowAnyException();

}

@Test
void saveResponsesFromXmlCampaignFolderTest() throws Exception {
responseControllerStatic.saveResponsesFromXmlCampaignFolder(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Campaign>
<Id>NOCOLLECTED</Id>
<Label>Traiter - Questions Simples</Label>
<SurveyUnits>
<SurveyUnit>
<Id>00000001</Id>
<QuestionnaireModelId>NOCOLLECTED</QuestionnaireModelId>
<Data>
<CALCULATED/>
<EXTERNAL/>
</Data>
</SurveyUnit>
</SurveyUnits>
</Campaign>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Campaign>
<Id>NOCOLLECTED</Id>
<Label>Traiter - Questions Simples</Label>
<SurveyUnits>
<SurveyUnit>
<Id>00000001</Id>
<QuestionnaireModelId>NOCOLLECTED</QuestionnaireModelId>
<Data>
<CALCULATED/>
<EXTERNAL/>
</Data>
</SurveyUnit>
</SurveyUnits>
</Campaign>
Loading

0 comments on commit 869ac43

Please sign in to comment.