use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class DatasetImporterForZenodoMetadataIT method importStudy.
@Test
public void importStudy() throws IOException, StudyImporterException {
List<Map<String, String>> links = new ArrayList<>();
final DatasetImporterForZenodoMetadata importer = new DatasetImporterForZenodoMetadata(null, null);
importer.setInteractionListener(new InteractionListener() {
@Override
public void on(Map<String, String> interaction) throws StudyImporterException {
links.add(interaction);
}
});
final DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("some:archive"), in -> in) {
@Override
public String getOrDefault(String key, String defaultValue) {
return "https://sandbox.zenodo.org/api/records/?custom=%5Bobo%3ARO_0002453%5D%3A%5B%3A%5D";
}
};
importer.setDataset(dataset);
importer.importStudy();
assertThat(links.size() > 0, Is.is(true));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class ReferenceUtilTest method sourceCitationDatasetLocalResourceNonURI.
@Test
public void sourceCitationDatasetLocalResourceNonURI() throws IOException {
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example"), inStream -> inStream);
JsonNode config = new ObjectMapper().readTree("{ \"url\": \"foo bar\" }");
dataset.setConfig(config);
String citation = CitationUtil.sourceCitationLastAccessed(dataset);
assertThat(citation, startsWith("<http://example>. Accessed at <http://example> on"));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class ReferenceUtilTest method generateSourceCitation.
@Test
public void generateSourceCitation() throws IOException, StudyImporterException {
final InputStream inputStream = getClass().getResourceAsStream("/org/eol/globi/data/test-meta-globi.json");
DatasetImpl dataset = new DatasetImpl(null, URI.create("http://base"), inStream -> inStream);
dataset.setConfig(new ObjectMapper().readTree(inputStream));
String citation = CitationUtil.sourceCitationLastAccessed(dataset);
assertThat(citation, startsWith("Seltzer, Carrie; Wysocki, William; Palacios, Melissa; Eickhoff, Anna; Pilla, Hannah; Aungst, Jordan; Mercer, Aaron; Quicho, Jamie; Voss, Neil; Xu, Man; J. Ndangalasi, Henry; C. Lovett, Jon; J. Cordeiro, Norbert (2015): Plant-animal interactions from Africa. figshare. https://dx.doi.org/10.6084/m9.figshare.1526128. Accessed at <https://ndownloader.figshare.com/files/2231424>"));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class ReferenceUtilTest method sourceCitationDatasetNoConfig.
@Test
public void sourceCitationDatasetNoConfig() {
String citation = CitationUtil.sourceCitationLastAccessed(new DatasetImpl("some/namespace", URI.create("http://example"), inStream -> inStream));
assertThat(citation, startsWith("<http://example>. Accessed at <http://example> on"));
}
use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.
the class ReferenceUtilTest method sourceCitationDataset.
@Test
public void sourceCitationDataset() throws IOException {
DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example"), inStream -> inStream);
JsonNode config = new ObjectMapper().readTree("{ \"resources\": { \"archive\": \"archive.zip\" } }");
dataset.setConfig(config);
String citation = CitationUtil.sourceCitationLastAccessed(dataset);
assertThat(citation, startsWith("<http://example>. Accessed at <http://example> on"));
}
Aggregations