From 570d90d7d0635c85db21efaa12e1ecf3582edd6b Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sat, 19 Nov 2011 07:34:13 -0500
Subject: [PATCH] Removed legacy css file
---
tests/com/gitblit/tests/GitServletTest.java | 41 +++++++++++++++++++++++++++++++----------
1 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/tests/com/gitblit/tests/GitServletTest.java b/tests/com/gitblit/tests/GitServletTest.java
index 0ede7ca..89466d7 100644
--- a/tests/com/gitblit/tests/GitServletTest.java
+++ b/tests/com/gitblit/tests/GitServletTest.java
@@ -8,24 +8,26 @@
import java.util.Date;
import java.util.concurrent.Executors;
-import junit.framework.TestCase;
-
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.util.FileUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
import com.gitblit.GitBlitServer;
-public class GitServletTest extends TestCase {
+public class GitServletTest {
File folder = new File(GitBlitSuite.REPOSITORIES, "working/ticgit");
- int port = 8180;
+ static int port = 8180;
- int shutdownPort = 8181;
+ static int shutdownPort = 8181;
- @Override
- protected void setUp() throws Exception {
+ @BeforeClass
+ public static void startGitblit() throws Exception {
// Start a Gitblit instance
Executors.newSingleThreadExecutor().execute(new Runnable() {
public void run() {
@@ -40,8 +42,8 @@
Thread.sleep(2500);
}
- @Override
- protected void tearDown() throws Exception {
+ @AfterClass
+ public static void stopGitblit() throws Exception {
// Stop Gitblit
GitBlitServer.main("--stop", "--shutdownPort", "" + shutdownPort);
@@ -49,8 +51,11 @@
Thread.sleep(2500);
}
+ @Test
public void testClone() throws Exception {
- FileUtils.delete(folder, FileUtils.RECURSIVE);
+ if (folder.exists()) {
+ FileUtils.delete(folder, FileUtils.RECURSIVE);
+ }
CloneCommand clone = Git.cloneRepository();
clone.setURI(MessageFormat.format("http://localhost:{0,number,#}/git/ticgit.git", port));
clone.setDirectory(folder);
@@ -59,6 +64,7 @@
clone.call();
}
+ @Test
public void testAnonymousCommit() throws Exception {
Git git = Git.open(folder);
File file = new File(folder, "TODO");
@@ -71,4 +77,19 @@
git.push().setPushAll().call();
git.getRepository().close();
}
+
+ @Test
+ public void testBogusLoginClone() throws Exception {
+ File folder = new File(GitBlitSuite.REPOSITORIES, "working/gitblit");
+ if (folder.exists()) {
+ FileUtils.delete(folder, FileUtils.RECURSIVE);
+ }
+ CloneCommand clone = Git.cloneRepository();
+ clone.setURI(MessageFormat.format("http://localhost:{0,number,#}/git/gitblit.git", port));
+ clone.setDirectory(folder);
+ clone.setBare(false);
+ clone.setCloneAllBranches(true);
+ clone.setCredentialsProvider(new UsernamePasswordCredentialsProvider("bogus", "bogus"));
+ clone.call();
+ }
}
--
Gitblit v1.9.1