From 2a02f843771aaccea2cb497fdc40ae8ca384d498 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 18 Nov 2011 17:39:37 -0500
Subject: [PATCH] Added some flare to the console log
---
tests/com/gitblit/tests/GitBlitSuite.java | 61 ++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/tests/com/gitblit/tests/GitBlitSuite.java b/tests/com/gitblit/tests/GitBlitSuite.java
index e13e1bb..ad87cb0 100644
--- a/tests/com/gitblit/tests/GitBlitSuite.java
+++ b/tests/com/gitblit/tests/GitBlitSuite.java
@@ -16,6 +16,7 @@
package com.gitblit.tests;
import java.io.File;
+import java.util.concurrent.Executors;
import junit.extensions.TestSetup;
import junit.framework.Test;
@@ -25,14 +26,23 @@
import org.eclipse.jgit.storage.file.FileRepository;
import com.gitblit.FileSettings;
+import com.gitblit.FileUserService;
import com.gitblit.GitBlit;
import com.gitblit.GitBlitException;
-import com.gitblit.JettyLoginService;
+import com.gitblit.GitBlitServer;
import com.gitblit.models.RepositoryModel;
import com.gitblit.utils.JGitUtils;
public class GitBlitSuite extends TestSetup {
+
public static final File REPOSITORIES = new File("git");
+
+ static int port = 8280;
+ static int shutdownPort = 8281;
+
+ public static String url = "http://localhost:" + port;
+ public static String account = "admin";
+ public static String password = "admin";
private GitBlitSuite(TestSuite suite) {
super(suite);
@@ -40,15 +50,21 @@
public static Test suite() {
TestSuite suite = new TestSuite();
+ suite.addTestSuite(FileUtilsTest.class);
suite.addTestSuite(TimeUtilsTest.class);
suite.addTestSuite(StringUtilsTest.class);
+ suite.addTestSuite(Base64Test.class);
+ suite.addTestSuite(JsonUtilsTest.class);
suite.addTestSuite(ByteFormatTest.class);
+ suite.addTestSuite(ObjectCacheTest.class);
suite.addTestSuite(MarkdownUtilsTest.class);
suite.addTestSuite(JGitUtilsTest.class);
+ suite.addTestSuite(SyndicationUtilsTest.class);
suite.addTestSuite(DiffUtilsTest.class);
suite.addTestSuite(MetricUtilsTest.class);
suite.addTestSuite(TicgitUtilsTest.class);
suite.addTestSuite(GitBlitTest.class);
+ suite.addTestSuite(RpcTests.class);
return new GitBlitSuite(suite);
}
@@ -68,13 +84,35 @@
return new FileRepository(new File(REPOSITORIES, "test/bluez-gnome.git"));
}
+ public static void startGitblit() throws Exception {
+ // Start a Gitblit instance
+ Executors.newSingleThreadExecutor().execute(new Runnable() {
+ public void run() {
+ GitBlitServer.main("--httpPort", "" + port, "--httpsPort", "0", "--shutdownPort",
+ "" + shutdownPort, "--repositoriesFolder",
+ "\"" + GitBlitSuite.REPOSITORIES.getAbsolutePath() + "\"", "--userService",
+ "distrib/users.properties");
+ }
+ });
+
+ // Wait a few seconds for it to be running
+ Thread.sleep(2500);
+ }
+
+ public static void stopGitblit() throws Exception {
+ // Stop Gitblit
+ GitBlitServer.main("--stop", "--shutdownPort", "" + shutdownPort);
+
+ // Wait a few seconds for it to be running
+ Thread.sleep(2500);
+ }
+
@Override
protected void setUp() throws Exception {
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);
+ GitBlit.self().configureContext(settings, true);
+ FileUserService loginService = new FileUserService(new File("distrib/users.properties"));
+ GitBlit.self().setUserService(loginService);
if (REPOSITORIES.exists() || REPOSITORIES.mkdirs()) {
cloneOrFetch("helloworld.git", "https://github.com/git/hello-world.git");
@@ -89,6 +127,13 @@
showRemoteBranches("ticgit.git");
showRemoteBranches("test/jgit.git");
}
+
+ startGitblit();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ stopGitblit();
}
private void cloneOrFetch(String name, String fromUrl) throws Exception {
@@ -101,7 +146,7 @@
try {
RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
model.useTickets = true;
- GitBlit.self().editRepositoryModel(model.name, model, false);
+ GitBlit.self().updateRepositoryModel(model.name, model, false);
} catch (GitBlitException g) {
g.printStackTrace();
}
@@ -111,7 +156,7 @@
try {
RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
model.useDocs = true;
- GitBlit.self().editRepositoryModel(model.name, model, false);
+ GitBlit.self().updateRepositoryModel(model.name, model, false);
} catch (GitBlitException g) {
g.printStackTrace();
}
@@ -121,7 +166,7 @@
try {
RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);
model.showRemoteBranches = true;
- GitBlit.self().editRepositoryModel(model.name, model, false);
+ GitBlit.self().updateRepositoryModel(model.name, model, false);
} catch (GitBlitException g) {
g.printStackTrace();
}
--
Gitblit v1.9.1