use of org.eol.globi.data.DatasetImporter in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method defaultTSVImporterNotCached.
@Test
public void defaultTSVImporterNotCached() throws StudyImporterException, DatasetRegistryException, IOException {
final DatasetRegistry datasetRegistry = new DatasetRegistryGitHubRemote(inStream -> inStream);
DatasetImporter importer = getTemplateImporter(datasetRegistry, "globalbioticinteractions/template-dataset");
assertThat(((DatasetImporterForTSV) importer).getBaseUrl(), startsWith("https://raw.githubusercontent.com/globalbioticinteractions/template-dataset/"));
InputStream actual = ((DatasetImporterForTSV) importer).getDataset().retrieve(URI.create("globi.json"));
assertThat(actual, is(notNullValue()));
}
use of org.eol.globi.data.DatasetImporter in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplTest method createImporter.
@Test
public void createImporter() throws StudyImporterException {
DatasetImporter someImporter = new StudyImporterFactoryImpl(null).createImporter(new DatasetImpl("namespace", URI.create("some:uri"), is -> is));
assertThat(someImporter, instanceOf(DatasetImporterForTSV.class));
}
use of org.eol.globi.data.DatasetImporter in project eol-globi-data by jhpoelen.
the class DatasetImportUtil method importDataset.
public static void importDataset(StudyImporterConfigurator studyImporterConfigurator, Dataset dataset, NodeFactory nodeFactory, ImportLogger logger, GeoNamesService geoNamesService) throws StudyImporterException {
nodeFactory.getOrCreateDataset(dataset);
NodeFactory nodeFactoryForDataset = new NodeFactoryWithDatasetContext(nodeFactory, dataset);
DatasetImporter datasetImporter = new StudyImporterFactoryImpl(nodeFactoryForDataset).createImporter(dataset);
datasetImporter.setDataset(dataset);
if (studyImporterConfigurator != null) {
studyImporterConfigurator.configure(datasetImporter);
}
if (logger != null) {
datasetImporter.setLogger(logger);
}
if (geoNamesService != null) {
datasetImporter.setGeoNamesService(geoNamesService);
}
datasetImporter.importStudy();
}
use of org.eol.globi.data.DatasetImporter in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method createSIAD.
@Test
public void createSIAD() throws StudyImporterException, DatasetRegistryException {
final DatasetRegistryGitHubRemote datasetFinderGitHubRemote = new DatasetRegistryGitHubRemote(inStream -> inStream);
DatasetImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/siad");
assertThat(importer, is(notNullValue()));
Dataset dataset = ((BaseDatasetImporter) importer).getDataset();
final JsonNode config = dataset.getConfig();
assertThat(config, is(notNullValue()));
assertThat(dataset.getOrDefault(DatasetConstant.SHOULD_RESOLVE_REFERENCES, "donald"), is("false"));
}
use of org.eol.globi.data.DatasetImporter in project eol-globi-data by jhpoelen.
the class DatasetImporterFactoryImplIT method defaultTSVImporterCached.
@Test
public void defaultTSVImporterCached() throws StudyImporterException, DatasetRegistryException, IOException {
final DatasetRegistry datasetRegistry = new DatasetRegistryWithCache(new DatasetRegistryGitHubArchive(inStream -> inStream), dataset -> CacheUtil.cacheFor(dataset.getNamespace(), "target/datasets", inStream -> inStream));
DatasetImporter importer = getTemplateImporter(datasetRegistry, "globalbioticinteractions/template-dataset");
DatasetImporterForTSV importerTSV = (DatasetImporterForTSV) importer;
assertThat(importerTSV.getBaseUrl(), startsWith("https://github.com/globalbioticinteractions/template-dataset/"));
assertThat(importerTSV.getDataset().retrieve(URI.create("globi.json")), is(notNullValue()));
}
Aggregations