From a276b7c806a6600a603b4fac15914dcd82f99542 Mon Sep 17 00:00:00 2001
From: Winston Li
Date: Sun, 11 Jan 2015 15:54:36 +0000
Subject: [PATCH] Added integration test for pulling a modified tex file.
---
.../WLGitBridgeIntegrationTest.java | 24 ++++++
...sions-a7e4de19d015c3e7477e3f7eaa6c418e.png | Bin 346 -> 3573 bytes
.../canPullAModifiedTexFile/base/state.json | 46 +++++++++++
.../base/testproj/foo/bar/test.tex | 1 +
.../base/testproj/main.tex | 1 +
.../base/testproj/overleaf-white-410.png | 12 +++
.../withModifiedTexFile/state.json | 72 ++++++++++++++++++
.../testproj/foo/bar/test.tex | 1 +
.../withModifiedTexFile/testproj/main.tex | 2 +
.../testproj/overleaf-white-410.png | 12 +++
10 files changed, 171 insertions(+)
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/state.json
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/foo/bar/test.tex
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/main.tex
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/overleaf-white-410.png
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/state.json
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/foo/bar/test.tex
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/main.tex
create mode 100644 services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/overleaf-white-410.png
diff --git a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
index 066c65068d..379c7f78bc 100644
--- a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
+++ b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest.java
@@ -32,6 +32,10 @@ public class WLGitBridgeIntegrationTest {
put("canCloneMultipleRepositories", new HashMap() {{
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/canCloneMultipleRepositories/state/state.json")).build());
}});
+ put("canPullAModifiedTexFile", new HashMap() {{
+ put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/base/state.json")).build());
+ put("withModifiedTexFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/withModifiedTexFile/state.json")).build());
+ }});
}};
@Rule
@@ -84,6 +88,26 @@ public class WLGitBridgeIntegrationTest {
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canCloneMultipleRepositories/state/testproj2"), testproj2.toPath()));
}
+ @Test
+ public void canPullAModifiedTexFile() throws IOException, GitAPIException {
+ MockSnapshotServer server = new MockSnapshotServer(3859, getResource("/canPullAModifiedTexFile").toFile());
+ server.start();
+ server.setState(states.get("canPullAModifiedTexFile").get("base"));
+ WLGitBridgeApplication wlgb = new WLGitBridgeApplication(new String[] {
+ makeConfigFile(33859, 3859)
+ });
+ wlgb.run();
+ folder.create();
+ File git = folder.newFolder();
+ Git.cloneRepository()
+ .setURI("http://127.0.0.1:33859/testproj.git")
+ .setDirectory(git)
+ .call()
+ .close();
+ wlgb.stop();
+ assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canPullAModifiedTexFile/base/testproj"), git.toPath()));
+ }
+
private String makeConfigFile(int port, int apiPort) throws IOException {
File wlgb = folder.newFolder();
File config = folder.newFile();
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canCloneMultipleRepositories/state/testproj2/editor-versions-a7e4de19d015c3e7477e3f7eaa6c418e.png b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canCloneMultipleRepositories/state/testproj2/editor-versions-a7e4de19d015c3e7477e3f7eaa6c418e.png
index bd650735423963a142cca021c020c3f43dfb8766..7fa339be7a9ab251a9d2adde54b39501bc0dc056 100644
GIT binary patch
literal 3573
zcmVVGd000McNliru-3u8IH87xi-9G>T4T4ET
zK~#9!?Okh(Rn-;#*1iKch#-iFiq=O3As~q;iVE0JAE=*Hk9=&dk~8dGDN+%%7P#
zcdxa+Z?C=fKKrf(6jDebg%r|3#p>NalDh-w2VgemJ$(52eDIM7+X)VdWlAKsXfb>K9g=TgZfZ+gk&52rzCCxUoyUpzVVrs@a%R7-A
zO7eb^%Da$!Q_^^ny$kfB&-QCn!$R^el6n+NKzQIEHnZ^ndelP@127-J_swi^-js7W
z0==K4DI{fP=hO-KUrw?S0N#=`o8;&s0_+TY1AvRnY+47(Yo0f=v&?K=hb92YVF2cs
zS@#Z@;_Q%glXLEt4o3h(4-U_z1VVu_>+opUdD2m+8C1>kRHRzSb=q`1*JcXM46
zfaDZ2yEG*^X+qRH=C+(Lq<(E*8OIn-oN#a8_3qHw<
z5_HUZlHViQHDen)m&x!_lJ6F35&T;da>jEckI19VK@jwn^wWgwULdJct$=?|0uFdl
z(tsM808=Ebi`fV7O6t;~Wr?J@c2!8~pC2FHZ`c9Iv=`EhS=k}F~&!R>i5>a!S(
z*+Q}pI*5>bAf`!kbk>Hv9Rv8YNxF>mA4u|IlH*8rNqOwE;$T1!1bdaQ#i#DP>tX=^
z4;ca9o8+q%^!Y)`dYl#m2Nq`Gz)>-P|MQH%FOh6&MXy^^*5{z|cMYQW^8T7y_eo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gt+=2jJ}k+MGgWdWG3(~b#{6fg_rW>bUMPmst(m|P5D$S5)LhL95S#lzOQ1Y(w+jUgl7d3eN7L
zh9?Qp-W|iUyIL)9grXle^MFzqDMF{(Rvz6CdD3tm;EkAv9iqUgB+x`Y-Y@$9i=6!d
DOZ0C3
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/state.json b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/state.json
new file mode 100644
index 0000000000..d3fb76a03d
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/state.json
@@ -0,0 +1,46 @@
+[
+ {
+ "project": "testproj",
+ "getDoc": {
+ "versionID": 1,
+ "createdAt": "2014-11-30T18:40:58Z",
+ "email": "jdleesmiller+1@gmail.com",
+ "name": "John+1"
+ },
+ "getSavedVers": [
+ {
+ "versionID": 1,
+ "comment": "added more info on doc GET and error details",
+ "email": "jdleesmiller+1@gmail.com",
+ "name": "John+1",
+ "createdAt": "2014-11-30T18:47:01Z"
+ }
+ ],
+ "getForVers": [
+ {
+ "versionID": 1,
+ "srcs": [
+ {
+ "content": "content\n",
+ "path": "main.tex"
+ },
+ {
+ "content": "This text is from another file.",
+ "path": "foo/bar/test.tex"
+ }
+ ],
+ "atts": [
+ {
+ "url": "http://127.0.0.1:3859/base/testproj/overleaf-white-410.png",
+ "path": "overleaf-white-410.png"
+ }
+ ]
+ }
+ ],
+ "push": "success",
+ "postback": {
+ "type": "success",
+ "versionID": 2
+ }
+ }
+]
\ No newline at end of file
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/foo/bar/test.tex b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/foo/bar/test.tex
new file mode 100644
index 0000000000..046794f19a
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/foo/bar/test.tex
@@ -0,0 +1 @@
+This text is from another file.
\ No newline at end of file
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/main.tex b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/main.tex
new file mode 100644
index 0000000000..d95f3ad14d
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/main.tex
@@ -0,0 +1 @@
+content
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/overleaf-white-410.png b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/overleaf-white-410.png
new file mode 100644
index 0000000000..be0315abbb
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/base/testproj/overleaf-white-410.png
@@ -0,0 +1,12 @@
+
+
+
+Error 404
+
+
+HTTP ERROR: 404
+Problem accessing /state/testproj1/overleaf-white-410.png. Reason:
+
Not Found
+
Powered by Jetty://
+
+
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/state.json b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/state.json
new file mode 100644
index 0000000000..2be7aa4bdd
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/state.json
@@ -0,0 +1,72 @@
+[
+ {
+ "project": "testproj",
+ "getDoc": {
+ "versionID": 2,
+ "createdAt": "2014-11-30T18:40:58Z",
+ "email": "jdleesmiller+1@gmail.com",
+ "name": "John+1"
+ },
+ "getSavedVers": [
+ {
+ "versionID": 2,
+ "comment": "i added more stuff to main.tex",
+ "email": "jdleesmiller+1@gmail.com",
+ "name": "John+1",
+ "createdAt": "2014-11-30T18:48:01Z"
+ },
+ {
+ "versionID": 1,
+ "comment": "added more info on doc GET and error details",
+ "email": "jdleesmiller+1@gmail.com",
+ "name": "John+1",
+ "createdAt": "2014-11-30T18:47:01Z"
+ }
+ ],
+ "getForVers": [
+ {
+ "versionID": 2,
+ "srcs": [
+ {
+ "content": "content\nadded more stuff\n",
+ "path": "main.tex"
+ },
+ {
+ "content": "This text is from another file.",
+ "path": "foo/bar/test.tex"
+ }
+ ],
+ "atts": [
+ {
+ "url": "http://127.0.0.1:3859/withModifiedTexFile/testproj/overleaf-white-410.png",
+ "path": "overleaf-white-410.png"
+ }
+ ]
+ },
+ {
+ "versionID": 1,
+ "srcs": [
+ {
+ "content": "content\n",
+ "path": "main.tex"
+ },
+ {
+ "content": "This text is from another file.",
+ "path": "foo/bar/test.tex"
+ }
+ ],
+ "atts": [
+ {
+ "url": "http://127.0.0.1:3857/base/testproj/overleaf-white-410.png",
+ "path": "overleaf-white-410.png"
+ }
+ ]
+ }
+ ],
+ "push": "success",
+ "postback": {
+ "type": "success",
+ "versionID": 2
+ }
+ }
+]
\ No newline at end of file
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/foo/bar/test.tex b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/foo/bar/test.tex
new file mode 100644
index 0000000000..046794f19a
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/foo/bar/test.tex
@@ -0,0 +1 @@
+This text is from another file.
\ No newline at end of file
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/main.tex b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/main.tex
new file mode 100644
index 0000000000..933682f779
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/main.tex
@@ -0,0 +1,2 @@
+content
+added more stuff
diff --git a/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/overleaf-white-410.png b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/overleaf-white-410.png
new file mode 100644
index 0000000000..be0315abbb
--- /dev/null
+++ b/services/git-bridge/src/test/resources/uk/ac/ic/wlgitbridge/WLGitBridgeIntegrationTest/canPullAModifiedTexFile/withModifiedTexFile/testproj/overleaf-white-410.png
@@ -0,0 +1,12 @@
+
+
+
+Error 404
+
+
+HTTP ERROR: 404
+Problem accessing /state/testproj1/overleaf-white-410.png. Reason:
+
Not Found
+
Powered by Jetty://
+
+