diff --git a/pom.xml b/pom.xml index 76b93c04..cc56bb8b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.insee.queen queen - 3.0.4 + 3.0.5 war Queen-Back-Office Back-office services for Queen @@ -391,7 +391,7 @@ src/main/resources/db/master.xml src/main/resources/db/changelog/new_changelog.xml org.postgresql.Driver - jdbc:postgresql://localhost:5433/queen_api + jdbc:postgresql://localhost:5432/queen_api public test,dev,prod user_capi3g diff --git a/src/main/java/fr/insee/queen/api/controller/NomenclatureController.java b/src/main/java/fr/insee/queen/api/controller/NomenclatureController.java index d10cece9..e5e08e7d 100644 --- a/src/main/java/fr/insee/queen/api/controller/NomenclatureController.java +++ b/src/main/java/fr/insee/queen/api/controller/NomenclatureController.java @@ -1,5 +1,6 @@ package fr.insee.queen.api.controller; +import java.util.List; import java.util.Optional; import java.util.Set; @@ -85,7 +86,7 @@ public ResponseEntity getNomenclatureById(@PathVariable(value = "id") St */ @ApiOperation(value = "Get list of required nomenclature by campaign Id ") @GetMapping(path = "/campaign/{id}/required-nomenclatures") - public ResponseEntity getListRequiredNomenclature(@PathVariable(value = "id") String id){ + public ResponseEntity> getListRequiredNomenclature(@PathVariable(value = "id") String id){ Optional campaignOptional = campaignService.findById(id); if (!campaignOptional.isPresent()) { LOGGER.info("GET required-nomenclatures for campaign with id {} resulting in 404", id); @@ -104,7 +105,7 @@ public ResponseEntity getListRequiredNomenclature(@PathVariable(value = */ @ApiOperation(value = "Get list of required nomenclature by campaign Id ") @GetMapping(path = "/questionnaire/{id}/required-nomenclatures") - public ResponseEntity getListRequiredNomenclatureByQuestionnaireId(@PathVariable(value = "id") String id){ + public ResponseEntity> getListRequiredNomenclatureByQuestionnaireId(@PathVariable(value = "id") String id){ Optional questionnaireOptional = questionnaireModelService.findById(id); if (!questionnaireOptional.isPresent()) { LOGGER.info("GET required-nomenclatures for questionnaire with id {} resulting in 404", id); diff --git a/src/main/java/fr/insee/queen/api/service/impl/NomenclatureServiceImpl.java b/src/main/java/fr/insee/queen/api/service/impl/NomenclatureServiceImpl.java index 44f7bc06..eb637d4c 100644 --- a/src/main/java/fr/insee/queen/api/service/impl/NomenclatureServiceImpl.java +++ b/src/main/java/fr/insee/queen/api/service/impl/NomenclatureServiceImpl.java @@ -47,7 +47,7 @@ public Optional findById(String id) { public List findRequiredNomenclatureByQuestionnaire(Set setQuestionnaireModel) { return setQuestionnaireModel.parallelStream().map(QuestionnaireModel::getNomenclatures).collect(Collectors.toList()) .parallelStream().flatMap(Set::parallelStream).collect(Collectors.toList()) - .parallelStream().distinct().map(Nomenclature::getLabel).collect(Collectors.toList()); + .parallelStream().distinct().map(Nomenclature::getId).collect(Collectors.toList()); } public List findRequiredNomenclatureByCampaign(String campaignId) { diff --git a/src/test/java/fr/insee/queen/api/authKeycloak/mongo/TestAuthKeycloakMongo.java b/src/test/java/fr/insee/queen/api/authKeycloak/mongo/TestAuthKeycloakMongo.java index 9e7fb880..ed991ad9 100644 --- a/src/test/java/fr/insee/queen/api/authKeycloak/mongo/TestAuthKeycloakMongo.java +++ b/src/test/java/fr/insee/queen/api/authKeycloak/mongo/TestAuthKeycloakMongo.java @@ -34,12 +34,13 @@ public void initialize(ConfigurableApplicationContext configurableApplicationCon .of("spring.data.mongodb.uri=" + mongoDBContainer.getReplicaSetUrl(), "keycloak.auth-server-url=" + keycloak.getAuthServerUrl()) .applyTo(configurableApplicationContext.getEnvironment()); + mongoDBContainer.start(); } } @AfterAll public static void cleanUp() { - if(mongoDBContainer!=null) { + if(mongoDBContainer!=null && mongoDBContainer.isRunning()) { mongoDBContainer.close(); } if(keycloak!=null) { diff --git a/src/test/java/fr/insee/queen/api/basicAuth/mongo/TestBasicAuthMongo.java b/src/test/java/fr/insee/queen/api/basicAuth/mongo/TestBasicAuthMongo.java index e2bec245..e4d43356 100644 --- a/src/test/java/fr/insee/queen/api/basicAuth/mongo/TestBasicAuthMongo.java +++ b/src/test/java/fr/insee/queen/api/basicAuth/mongo/TestBasicAuthMongo.java @@ -33,12 +33,13 @@ public void initialize(ConfigurableApplicationContext configurableApplicationCon TestPropertyValues .of("spring.data.mongodb.uri=" + mongoDBContainer.getReplicaSetUrl()) .applyTo(configurableApplicationContext.getEnvironment()); + mongoDBContainer.start(); } } @AfterAll public static void cleanUp() { - if(mongoDBContainer!=null) { + if(mongoDBContainer!=null && mongoDBContainer.isRunning()) { mongoDBContainer.close(); } if(mockServerClient!=null) { diff --git a/src/test/java/fr/insee/queen/api/noAuth/mongo/TestNoAuthMongo.java b/src/test/java/fr/insee/queen/api/noAuth/mongo/TestNoAuthMongo.java index 477c1865..aeef5e1f 100644 --- a/src/test/java/fr/insee/queen/api/noAuth/mongo/TestNoAuthMongo.java +++ b/src/test/java/fr/insee/queen/api/noAuth/mongo/TestNoAuthMongo.java @@ -37,13 +37,14 @@ public void initialize(ConfigurableApplicationContext configurableApplicationCon TestPropertyValues .of("spring.data.mongodb.uri=" + mongoDBContainer.getReplicaSetUrl()) .applyTo(configurableApplicationContext.getEnvironment()); + mongoDBContainer.start(); } } @AfterAll public static void cleanUp() { - if(mongoDBContainer!=null) { - mongoDBContainer.stop(); + if(mongoDBContainer!=null && mongoDBContainer.isRunning()) { + mongoDBContainer.close(); } } }