Fix issue with cloning multiple identical files and add test

This commit is contained in:
Winston Li
2015-08-04 21:13:50 +01:00
parent 34c2d7f613
commit 4fbd6eaabe
8 changed files with 87 additions and 9 deletions

View File

@@ -60,6 +60,9 @@ public class WLGitBridgeIntegrationTest {
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADuplicateBinaryFile/base/state.json")).build());
put("withDuplicateBinaryFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullADuplicateBinaryFile/withDuplicateBinaryFile/state.json")).build());
}});
put("canCloneDuplicateBinaryFiles", new HashMap<String, SnapshotAPIState>() {{
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/canCloneDuplicateBinaryFiles/state/state.json")).build());
}});
put("canPullAModifiedNestedFile", new HashMap<String, SnapshotAPIState>() {{
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/base/state.json")).build());
put("withModifiedNestedFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedNestedFile/withModifiedNestedFile/state.json")).build());
@@ -273,6 +276,24 @@ public class WLGitBridgeIntegrationTest {
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullADuplicateBinaryFile/withDuplicateBinaryFile/testproj"), testprojDir.toPath()));
}
@Test
public void canCloneDuplicateBinaryFiles() throws IOException, GitAPIException, InterruptedException {
MockSnapshotServer server = new MockSnapshotServer(4002, getResource("/canCloneDuplicateBinaryFiles").toFile());
server.start();
server.setState(states.get("canCloneDuplicateBinaryFiles").get("state"));
GitBridgeApp wlgb = new GitBridgeApp(new String[] {
makeConfigFile(44002, 4002)
});
wlgb.run();
File dir = folder.newFolder();
Process git = runtime.exec("git clone http://127.0.0.1:44002/testproj.git", null, dir);
int exitCode = git.waitFor();
wlgb.stop();
File testprojDir = new File(dir, "testproj");
assertEquals(0, exitCode);
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canCloneDuplicateBinaryFiles/state/testproj"), testprojDir.toPath()));
}
@Test
public void canPullAModifiedNestedFile() throws IOException, GitAPIException, InterruptedException {
MockSnapshotServer server = new MockSnapshotServer(3864, getResource("/canPullAModifiedNestedFile").toFile());