@Test public void expectCaching() throws IOException { final ResourceService resourceService = singleRequestResourceService(); final SparqlClient openBiodivClient = new SparqlClientCachingFactory().create(resourceService); assertCitation(openBiodivClient); assertCitation(openBiodivClient); }
@Override public SparqlClient create(ResourceService resourceService) { DB db = getDb(); final Map<String, String> queryCache = db.createTreeMap("queryCache").make(); final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService); return new OpenBiodivClient(resourceServiceCaching) { @Override public void close() throws IOException { db.close(); } }; }
SparqlClientCachingFactory extends SparqlClientOpenBiodivFactory { @Override public SparqlClient create(ResourceService resourceService) { DB db = getDb(); final Map<String, String> queryCache = db.createTreeMap("queryCache").make(); final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService); return new OpenBiodivClient(resourceServiceCaching) { @Override public void close() throws IOException { db.close(); } }; } }
SparqlClientCachingFactory extends SparqlClientOpenBiodivFactory { @Override public SparqlClient create(ResourceService resourceService) { DB db = getDb(); final Map<String, String> queryCache = db.createTreeMap("queryCache").make(); final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService); return new OpenBiodivClient(resourceServiceCaching) { @Override public void close() throws IOException { db.close(); } }; }  }
SparqlClientCachingFactory extends SparqlClientOpenBiodivFactory { @Override public SparqlClient create(ResourceService resourceService) { DB db = getDb(); final Map<String, String> queryCache = db.createTreeMap("queryCache").make(); final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService); return new OpenBiodivClient(resourceServiceCaching) { @Override public void close() throws IOException { db.close(); } }; }  @Override SparqlClient create(ResourceService resourceService); DB getDb(); }
SparqlClientCachingFactory extends SparqlClientOpenBiodivFactory { @Override public SparqlClient create(ResourceService resourceService) { DB db = getDb(); final Map<String, String> queryCache = db.createTreeMap("queryCache").make(); final ResourceService resourceServiceCaching = new ResourceServiceCaching(queryCache, resourceService); return new OpenBiodivClient(resourceServiceCaching) { @Override public void close() throws IOException { db.close(); } }; }  @Override SparqlClient create(ResourceService resourceService); DB getDb();  }