use of org.eol.globi.service.TaxonUtil.SOURCE_TAXON_FAMILY in project eol-globi-data by jhpoelen.
the class DatasetImporterForDwCATest method importRecordsFromArctosArchive.
@Test
public void importRecordsFromArctosArchive() throws StudyImporterException, URISyntaxException {
URL resource = getClass().getResource("/org/globalbioticinteractions/dataset/arctos_mvz_bird_small.zip");
DatasetImporterForDwCA studyImporterForDwCA = new DatasetImporterForDwCA(null, null);
studyImporterForDwCA.setDataset(new DatasetImpl("some/namespace", resource.toURI(), inStream -> inStream));
List<String> families = new ArrayList<>();
AtomicBoolean someRecords = new AtomicBoolean(false);
studyImporterForDwCA.setInteractionListener(new InteractionListener() {
@Override
public void on(Map<String, String> interaction) throws StudyImporterException {
assertThat(interaction.get(REFERENCE_URL), startsWith("http://arctos.database.museum/guid/"));
assertThat(interaction.get(SOURCE_OCCURRENCE_ID), anyOf(is("http://arctos.database.museum/guid/MVZ:Bird:180448?seid=587053"), is("http://arctos.database.museum/guid/MVZ:Bird:183644?seid=158590"), is("http://arctos.database.museum/guid/MVZ:Bird:58090?seid=657121")));
if (interaction.containsKey(DatasetImporterForTSV.TARGET_OCCURRENCE_ID)) {
assertThat(interaction.get(DatasetImporterForTSV.TARGET_OCCURRENCE_ID), anyOf(is("http://arctos.database.museum/guid/MVZ:Herp:241200"), is("http://arctos.database.museum/guid/MVZ:Bird:183643"), is("http://arctos.database.museum/guid/MVZ:Bird:58093")));
}
assertThat(interaction.get(SOURCE_TAXON_FAMILY), anyOf(is("Accipitridae"), is("Strigidae")));
assertThat(interaction.get(DatasetImporterForTSV.RESOURCE_TYPES), is("http://rs.tdwg.org/dwc/terms/associatedOccurrences | http://rs.tdwg.org/dwc/terms/Occurrence"));
someRecords.set(true);
}
});
studyImporterForDwCA.importStudy();
assertThat(someRecords.get(), is(true));
}
Aggregations