/** * Check the creation of chaining between the default {@link Store}s and a {@link InMemoryBackend}. */ @Test public void testCreateTransientStore() throws IOException { try (Backend backend = new InMemoryBackendFactory().createBackend(new InMemoryUriFactory().createLocalUri(currentTempFile()), new InMemoryConfig())) { try (Store store = StoreFactory.getInstance().createStore(backend, context().config())) { assertThat(store).isInstanceOf(NoopStore.class); assertThat(store.backend()).isSameAs(backend); } } }
/** * Checks the copy of a {@link Backend} to another. */ @Test public void testCopyBackend() throws IOException { ImmutableConfig config = context().config(); File file = currentTempFile(); try (Backend transientBackend = new InMemoryBackendFactory().createBackend(new InMemoryUriFactory().createLocalUri(file), new InMemoryConfig())) { try (Backend persistentBackend = context().factory().createBackend(context().createUri(currentTempFile()), config)) { transientBackend.copyTo(persistentBackend); } } }