Search in sources :

Example 11 with StudyImporter

use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.

the class GitHubImporterFactoryIT method defaultTSVImporterCached.

@Test
public void defaultTSVImporterCached() throws StudyImporterException, DatasetFinderException {
    final DatasetFinder datasetFinder = new DatasetFinderWithCache(new DatasetFinderGitHubArchive());
    StudyImporter importer = getTemplateImporter(datasetFinder, "globalbioticinteractions/template-dataset");
    StudyImporterForTSV importerTSV = (StudyImporterForTSV) importer;
    assertThat(importerTSV.getBaseUrl(), startsWith("https://github.com/globalbioticinteractions/template-dataset/"));
    String actual = importerTSV.getDataset().getResourceURI("this/is/relative").toString();
    assertThat(actual, startsWith("jar:file:"));
    assertThat(actual, endsWith("this/is/relative"));
}
Also used : StudyImporterForTSV(org.eol.globi.data.StudyImporterForTSV) StringContains.containsString(org.junit.internal.matchers.StringContains.containsString) BaseStudyImporter(org.eol.globi.data.BaseStudyImporter) StudyImporter(org.eol.globi.data.StudyImporter) DatasetFinderWithCache(org.globalbioticinteractions.dataset.DatasetFinderWithCache) Test(org.junit.Test)

Example 12 with StudyImporter

use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.

the class GitHubImporterFactoryIT method createWood.

@Test
public void createWood() throws StudyImporterException, DatasetFinderException {
    final DatasetFinderGitHubRemote datasetFinderGitHubRemote = new DatasetFinderGitHubRemote();
    StudyImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/wood2015");
    assertThat(importer, is(notNullValue()));
    assertThat(importer, is(instanceOf(StudyImporterForWood.class)));
    StudyImporterForWood importerz = (StudyImporterForWood) importer;
    assertThat(importerz.getSourceCitation(), containsString("Wood"));
    assertThat(importerz.getDataset().getResourceURI(importerz.getLinksResourceName()).toString(), endsWith(".csv"));
}
Also used : StudyImporterForWood(org.eol.globi.data.StudyImporterForWood) BaseStudyImporter(org.eol.globi.data.BaseStudyImporter) StudyImporter(org.eol.globi.data.StudyImporter) Test(org.junit.Test)

Example 13 with StudyImporter

use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.

the class GitHubImporterFactoryIT method createMetaTableREEM.

@Test
public void createMetaTableREEM() throws StudyImporterException, DatasetFinderException {
    final DatasetFinderGitHubRemote datasetFinderGitHubRemote = new DatasetFinderGitHubRemote();
    StudyImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/noaa-reem");
    assertThat(importer, is(notNullValue()));
    assertThat(importer, is(instanceOf(StudyImporterForMetaTable.class)));
    final JsonNode config = ((StudyImporterForMetaTable) importer).getConfig();
    assertThat(config, is(notNullValue()));
}
Also used : StudyImporterForMetaTable(org.eol.globi.data.StudyImporterForMetaTable) JsonNode(org.codehaus.jackson.JsonNode) BaseStudyImporter(org.eol.globi.data.BaseStudyImporter) StudyImporter(org.eol.globi.data.StudyImporter) Test(org.junit.Test)

Example 14 with StudyImporter

use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.

the class GitHubImporterFactoryIT method createSzoboszlai.

@Test
public void createSzoboszlai() throws StudyImporterException, DatasetFinderException {
    final DatasetFinderGitHubRemote datasetFinderGitHubRemote = new DatasetFinderGitHubRemote();
    StudyImporter importer = importerFor(datasetFinderGitHubRemote, "globalbioticinteractions/szoboszlai2015");
    assertThat(importer, is(notNullValue()));
    assertThat(importer, is(instanceOf(StudyImporterForSzoboszlai.class)));
    StudyImporterForSzoboszlai importerz = (StudyImporterForSzoboszlai) importer;
    assertThat(importerz.getSourceCitation(), containsString("Szoboszlai"));
}
Also used : StudyImporterForSzoboszlai(org.eol.globi.data.StudyImporterForSzoboszlai) BaseStudyImporter(org.eol.globi.data.BaseStudyImporter) StudyImporter(org.eol.globi.data.StudyImporter) Test(org.junit.Test)

Example 15 with StudyImporter

use of org.eol.globi.data.StudyImporter in project eol-globi-data by jhpoelen.

the class GitHubImporterFactoryIT method defaultTSVImporterNotCached.

@Test
public void defaultTSVImporterNotCached() throws StudyImporterException, DatasetFinderException {
    final DatasetFinder datasetFinder = new DatasetFinderGitHubRemote();
    StudyImporter importer = getTemplateImporter(datasetFinder, "globalbioticinteractions/template-dataset");
    assertThat(((StudyImporterForTSV) importer).getBaseUrl(), startsWith("https://raw.githubusercontent.com/globalbioticinteractions/template-dataset/"));
    String actual = ((StudyImporterForTSV) importer).getDataset().getResourceURI("this/is/relative").toString();
    assertThat(actual, startsWith("https:/"));
    assertThat(actual, endsWith("this/is/relative"));
}
Also used : StudyImporterForTSV(org.eol.globi.data.StudyImporterForTSV) StringContains.containsString(org.junit.internal.matchers.StringContains.containsString) BaseStudyImporter(org.eol.globi.data.BaseStudyImporter) StudyImporter(org.eol.globi.data.StudyImporter) Test(org.junit.Test)

Aggregations

StudyImporter (org.eol.globi.data.StudyImporter)20 BaseStudyImporter (org.eol.globi.data.BaseStudyImporter)16 Test (org.junit.Test)15 JsonNode (org.codehaus.jackson.JsonNode)3 StudyImporterForTSV (org.eol.globi.data.StudyImporterForTSV)3 DatasetFinderWithCache (org.globalbioticinteractions.dataset.DatasetFinderWithCache)3 StringContains.containsString (org.junit.internal.matchers.StringContains.containsString)3 StudyImporterException (org.eol.globi.data.StudyImporterException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 MalformedURLException (java.net.MalformedURLException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BasicParser (org.apache.commons.cli.BasicParser)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 HelpFormatter (org.apache.commons.cli.HelpFormatter)1 Option (org.apache.commons.cli.Option)1 Options (org.apache.commons.cli.Options)1