Skip to content

Conversation

@SMaSndil
Copy link
Contributor

Correction of "Publisher" and "Creator" descriptions.
@SMaSndil SMaSndil linked an issue Mar 19, 2025 that may be closed by this pull request
3 tasks
@SMaSndil SMaSndil closed this Mar 19, 2025
@SMaSndil SMaSndil reopened this Mar 19, 2025
}

protected IdLabel labelInformation(String id,String string1,String string2){
List<LangContent> listOfLangContent = null;
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence.

reponse.setPublisher(publisher);
String id = organisations_result.getString("idPublisher");
String string1 =organisations_result.getString("labelPublisherLg1");
String string2 =organisations_result.getString("labelPublisherLg2");
Copy link
Contributor

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 variables, par exemple labelLg1 au lieu de string1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence.


private List<IdLabel> getCreator(List<String> creatorUris) throws RmesException {

List<String> stepOne = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indiquer dans le nom de la variable que c'est une liste

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence.


@Test
void shouldReturnLabelInformationOne() {
IdLabel actual = dataSetsImpl.labelInformation("2025","elementLg1","elementLg2");
Copy link
Contributor

Choose a reason for hiding this comment

The 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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence ( shouldReturnIdLabelFromTwoStrings())

}

@Test
void shouldReturnLabelInformationTwo() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence.

}

@Test
void shouldReturnLabelInformationThree() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem
je ne sais pas si ce test est très utile, ou indiquer la valeur attendue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimé en conséquence.

}

@Test
void shouldReturnLabelInformationFour() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem
je ne sais pas si ce test est très utile, ou indiquer la valeur attendue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimé en conséquence.

@Test
void shouldConstructLangContent1() {
List<LangContent> actual = dataSetsImpl.constructLangContent1("elementLg1");
List<LangContent> expected= List.of(LangContent.lg1("elementLg1"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne sais pas si ce test est très utile
ou indiquer la valeur attendue : [LangContent(lang=fr, content=elementLg1)]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimé en conséquence.

@Test
void shouldConstructLangContent2() {
List<LangContent> actual = dataSetsImpl.constructLangContent2("elementLg2");
List<LangContent> expected= List.of(LangContent.lg2("elementLg2"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimé en conséquence.

@Test
void shouldReturnStepsOfGetCreator() {
List<String> creatorUris = List.of(" Insee ","Ined ","Ine d","Ined");
List<String> stepOne = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stepOne : utiliser un nom plus explicite

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence ( creatorUrisWithoutExternalSpaces ).

for (String s : creatorUris) { stepOne.add(s.trim());}
List<String> stepTwo = new ArrayList<>(new LinkedHashSet<>(stepOne));
boolean responseOne = stepOne.equals(List.of("Insee", "Ined", "Ine d", "Ined"));
boolean responseTwo = stepTwo.toString().equals("[Insee, Ined, Ine d]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem pour responseOne et ResponseTwo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifié en conséquence :

  • stepTwo devient deleteDuplicatesCreatorUris
  • responseOne devient correctDeletionOfSpaces
  • responseTwo devient goodDuplicateRemoval

if(!identifiers.contains(id.trim())){
String string1 = creator_result.getString("labelCreatorLg1");
String string2 = creator_result.getString("labelCreatorLg2");
creator.add(labelInformation(id.trim(),string1,string2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi .trim() ? tu as rencontré un souci avec un exemple en base ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le problème rencontré avait de mémoire trait à la fonction getCreator de DataSetsImpl.java. En effet, les éléments de la liste passée en paramètre figurent initialement dans une même chaîne de caractères d'un JSON et sont séparés par une virgule et des espaces ( par exemple "A K, B, C"). Pour les stocker un à un dans une liste, le codeur identifie le séparateur virgule avec des espaces. Pour autant le nombre d'espaces inclus in fine dans le séparateur était erroné ( par exemple séparateur ", " ou ", " à la place de ","). Au lieu de supprimer les espaces préfixant et suffixant chaque élément pour ensuite interroger la base, le codeur a demandé la suppression de la totalité des espaces dans l'élément ( on obtient ainsi par exemple l'élément "AK" à chercher au lieu de "A K"). La requête ne trouvait subséquemment pas tous les éléments en interrogeant GraphDB. Pour éviter le moindre problème, on force la suppression des espaces en début et fin de l'élément ( qu'importe le nombre d'espaces dans le séparateur dès lors qu'il contient une virgule).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai modifié aussi d'autres string1 et string2 dans mon code pour le rendre plus explicite.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
29.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
29.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correction sur la récupération des organismes dans get/dataset/{id}

4 participants