diff --git a/magma-gestion-impl/pom.xml b/magma-gestion-impl/pom.xml
index 4e457dce3..c9e5913a7 100644
--- a/magma-gestion-impl/pom.xml
+++ b/magma-gestion-impl/pom.xml
@@ -114,6 +114,11 @@
boot-properties-logger-starter
1.5.0
+
+ fr.insee.rmes
+ magma-gestion-interface
+ test
+
diff --git a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java
index d56b7302f..f21d9cc1c 100644
--- a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java
+++ b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java
@@ -194,4 +194,15 @@ public DataSetModelSwagger(Id id, List title, Uri uri, Modified mod
this.validationState = validationState;
this.themeModelSwaggerS = themeModelSwaggerS;
}
+
+ public DataSetModelSwagger(Id id, List title, Uri uri, String validationState, CatalogRecordCreated catalogRecordCreated, CatalogRecordModified catalogRecordModified, CatalogRecordCreator catalogRecordCreator, CatalogRecordContributor catalogRecordContributor) {
+ this.id = id.toString();
+ this.title = title;
+ this.uri = uri.toString();
+ this.validationState = validationState;
+ this.catalogRecordContributor = catalogRecordContributor;
+ this.catalogRecordCreator = catalogRecordCreator;
+ this.catalogRecordCreated = catalogRecordCreated;
+ this.catalogRecordModified = catalogRecordModified;
+ }
}
diff --git a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java
index 87c09158a..7f171b0b4 100644
--- a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java
+++ b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java
@@ -152,13 +152,22 @@ protected DataSetModelSwagger findDataSetModelSwagger(String id) throws RmesExce
List title = constructLangContent(catalogue_result.getString("titleLg1"), catalogue_result.getString("titleLg2"));
Id id1=new Id(catalogue_result.getString("id"));
Uri uri = new Uri(catalogue_result.getString("uri"));
- DisseminationStatus disseminationStatus = new DisseminationStatus(ontologies_result.getString("labeldisseminationStatusLg1"));
+
CatalogRecordCreated catalogRecordCreated = new CatalogRecordCreated(catalogue_result.getString("catalogRecordCreated"));
CatalogRecordModified catalogRecordModified = new CatalogRecordModified(catalogue_result.getString("catalogRecordModified"));
CatalogRecordCreator catalogRecordCreator = new CatalogRecordCreator(catalogue_result.getString("catalogRecordCreator"));
CatalogRecordContributor catalogRecordContributor = new CatalogRecordContributor(catalogue_result.getString("catalogRecordContributor"));
String validationState = catalogue_result.getString("statutValidation");
- DataSetModelSwagger response = new DataSetModelSwagger(id1, title, uri, validationState, disseminationStatus, catalogRecordCreated,catalogRecordModified,catalogRecordCreator,catalogRecordContributor);
+
+ DisseminationStatus disseminationStatus = null;
+ DataSetModelSwagger response = null;
+ if (ontologies_result.has("labeldisseminationStatusLg1")){
+ disseminationStatus = new DisseminationStatus(ontologies_result.getString("labeldisseminationStatusLg1"));
+ response = new DataSetModelSwagger(id1, title, uri, validationState, disseminationStatus, catalogRecordCreated, catalogRecordModified, catalogRecordCreator, catalogRecordContributor);
+ } else {
+ response = new DataSetModelSwagger(id1, title, uri, validationState, catalogRecordCreated, catalogRecordModified, catalogRecordCreator, catalogRecordContributor);
+ }
+
testPresenceVariablePuisAjout(response,catalogue_result,adms_result,codes_result,organisations_result,structures_result);
return response;
} else {
@@ -524,10 +533,14 @@ private List getWasGeneratedBy(List operationStat) throws RmesE
params.put("URI", s.replace(" ", ""));
JSONObject wasGeneratedByQuery = repoGestion.getResponseAsObject(buildRequest(Constants.DATASETS_QUERIES_PATH+DATASET_BY_ID_PATH, "getDataSetByIdWasGeneratedBy.ftlh", params));
- List wasGeneratedByTitles = constructLangContent(wasGeneratedByQuery.getString("labelwasGeneratedByLg1"),wasGeneratedByQuery.getString("labelwasGeneratedByLg2"));
- IdLabel wasGeneratedByIdLabel = new IdLabel(wasGeneratedByQuery.getString("wasGeneratedById"),wasGeneratedByTitles);
- wasGeneratedByIdLabel.setType(wasGeneratedByQuery.getString("typeWasGeneratedBy"));
- wasGeneratedBy.add(wasGeneratedByIdLabel);
+ List wasGeneratedByTitles = null;
+ IdLabel wasGeneratedByIdLabel = null;
+ if (wasGeneratedByQuery.has("wasGeneratedById")) {
+ wasGeneratedByTitles = constructLangContent(wasGeneratedByQuery.getString("labelwasGeneratedByLg1"), wasGeneratedByQuery.getString("labelwasGeneratedByLg2"));
+ wasGeneratedByIdLabel = new IdLabel(wasGeneratedByQuery.getString("wasGeneratedById"), wasGeneratedByTitles);
+ wasGeneratedByIdLabel.setType(wasGeneratedByQuery.getString("typeWasGeneratedBy"));
+ wasGeneratedBy.add(wasGeneratedByIdLabel);
+ }
}
return wasGeneratedBy;
}
diff --git a/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh b/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh
index 161eead31..d3e4b213e 100644
--- a/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh
+++ b/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh
@@ -2,9 +2,13 @@ select distinct ?id ?dateModification
FROM
where {
- ?uri a dcat:Dataset ;
- dcterms:identifier "${ID}" ;
- dcterms:identifier ?id ;
- OPTIONAL {?uri dcterms:modified ?dateModification . }
+ ?uri a dcat:Dataset ;
+ dcterms:identifier "${ID}" ;
+ dcterms:identifier ?id ;
+ OPTIONAL {
+ ?record a dcat:CatalogRecord ;
+ foaf:primaryTopic ?uri ;
+ dcterms:modified ?dateModification .
+ }
-} group by ?id ?dateModification
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/modelSwagger/datasets/DataSetModelSwaggerTest.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/modelSwagger/datasets/DataSetModelSwaggerTest.java
new file mode 100644
index 000000000..4b803de0e
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/modelSwagger/datasets/DataSetModelSwaggerTest.java
@@ -0,0 +1,87 @@
+package fr.insee.rmes.magma.gestion.old.modelSwagger.datasets;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import fr.insee.rmes.magma.gestion.old.model.datasets.*;
+import fr.insee.rmes.magma.gestion.old.modelSwagger.dataset.DataSetModelSwagger;
+import fr.insee.rmes.magma.gestion.old.modelSwagger.dataset.LangContent;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class DataSetModelSwaggerTest {
+
+
+ @Test
+ void verify_jacksonAnnotation_test() throws JsonProcessingException, JSONException {
+ var dataSetModelSwagger=new DataSetModelSwagger();
+ dataSetModelSwagger.setCatalogRecordContributor(new CatalogRecordContributor("test_contributor"));
+ dataSetModelSwagger.setCatalogRecordCreated(new CatalogRecordCreated("recordCreated"));
+ dataSetModelSwagger.setCatalogRecordCreator(new CatalogRecordCreator("creator"));
+ dataSetModelSwagger.setCatalogRecordModified(new CatalogRecordModified("modified"));
+ ObjectMapper mapper=new JsonMapper();
+ var result=mapper.writeValueAsString(dataSetModelSwagger);
+ var json=new JSONObject(result);
+
+ assertThat(json.keySet()).contains("catalogRecordContributor", "catalogRecordCreated", "catalogRecordCreator", "catalogRecordModified");
+ assertThat(result).contains("\"catalogRecordContributor\":\"test_contributor\"",
+ "\"catalogRecordCreated\":\"recordCreated\"",
+ "\"catalogRecordCreator\":\"creator\"",
+ "\"catalogRecordModified\":\"modified\"");
+ }
+
+ @Test
+ void constructor_withIdTitleUriValidationStateAndCatalogFields_shouldSetAllFields() {
+ Id id = new Id("jd1000");
+ Uri uri = new Uri("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ List title = List.of(new LangContent("fr", "Titre FR"), new LangContent("en", "Title EN"));
+ String validationState = "Published";
+ CatalogRecordCreated created = new CatalogRecordCreated("2024-01-01T00:00:00");
+ CatalogRecordModified modified = new CatalogRecordModified("2024-06-15T10:00:00");
+ CatalogRecordCreator creator = new CatalogRecordCreator("creator1");
+ CatalogRecordContributor contributor = new CatalogRecordContributor("contributor1");
+
+ DataSetModelSwagger result = new DataSetModelSwagger(id, title, uri, validationState, created, modified, creator, contributor);
+
+ assertThat(result.getId()).isEqualTo("jd1000");
+ assertThat(result.getUri()).isEqualTo("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ assertThat(result.getTitle()).isEqualTo(title);
+ assertThat(result.getValidationState()).isEqualTo("Published");
+ assertThat(result.getCatalogRecordCreated()).isEqualTo(created);
+ assertThat(result.getCatalogRecordModified()).isEqualTo(modified);
+ assertThat(result.getCatalogRecordCreator()).isEqualTo(creator);
+ assertThat(result.getCatalogRecordContributor()).isEqualTo(contributor);
+ }
+
+ @Test
+ void constructor_withIdTitleUriValidationStateAndCatalogFields_shouldSerializeToJson() throws JsonProcessingException, JSONException {
+ Id id = new Id("jd1000");
+ Uri uri = new Uri("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ List title = List.of(new LangContent("fr", "Titre FR"), new LangContent("en", "Title EN"));
+ CatalogRecordCreated created = new CatalogRecordCreated("2024-01-01T00:00:00");
+ CatalogRecordModified modified = new CatalogRecordModified("2024-06-15T10:00:00");
+ CatalogRecordCreator creator = new CatalogRecordCreator("creator1");
+ CatalogRecordContributor contributor = new CatalogRecordContributor("contributor1");
+
+ DataSetModelSwagger result = new DataSetModelSwagger(id, title, uri, "Published", created, modified, creator, contributor);
+
+ ObjectMapper mapper = new JsonMapper();
+ String json = mapper.writeValueAsString(result);
+ JSONObject jsonObject = new JSONObject(json);
+
+ assertThat(jsonObject.getString("id")).isEqualTo("jd1000");
+ assertThat(jsonObject.getString("uri")).isEqualTo("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ assertThat(jsonObject.getString("validationState")).isEqualTo("Published");
+ assertThat(jsonObject.getString("catalogRecordCreated")).isEqualTo("2024-01-01T00:00:00");
+ assertThat(jsonObject.getString("catalogRecordModified")).isEqualTo("2024-06-15T10:00:00");
+ assertThat(jsonObject.getString("catalogRecordCreator")).isEqualTo("creator1");
+ assertThat(jsonObject.getString("catalogRecordContributor")).isEqualTo("contributor1");
+ assertThat(jsonObject.getJSONArray("title")).hasSize(2);
+ }
+
+}
\ No newline at end of file
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/persistence/RdfServiceTest.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/persistence/RdfServiceTest.java
new file mode 100644
index 000000000..9057882f2
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/persistence/RdfServiceTest.java
@@ -0,0 +1,68 @@
+package fr.insee.rmes.magma.gestion.old.persistence;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class RdfServiceTest {
+
+ private RdfService rdfService;
+
+ @BeforeEach
+ void init(){
+ rdfService=new RdfService() {};
+ }
+
+ @Test
+ @DisplayName("Test de formatLabel, cas nominal")
+ void formatLabelTest_nominal() throws JSONException{
+ JSONObject jsonObject=new JSONObject();
+ jsonObject.put("prefLabelLg1", "description en français");
+ jsonObject.put("prefLabelLg2", "english description");
+ JSONArray expected=new JSONArray("[{\"contenu\":\"description en français\"},{\"contenu\":\"english description\"}]");
+ JSONAssert.assertEquals(expected, rdfService.formatLabel(jsonObject), false);
+ }
+
+ @Test
+ void formatLabelTest_empty() {
+ JSONObject jsonObject=new JSONObject();
+ assertThrows(JSONException.class, ()->rdfService.formatLabel(jsonObject));
+ }
+
+ @Test
+ @DisplayName("Test de formatNom, cas nominal")
+ void formatNomTest_nominal() throws JSONException{
+ JSONObject jsonObject=new JSONObject();
+ jsonObject.put("altLabelLg1", "description en français");
+ jsonObject.put("altLabelLg2", "english description");
+ JSONArray expected=new JSONArray("[{\"contenu\":\"description en français\"},{\"contenu\":\"english description\"}]");
+ System.out.println(rdfService.formatNom(jsonObject));
+ JSONAssert.assertEquals(expected, rdfService.formatNom(jsonObject), false);
+ }
+
+ @Test
+ @DisplayName("Test de getValidationState")
+ void getValidationStateTest() {
+ //GIVEN
+ String str = "Validated";
+ String str2 = "UnPubLIShed";
+ String str3 = "Modified";
+ //WHEN
+ String result = rdfService.getValidationState(str);
+ String result2 = rdfService.getValidationState(str2);
+ String result3 = rdfService.getValidationState(str3);
+ //THEN
+ assertEquals("Publiée", result);
+ assertEquals("Provisoire, jamais publiée", result2);
+ assertEquals("Provisoire, déjà publiée", result3);
+ }
+
+
+
+}
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImplTest.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImplTest.java
new file mode 100644
index 000000000..b09c087c3
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImplTest.java
@@ -0,0 +1,482 @@
+package fr.insee.rmes.magma.gestion.old.services.datasets;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import fr.insee.rmes.magma.gestion.old.datasets.PatchDatasetDTO;
+import fr.insee.rmes.magma.gestion.old.modelSwagger.dataset.*;
+import fr.insee.rmes.magma.gestion.old.model.datasets.*;
+import fr.insee.rmes.magma.gestion.old.persistence.RepositoryGestion;
+import fr.insee.rmes.magma.gestion.old.utils.DataSetsUtilsTest;
+import fr.insee.rmes.services.utils.ResponseUtilsTest;
+import fr.insee.rmes.stubs.FreeMarkerUtilsStub;
+import fr.insee.rmes.utils.config.Config;
+import fr.insee.rmes.utils.exceptions.RmesException;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.http.HttpStatus;
+
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+import static java.util.Optional.empty;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+class DataSetsImplTest {
+
+ private static final DataSetModelSwagger response = new DataSetModelSwagger();
+ @InjectMocks
+ DataSetsImpl dataSetsImpl = new DataSetsImpl(new FreeMarkerUtilsStub());
+ @Mock
+ RepositoryGestion repoGestion;
+ public static final ObjectMapper MAPPER = new JsonMapper();
+
+ @Test
+ void getListDataSetsTest() throws RmesException, JsonProcessingException {
+ JSONArray mockJSON = new JSONArray(DataSetsUtilsTest.DATA_SET_LIST);
+ when(repoGestion.getResponseAsArray(Mockito.anyString())).thenReturn(mockJSON);
+ assertThat(MAPPER.readTree(dataSetsImpl.getListDataSets(""))).isEqualTo(MAPPER.readTree(DataSetsUtilsTest.EXPECTED_GET_DATA_SET_LIST));
+ }
+
+ @Test
+ void setTitreListTest() {
+ LangContent titre1 = new LangContent("fr", "elementLg1");
+ LangContent titre2 = new LangContent("en", "elementLg2");
+ List titres = new ArrayList<>();
+ titres.add(titre1);
+ titres.add(titre2);
+ assertThat(titres).hasToString(DataSetsUtilsTest.EXPECTED_JSON_SET_TITRE_LIST);
+ }
+
+ @Test
+ void initParamsTest() {
+ Map params = new HashMap<>();
+ params.put("DATASETS_GRAPH", "DatasetGraphTest");
+ params.put("LG1", "fr");
+ params.put("LG2", "en");
+ params.put("ADMS_GRAPH", "AdmsGraphTest");
+ params.put("STRUCTURES_GRAPH", "StructureGraphTest");
+ params.put("CODES_GRAPH", "CodesGraphTest");
+ params.put("CONCEPTS_GRAPH", "ConceptsGraphTest");
+ params.put("ORGANISATIONS_GRAPH", "OrganisationsGraphTest");
+ params.put("OPERATIONS_GRAPH", "OperationsGraphTest");
+ params.put("ONTOLOGIES_GRAPH", "OntologiesGraphTest");
+ assertEquals(DataSetsUtilsTest.EXPECTED_MAP_INIT_PARAMS, params.toString());
+ }
+
+ @Test
+ void shouldDisplayDataStructureDefinitionFormat() {
+
+ JSONObject structures_result = new JSONObject();
+ structures_result.put("uri", "http://uriTest");
+ structures_result.put("dsd", "TEST_CHAMP");
+ structures_result.put("structureId","dsdTest");
+ structures_result.put("type", "http://purl.org/linked-data/cube#DataStructureDefinition");
+ structures_result.put("DataStructureDefinition", "true");
+
+ boolean condition1 = structures_result.has("structureId") && structures_result.has("dsd");
+ boolean condition2 = (structures_result.has("uri") && structures_result.has("DataStructureDefinition"));
+ boolean condition3 = ("true").equals(structures_result.getString("DataStructureDefinition"));
+
+ assertEquals(List.of(true, true, true), List.of(condition1,condition2,condition3));
+ }
+
+ @Test
+ void shouldnotDisplayDataStructureDefinitionFormat1() {
+
+ JSONObject structures_result = new JSONObject();
+ structures_result.put("uri", "http://uriTest");
+ structures_result.put("dsd", "TEST_CHAMP");
+ structures_result.put("structureId","dsdTest");
+ structures_result.put("type", "http://purl.org/linked-data/cube#DataStructureDefinition");
+
+ boolean condition1 = structures_result.has("structureId") && structures_result.has("dsd");
+ boolean condition2 = (structures_result.has("uri") && structures_result.has("DataStructureDefinition"));
+
+ assertEquals(List.of(true,false), List.of(condition1,condition2));
+ }
+
+ @Test
+ void shouldnotDisplayDataStructureDefinitionFormat2() {
+ JSONObject structures_result = new JSONObject();
+ assertTrue(structures_result.isEmpty());
+ }
+
+ @Test
+ void shouldnotDisplayDataStructureDefinitionFormat3() {
+
+ JSONObject structures_result = new JSONObject();
+ structures_result.put("uri", "http://uriTest");
+ structures_result.put("dsd", "TEST_CHAMP");
+ structures_result.put("structureId","dsdTest");
+ structures_result.put("type", "http://purl.org/linked-data/cube#DataStructureDefinition");
+ structures_result.put("DataStructureDefinition", "false");
+
+ boolean condition1 = structures_result.has("structureId") && structures_result.has("dsd");
+ boolean condition2 = (structures_result.has("uri") && structures_result.has("DataStructureDefinition"));
+ boolean condition3 = ("false").equals(structures_result.getString("DataStructureDefinition"));
+
+ assertEquals(List.of(true, true, true), List.of(condition1,condition2,condition3));
+ }
+
+ //inutile je pense
+ @Test
+ void setIdLabelTest() {
+ List langContentList = new ArrayList<>();
+ LangContent langContent1 = new LangContent("fr", "content1");
+ LangContent langContent2 = new LangContent("en", "content2");
+ langContentList.add(langContent1);
+ langContentList.add(langContent2);
+ IdLabel idlabeltest = new IdLabel("id", langContentList);
+ assertEquals(DataSetsUtilsTest.EXPECTED_LANGCONTENTLIST_SET_ID_LABEL, idlabeltest.toString());
+ idlabeltest.setType("type");
+ assertEquals(DataSetsUtilsTest.EXPECTED_LANGCONTENTLIST_SET_ID_LABEL_WITH_TYPE, idlabeltest.toString());
+ }
+
+ //TODO petite méthode d'extraction des URIs
+ @Test
+ void getThemeModelSwaggerSTest() {
+ String liste_uris = "uri0, uri1 ,uri2 , uri3";
+ String[] parts = liste_uris.split(",");
+ List themeListModelSwaggerS = new ArrayList<>();
+ for (int i = 0; i < Arrays.stream(parts).count(); i++) {
+ Map params = new HashMap<>();
+ params.put("URI", parts[i].replace(" ", ""));
+ String expectedParams = "{URI=uri" + i + "}";
+ assertEquals(expectedParams, params.toString());
+ params.remove("URI");
+ Theme themetest = new Theme("uri" + i, "labelThemeLg1" + i, "labelThemeLg2" + i, "themeTaxonomy" + i);
+ LabelDataSet labelDataSet1 = new LabelDataSet("fr", themetest.getLabelThemeLg1());
+ LabelDataSet labelDataSet2 = new LabelDataSet("en", themetest.getLabelThemeLg2());
+ List labelDataSets = new ArrayList<>();
+ labelDataSets.add(labelDataSet1);
+ labelDataSets.add(labelDataSet2);
+ ThemeModelSwagger themeModelSwagger = new ThemeModelSwagger(themetest.getUri(), labelDataSets, themetest.getThemeTaxonomy());
+ themeListModelSwaggerS.add(themeModelSwagger);
+ }
+ assertEquals(DataSetsUtilsTest.EXPECTED_THEMELIST_GET_THEME_MODEL_SWAGGERS, themeListModelSwaggerS.toString());
+ }
+
+ @ParameterizedTest(name = "{0}")
+ @MethodSource(value = "argumentsProvider")
+ void testPresenceVariablePuisAjoutTest_checkFieldIsAdded(String key1, String key2, Supplier> getListLangContent) throws RmesException, JsonProcessingException {
+ var catalogue_result = new JSONObject(Map.of(key1, "l1", key2, "l2"));
+ var expected = dataSetsImpl.constructLangContent("l1", "l2");
+ dataSetsImpl.testPresenceVariablePuisAjout(response, catalogue_result, new JSONObject(), new JSONObject(), new JSONObject(), new JSONObject());
+ assertThat(getListLangContent.get()).isEqualTo(expected);
+ }
+
+
+ static Stream argumentsProvider() {
+ return Stream.of(
+ Arguments.of("subtitleLg1", "subtitleLg2", (Supplier>) response::getSubtitle),
+ Arguments.of("abstractLg1", "abstractLg2", (Supplier>) response::getAbstractDataset),
+ Arguments.of("scopeNoteLg1", "scopeNoteLg2", (Supplier>) response::getScopeNote)
+ );
+ }
+
+ @BeforeAll
+ static void setUp() {
+ Config.LG1 = "fr";
+ Config.LG2 = "en";
+ }
+
+ @Test
+ void getDataSetByIDDateMiseAJourFalse_shouldReturn404IfInexistentId() throws RmesException {
+ JSONObject mockJSON = new JSONObject(ResponseUtilsTest.EMPTY_JSON_OBJECT);
+ when(repoGestion.getResponseAsObject(Mockito.anyString())).thenReturn(mockJSON);
+
+ assertThatThrownBy(() -> dataSetsImpl.findDataSetModelSwagger("1")).isInstanceOf(RmesException.class)
+ .matches(rmesException -> ((RmesException) rmesException).getStatus() == 404)
+ .hasMessageContaining("Non existent dataset identifier");
+ }
+
+
+
+
+ @Test
+ void getDataSetByIDDateMiseAJour_shouldReturn404IfInexistentId() throws RmesException {
+ JSONObject mockJSON = new JSONObject(ResponseUtilsTest.EMPTY_JSON_OBJECT);
+ when(repoGestion.getResponseAsObject(Mockito.anyString())).thenReturn(mockJSON);
+
+ assertThatThrownBy(() -> dataSetsImpl.getDataSetByIDSummary("1")).isInstanceOf(RmesException.class)
+ .matches(rmesException -> ((RmesException) rmesException).getStatus() == 404)
+ .hasMessageContaining("Non existent dataset identifier");
+ }
+
+ @Test
+ void getDataSetByIDSummary_shouldReturnIdUriAndModified_whenDataSetExists() throws RmesException, JsonProcessingException {
+ JSONObject mockJSON = new JSONObject();
+ mockJSON.put("id", "jd1000");
+ mockJSON.put("uri", "http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ mockJSON.put("dateMiseAJour", "2024-06-15T10:00:00");
+ when(repoGestion.getResponseAsObject(Mockito.anyString())).thenReturn(mockJSON);
+
+ String result = dataSetsImpl.getDataSetByIDSummary("jd1000");
+
+ var resultNode = MAPPER.readTree(result);
+ assertThat(resultNode.get("id").asText()).isEqualTo("jd1000");
+ assertThat(resultNode.get("uri").asText()).isEqualTo("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ assertThat(resultNode.get("modified").asText()).isEqualTo("2024-06-15T10:00:00");
+ }
+
+
+ @Test
+ void patchDataset_shouldReturn400() {
+ assertThatThrownBy(() -> dataSetsImpl.patchDataset("jdtest", new PatchDatasetDTO(null, null, null, null, null), ResponseUtilsTest.FAKE_TOKEN, empty())).isInstanceOf(RuntimeException.class)
+ .hasCause(new RmesException(HttpStatus.BAD_REQUEST, "All required fields are null", "Fill in at least one valid field"));
+ }
+
+ @Test
+ void testPresenceRelationsPuisAjout_checkFieldIsAdded() throws RmesException, JsonProcessingException {
+
+ var datasetImpl = new DataSetsImpl(null, null);
+ var swaggerResponse = new DataSetModelSwagger();
+ var catalogue_result = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_RELATIONS);
+ var expected = new JSONArray(DataSetsUtilsTest.EXPECTED_RELATIONS);
+ datasetImpl.testPresenceVariablePuisAjout(swaggerResponse, catalogue_result, new JSONObject(), new JSONObject(), new JSONObject(), new JSONObject());
+ assertThat(swaggerResponse.getRelations().get(0)).isEqualTo(expected.get(0));
+ assertThat(swaggerResponse.getRelations().get(1)).isEqualTo(expected.get(1));
+ }
+
+ @Test
+ void testConstructLangContentList(){
+ String actual_1= dataSetsImpl.constructLangContentList("contentLg1,contentLg1_","lg1").toString();
+ String actual_2= dataSetsImpl.constructLangContentList("contentLg2","lg2").toString();
+ String expected_1 = "[LangContent(lang=lg1, content=contentLg1), LangContent(lang=lg1, content=contentLg1_)]";
+ String expected_2 = "[LangContent(lang=lg2, content=contentLg2)]";
+ assertThat(actual_1).isEqualTo(expected_1);
+ assertThat(actual_2).isEqualTo(expected_2);
+ }
+
+ // /////////////////////////////////////
+ // Tests for findDataSetModelSwagger //
+ // /////////////////////////////////////
+
+
+ private void mockSubQueries(JSONObject adms, JSONObject codes, JSONObject ontologies, JSONObject organisations, JSONObject structures) throws RmesException {
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogueAdms.ftlh")).thenReturn(adms);
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogueCodes.ftlh")).thenReturn(codes);
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogueOntologies.ftlh")).thenReturn(ontologies);
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogueOrganisations.ftlh")).thenReturn(organisations);
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogueStructures.ftlh")).thenReturn(structures);
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldReturnMinimalDataSet_withoutDisseminationStatus() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getId()).isEqualTo("jd1000");
+ assertThat(result.getUri()).isEqualTo("http://bauhaus/catalogues/jeuDeDonnees/jd1000");
+ assertThat(result.getValidationState()).isEqualTo("Modified");
+ assertThat(result.getTitle()).isEqualTo(dataSetsImpl.constructLangContent("Titre FR", "Title EN"));
+ assertThat(result.getCatalogRecordCreated()).isEqualTo(new CatalogRecordCreated("2024-01-01T00:00:00"));
+ assertThat(result.getCatalogRecordModified()).isEqualTo(new CatalogRecordModified("2024-01-02T00:00:00"));
+ assertThat(result.getCatalogRecordCreator()).isEqualTo(new CatalogRecordCreator("creator1"));
+ assertThat(result.getCatalogRecordContributor()).isEqualTo(new CatalogRecordContributor("contributor1"));
+ assertThat(result.getDisseminationStatus()).isNull();
+ assertThat(result.getKeyword()).isEmpty();
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldReturnDataSet_withDisseminationStatus() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject emptyJson = new JSONObject();
+ JSONObject ontologiesResult = new JSONObject();
+ ontologiesResult.put("labeldisseminationStatusLg1", "Public");
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, ontologiesResult, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getId()).isEqualTo("jd1000");
+ assertThat(result.getDisseminationStatus()).isEqualTo("Public");
+ assertThat(result.getTitle()).isEqualTo(dataSetsImpl.constructLangContent("Titre FR", "Title EN"));
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetOptionalFields_whenPresentInCatalogue() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ catalogueResult.put("dateModification", "2024-06-15T10:00:00");
+ catalogueResult.put("subtitleLg1", "Sous-titre FR");
+ catalogueResult.put("subtitleLg2", "Subtitle EN");
+ catalogueResult.put("abstractLg1", "Resume FR");
+ catalogueResult.put("abstractLg2", "Abstract EN");
+ catalogueResult.put("version", "1.0");
+ catalogueResult.put("dateEmission", "2024-01-15");
+
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getModified()).isEqualTo("2024-06-15T10:00:00");
+ assertThat(result.getSubtitle()).isEqualTo(dataSetsImpl.constructLangContent("Sous-titre FR", "Subtitle EN"));
+ assertThat(result.getAbstractDataset()).isEqualTo(dataSetsImpl.constructLangContent("Resume FR", "Abstract EN"));
+ assertThat(result.getVersion()).isEqualTo("1.0");
+ assertThat(result.getIssued()).isEqualTo("2024-01-15");
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetIdentifier_whenPresentInAdms() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject admsResult = new JSONObject();
+ admsResult.put("identifier", "INSEE-JD1000");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(admsResult, emptyJson, emptyJson, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getIdentifier()).isEqualTo("INSEE-JD1000");
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetPublisher_whenPresentInOrganisations() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject organisationsResult = new JSONObject();
+ organisationsResult.put("idPublisher", "INSEE");
+ organisationsResult.put("labelPublisherLg1", "Institut national de la statistique");
+ organisationsResult.put("labelPublisherLg2", "National Institute of Statistics");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, organisationsResult, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getPublisher()).isNotNull();
+ assertThat(result.getPublisher().getId()).isEqualTo("INSEE");
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetTypeAndAccessRights_whenPresentInCodes() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject codesResult = new JSONObject();
+ codesResult.put("labeltypeLg1", "Fichier detail");
+ codesResult.put("labeltypeLg2", "Detail file");
+ codesResult.put("labelaccessRightsLg1", "Acces libre");
+ codesResult.put("labelaccessRightsLg2", "Open access");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, codesResult, emptyJson, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getType()).isEqualTo(dataSetsImpl.constructLangContent("Fichier detail", "Detail file"));
+ assertThat(result.getAccessRights()).isEqualTo(dataSetsImpl.constructLangContent("Acces libre", "Open access"));
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetTemporal_whenPresentInCatalogue() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ catalogueResult.put("startPeriod", "2020-01-01");
+ catalogueResult.put("endPeriod", "2023-12-31");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, emptyJson, emptyJson);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getTemporal()).isNotNull();
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetStructure_whenDsdPresentInStructures() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject structuresResult = new JSONObject();
+ structuresResult.put("uri", "http://structures/dsd1");
+ structuresResult.put("structureId", "dsd1");
+ structuresResult.put("dsd", "DSD_CHAMP");
+ structuresResult.put("DataStructureDefinition", "true");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, emptyJson, structuresResult);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getStructure()).isNotNull();
+ }
+
+ @Test
+ void findDataSetModelSwagger_shouldSetStructureFromUri_whenNoDsd() throws RmesException, JsonProcessingException {
+ var catalogueResult = new JSONObject(DataSetsUtilsTest.CATALOGUE_RESULT_MINIMAL);
+ JSONObject structuresResult = new JSONObject();
+ structuresResult.put("uri", "http://structures/struct1");
+ JSONObject emptyJson = new JSONObject();
+
+ when(repoGestion.getResponseAsObject("getDataSetById_catalogue.ftlh")).thenReturn(catalogueResult);
+ mockSubQueries(emptyJson, emptyJson, emptyJson, emptyJson, structuresResult);
+
+ DataSetModelSwagger result = dataSetsImpl.findDataSetModelSwagger("jd1000");
+
+ assertThat(result.getStructure()).isNotNull();
+ }
+
+ @Test
+ void getStatisticalUnit_shouldReturnIdLabelsForEachUri() throws Exception {
+ JSONObject response1 = new JSONObject();
+ response1.put("labelUriStatisticalLg1", "Ménages");
+ response1.put("labelUriStatisticalLg2", "Households");
+
+ JSONObject response2 = new JSONObject();
+ response2.put("labelUriStatisticalLg1", "Individus");
+ response2.put("labelUriStatisticalLg2", "Individuals");
+
+ when(repoGestion.getResponseAsObject(Mockito.anyString()))
+ .thenReturn(response1)
+ .thenReturn(response2);
+
+ Method method = DataSetsImpl.class.getDeclaredMethod("getStatisticalUnit", List.class, String.class);
+ method.setAccessible(true);
+
+ @SuppressWarnings("unchecked")
+ List result = (List) method.invoke(dataSetsImpl, List.of("http://uri1", "http://uri2"), "jd1000");
+
+ assertThat(result).hasSize(2);
+ assertThat(result.get(0).getId()).isEqualTo("http://uri1");
+ assertThat(result.get(0).getLabel()).isEqualTo(dataSetsImpl.constructLangContent("Ménages", "Households"));
+ assertThat(result.get(1).getId()).isEqualTo("http://uri2");
+ assertThat(result.get(1).getLabel()).isEqualTo(dataSetsImpl.constructLangContent("Individus", "Individuals"));
+ }
+
+ @Test
+ void getStatisticalUnit_shouldReturnEmptyList_whenNoUris() throws Exception {
+ Method method = DataSetsImpl.class.getDeclaredMethod("getStatisticalUnit", List.class, String.class);
+ method.setAccessible(true);
+
+ @SuppressWarnings("unchecked")
+ List result = (List) method.invoke(dataSetsImpl, List.of(), "jd1000");
+
+ assertThat(result).isEmpty();
+ }
+
+}
\ No newline at end of file
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/stubs/FreeMarkerUtilsStub.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/stubs/FreeMarkerUtilsStub.java
new file mode 100644
index 000000000..be1c20d79
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/stubs/FreeMarkerUtilsStub.java
@@ -0,0 +1,14 @@
+package fr.insee.rmes.magma.gestion.old.stubs;
+
+import fr.insee.rmes.magma.gestion.old.persistence.FreeMarkerUtils;
+import fr.insee.rmes.utils.exceptions.RmesException;
+
+import java.util.Map;
+
+public class FreeMarkerUtilsStub extends FreeMarkerUtils {
+
+ @Override
+ public String buildRequest(String root, String fileName, Map params) {
+ return fileName;
+ }
+}
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/DataSetsUtilsTest.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/DataSetsUtilsTest.java
new file mode 100644
index 000000000..62276feed
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/DataSetsUtilsTest.java
@@ -0,0 +1,74 @@
+package fr.insee.rmes.magma.gestion.old.utils;
+
+public class DataSetsUtilsTest {
+ public static final String EXPECTED_JSON_SET_TITRE_LIST = "[LangContent(lang=fr, content=elementLg1), LangContent(lang=en, content=elementLg2)]";
+ public static final String EXPECTED_MAP_INIT_PARAMS = "{STRUCTURES_GRAPH=StructureGraphTest, ORGANISATIONS_GRAPH=OrganisationsGraphTest, DATASETS_GRAPH=DatasetGraphTest, LG2=en, ADMS_GRAPH=AdmsGraphTest, CODES_GRAPH=CodesGraphTest, LG1=fr, ONTOLOGIES_GRAPH=OntologiesGraphTest, CONCEPTS_GRAPH=ConceptsGraphTest, OPERATIONS_GRAPH=OperationsGraphTest}";
+ public static final String EXPECTED_THEMELIST_GET_THEME_MODEL_SWAGGERS = "[ThemeModelSwagger(uri=uri0, labelDataSet=[LabelDataSet(lang=fr, content=labelThemeLg10), LabelDataSet(lang=en, content=labelThemeLg20)], themeTaxonomy=themeTaxonomy0), ThemeModelSwagger(uri=uri1, labelDataSet=[LabelDataSet(lang=fr, content=labelThemeLg11), LabelDataSet(lang=en, content=labelThemeLg21)], themeTaxonomy=themeTaxonomy1), ThemeModelSwagger(uri=uri2, labelDataSet=[LabelDataSet(lang=fr, content=labelThemeLg12), LabelDataSet(lang=en, content=labelThemeLg22)], themeTaxonomy=themeTaxonomy2), ThemeModelSwagger(uri=uri3, labelDataSet=[LabelDataSet(lang=fr, content=labelThemeLg13), LabelDataSet(lang=en, content=labelThemeLg23)], themeTaxonomy=themeTaxonomy3)]";
+ public static final String EXPECTED_LANGCONTENTLIST_SET_ID_LABEL = "IdLabel(id=id, label=[LangContent(lang=fr, content=content1), LangContent(lang=en, content=content2)], type=null)";
+ public static final String EXPECTED_LANGCONTENTLIST_SET_ID_LABEL_WITH_TYPE = "IdLabel(id=id, label=[LangContent(lang=fr, content=content1), LangContent(lang=en, content=content2)], type=type)";
+ public static final String DATA_SET_LIST= """
+ [
+ {
+ "dateMiseAJour":"2024-03-28T16:24:07.626773775",
+ "dateCreation":"2024-03-28T13:42:13.696871447",
+ "statutValidation":"Modified",
+ "titreLg1":"Test1",
+ "id":"jd1000",
+ "titreLg2":"all fields",
+ "uri":"http://bauhaus/catalogues/jeuDeDonnees/jd1000"
+ },
+ {
+ "dateMiseAJour":"2024-03-28T13:58:46.726856504",
+ "dateCreation":"2024-03-28T13:58:46.726856504",
+ "statutValidation":"Unpublished",
+ "titreLg1":"Test2",
+ "id":"jd1001",
+ "titreLg2":"title",
+ "uri":"http://bauhaus/catalogues/jeuDeDonnees/jd1001"
+ }
+ ]
+ """
+ ;
+ public static final String EXPECTED_GET_DATA_SET_LIST= """
+ [
+ {
+ "id": "jd1000",
+ "uri": "http://bauhaus/catalogues/jeuDeDonnees/jd1000",
+ "modified": "2024-03-28T16:24:07.626773775",
+ "validationState": "Modified",
+ "title": [
+ {
+ "lang": "fr",
+ "content": "Test1"
+ },
+ {
+ "lang": "en",
+ "content": "all fields"
+ }
+ ]
+ },
+ {
+ "id": "jd1001",
+ "uri": "http://bauhaus/catalogues/jeuDeDonnees/jd1001",
+ "modified": "2024-03-28T13:58:46.726856504",
+ "validationState": "Unpublished",
+ "title": [
+ {
+ "lang": "fr",
+ "content": "Test2"
+ },
+ {
+ "lang": "en",
+ "content": "title"
+ }
+ ]
+ }
+ ]
+ """
+ ;
+
+ public static final String CATALOGUE_RESULT_RELATIONS = "{\"relations\":\"http://www.insee.fr,http://www.rdf.insee.fr\"}";
+ public static final String EXPECTED_RELATIONS = "[\"http://www.insee.fr\", \"http://www.rdf.insee.fr\"]";
+ public static final String CATALOGUE_RESULT_MINIMAL = "{\"id\":\"jd1000\", \"titleLg1\":\"Titre FR\", \"titleLg2\":\"Title EN\", \"uri\":\"http://bauhaus/catalogues/jeuDeDonnees/jd1000\", \"catalogRecordCreated\":\"2024-01-01T00:00:00\", \"catalogRecordModified\":\"2024-01-02T00:00:00\", \"catalogRecordCreator\":\"creator1\", \"catalogRecordContributor\":\"contributor1\", \"statutValidation\":\"Modified\"}";
+
+}
diff --git a/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/ResponseUtilsTest.java b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/ResponseUtilsTest.java
new file mode 100644
index 000000000..c2fbae117
--- /dev/null
+++ b/magma-gestion-impl/src/test/java/fr/insee/rmes/magma/gestion/old/utils/ResponseUtilsTest.java
@@ -0,0 +1,40 @@
+package fr.insee.rmes.magma.gestion.old.utils;
+
+public class ResponseUtilsTest {
+ public static final String EMPTY_JSON_OBJECT = "{}";
+ public static final String EMPTY_JSON_ARRAY = "[]";
+ public static final String FAKE_TOKEN = "fake_token";
+
+ public static final String COLLECTION_JSON_OBJECT = "{\n" +
+ " \"uri\": \"http://bauhaus/concepts/collection/definitions-insee-fr\",\n" +
+ " \"date_mis_a_jour\": \"2024-11-01T00:00:00.000+01:00\",\n" +
+ " \"intitule_fr\": \"Concepts affichés sur insee.fr\",\n" +
+ " \"intitule_en\": \"Concepts displayed on insee.fr\",\n" +
+ " \"description_fr\": \"Ensemble des concepts affichés sur la page définitions du site insee.fr\",\n" +
+ " \"description_en\": \"All concepts displayed on the \\\"définitions\\\" section from the website insee.fr\",\n" +"}";
+
+ public static final String COLLECTION_MODELSWAGGER = "{\"id\":\"definitions-insee-fr\",\"uri\":\"http://bauhaus/concepts/collection/definitions-insee-fr\",\"dateMiseAJour\":\"2024-11-01T00:00:00.000+01:00\"}";
+
+ public static final String SET_OF_CONCEPTS_JSON_ARRAY ="[\n"+
+ " {\n" +
+ " \"uriConcept\" : {\n" +
+ " \"type\" : \"uri\",\n" +
+ " \"value\" : \"http://bauhaus/concepts/definition/c1365\"\n" +
+ " },\n" +
+ " \"idConcept\" : {\n" +
+ " \"type\" : \"literal\",\n" +
+ " \"value\" : \"c1365\"\n" +
+ " }\n" +
+ " },\n" +
+ " {\n" +
+ " \"uriConcept\" : {\n" +
+ " \"type\" : \"uri\",\n" +
+ " \"value\" : \"http://bauhaus/concepts/definition/c1632\"\n" +
+ " },\n" +
+ " \"idConcept\" : {\n" +
+ " \"type\" : \"literal\",\n" +
+ " \"value\" : \"c1632\"\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n";
+}
\ No newline at end of file