Search in sources :

Example 26 with DatasetImpl

use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.

the class DatasetImplTest method doiExpectedPrefix.

@Test
public void doiExpectedPrefix() throws IOException {
    Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
    dataset.setConfig(new ObjectMapper().readTree("{\"doi\": \"doi:10.2980/1195-6860(2006)13[23:TDOFUB]2.0.CO;2\" }"));
    assertThat(dataset.getDOI(), is(new DOI("2980", "1195-6860(2006)13[23:TDOFUB]2.0.CO;2")));
}
Also used : Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 27 with DatasetImpl

use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.

the class DatasetImplTest method doiExpected.

@Test
public void doiExpected() throws IOException {
    Dataset dataset = new DatasetImpl("some/namespace", URI.create("some:uri"), inStream -> inStream);
    dataset.setConfig(new ObjectMapper().readTree("{\"doi\": \"http://dx.doi.org/10.2980/1195-6860(2006)13[23:TDOFUB]2.0.CO;2\" }"));
    assertThat(dataset.getDOI(), is(new DOI("2980", "1195-6860(2006)13[23:TDOFUB]2.0.CO;2")));
}
Also used : Dataset(org.globalbioticinteractions.dataset.Dataset) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DOI(org.globalbioticinteractions.doi.DOI) Test(org.junit.Test)

Example 28 with DatasetImpl

use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.

the class DatasetProxyTest method getTestDataset.

public DatasetProxy getTestDataset(JsonNode config, JsonNode configProxy) {
    DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"), inStream -> inStream);
    dataset.setConfig(config);
    DatasetProxy datasetProxy = new DatasetProxy(dataset);
    datasetProxy.setConfig(configProxy);
    return datasetProxy;
}
Also used : DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) DatasetProxy(org.globalbioticinteractions.dataset.DatasetProxy)

Example 29 with DatasetImpl

use of org.globalbioticinteractions.dataset.DatasetImpl 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));
}
Also used : StudyImporterException(org.eol.globi.data.StudyImporterException) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) DatasetImporterForTSV(org.eol.globi.data.DatasetImporterForTSV) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) IsNull.nullValue(org.hamcrest.core.IsNull.nullValue) CoreMatchers.not(org.hamcrest.CoreMatchers.not) DatasetImporter(org.eol.globi.data.DatasetImporter) Test(org.junit.Test) URI(java.net.URI) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assert(org.junit.Assert) Is(org.hamcrest.core.Is) DatasetImporterForTSV(org.eol.globi.data.DatasetImporterForTSV) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) DatasetImporter(org.eol.globi.data.DatasetImporter) Test(org.junit.Test)

Example 30 with DatasetImpl

use of org.globalbioticinteractions.dataset.DatasetImpl in project eol-globi-data by jhpoelen.

the class DatasetTest method resourceURL.

@Test
public void resourceURL() throws IOException, URISyntaxException {
    URL resource = getClass().getResource("archive.zip");
    File archive = new File(resource.toURI());
    assertThat(archive.exists(), is(true));
    URI parentDir = archive.getParentFile().toURI();
    Dataset dataset = new DatasetImpl("some/namespace", parentDir, inStream -> inStream);
    InputStream retrieve = dataset.retrieve(resource.toURI());
    assertArchiveHash(retrieve);
    assertArchiveHash(dataset.retrieve(URI.create("archive.zip")));
    assertArchiveHash(dataset.retrieve(URI.create("/archive.zip")));
}
Also used : Dataset(org.globalbioticinteractions.dataset.Dataset) InputStream(java.io.InputStream) DatasetImpl(org.globalbioticinteractions.dataset.DatasetImpl) File(java.io.File) URI(java.net.URI) URL(java.net.URL) Test(org.junit.Test)

Aggregations

DatasetImpl (org.globalbioticinteractions.dataset.DatasetImpl)83 Test (org.junit.Test)73 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)50 URI (java.net.URI)32 JsonNode (com.fasterxml.jackson.databind.JsonNode)31 Dataset (org.globalbioticinteractions.dataset.Dataset)25 ArrayList (java.util.ArrayList)22 IOException (java.io.IOException)21 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)21 InteractionListener (org.eol.globi.process.InteractionListener)19 URL (java.net.URL)18 Map (java.util.Map)17 StudyNode (org.eol.globi.domain.StudyNode)17 HashMap (java.util.HashMap)16 Is.is (org.hamcrest.core.Is.is)16 List (java.util.List)15 StudyImpl (org.eol.globi.domain.StudyImpl)15 StringUtils (org.apache.commons.lang3.StringUtils)14 CoreMatchers.nullValue (org.hamcrest.CoreMatchers.nullValue)14 Is (org.hamcrest.core.Is)14