Added unit test classes.

This commit is contained in:
Winston Li 2014-12-04 21:08:53 +00:00
parent 3d19cb95b9
commit 3887e5025f
96 changed files with 1651 additions and 160 deletions

View file

@ -24,10 +24,6 @@ public class SnapshotPushPostbackHandler extends AbstractHandler {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// System.out.println("handling");
// System.out.println(request.getMethod());
// response.setContentType("text/html;charset=utf-8");
// response.setStatus(HttpServletResponse.SC_OK);
if (request.getMethod().equals("POST") && request.getPathInfo().endsWith("postback")) {
String contents = getContentsOfReader(request.getReader());
String projectName = request.getRequestURI().split("/")[1];

View file

@ -2,22 +2,12 @@ package uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.AsyncHttpClient;
import com.ning.http.client.HttpResponseBodyPart;
import com.ning.http.client.Response;
import uk.ac.ic.wlgitbridge.writelatex.api.request.exception.FailedConnectionException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.concurrent.Future;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotAttachment extends SnapshotFile {
private Future<byte[]> future;
private String url;
public SnapshotAttachment(JsonElement json) {
@ -27,43 +17,11 @@ public class SnapshotAttachment extends SnapshotFile {
@Override
public byte[] getContents() {
return null;
// try {
// return future.get();
// } catch (InterruptedException e) {
// throw new FailedConnectionException();
// } catch (ExecutionException e) {
// throw new FailedConnectionException();
// }
}
@Override
protected void getContentsFromJSON(JsonArray jsonArray) {
url = jsonArray.get(0).getAsString();
// fetchContents(jsonArray.get(0).getAsString());
}
private void fetchContents(String url) throws FailedConnectionException {
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
try {
future = asyncHttpClient.prepareGet(url).execute(new AsyncCompletionHandler<byte[]>() {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
@Override
public STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
bytes.write(bodyPart.getBodyPartBytes());
return STATE.CONTINUE;
}
@Override
public byte[] onCompleted(Response response) throws Exception {
return bytes.toByteArray();
}
});
} catch (IOException e) {
throw new FailedConnectionException();
}
}
public String getUrl() {

View file

@ -1,8 +1,9 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
@ -10,10 +11,7 @@ import java.util.List;
*/
public class InvalidProjectException extends SnapshotPostException {
private static final String[] DESCRIPTION_LINES = {
"Your WriteLatex project is too big.",
"Delete some files and try again.."
};
private LinkedList<String> descriptionLines;
public InvalidProjectException(JsonElement jsonElement) {
super(jsonElement);
@ -26,12 +24,16 @@ public class InvalidProjectException extends SnapshotPostException {
@Override
public List<String> getDescriptionLines() {
return Arrays.asList(DESCRIPTION_LINES);
return descriptionLines;
}
@Override
public void fromJSON(JsonElement json) {
descriptionLines = new LinkedList<String>();
JsonArray errors = json.getAsJsonObject().get("errors").getAsJsonArray();
for (JsonElement error : errors) {
descriptionLines.add(error.getAsString());
}
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class MainTests {
public class MainTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.application;
import org.junit.Test;
public class AttsResourceHandlerTest {
@Test
public void testHandle() throws Exception {
}
}

View file

@ -0,0 +1,17 @@
package uk.ac.ic.wlgitbridge.application;
import org.junit.Test;
public class SnapshotPushPostbackContentsTest {
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testProcessPostback() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.application;
import org.junit.Test;
public class SnapshotPushPostbackHandlerTest {
@Test
public void testHandle() throws Exception {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLGitBridgeApplicationTests {
public class WLGitBridgeApplicationTest {
@Test
public void diesIfLessThanTwoArguments() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLGitBridgeServerTests {
public class WLGitBridgeServerTest {
@Test
public void nothingToTest() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 03/11/14.
*/
public class InvalidProgramArgumentsExceptionTests {
public class InvalidProgramArgumentsExceptionTest {
@Test
public void nothingToTest() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 03/11/14.
*/
public class NullLoggerTests {
public class NullLoggerTest {
@Test
public void nothingToTest() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 05/11/14.
*/
public class WLBridgedProjectTests {
public class WLBridgedProjectTest {
@Test
public void nothingToTest() {

View file

@ -1,15 +0,0 @@
package uk.ac.ic.wlgitbridge.git;
import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLGitServletConfigTests {
@Test
public void nothingToTest() {
}
}

View file

@ -1,15 +0,0 @@
package uk.ac.ic.wlgitbridge.git;
import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLGitServletTests {
@Test
public void nothingToTest() {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLReceivePackFactoryTests {
public class WLReceivePackFactoryTest {
@Test
public void nothingToTest() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLRepositoryResolverTests {
public class WLRepositoryResolverTest {
@Test
public void joinsFilePathsTogether() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 02/11/14.
*/
public class WLUploadPackTests {
public class WLUploadPackTest {
@Test
public void nothingToTest() {

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 03/11/14.
*/
public class CheckNonFastForwardHookTests {
public class WriteLatexPutHookTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,22 @@
package uk.ac.ic.wlgitbridge.git.handler.hook.exception;
import org.junit.Test;
public class ForcedPushExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.git.servlet;
import org.junit.Test;
public class WLGitServletConfigTest {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.git.servlet;
import org.junit.Test;
public class WLGitServletTest {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,13 @@
package uk.ac.ic.wlgitbridge.git.util;
import org.junit.Test;
import static org.junit.Assert.*;
public class FileDirectoryContentsTest {
@Test
public void testGetFileContentsTable() throws Exception {
}
}

View file

@ -0,0 +1,11 @@
package uk.ac.ic.wlgitbridge.git.util;
import org.junit.Test;
public class RepositoryObjectTreeWalkerTest {
@Test
public void testGetDirectoryContents() throws Exception {
}
}

View file

@ -0,0 +1,26 @@
package uk.ac.ic.wlgitbridge.util;
import org.junit.Test;
public class UtilTest {
@Test
public void testEntries() throws Exception {
}
@Test
public void testBooleanToInt() throws Exception {
}
@Test
public void testIntToBoolean() throws Exception {
}
@Test
public void testRemoveAllSuffixes() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.junit.Test;
import static org.junit.Assert.*;
public class ProjectLockTest {
@Test
public void testLockForProject() throws Exception {
}
@Test
public void testUnlockForProject() throws Exception {
}
}

View file

@ -0,0 +1,33 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotFetcherTest {
@Test
public void testFetchNewSnapshots() throws Exception {
}
@Test
public void testGetLatestSnapshot() throws Exception {
}
@Test
public void testPutLatestVersion() throws Exception {
}
@Test
public void testInitFromPersistentStore() throws Exception {
}
@Test
public void testGetVersions() throws Exception {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 05/11/14.
*/
public class SnapshotRepositoryBuilderTests {
public class SnapshotRepositoryBuilderTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,38 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLDirectoryNodeSnapshotTest {
@Test
public void testGetJsonRepresentation() throws Exception {
}
@Test
public void testGetPreviousVersionID() throws Exception {
}
@Test
public void testGetProjectURL() throws Exception {
}
@Test
public void testApproveWithVersionID() throws Exception {
}
@Test
public void testGetProjectName() throws Exception {
}
@Test
public void testGetDirectoryNode() throws Exception {
}
}

View file

@ -0,0 +1,41 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.junit.Test;
public class WriteLatexAPITest {
@Test
public void testLockForProject() throws Exception {
}
@Test
public void testUnlockForProject() throws Exception {
}
@Test
public void testRepositoryExists() throws Exception {
}
@Test
public void testGetWritableRepositories() throws Exception {
}
@Test
public void testPutDirectoryContentsToProjectWithName() throws Exception {
}
@Test
public void testPostbackReceivedSuccessfully() throws Exception {
}
@Test
public void testPostbackReceivedWithException() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.base;
import org.junit.Test;
public class HTTPMethodTest {
@Test
public void nothingToTest() {
}
}

View file

@ -8,7 +8,7 @@ import uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers.SnapshotGetSaved
/**
* Created by Winston on 06/11/14.
*/
public class RequestTests {
public class RequestTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,17 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.base;
import org.junit.Test;
public class ResultTest {
@Test
public void testGetRequest() throws Exception {
}
@Test
public void testToString() throws Exception {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotAPIRequestTests {
public class SnapshotAPIRequestTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.exception;
import org.junit.Test;
public class FailedConnectionExceptionTest {
@Test
public void nothingToTest() {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotGetDocRequestTests {
public class SnapshotGetDocRequestTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getdoc;
import org.junit.Test;
public class SnapshotGetDocResultTest {
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testGetVersionID() throws Exception {
}
}

View file

@ -0,0 +1,21 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getdoc.exception;
import org.junit.Test;
public class InvalidProjectExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotAttachmentTest {
@Test
public void testGetContents() throws Exception {
}
@Test
public void testGetContentsFromJSON() throws Exception {
}
@Test
public void testGetUrl() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotDataTest {
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testGetSrcs() throws Exception {
}
@Test
public void testGetAtts() throws Exception {
}
}

View file

@ -0,0 +1,33 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotFileTest {
@Test
public void testGetPath() throws Exception {
}
@Test
public void testGetContents() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testGetContentsFromJSON() throws Exception {
}
@Test
public void testGetPathFromJSON() throws Exception {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotGetForVersionRequestTests {
public class SnapshotGetForVersionRequestTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getforversion;
import org.junit.Test;
public class SnapshotGetForVersionResultTest {
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testGetSnapshotData() throws Exception {
}
}

View file

@ -5,7 +5,7 @@ import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class SnapshotGetSavedVersRequestTests {
public class SnapshotGetSavedVersRequestTest {
@Test
public void nothingToTest() {

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotGetSavedVersResultTest {
@Test
public void testFromJSON() throws Exception {
}
@Test
public void testGetSavedVers() throws Exception {
}
}

View file

@ -0,0 +1,28 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotInfoTest {
@Test
public void testGetVersionId() throws Exception {
}
@Test
public void testGetComment() throws Exception {
}
@Test
public void testGetUser() throws Exception {
}
@Test
public void testGetCreatedAt() throws Exception {
}
}

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.getsavedvers;
import org.junit.Test;
public class WLUserTest {
@Test
public void testGetName() throws Exception {
}
@Test
public void testGetEmail() throws Exception {
}
}

View file

@ -0,0 +1,21 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push;
import org.junit.Test;
public class PostbackContentsTest {
@Test
public void testWaitForPostback() throws Exception {
}
@Test
public void testReceivedVersionID() throws Exception {
}
@Test
public void testReceivedException() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push;
import org.junit.Test;
import static org.junit.Assert.*;
public class PostbackManagerTest {
@Test
public void testGetVersionID() throws Exception {
}
@Test
public void testPostVersionIDForProject() throws Exception {
}
@Test
public void testPostExceptionForProject() throws Exception {
}
}

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push;
import org.junit.Test;
public class SnapshotPushRequestResultTest {
@Test
public void testWasSuccessful() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotPushRequestTest {
@Test
public void testHttpMethod() throws Exception {
}
@Test
public void testGetPostBody() throws Exception {
}
@Test
public void testParseResponse() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push;
import org.junit.Test;
public class UnexpectedPostbackExceptionTest {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
import static org.junit.Assert.*;
public class InvalidFilesExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
import static org.junit.Assert.*;
public class InvalidProjectExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
import static org.junit.Assert.*;
public class OutOfDateExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -0,0 +1,13 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotPostExceptionBuilderTest {
@Test
public void testBuild() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotPostExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
}

View file

@ -0,0 +1,21 @@
package uk.ac.ic.wlgitbridge.writelatex.api.request.push.exception;
import org.junit.Test;
public class UnexpectedErrorExceptionTest {
@Test
public void testGetMessage() throws Exception {
}
@Test
public void testGetDescriptionLines() throws Exception {
}
@Test
public void testFromJSON() throws Exception {
}
}

View file

@ -1,16 +0,0 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore;
import org.junit.Test;
import uk.ac.ic.wlgitbridge.writelatex.filestore.store.BlobHash;
public class BlobHashTest {
private static final String toHash = "\\\\documentclass[a4paper]{article}\\n\\n\\\\usepackage[english]{babel}\\n\\\\usepackage[utf8]{inputenc}\\n\\\\usepackage{graphicx}\\n\\\\usepackage{fullpage}\\n\\\\usepackage{listings}\\n\\\\usepackage{courier}\\n\\\\usepackage{url}\\n\\n\\\\lstset{basicstyle=\\\\ttfamily,breaklines=true}\\n\\n\\\\begin{document}\\n\\\\title{API for the writeLaTeX-Git Bridge}\\n\\\\author{JLM}\\n\\\\date{\\\\today}\\n\\\\maketitle\\n\\n\\\\section{Fetching a Project from WriteLaTeX}\\n\\nThere are three API calls that will likely be of interest. You can run them against this server, \\\\url{radiant-wind-3058.herokuapp.com}, but they're not on the production server yet.\\n\\n\\\\subsection{Get Doc}\\n\\nA ``doc'' is our internal term for a ``project''. At present, this just returns the latest version number.\\n\\n\\\\begin{lstlisting}\\nGET https://.../api/v0/docs/1826rqgsdb\\n# => { latestVerId: 39 }\\n\\\\end{lstlisting}\\n\\n\\\\subsection{Get Saved Vers}\\n\\nA ``saved ver'' is a version of a doc, saved by via the versions menu. Note that this query is not currently paginated.\\n\\n\\\\begin{lstlisting}\\nGET https://.../api/v0/docs/1826rqgsdb/saved_vers\\n# => [\\n {\\\"versionId\\\":39,\\n \\\"comment\\\":\\\"with more files\\\",\\n \\\"user\\\":{\\n \\\"email\\\":\\\"jdleesmiller@gmail.com\\\",\\n \\\"name\\\":\\\"John Lees-Miller\\\"},\\n \\\"createdAt\\\":\\\"2014-11-05T18:02:19Z\\\"},\\n {\\\"versionId\\\":24,\\n \\\"comment\\\":\\\"first draft\\\",\\n \\\"user\\\":{\\n \\\"email\\\":\\\"jdleesmiller@gmail.com\\\",\\n \\\"name\\\":\\\"John Lees-Miller\\\"},\\n \\\"createdAt\\\":\\\"2014-11-05T17:56:58Z\\\"}]\\n\\\\end{lstlisting}\\n\\n\\\\subsection{Get Snapshot for Version}\\n\\nA snapshot contains the content of a project in the given version. You can safely request a snapshot of any version that is, or was at any point in the last 24 hours, (1) a saved version, or (2) the current version. (Older versions may or may not have been moved to cold storage.)\\n\\nThe srcs array contains (content, file name) pairs; the atts array contains (URL, file name) pairs.\\n\\n\\\\begin{lstlisting}\\nGET https://.../api/v0/docs/1826rqgsdb/snapshots/39\\n# => {\\n \\\"srcs\\\":[\\n [\\\"This text is from another file.\\\",\\\"foo/bar/test.tex\\\"],\\n [\\\"\\\\\\\\documentclass[a4paper]{article}\\\\n...\\\",\\\"main.tex\\\"]],\\n \\\"atts\\\":[\\n [\\\"https://writelatex-staging.s3.amazonaws.com/filepicker/1ENnu6zJSGyslI3DuNZD_min_mean_wait_evm_7.eps.150dpi.png\\\",\\\"min_mean_wait_evm_7_eps_150dpi.png\\\"]]}\\n\\\\end{lstlisting}\\n\\n\\\\section{Pushing a Project to WriteLaTeX}\\n\\nTODO still working on this part\\n\\n\\\\section{Test Data}\\n\\nYou can use this project as one of your test projects. I've added an attachment and a file in a subfolder to make it a bit more interesting.\\n\\n\\\\input{foo/bar/test}\\n\\n\\\\includegraphics[width=\\\\linewidth]{min_mean_wait_evm_7_eps_150dpi}\\n\\n\\\\end{document}";
@Test
public void hashesTheBytesGivenInTheConstructorUsingSha256() {
BlobHash blobHash = new BlobHash(toHash.getBytes());
}
}

View file

@ -0,0 +1,28 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore;
import org.junit.Test;
import static org.junit.Assert.*;
public class GitDirectoryContentsTest {
@Test
public void testWrite() throws Exception {
}
@Test
public void testGetUserName() throws Exception {
}
@Test
public void testGetUserEmail() throws Exception {
}
@Test
public void testGetCommitMessage() throws Exception {
}
}

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore;
import org.junit.Test;
public class RepositoryFileTest {
@Test
public void testGetPath() throws Exception {
}
@Test
public void testGetContents() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
import org.junit.Test;
public class AttachmentBlobTest {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
import org.junit.Test;
import static org.junit.Assert.*;
public class BlobTest {
@Test
public void testGetContents() throws Exception {
}
@Test
public void testEquals() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
import org.junit.Test;
import static org.junit.Assert.*;
public class ByteBlobTest {
@Test
public void testGetContents() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
import org.junit.Test;
import static org.junit.Assert.*;
public class ExternalBlobTest {
@Test
public void testGetContents() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
}

View file

@ -0,0 +1,12 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.blob;
import org.junit.Test;
public class RawFileBlobTest {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,33 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.node;
import org.junit.Test;
import static org.junit.Assert.*;
public class AttachmentNodeTest {
@Test
public void testIndexWith() throws Exception {
}
@Test
public void testGetBlob() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
@Test
public void testGetURL() throws Exception {
}
@Test
public void testGetProjectName() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.node;
import org.junit.Test;
import static org.junit.Assert.*;
public class BlobNodeTest {
@Test
public void testIndexWith() throws Exception {
}
@Test
public void testGetBlob() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
}

View file

@ -0,0 +1,48 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.node;
import org.junit.Test;
import static org.junit.Assert.*;
public class FileNodeTest {
@Test
public void testGetContents() throws Exception {
}
@Test
public void testWriteToDisk() throws Exception {
}
@Test
public void testGetFilePath() throws Exception {
}
@Test
public void testIsChanged() throws Exception {
}
@Test
public void testIndexWith() throws Exception {
}
@Test
public void testGetBlob() throws Exception {
}
@Test
public void testEquals() throws Exception {
}
@Test
public void testToString() throws Exception {
}
}

View file

@ -0,0 +1,38 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.node;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLDirectoryNodeTest {
@Test
public void testInitFromPersistentStore() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
@Test
public void testGetFileNodes() throws Exception {
}
@Test
public void testUpdateFromSnapshot() throws Exception {
}
@Test
public void testCreateFromRawDirectoryContents() throws Exception {
}
@Test
public void testToString() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.store;
import org.junit.Test;
import static org.junit.Assert.*;
public class BlobHashTest {
@Test
public void testEquals() throws Exception {
}
@Test
public void testHashCode() throws Exception {
}
}

View file

@ -0,0 +1,38 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.store;
import org.junit.Test;
import static org.junit.Assert.*;
public class FileIndexStoreTest {
@Test
public void testIndex() throws Exception {
}
@Test
public void testIndex1() throws Exception {
}
@Test
public void testInitFromPersistentStore() throws Exception {
}
@Test
public void testHasAttachmentWithURL() throws Exception {
}
@Test
public void testGetAttachment() throws Exception {
}
@Test
public void testUpdatePersistentStore() throws Exception {
}
}

View file

@ -0,0 +1,38 @@
package uk.ac.ic.wlgitbridge.writelatex.filestore.store;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLFileStoreTest {
@Test
public void testInitFromPersistentStore() throws Exception {
}
@Test
public void testDeleteInDirectory() throws Exception {
}
@Test
public void testDeleteInDirectoryApartFrom() throws Exception {
}
@Test
public void testUpdateForProject() throws Exception {
}
@Test
public void testCreateNextDirectoryNodeInProjectFromContents() throws Exception {
}
@Test
public void testApproveCandidateSnapshot() throws Exception {
}
}

View file

@ -0,0 +1,48 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
import static org.junit.Assert.*;
public class SnapshotTest {
@Test
public void testGetVersionID() throws Exception {
}
@Test
public void testGetComment() throws Exception {
}
@Test
public void testGetUserName() throws Exception {
}
@Test
public void testGetUserEmail() throws Exception {
}
@Test
public void testGetSrcs() throws Exception {
}
@Test
public void testGetAtts() throws Exception {
}
@Test
public void testCompareTo() throws Exception {
}
@Test
public void testToString() throws Exception {
}
}

View file

@ -1,15 +0,0 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
/**
* Created by Winston on 05/11/14.
*/
public class SnapshotTests {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,28 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLDataModelTest {
@Test
public void testUpdateProjectWithName() throws Exception {
}
@Test
public void testGetProjectWithName() throws Exception {
}
@Test
public void testCreateCandidateSnapshotFromProjectWithContents() throws Exception {
}
@Test
public void testApproveSnapshot() throws Exception {
}
}

View file

@ -1,15 +0,0 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class WLDataModelTests {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,21 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
public class WLProjectStoreTest {
@Test
public void testGetProjectWithName() throws Exception {
}
@Test
public void testGetProjectNames() throws Exception {
}
@Test
public void testInitFromPersistentStore() throws Exception {
}
}

View file

@ -0,0 +1,33 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLProjectTest {
@Test
public void testFetchNewSnapshots() throws Exception {
}
@Test
public void testGetName() throws Exception {
}
@Test
public void testGetLatestSnapshotID() throws Exception {
}
@Test
public void testPutLatestSnapshot() throws Exception {
}
@Test
public void testInitFromPersistentStore() throws Exception {
}
}

View file

@ -1,15 +0,0 @@
package uk.ac.ic.wlgitbridge.writelatex.model;
import org.junit.Test;
/**
* Created by Winston on 06/11/14.
*/
public class WLProjectTests {
@Test
public void nothingToTest() {
}
}

View file

@ -0,0 +1,73 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db;
import org.junit.Test;
import static org.junit.Assert.*;
public class WLGBPersistentStoreTest {
@Test
public void testLoadProjectStore() throws Exception {
}
@Test
public void testLoadFileStore() throws Exception {
}
@Test
public void testAddProject() throws Exception {
}
@Test
public void testAddSnapshot() throws Exception {
}
@Test
public void testAddFileNodeBlob() throws Exception {
}
@Test
public void testAddFileNodeExternal() throws Exception {
}
@Test
public void testAddURLIndex() throws Exception {
}
@Test
public void testGetProjectNames() throws Exception {
}
@Test
public void testGetVersionIDsForProjectName() throws Exception {
}
@Test
public void testGetFileNodesForProjectName() throws Exception {
}
@Test
public void testGetURLIndexTableForProjectName() throws Exception {
}
@Test
public void testDeleteFileNodesForProjectName() throws Exception {
}
@Test
public void testDeleteURLIndexesForProjectName() throws Exception {
}
}

View file

@ -0,0 +1,61 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql;
import org.junit.Test;
public class SQLiteWLDatabaseTest {
@Test
public void testAddProject() throws Exception {
}
@Test
public void testAddSnapshot() throws Exception {
}
@Test
public void testAddFileNodeBlob() throws Exception {
}
@Test
public void testAddFileNodeExternal() throws Exception {
}
@Test
public void testAddURLIndex() throws Exception {
}
@Test
public void testGetProjectNames() throws Exception {
}
@Test
public void testGetVersionIDsForProjectName() throws Exception {
}
@Test
public void testGetFileNodesForProjectName() throws Exception {
}
@Test
public void testGetURLIndexTableForProjectName() throws Exception {
}
@Test
public void testDeleteFileNodesForProjectName() throws Exception {
}
@Test
public void testDeleteURLIndexesForProjectName() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.query;
import org.junit.Test;
import static org.junit.Assert.*;
public class GetFileNodesForProjectNameSQLQueryTest {
@Test
public void testProcessResultSet() throws Exception {
}
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.query;
import org.junit.Test;
import static org.junit.Assert.*;
public class GetProjectNamesSQLQueryTest {
@Test
public void testProcessResultSet() throws Exception {
}
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.query;
import org.junit.Test;
import static org.junit.Assert.*;
public class GetURLIndexTableForProjectNameSQLQueryTest {
@Test
public void testProcessResultSet() throws Exception {
}
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.query;
import org.junit.Test;
import static org.junit.Assert.*;
public class GetVersionIDsForProjectNameSQLQueryTest {
@Test
public void testProcessResultSet() throws Exception {
}
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.create;
import org.junit.Test;
import static org.junit.Assert.*;
public class CreateFileNodeTableSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.create;
import org.junit.Test;
import static org.junit.Assert.*;
public class CreateProjectsTableSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.create;
import org.junit.Test;
import static org.junit.Assert.*;
public class CreateSnapshotsTableSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.create;
import org.junit.Test;
public class CreateURLIndexStoreSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.delete;
import org.junit.Test;
import static org.junit.Assert.*;
public class DeleteFileNodesForProjectNameSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.delete;
import org.junit.Test;
import static org.junit.Assert.*;
public class DeleteURLIndexesForProjectNameSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.insert;
import org.junit.Test;
import static org.junit.Assert.*;
public class AddFileNodeBlobSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.insert;
import org.junit.Test;
import static org.junit.Assert.*;
public class AddFileNodeExternalSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.insert;
import org.junit.Test;
import static org.junit.Assert.*;
public class AddProjectSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,18 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.insert;
import org.junit.Test;
import static org.junit.Assert.*;
public class AddSnapshotSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}

View file

@ -0,0 +1,16 @@
package uk.ac.ic.wlgitbridge.writelatex.model.db.sql.update.insert;
import org.junit.Test;
public class AddURLIndexSQLUpdateTest {
@Test
public void testGetSQL() throws Exception {
}
@Test
public void testAddParametersToStatement() throws Exception {
}
}