]> source.dussan.org Git - gitblit.git/commitdiff
Updated test suite to use relocated test config files
authorJames Moger <james.moger@gitblit.com>
Tue, 2 Jul 2013 18:54:12 +0000 (14:54 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 2 Jul 2013 18:54:25 +0000 (14:54 -0400)
src/main/java/com/gitblit/GitBlit.java
src/test/config/test-gitblit.properties
src/test/java/com/gitblit/tests/FileUtilsTest.java
src/test/java/com/gitblit/tests/GitBlitSuite.java
src/test/java/com/gitblit/tests/GitBlitTest.java

index b6f7de46fd41480068c516f60524c2e80ffc9ba0..1fd52f1a6e120e063c712fa707551eddd33d04e3 100644 (file)
@@ -277,6 +277,15 @@ public class GitBlit implements ServletContextListener {
                return self().timezone;
        }
        
+       /**
+        * Returns the active settings.
+        * 
+        * @return the active settings
+        */
+       public static IStoredSettings getSettings() {
+               return self().settings;
+       }
+       
        /**
         * Returns the user-defined blob encodings.
         * 
index f16f5c5a8fe5bf44701555561c2d4bf808554770..7876407b7b12375f3498c6f9138c98e43c62a17b 100644 (file)
@@ -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
index 8e5cf8a661318a150161ed706413fd9759032522..26f81d52e3e9070db851a3bcc3334d1e02080cd0 100644 (file)
@@ -47,7 +47,7 @@ public class FileUtilsTest {
                assertEquals(-1, FileUtils.folderSize(null));\r
                assertEquals(-1, FileUtils.folderSize(new File(System.getProperty("user.dir"), "pretend")));\r
 \r
-               File dir = new File(System.getProperty("user.dir"), "distrib");\r
+               File dir = new File(System.getProperty("user.dir"), "src/main/distrib");\r
                long size = FileUtils.folderSize(dir);\r
                assertTrue("size is actually " + size, size >= 470000L);\r
 \r
index 82552ec111f973db4bb2e7ea172a6b2ab55c793d..d5e37075d98185326a0d8e296b45ddf7d2f740f7 100644 (file)
@@ -64,6 +64,10 @@ import com.gitblit.utils.JGitUtils;
 public class GitBlitSuite {\r
 \r
        public static final File REPOSITORIES = new File("data/git");\r
+       \r
+       public static final File SETTINGS = new File("src/test/config/test-gitblit.properties");\r
+       \r
+       public static final File USERSCONF = new File("src/test/config/test-users.conf");\r
 \r
        static int port = 8280;\r
        static int gitPort = 8300;\r
@@ -126,7 +130,7 @@ public class GitBlitSuite {
                                GitBlitServer.main("--httpPort", "" + port, "--httpsPort", "0", "--shutdownPort",\r
                                                "" + shutdownPort, "--gitPort", "" + gitPort, "--repositoriesFolder",\r
                                                "\"" + GitBlitSuite.REPOSITORIES.getAbsolutePath() + "\"", "--userService",\r
-                                               "test-users.conf", "--settings", "test-gitblit.properties",\r
+                                               GitBlitSuite.USERSCONF.getAbsolutePath(), "--settings", GitBlitSuite.SETTINGS.getAbsolutePath(),\r
                                                "--baseFolder", "data");\r
                        }\r
                });\r
index 786614f810e549744250462fc91c41d49573c750..ab23f4eb9a96013e1dc93391eac51547aa8cb245 100644 (file)
@@ -131,7 +131,7 @@ public class GitBlitTest {
 \r
        @Test\r
        public void testFileSettings() throws Exception {\r
-               FileSettings settings = new FileSettings("distrib/gitblit.properties");\r
+               FileSettings settings = new FileSettings("src/main/distrib/data/gitblit.properties");\r
                assertEquals(true, settings.getBoolean("missing", true));\r
                assertEquals("default", settings.getString("missing", "default"));\r
                assertEquals(10, settings.getInteger("missing", 10));\r
@@ -160,7 +160,7 @@ public class GitBlitTest {
                assertEquals(5, GitBlit.getInteger("realm.userService", 5));\r
 \r
                assertTrue(GitBlit.getBoolean("git.enableGitServlet", false));\r
-               assertEquals("test-users.conf", GitBlit.getString("realm.userService", null));\r
+               assertEquals(GitBlitSuite.USERSCONF.getAbsolutePath(), GitBlit.getString("realm.userService", null));\r
                assertEquals(5, GitBlit.getInteger("realm.minPasswordLength", 0));\r
                List<String> mdExtensions = GitBlit.getStrings("web.markdownExtensions");\r
                assertTrue(mdExtensions.size() > 0);\r