@Test public void persistsStatesThroughSessions() throws Exception { SyncIndex index = new SqliteSyncIndex(repo); SyncIndexEntry entry = index.get(BoxFileSystem.getRoot().resolve("testpath")); entry.setSyncedState(new SyncState(true, 10L, 20L)); SyncIndex index2 = new SqliteSyncIndex(repo); SyncIndexEntry entry2 = index2.get(BoxFileSystem.getRoot().resolve("testpath")); SyncState state = entry2.getSyncedState(); assertThat(state.isExisting(), is(true)); assertThat(state.getMtime(), is(10L)); assertThat(state.getSize(), is(20L)); }
@Override public SyncIndexEntry get(BoxPath relativePath) { if (relativePath.isAbsolute()) { relativePath = BoxFileSystem.getRoot().relativize(relativePath); } return entries.getOrDefault(relativePath, this::loadEntry); }
SqliteSyncIndex implements SyncIndex { @Override public SyncIndexEntry get(BoxPath relativePath) { if (relativePath.isAbsolute()) { relativePath = BoxFileSystem.getRoot().relativize(relativePath); } return entries.getOrDefault(relativePath, this::loadEntry); } }
SqliteSyncIndex implements SyncIndex { @Override public SyncIndexEntry get(BoxPath relativePath) { if (relativePath.isAbsolute()) { relativePath = BoxFileSystem.getRoot().relativize(relativePath); } return entries.getOrDefault(relativePath, this::loadEntry); } SqliteSyncIndex(SyncIndexEntryRepository repo); }
SqliteSyncIndex implements SyncIndex { @Override public SyncIndexEntry get(BoxPath relativePath) { if (relativePath.isAbsolute()) { relativePath = BoxFileSystem.getRoot().relativize(relativePath); } return entries.getOrDefault(relativePath, this::loadEntry); } SqliteSyncIndex(SyncIndexEntryRepository repo); @Override SyncIndexEntry get(BoxPath relativePath); @Override void clear(); }
SqliteSyncIndex implements SyncIndex { @Override public SyncIndexEntry get(BoxPath relativePath) { if (relativePath.isAbsolute()) { relativePath = BoxFileSystem.getRoot().relativize(relativePath); } return entries.getOrDefault(relativePath, this::loadEntry); } SqliteSyncIndex(SyncIndexEntryRepository repo); @Override SyncIndexEntry get(BoxPath relativePath); @Override void clear();  }