Add and test GetNumProjects

This commit is contained in:
Winston Li
2016-08-24 00:48:26 +01:00
committed by Michael Mazour
parent 4b014826d3
commit a595acd0a6
11 changed files with 114 additions and 17 deletions

View File

@@ -44,9 +44,9 @@ public class BridgeTest {
repoStore,
dbStore,
swapStore,
swapJob,
snapshotAPI,
resourceCache,
swapJob
resourceCache
);
}

View File

@@ -26,6 +26,17 @@ public class SqliteDBStoreTest {
dbStore = new SqliteDBStore(tmpFolder.newFile("dbStore.db"));
}
@Test
public void testGetNumProjects() {
assertEquals(0, dbStore.getNumProjects());
dbStore.setLatestVersionForProject("asdf", 1);
assertEquals(1, dbStore.getNumProjects());
dbStore.setLatestVersionForProject("asdf1", 2);
assertEquals(2, dbStore.getNumProjects());
dbStore.setLatestVersionForProject("asdf1", 3);
assertEquals(2, dbStore.getNumProjects());
}
@Test
public void swapTableStartsOutEmpty() {
assertNull(dbStore.getOldestUnswappedProject());

View File

@@ -31,6 +31,7 @@ public class SwapJobImplTest {
dbStore = mock(DBStore.class);
swapStore = mock(SwapStore.class);
swapJob = new SwapJobImpl(
SwapJobConfig.DEFAULT,
lock,
repoStore,
dbStore,