use of org.eol.globi.service.GeoNamesServiceImpl in project eol-globi-data by jhpoelen.
the class StudyImporterForRaymondIT method importStudy.
@Test
public void importStudy() throws StudyImporterException {
StudyImporterForRaymond importer = new StudyImporterForRaymond(new ParserFactoryLocal(), nodeFactory);
importer.setGeoNamesService(new GeoNamesService() {
@Override
public boolean hasTermForLocale(String locality) {
return true;
}
@Override
public LatLng findLatLng(String locality) throws IOException {
return new LatLng(0, 0);
}
});
importer.setDataset(new DatasetLocal());
importStudy(importer);
importer.setGeoNamesService(new GeoNamesServiceImpl());
Collection<String> unmappedLocations = new HashSet<String>();
for (String location : importer.getLocations()) {
if (!importer.getGeoNamesService().hasTermForLocale(location)) {
unmappedLocations.add(location);
}
}
assertThat(unmappedLocations, containsInAnyOrder("Not described", "South African waters", "Ocean location", "subantarctic waters", "oceanic habitat in Southern Ocean. 68� 07\u0019 S & 70�13\u0019 S", "Subantarctic Pacific Ocean"));
}
use of org.eol.globi.service.GeoNamesServiceImpl in project eol-globi-data by jhpoelen.
the class StudyImporterForSPIRETest method importStudy.
@Test
public void importStudy() throws IOException, StudyImporterException {
RDFDefaultErrorHandler.silent = true;
StudyImporterForSPIRE importer = createImporter();
TestInteractionListener listener = new TestInteractionListener();
importer.setInteractionListener(listener);
importStudy(importer);
assertGAZMapping(listener);
GeoNamesServiceImpl geoNamesServiceImpl = new GeoNamesServiceImpl();
for (String locality : listener.localities) {
assertThat(geoNamesServiceImpl.hasTermForLocale(locality), is(true));
}
assertThat(listener.getCount(), is(30196));
assertThat(listener.descriptions, not(hasItem("http://spire.umbc.edu/ontologies/SpireEcoConcepts.owl#")));
assertThat(listener.titles, not(hasItem("http://spire.umbc.edu/")));
assertThat(listener.environments, not(hasItem("http://spire.umbc.edu/ontologies/SpireEcoConcepts.owl#")));
assertThat(listener.invalidInteractions.size(), is(greaterThan(0)));
}
Aggregations