mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-24 17:51:51 +02:00
Delete the SnapshotRepositoryBuilder and WLBridgedProject abominations. Set accessed time after update and push.
This commit is contained in:
committed by
Michael Mazour
parent
c459cd57af
commit
dd5694104d
@@ -3,6 +3,7 @@ package uk.ac.ic.wlgitbridge.bridge.db.sqlite;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import uk.ac.ic.wlgitbridge.bridge.db.ProjectState;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Timestamp;
|
||||
@@ -147,4 +148,29 @@ public class SqliteDBStoreTest {
|
||||
assertEquals(0, dbStore.getNumUnswappedProjects());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectStateIsNotPresentIfNotInDBAtAll() {
|
||||
assertEquals(
|
||||
ProjectState.NOT_PRESENT,
|
||||
dbStore.getProjectState("asdf")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectStateIsPresentIfProjectHasLastAccessed() {
|
||||
dbStore.setLatestVersionForProject("asdf", 1);
|
||||
dbStore.setLastAccessedTime(
|
||||
"asdf",
|
||||
Timestamp.valueOf(LocalDateTime.now())
|
||||
);
|
||||
assertEquals(ProjectState.PRESENT, dbStore.getProjectState("asdf"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectStateIsSwappedIfLastAccessedIsNull() {
|
||||
dbStore.setLatestVersionForProject("asdf", 1);
|
||||
dbStore.setLastAccessedTime("asdf", null);
|
||||
assertEquals(ProjectState.SWAPPED, dbStore.getProjectState("asdf"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import static org.junit.Assert.assertEquals;
|
||||
/**
|
||||
* Created by winston on 23/08/2016.
|
||||
*/
|
||||
public class FSRepoStoreTest {
|
||||
public class FSGitRepoStoreTest {
|
||||
|
||||
public static File makeTempRepoDir(
|
||||
TemporaryFolder tmpFolder,
|
||||
@@ -28,14 +28,14 @@ public class FSRepoStoreTest {
|
||||
File tmp = tmpFolder.newFolder(name);
|
||||
Path rootdir = Paths.get(
|
||||
"src/test/resources/uk/ac/ic/wlgitbridge/"
|
||||
+ "bridge/repo/FSRepoStoreTest/rootdir"
|
||||
+ "bridge/repo/FSGitRepoStoreTest/rootdir"
|
||||
);
|
||||
FileUtils.copyDirectory(rootdir.toFile(), tmp);
|
||||
Files.renameAll(tmp, "DOTgit", ".git");
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private FSRepoStore repoStore;
|
||||
private FSGitRepoStore repoStore;
|
||||
private File original;
|
||||
|
||||
@Before
|
||||
@@ -45,7 +45,7 @@ public class FSRepoStoreTest {
|
||||
File tmp = makeTempRepoDir(tmpFolder, "rootdir");
|
||||
original = tmpFolder.newFolder("original");
|
||||
FileUtils.copyDirectory(tmp, original);
|
||||
repoStore = new FSRepoStore(tmp.getAbsolutePath());
|
||||
repoStore = new FSGitRepoStore(tmp.getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -6,8 +6,8 @@ import org.junit.rules.TemporaryFolder;
|
||||
import uk.ac.ic.wlgitbridge.bridge.db.DBStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.db.sqlite.SqliteDBStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.lock.ProjectLock;
|
||||
import uk.ac.ic.wlgitbridge.bridge.repo.FSRepoStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.repo.FSRepoStoreTest;
|
||||
import uk.ac.ic.wlgitbridge.bridge.repo.FSGitRepoStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.repo.FSGitRepoStoreTest;
|
||||
import uk.ac.ic.wlgitbridge.bridge.repo.RepoStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.swap.store.InMemorySwapStore;
|
||||
import uk.ac.ic.wlgitbridge.bridge.swap.store.SwapStore;
|
||||
@@ -39,8 +39,8 @@ public class SwapJobImplTest {
|
||||
TemporaryFolder tmpFolder = new TemporaryFolder();
|
||||
tmpFolder.create();
|
||||
lock = new ProjectLockImpl();
|
||||
repoStore = new FSRepoStore(
|
||||
FSRepoStoreTest.makeTempRepoDir(
|
||||
repoStore = new FSGitRepoStore(
|
||||
FSGitRepoStoreTest.makeTempRepoDir(
|
||||
tmpFolder,
|
||||
"repostore"
|
||||
).getAbsolutePath()
|
||||
|
||||
Reference in New Issue
Block a user