mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Added integration test for pulling a modified tex file.
This commit is contained in:
parent
21455e494a
commit
a276b7c806
10 changed files with 171 additions and 0 deletions
|
@ -32,6 +32,10 @@ public class WLGitBridgeIntegrationTest {
|
||||||
put("canCloneMultipleRepositories", new HashMap<String, SnapshotAPIState>() {{
|
put("canCloneMultipleRepositories", new HashMap<String, SnapshotAPIState>() {{
|
||||||
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/canCloneMultipleRepositories/state/state.json")).build());
|
put("state", new SnapshotAPIStateBuilder(getResourceAsStream("/canCloneMultipleRepositories/state/state.json")).build());
|
||||||
}});
|
}});
|
||||||
|
put("canPullAModifiedTexFile", new HashMap<String, SnapshotAPIState>() {{
|
||||||
|
put("base", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/base/state.json")).build());
|
||||||
|
put("withModifiedTexFile", new SnapshotAPIStateBuilder(getResourceAsStream("/canPullAModifiedTexFile/withModifiedTexFile/state.json")).build());
|
||||||
|
}});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
|
@ -84,6 +88,26 @@ public class WLGitBridgeIntegrationTest {
|
||||||
assertTrue(FileUtil.gitDirectoriesAreEqual(getResource("/canCloneMultipleRepositories/state/testproj2"), testproj2.toPath()));
|
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 {
|
private String makeConfigFile(int port, int apiPort) throws IOException {
|
||||||
File wlgb = folder.newFolder();
|
File wlgb = folder.newFolder();
|
||||||
File config = folder.newFile();
|
File config = folder.newFile();
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 3.5 KiB |
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
This text is from another file.
|
|
@ -0,0 +1 @@
|
||||||
|
content
|
|
@ -0,0 +1,12 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
|
||||||
|
<title>Error 404 </title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>HTTP ERROR: 404</h2>
|
||||||
|
<p>Problem accessing /state/testproj1/overleaf-white-410.png. Reason:
|
||||||
|
<pre> Not Found</pre></p>
|
||||||
|
<hr /><i><small>Powered by Jetty://</small></i>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1 @@
|
||||||
|
This text is from another file.
|
|
@ -0,0 +1,2 @@
|
||||||
|
content
|
||||||
|
added more stuff
|
|
@ -0,0 +1,12 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
|
||||||
|
<title>Error 404 </title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>HTTP ERROR: 404</h2>
|
||||||
|
<p>Problem accessing /state/testproj1/overleaf-white-410.png. Reason:
|
||||||
|
<pre> Not Found</pre></p>
|
||||||
|
<hr /><i><small>Powered by Jetty://</small></i>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue