From f3ce6e80794ff3a234dbd8850c8501abda95cedb Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 11 Jul 2012 17:14:30 -0400
Subject: [PATCH] Fixes and adjustments to test suite

---
 tests/com/gitblit/tests/TicgitUtilsTest.java      |    4 +---
 tests/com/gitblit/tests/GitBlitSuite.java         |    7 +++++--
 tests/com/gitblit/tests/GitServletTest.java       |    5 ++---
 test-users.conf                                   |    1 +
 tests/com/gitblit/tests/SyndicationUtilsTest.java |    2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/test-users.conf b/test-users.conf
index 70e9a87..5551e47 100644
--- a/test-users.conf
+++ b/test-users.conf
@@ -1,5 +1,6 @@
 [user "admin"]
 	password = admin
+	cookie = dd94709528bb1c83d08f3088d4043f4742891f4f
 	role = "#admin"
 	role = "#notfederated"
 [team "admins"]
diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java
index 0cb63ec..07c5e08 100644
--- a/tests/com/gitblit/tests/GitBlitSuite.java
+++ b/tests/com/gitblit/tests/GitBlitSuite.java
@@ -101,6 +101,9 @@
 			// already started
 			return false;
 		}
+		
+		GitServletTest.deleteWorkingFolders();
+		
 		// Start a Gitblit instance
 		Executors.newSingleThreadExecutor().execute(new Runnable() {
 			public void run() {
@@ -123,7 +126,7 @@
 		GitBlitServer.main("--stop", "--shutdownPort", "" + shutdownPort);
 
 		// Wait a few seconds for it to be running
-		Thread.sleep(2500);
+		Thread.sleep(5000);
 	}
 
 	@BeforeClass
@@ -132,7 +135,7 @@
 
 		if (REPOSITORIES.exists() || REPOSITORIES.mkdirs()) {
 			cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git");
-			cloneOrFetch("ticgit.git", "https://github.com/jeffWelling/ticgit.git");
+			cloneOrFetch("ticgit.git", "https://github.com/schacon/ticgit.git");
 			cloneOrFetch("test/jgit.git", "https://github.com/eclipse/jgit.git");
 			cloneOrFetch("test/helloworld.git", "https://github.com/git/hello-world.git");
 			cloneOrFetch("test/ambition.git", "https://github.com/defunkt/ambition.git");
diff --git a/tests/com/gitblit/tests/GitServletTest.java b/tests/com/gitblit/tests/GitServletTest.java
index 2f9a9c4..848a1d0 100644
--- a/tests/com/gitblit/tests/GitServletTest.java
+++ b/tests/com/gitblit/tests/GitServletTest.java
@@ -42,7 +42,6 @@
 
 	@BeforeClass
 	public static void startGitblit() throws Exception {
-		deleteWorkingFolders();
 		started.set(GitBlitSuite.startGitblit());
 	}
 
@@ -50,11 +49,11 @@
 	public static void stopGitblit() throws Exception {
 		if (started.get()) {
 			GitBlitSuite.stopGitblit();
+			deleteWorkingFolders();
 		}
-		deleteWorkingFolders();
 	}
 	
-	private static void deleteWorkingFolders() throws Exception {
+	public static void deleteWorkingFolders() throws Exception {
 		if (ticgitFolder.exists()) {
 			FileUtils.delete(ticgitFolder, FileUtils.RECURSIVE);
 		}
diff --git a/tests/com/gitblit/tests/SyndicationUtilsTest.java b/tests/com/gitblit/tests/SyndicationUtilsTest.java
index ca6678d..4542adb 100644
--- a/tests/com/gitblit/tests/SyndicationUtilsTest.java
+++ b/tests/com/gitblit/tests/SyndicationUtilsTest.java
@@ -67,7 +67,7 @@
 		Set<String> links = new HashSet<String>();
 		for (int i = 0; i < 2; i++) {
 			List<FeedEntryModel> feed = SyndicationUtils.readFeed(GitBlitSuite.url, "ticgit.git",
-					"deving", 5, i, GitBlitSuite.account, GitBlitSuite.password.toCharArray());
+					"master", 5, i, GitBlitSuite.account, GitBlitSuite.password.toCharArray());
 			assertTrue(feed != null);
 			assertTrue(feed.size() > 0);
 			assertEquals(5, feed.size());
diff --git a/tests/com/gitblit/tests/TicgitUtilsTest.java b/tests/com/gitblit/tests/TicgitUtilsTest.java
index a77dae4..74f9e44 100644
--- a/tests/com/gitblit/tests/TicgitUtilsTest.java
+++ b/tests/com/gitblit/tests/TicgitUtilsTest.java
@@ -82,8 +82,6 @@
 				.getTicket(repository, tickets.get(tickets.size() - 1).name);
 		repository.close();
 		assertNotNull(ticket);
-		assertEquals(
-				"1254123752_comments-on-ticgits-longer-than-5-lines-can-t-be-viewed-entirely_266",
-				ticket.name);
+		assertEquals("1206206148_add-attachment-to-ticket_138", ticket.name);
 	}
 }
\ No newline at end of file

--
Gitblit v1.9.1