Search in sources :

Example 1 with Cache

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

the class DatasetWithCacheTest method datasetLastAccessedAt.

private DatasetWithCache datasetLastAccessedAt(String lastAccessed) {
    Cache cache = Mockito.mock(Cache.class);
    CachedURI cacheURI = Mockito.mock(CachedURI.class);
    when(cacheURI.getAccessedAt()).thenReturn(lastAccessed);
    when(cache.asMeta(any(URI.class))).thenReturn(cacheURI);
    DatasetImpl datasetUncached = new DatasetImpl("some/namespace", URI.create("some:bla"));
    return new DatasetWithCache(datasetUncached, cache);
}
Also used : CachedURI(org.globalbioticinteractions.cache.CachedURI) DatasetImpl(org.eol.globi.service.DatasetImpl) CachedURI(org.globalbioticinteractions.cache.CachedURI) URI(java.net.URI) Cache(org.globalbioticinteractions.cache.Cache)

Example 2 with Cache

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

the class DatasetFinderWithCacheTest method datasetCached.

private Dataset datasetCached() throws IOException, URISyntaxException {
    Dataset dataset = Mockito.mock(Dataset.class);
    when(dataset.getNamespace()).thenReturn("some/namespace");
    when(dataset.getArchiveURI()).thenReturn(getClass().getResource("archive.zip").toURI());
    Cache cache = CacheUtil.cacheFor("some/namespace", cachePath);
    return new DatasetWithCache(dataset, cache);
}
Also used : Dataset(org.eol.globi.service.Dataset) Cache(org.globalbioticinteractions.cache.Cache)

Aggregations

Cache (org.globalbioticinteractions.cache.Cache)2 URI (java.net.URI)1 Dataset (org.eol.globi.service.Dataset)1 DatasetImpl (org.eol.globi.service.DatasetImpl)1 CachedURI (org.globalbioticinteractions.cache.CachedURI)1