diff options
-rw-r--r-- | src/main/java/com/gitblit/GitBlit.java | 9 | ||||
-rw-r--r-- | src/test/config/test-gitblit.properties | 6 | ||||
-rw-r--r-- | src/test/java/com/gitblit/tests/FileUtilsTest.java | 2 | ||||
-rw-r--r-- | src/test/java/com/gitblit/tests/GitBlitSuite.java | 6 | ||||
-rw-r--r-- | src/test/java/com/gitblit/tests/GitBlitTest.java | 4 |
5 files changed, 20 insertions, 7 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index b6f7de46..1fd52f1a 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -278,6 +278,15 @@ public class GitBlit implements ServletContextListener { } /** + * Returns the active settings. + * + * @return the active settings + */ + public static IStoredSettings getSettings() { + return self().settings; + } + + /** * Returns the user-defined blob encodings. * * @return an array of encodings, may be empty diff --git a/src/test/config/test-gitblit.properties b/src/test/config/test-gitblit.properties index f16f5c5a..7876407b 100644 --- a/src/test/config/test-gitblit.properties +++ b/src/test/config/test-gitblit.properties @@ -5,16 +5,16 @@ git.repositoriesFolder = ${baseFolder}/git git.searchRepositoriesSubfolders = true git.enableGitServlet = true -groovy.scriptsFolder = ${baseFolder}/groovy +groovy.scriptsFolder = src/main/distrib/data/groovy groovy.preReceiveScripts = blockpush groovy.postReceiveScripts = sendmail web.authenticateViewPages = false web.authenticateAdminPages = true web.allowCookieAuthentication = true -realm.userService = test-users.conf +realm.userService = ${baseFolder}/src/test/config/test-users.conf realm.passwordStorage = md5 realm.minPasswordLength = 5 -web.siteName = +web.siteName = Test Gitblit web.allowAdministration = true web.enableRpcServlet = true web.enableRpcManagement = true diff --git a/src/test/java/com/gitblit/tests/FileUtilsTest.java b/src/test/java/com/gitblit/tests/FileUtilsTest.java index 8e5cf8a6..26f81d52 100644 --- a/src/test/java/com/gitblit/tests/FileUtilsTest.java +++ b/src/test/java/com/gitblit/tests/FileUtilsTest.java @@ -47,7 +47,7 @@ public class FileUtilsTest { assertEquals(-1, FileUtils.folderSize(null));
assertEquals(-1, FileUtils.folderSize(new File(System.getProperty("user.dir"), "pretend")));
- File dir = new File(System.getProperty("user.dir"), "distrib");
+ File dir = new File(System.getProperty("user.dir"), "src/main/distrib");
long size = FileUtils.folderSize(dir);
assertTrue("size is actually " + size, size >= 470000L);
diff --git a/src/test/java/com/gitblit/tests/GitBlitSuite.java b/src/test/java/com/gitblit/tests/GitBlitSuite.java index 82552ec1..d5e37075 100644 --- a/src/test/java/com/gitblit/tests/GitBlitSuite.java +++ b/src/test/java/com/gitblit/tests/GitBlitSuite.java @@ -64,6 +64,10 @@ import com.gitblit.utils.JGitUtils; public class GitBlitSuite {
public static final File REPOSITORIES = new File("data/git");
+
+ public static final File SETTINGS = new File("src/test/config/test-gitblit.properties");
+
+ public static final File USERSCONF = new File("src/test/config/test-users.conf");
static int port = 8280;
static int gitPort = 8300;
@@ -126,7 +130,7 @@ public class GitBlitSuite { GitBlitServer.main("--httpPort", "" + port, "--httpsPort", "0", "--shutdownPort",
"" + shutdownPort, "--gitPort", "" + gitPort, "--repositoriesFolder",
"\"" + GitBlitSuite.REPOSITORIES.getAbsolutePath() + "\"", "--userService",
- "test-users.conf", "--settings", "test-gitblit.properties",
+ GitBlitSuite.USERSCONF.getAbsolutePath(), "--settings", GitBlitSuite.SETTINGS.getAbsolutePath(),
"--baseFolder", "data");
}
});
diff --git a/src/test/java/com/gitblit/tests/GitBlitTest.java b/src/test/java/com/gitblit/tests/GitBlitTest.java index 786614f8..ab23f4eb 100644 --- a/src/test/java/com/gitblit/tests/GitBlitTest.java +++ b/src/test/java/com/gitblit/tests/GitBlitTest.java @@ -131,7 +131,7 @@ public class GitBlitTest { @Test
public void testFileSettings() throws Exception {
- FileSettings settings = new FileSettings("distrib/gitblit.properties");
+ FileSettings settings = new FileSettings("src/main/distrib/data/gitblit.properties");
assertEquals(true, settings.getBoolean("missing", true));
assertEquals("default", settings.getString("missing", "default"));
assertEquals(10, settings.getInteger("missing", 10));
@@ -160,7 +160,7 @@ public class GitBlitTest { assertEquals(5, GitBlit.getInteger("realm.userService", 5));
assertTrue(GitBlit.getBoolean("git.enableGitServlet", false));
- assertEquals("test-users.conf", GitBlit.getString("realm.userService", null));
+ assertEquals(GitBlitSuite.USERSCONF.getAbsolutePath(), GitBlit.getString("realm.userService", null));
assertEquals(5, GitBlit.getInteger("realm.minPasswordLength", 0));
List<String> mdExtensions = GitBlit.getStrings("web.markdownExtensions");
assertTrue(mdExtensions.size() > 0);
|