From a125cf6876e0edc5a2498df57a9df06d60b1f572 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 02 Jun 2011 22:40:23 -0400
Subject: [PATCH] Unit testing. Start of git-notes display feature.

---
 tests/com/gitblit/tests/GitBlitSuite.java |   48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java
index fcb5723..97e46c9 100644
--- a/tests/com/gitblit/tests/GitBlitSuite.java
+++ b/tests/com/gitblit/tests/GitBlitSuite.java
@@ -28,7 +28,9 @@
 
 import com.gitblit.FileSettings;
 import com.gitblit.GitBlit;
+import com.gitblit.GitBlitException;
 import com.gitblit.JettyLoginService;
+import com.gitblit.models.RepositoryModel;
 
 public class GitBlitSuite extends TestSetup {
 	public static final File REPOSITORIES = new File("git");
@@ -42,6 +44,7 @@
 		suite.addTestSuite(TimeUtilsTest.class);
 		suite.addTestSuite(StringUtilsTest.class);
 		suite.addTestSuite(ByteFormatTest.class);
+		suite.addTestSuite(MarkdownUtilsTest.class);
 		suite.addTestSuite(JGitUtilsTest.class);
 		suite.addTestSuite(DiffUtilsTest.class);
 		suite.addTestSuite(MetricUtilsTest.class);
@@ -60,16 +63,21 @@
 
 	@Override
 	protected void setUp() throws Exception {
-		if (REPOSITORIES.exists() || REPOSITORIES.mkdirs()) {
-			cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git", true);
-			cloneOrFetch("nested/helloworld.git", "https://github.com/git/hello-world.git", true);
-			cloneOrFetch("ticgit.git", "https://github.com/jeffWelling/ticgit.git", true);
-		}
 		FileSettings settings = new FileSettings("distrib/gitblit.properties");
 		GitBlit.self().configureContext(settings);
 		JettyLoginService loginService = new JettyLoginService(new File("distrib/users.properties"));
 		loginService.loadUsers();
 		GitBlit.self().setLoginService(loginService);
+
+		if (REPOSITORIES.exists() || REPOSITORIES.mkdirs()) {
+			cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git", true);
+			cloneOrFetch("nested/helloworld.git", "https://github.com/git/hello-world.git", true);
+			cloneOrFetch("ticgit.git", "https://github.com/jeffWelling/ticgit.git", true);
+
+			enableTickets("ticgit.git");
+			enableDocs("ticgit.git");
+			showRemoteBranches("ticgit.git");
+		}
 	}
 
 	private void cloneOrFetch(String toFolder, String fromUrl, boolean bare) throws Exception {
@@ -92,4 +100,34 @@
 			System.out.println("done.");
 		}
 	}
+
+	private void enableTickets(String repositoryName) {
+		try {
+			RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
+			model.useTickets = true;
+			GitBlit.self().editRepositoryModel(model.name, model, false);
+		} catch (GitBlitException g) {
+			g.printStackTrace();
+		}
+	}
+	
+	private void enableDocs(String repositoryName) {
+		try {
+			RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
+			model.useDocs = true;
+			GitBlit.self().editRepositoryModel(model.name, model, false);
+		} catch (GitBlitException g) {
+			g.printStackTrace();
+		}
+	}
+	
+	private void showRemoteBranches(String repositoryName) {
+		try {
+			RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
+			model.showRemoteBranches = true;
+			GitBlit.self().editRepositoryModel(model.name, model, false);
+		} catch (GitBlitException g) {
+			g.printStackTrace();
+		}
+	}
 }

--
Gitblit v1.9.1