-
Notifications
You must be signed in to change notification settings - Fork 6
feature : improve get/dataset/{id} methods #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "236-correction-sur-la-r\u00E9cup\u00E9ration-des-organismes-dans-getdatasetid"
Changes from all commits
a151a18
bbdbb1d
acab7af
91a465a
3ee8ada
b306e9a
bd02cdb
e1b64b0
e8d722c
08c0857
d8bdd2f
ca9bbf4
67e6a60
30690bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| SELECT DISTINCT (group_concat(distinct ?idCreator;separator=",") as ?names) | ||
|
|
||
| WHERE { | ||
| ?uri a dcat:CatalogRecord ; | ||
| foaf:primaryTopic ?uriDataset . | ||
| ?uriDataset dcterms:identifier '${ID}' . | ||
|
|
||
| OPTIONAL{?uriDataset dcterms:creator ?creator . | ||
| ?creator dcterms:identifier ?idCreator. | ||
| ?creator skos:prefLabel ?labelCreatorLg1 . | ||
| FILTER(lang(?labelCreatorLg1)= '${LG1}') . | ||
| ?creator skos:prefLabel ?labelCreatorLg2 . | ||
| FILTER(lang(?labelCreatorLg2)= '${LG2}') .} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.fasterxml.jackson.databind.json.JsonMapper; | ||
| import fr.insee.rmes.dto.datasets.PatchDatasetDTO; | ||
| import fr.insee.rmes.model.datasets.Theme; | ||
| import fr.insee.rmes.model.datasets.*; | ||
| import fr.insee.rmes.modelSwagger.dataset.*; | ||
| import fr.insee.rmes.persistence.RepositoryGestion; | ||
| import fr.insee.rmes.services.utils.DataSetsUtilsTest; | ||
|
|
@@ -44,6 +44,54 @@ class DataSetsImplTest { | |
| RepositoryGestion repoGestion; | ||
| public static final ObjectMapper MAPPER = new JsonMapper(); | ||
|
|
||
| @Test | ||
| void shouldGetDataSetBySummary() throws JsonProcessingException { | ||
|
|
||
| JSONObject dataSetId = new JSONObject(); | ||
| dataSetId.put("id","ID"); | ||
| dataSetId.put("uri","URI"); | ||
| dataSetId.put("dateMiseAJour","today"); | ||
|
|
||
| DataSetModelSwagger dataSetModelSwagger = null; | ||
|
|
||
| if (dataSetId.has("id")) { | ||
| ObjectMapper objectMapper = new ObjectMapper(); | ||
| DataSet dataSet = objectMapper.readValue(dataSetId.toString(), DataSet.class); | ||
| Id id1 = new Id(dataSet.getId()); | ||
| Uri uri = new Uri(dataSet.getUri()); | ||
| Modified modified = new Modified(dataSet.getDateMiseAJour()); | ||
| dataSetModelSwagger = new DataSetModelSwagger(id1, uri, modified); | ||
| } | ||
| assertNotNull(dataSetModelSwagger); | ||
| } | ||
|
|
||
| @Test | ||
| void shouldReturnIdLabelFromTwoStrings() { | ||
| IdLabel actual = dataSetsImpl.labelInformation("2025","elementLg1","elementLg2"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. expliciter davantage le nom de la méthode (au lieu de One/Two/Three/Four)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifié en conséquence ( shouldReturnIdLabelFromTwoStrings()) |
||
| IdLabel expected= new IdLabel("2025", dataSetsImpl.constructLangContent("elementLg1","elementLg2")); | ||
| assertEquals(expected.toString(),actual.toString()); | ||
| } | ||
|
|
||
| @Test | ||
| void shouldReturnIdLabelFromTwoNullStrings() { | ||
| IdLabel actual = dataSetsImpl.labelInformation("2025","",""); | ||
| IdLabel expected= new IdLabel("2025", null); | ||
| assertEquals(expected.toString(),actual.toString()); | ||
| } | ||
|
|
||
|
|
||
| @Test | ||
| void shouldReturnStepsOfGetCreator() { | ||
| List<String> creatorUris = List.of(" Insee ","Ined ","Ine d","Ined"); | ||
| List<String> creatorUrisWithoutExternalSpaces = new ArrayList<>(); | ||
| for (String s : creatorUris) {creatorUrisWithoutExternalSpaces.add(s.trim());} | ||
| List<String> deleteDuplicatesCreatorUris = new ArrayList<>(new LinkedHashSet<>(creatorUrisWithoutExternalSpaces)); | ||
| boolean correctDeletionOfSpaces = creatorUrisWithoutExternalSpaces.equals(List.of("Insee", "Ined", "Ine d", "Ined")); | ||
| boolean goodDuplicateRemoval = deleteDuplicatesCreatorUris .toString().equals("[Insee, Ined, Ine d]"); | ||
| assertTrue(correctDeletionOfSpaces && goodDuplicateRemoval); | ||
| } | ||
|
|
||
|
|
||
| @Test | ||
| void getListDataSetsTest() throws RmesException, JsonProcessingException { | ||
| JSONArray mockJSON = new JSONArray(DataSetsUtilsTest.DATA_SET_LIST); | ||
|
|
@@ -207,9 +255,6 @@ void getDataSetByIDDateMiseAJourFalse_shouldReturn404IfInexistentId() throws Rme | |
| .hasMessageContaining("Non existent dataset identifier"); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| @Test | ||
| void getDataSetByIDDateMiseAJour_shouldReturn404IfInexistentId() throws RmesException { | ||
| JSONObject mockJSON = new JSONObject(ResponseUtilsTest.EMPTY_JSON_OBJECT); | ||
|
|
@@ -220,7 +265,6 @@ void getDataSetByIDDateMiseAJour_shouldReturn404IfInexistentId() throws RmesExce | |
| .hasMessageContaining("Non existent dataset identifier"); | ||
| } | ||
|
|
||
|
|
||
| @Test | ||
| void patchDataset_shouldReturn400() { | ||
| assertThatThrownBy(() -> dataSetsImpl.patchDataset("jdtest", new PatchDatasetDTO(null, null, null, null, null), ResponseUtilsTest.FAKE_TOKEN, empty())).isInstanceOf(RuntimeException.class) | ||
|
|
@@ -248,8 +292,6 @@ void testConstructLangContentList(){ | |
| assertThat(actual_1).isEqualTo(expected_1); | ||
| assertThat(actual_2).isEqualTo(expected_2); | ||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Etre plus explicite dans le nom des paramètres, par exemple labelLg1 à la place de string1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modifié en conséquence.