use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method titleExcludePatternOnly.
@Test
public void titleExcludePatternOnly() throws StudyImporterException, IOException {
String configJson = "{ \"url\": \"classpath:/org/eol/globi/data/rss_vertnet.xml\", " + "\"exclude\": \".*GGBN.*\", " + "\"hasDependencies\": true }";
final Dataset dataset = datasetFor(configJson);
assertFalse(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla (Arctos) GGBN", dataset));
assertTrue(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla (Arctos)", dataset));
assertTrue(DatasetImporterForRSS.shouldIncludeTitleInDatasetCollection("bla", dataset));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method readRSSVertnet.
@Test
public void readRSSVertnet() throws StudyImporterException, IOException {
String configJson = "{ \"url\": \"classpath:/org/eol/globi/data/rss_vertnet.xml\", " + "\"include\": \".*(Arctos).*\", " + "\"exclude\": \".*GGBN.*\", " + "\"hasDependencies\": true }";
final Dataset dataset = datasetFor(configJson);
List<Dataset> datasets = DatasetImporterForRSS.getDatasetsForFeed(dataset);
for (Dataset dataset1 : datasets) {
assertThat(dataset1.getCitation(), containsString("(Arctos)"));
assertThat(dataset1.getCitation(), not(containsString("GGBN")));
}
assertThat(datasets.size(), is(84));
assertThat(datasets.get(0).getOrDefault("hasDependencies", null), is("true"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForRSSTest method readDatasetDependencies.
@Test
public void readDatasetDependencies() throws StudyImporterException, IOException {
String configJson = "{ \"url\": \"classpath:/org/eol/globi/data/rss_msb_para.xml\", " + "\"hasDependencies\": true }";
final Dataset dataset = datasetFor(configJson);
List<Dataset> datasets = DatasetImporterForRSS.getDatasets(dataset);
assertThat(datasets.size(), is(1));
List<Dataset> dependencies = DatasetImporterForRSS.getDependencies(dataset);
assertThat(dependencies.size(), is(2));
assertThat(dependencies.get(0).getArchiveURI().toString(), is("http://ipt.vertnet.org:8080/ipt/archive.do?r=msb_para"));
assertThat(dependencies.get(0).getFormat(), is("application/dwca"));
assertThat(dependencies.get(1).getArchiveURI().toString(), is("http://ipt.vertnet.org:8080/ipt/archive.do?r=msb_host"));
assertThat(dependencies.get(1).getFormat(), is("foo"));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryWithDatasetContextTest method getOrCreateStudyEmptyStudySource.
@Test
public void getOrCreateStudyEmptyStudySource() throws NodeFactoryException {
NodeFactory factory = Mockito.mock(NodeFactory.class);
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
NodeFactoryWithDatasetContext factoryWithDS = new NodeFactoryWithDatasetContext(factory, dataset);
factoryWithDS.getOrCreateStudy(new StudyImpl("some title"));
ArgumentCaptor<Study> argument = ArgumentCaptor.forClass(Study.class);
verify(factory).getOrCreateStudy(argument.capture());
assertEquals("some title", argument.getValue().getTitle());
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryWithDatasetContextTest method getOrCreateStudy.
@Test
public void getOrCreateStudy() throws NodeFactoryException {
NodeFactory factory = Mockito.mock(NodeFactory.class);
Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
NodeFactoryWithDatasetContext factoryWithDS = new NodeFactoryWithDatasetContext(factory, dataset);
factoryWithDS.getOrCreateStudy(new StudyImpl("some title"));
ArgumentCaptor<Study> argument = ArgumentCaptor.forClass(Study.class);
verify(factory).getOrCreateStudy(argument.capture());
assertEquals("some title", argument.getValue().getTitle());
String sourceCitation = CitationUtil.sourceCitationLastAccessed(dataset);
assertThat(StringUtils.contains(sourceCitation, "<some:uri>. Accessed at <some:uri> on"), Is.is(true));
}
Aggregations