@Test void testListDisabled() { final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + "resource"); final File dir = new File(getClass().getResource("/versions").getFile()); assertTrue(dir.exists(), "Resource directory doesn't exist!"); assertTrue(dir.isDirectory(), "Resource directory isn't a valid directory"); try { System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH, dir.getAbsolutePath()); System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO, "false"); final MementoService svc = new FileMementoService(); assertEquals(0L, svc.mementos(identifier).toCompletableFuture().join().size(), "Incorrect count of Mementos!"); } finally { System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH); System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO); } }
@Override public CompletionStage<SortedSet<Instant>> mementos(final IRI identifier) { if (enabled) { return supplyAsync(() -> listMementos(identifier)); } return completedFuture(emptySortedSet()); }
FileMementoService implements MementoService { @Override public CompletionStage<SortedSet<Instant>> mementos(final IRI identifier) { if (enabled) { return supplyAsync(() -> listMementos(identifier)); } return completedFuture(emptySortedSet()); } }
FileMementoService implements MementoService { @Override public CompletionStage<SortedSet<Instant>> mementos(final IRI identifier) { if (enabled) { return supplyAsync(() -> listMementos(identifier)); } return completedFuture(emptySortedSet()); } FileMementoService(); private  FileMementoService(final Config config);  FileMementoService(final String path, final boolean enabled); }
FileMementoService implements MementoService { @Override public CompletionStage<SortedSet<Instant>> mementos(final IRI identifier) { if (enabled) { return supplyAsync(() -> listMementos(identifier)); } return completedFuture(emptySortedSet()); } FileMementoService(); private  FileMementoService(final Config config);  FileMementoService(final String path, final boolean enabled); @Override CompletionStage<Void> put(final Resource resource); CompletionStage<Void> put(final Resource resource, final Instant time); @Override CompletionStage<Resource> get(final IRI identifier, final Instant time); @Override CompletionStage<SortedSet<Instant>> mementos(final IRI identifier); CompletionStage<Void> delete(final IRI identifier, final Instant time); }
FileMementoService implements MementoService { @Override public CompletionStage<SortedSet<Instant>> mementos(final IRI identifier) { if (enabled) { return supplyAsync(() -> listMementos(identifier)); } return completedFuture(emptySortedSet()); } FileMementoService(); private  FileMementoService(final Config config);  FileMementoService(final String path, final boolean enabled); @Override CompletionStage<Void> put(final Resource resource); CompletionStage<Void> put(final Resource resource, final Instant time); @Override CompletionStage<Resource> get(final IRI identifier, final Instant time); @Override CompletionStage<SortedSet<Instant>> mementos(final IRI identifier); CompletionStage<Void> delete(final IRI identifier, final Instant time); static final String CONFIG_FILE_MEMENTO_PATH; static final String CONFIG_FILE_MEMENTO; }