Search in sources :

Example 31 with DatasetImpl

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

the class StudyImporterForArthopodEasyCaptureTest method getDatasetGroupWithProperty.

private DatasetImpl getDatasetGroupWithProperty() throws IOException {
    DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"));
    JsonNode config = new ObjectMapper().readTree("{ \"" + DatasetConstant.SHOULD_RESOLVE_REFERENCES + "\": false, \"resources\": { \"rss\": \"http://amnh.begoniasociety.org/dwc/rss.xml\" } }");
    dataset.setConfig(config);
    return dataset;
}
Also used : JsonNode(org.codehaus.jackson.JsonNode) DatasetImpl(org.eol.globi.service.DatasetImpl) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 32 with DatasetImpl

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

the class ReferenceUtilTest method citationFor.

@Test
public void citationFor() throws IOException, StudyImporterException {
    DatasetImpl dataset = new DatasetImpl(null, URI.create("http://base"));
    dataset.setConfig(new ObjectMapper().readTree("{ \"citation\": \"http://gomexsi.tamucc.edu\" }"));
    String citation = CitationUtil.citationFor(dataset);
    assertThat(citation, is("http://gomexsi.tamucc.edu"));
}
Also used : DatasetImpl(org.eol.globi.service.DatasetImpl) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) Test(org.junit.Test)

Example 33 with DatasetImpl

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

the class ReferenceUtilTest method sourceCitation.

@Test
public void sourceCitation() {
    String s = CitationUtil.sourceCitationLastAccessed(new DatasetImpl("some/namespace", URI.create("http://example")), "some source citation. ");
    assertThat(s, startsWith("some source citation. Accessed at <http://example> on "));
    assertThat(s, endsWith("."));
}
Also used : DatasetImpl(org.eol.globi.service.DatasetImpl) Test(org.junit.Test)

Example 34 with DatasetImpl

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

the class StudyImporterForArthopodEasyCaptureTest method getDatasetGroup.

private DatasetImpl getDatasetGroup() throws IOException {
    DatasetImpl dataset = new DatasetImpl("some/namespace", URI.create("http://example.com"));
    JsonNode config = new ObjectMapper().readTree("{ \"resources\": { \"rss\": \"http://amnh.begoniasociety.org/dwc/rss.xml\" } }");
    dataset.setConfig(config);
    return dataset;
}
Also used : JsonNode(org.codehaus.jackson.JsonNode) DatasetImpl(org.eol.globi.service.DatasetImpl) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 35 with DatasetImpl

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

the class StudyImporterForMetaTableTest method assertExpectedColumnCount.

public void assertExpectedColumnCount(String metaTableDef) throws IOException {
    final Class<StudyImporterForMetaTable> clazz = StudyImporterForMetaTable.class;
    final URL resource = clazz.getResource(metaTableDef);
    assertNotNull(resource);
    final InputStream inputStream = clazz.getResourceAsStream(metaTableDef);
    final JsonNode config = new ObjectMapper().readTree(inputStream);
    String baseUrl = resource.toExternalForm().replaceFirst(metaTableDef + "$", "");
    List<StudyImporterForMetaTable.Column> columnNames = StudyImporterForMetaTable.columnsFromExternalSchema(config.get("tableSchema"), new DatasetImpl(null, URI.create(baseUrl)));
    assertThat(columnNames.size(), is(40));
}
Also used : InputStream(java.io.InputStream) JsonNode(org.codehaus.jackson.JsonNode) StringContains.containsString(org.junit.internal.matchers.StringContains.containsString) DatasetImpl(org.eol.globi.service.DatasetImpl) URL(java.net.URL) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Aggregations

DatasetImpl (org.eol.globi.service.DatasetImpl)45 Test (org.junit.Test)31 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)24 JsonNode (org.codehaus.jackson.JsonNode)16 Study (org.eol.globi.domain.Study)13 Relationship (org.neo4j.graphdb.Relationship)9 ArrayList (java.util.ArrayList)6 ObjectNode (org.codehaus.jackson.node.ObjectNode)6 StudyImpl (org.eol.globi.domain.StudyImpl)6 Dataset (org.eol.globi.service.Dataset)6 Node (org.neo4j.graphdb.Node)5 InputStream (java.io.InputStream)4 JUnitMatchers.containsString (org.junit.matchers.JUnitMatchers.containsString)4 NodeFactoryWithDatasetContext (org.eol.globi.data.NodeFactoryWithDatasetContext)3 LogContext (org.eol.globi.domain.LogContext)3 Specimen (org.eol.globi.domain.Specimen)3 Taxon (org.eol.globi.domain.Taxon)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 URI (java.net.URI)2