Search in sources :

Example 1 with CachePullThrough

use of org.globalbioticinteractions.cache.CachePullThrough in project eol-globi-data by jhpoelen.

the class DatasetImporterForRSSIT method importVertnet.

@Test
public void importVertnet() throws StudyImporterException, IOException {
    File tempFile = File.createTempFile("test", ".tmp", new File("target"));
    DatasetImporter importer = new StudyImporterTestFactory(nodeFactory).instantiateImporter(DatasetImporterForRSS.class);
    DatasetWithCache datasetWithCache = new DatasetWithCache(new DatasetLocal(inStream -> inStream), new CachePullThrough("testing", tempFile.getParentFile().getAbsolutePath()));
    ObjectNode rssUrl = new ObjectMapper().createObjectNode();
    rssUrl.put("rss", "http://ipt.vertnet.org:8080/ipt/rss.do");
    ObjectNode configNode = new ObjectMapper().createObjectNode();
    configNode.set("resources", rssUrl);
    datasetWithCache.setConfig(configNode);
    importer.setDataset(datasetWithCache);
    importStudy(importer);
}
Also used : DatasetWithCache(org.globalbioticinteractions.dataset.DatasetWithCache) CachePullThrough(org.globalbioticinteractions.cache.CachePullThrough) Dataset(org.globalbioticinteractions.dataset.Dataset) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test) IOException(java.io.IOException) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) File(java.io.File) DatasetLocal(org.eol.globi.service.DatasetLocal) Is(org.hamcrest.core.Is) CachePullThrough(org.globalbioticinteractions.cache.CachePullThrough) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) File(java.io.File) DatasetLocal(org.eol.globi.service.DatasetLocal) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DatasetWithCache(org.globalbioticinteractions.dataset.DatasetWithCache) Test(org.junit.Test)

Example 2 with CachePullThrough

use of org.globalbioticinteractions.cache.CachePullThrough in project eol-globi-data by jhpoelen.

the class DatasetImporterForRSSIT method importUCSB.

@Test
public void importUCSB() throws StudyImporterException, IOException {
    File tempFile = File.createTempFile("test", ".tmp", new File("target"));
    DatasetImporter importer = new StudyImporterTestFactory(nodeFactory).instantiateImporter(DatasetImporterForRSS.class);
    final DatasetLocal dataset = new DatasetLocal(inStream -> inStream);
    DatasetWithCache datasetWithCache = new DatasetWithCache(dataset, new CachePullThrough("testing", tempFile.getParentFile().getAbsolutePath()));
    ObjectNode rssUrl = new ObjectMapper().createObjectNode();
    rssUrl.put("rss", "https://symbiota.ccber.ucsb.edu/webservices/dwc/rss.xml");
    ObjectNode configNode = new ObjectMapper().createObjectNode();
    configNode.set("resources", rssUrl);
    datasetWithCache.setConfig(configNode);
    importer.setDataset(datasetWithCache);
    importStudy(importer);
    final Dataset datasetImported = nodeFactory.getOrCreateDataset(dataset);
    assertThat(datasetImported.getNamespace(), Is.is("jhpoelen/eol-globidata"));
}
Also used : CachePullThrough(org.globalbioticinteractions.cache.CachePullThrough) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Dataset(org.globalbioticinteractions.dataset.Dataset) File(java.io.File) DatasetLocal(org.eol.globi.service.DatasetLocal) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DatasetWithCache(org.globalbioticinteractions.dataset.DatasetWithCache) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 File (java.io.File)2 DatasetLocal (org.eol.globi.service.DatasetLocal)2 CachePullThrough (org.globalbioticinteractions.cache.CachePullThrough)2 Dataset (org.globalbioticinteractions.dataset.Dataset)2 DatasetWithCache (org.globalbioticinteractions.dataset.DatasetWithCache)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Is (org.hamcrest.core.Is)1