Skip to content

Commit

Permalink
fix: add creators to advanced search
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelDemey committed Jul 31, 2020
1 parent 0c6177d commit ce49e7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.model.vocabulary.RDFS;
import org.eclipse.rdf4j.model.vocabulary.SKOS;
import org.eclipse.rdf4j.model.vocabulary.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -89,6 +86,7 @@ public String getSeriesForSearch() throws RmesException {
for (int i = 0; i < resQuery.length(); i++) {
JSONObject series = resQuery.getJSONObject(i);
addOneOrganizationLink(series.get(Constants.ID).toString(), series, INSEE.DATA_COLLECTOR);
addOneOrganizationLink(series.get(Constants.ID).toString(), series, DCTERMS.CREATOR);
result.put(series);
}
return QueryUtils.correctEmptyGroupConcat(result.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@
import java.util.ArrayList;
import java.util.List;

import fr.insee.rmes.config.Config;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.*;

import fr.insee.rmes.bauhaus_services.rdf_utils.RepositoryGestion;
import fr.insee.rmes.exceptions.RmesException;
import fr.insee.rmes.model.structures.ComponentDefinition;
import fr.insee.rmes.model.structures.MutualizedComponent;
import fr.insee.rmes.model.structures.Structure;
import fr.insee.rmes.utils.DateUtils;
import org.springframework.core.env.Environment;

class StructureUtilsTest {

Expand All @@ -43,29 +42,6 @@ public void init() {
MockitoAnnotations.initMocks(this);
}

@Test
void shouldCallCreateRdfComponentSpecifications() throws RmesException {

String currentDate = DateUtils.getCurrentDate();
doNothing().when(structureUtils).createRdfComponentSpecifications(any(), anyList(), any(), any());
doNothing().when(repoGestion).loadSimpleObject(any(), any(), any());
doReturn(1).when(structureUtils).getNextComponentSpecificationID();

IRI structureIRI = SimpleValueFactory.getInstance().createIRI("http://structure");

Structure structure = new Structure();
structure.setId("id");
structure.setLabelLg1("labelLg1");
structure.setLabelLg2("labelLg2");
structure.setUpdated(currentDate);
structure.setCreated(currentDate);
structure.setComponentDefinitions(new ArrayList<>());

structureUtils.createRdfStructure(structure, "id", structureIRI, null);
verify(structureUtils, times(1)).createRdfComponentSpecifications(any(), anyList(), any(), any());

}

@Test
void shouldCallCreateComponentSpecificationForEachComponents() throws RmesException {
Resource graph = null;
Expand Down

0 comments on commit ce49e7e

Please sign in to comment.