]> source.dussan.org Git - gitblit.git/commitdiff
Fixed Lucene unit tests
authorJames Moger <james.moger@gitblit.com>
Wed, 1 Aug 2012 13:47:30 +0000 (09:47 -0400)
committerJames Moger <james.moger@gitblit.com>
Wed, 1 Aug 2012 13:47:30 +0000 (09:47 -0400)
tests/com/gitblit/tests/LdapUserServiceTest.java
tests/com/gitblit/tests/LuceneExecutorTest.java
tests/com/gitblit/tests/mock/MemorySettings.java

index 390fa00118a1d94e3196cb830cdf922bfda9eb5a..ffe826403c40e280f99b430931e8efc4e1fd8adb 100644 (file)
@@ -68,7 +68,7 @@ public class LdapUserServiceTest {
        }
        
        private MemorySettings getSettings() {
-               Map<Object, Object> backingMap = new HashMap<Object, Object>();
+               Map<String, Object> backingMap = new HashMap<String, Object>();
                backingMap.put("realm.ldap.server", "ldap://localhost:" + ldapPort);
                backingMap.put("realm.ldap.domain", "");
                backingMap.put("realm.ldap.username", "cn=Directory Manager");
index 21454fe4bdb4abd448f7c0fb45f3d32555dd8c55..6b45b9fede3030595e22cbaba51be2fa81ec77e1 100644 (file)
@@ -20,7 +20,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;\r
 \r
 import java.util.ArrayList;\r
+import java.util.HashMap;\r
 import java.util.List;\r
+import java.util.Map;\r
 \r
 import org.eclipse.jgit.lib.Repository;\r
 import org.junit.Test;\r
@@ -29,6 +31,7 @@ import com.gitblit.LuceneExecutor;
 import com.gitblit.models.RefModel;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.SearchResult;\r
+import com.gitblit.tests.mock.MemorySettings;\r
 import com.gitblit.utils.FileUtils;\r
 import com.gitblit.utils.JGitUtils;\r
 \r
@@ -41,7 +44,9 @@ import com.gitblit.utils.JGitUtils;
 public class LuceneExecutorTest {\r
 \r
        private LuceneExecutor newLuceneExecutor() {\r
-               return new LuceneExecutor(null, GitBlitSuite.REPOSITORIES);\r
+               Map<String, Object> map = new HashMap<String, Object>();\r
+               MemorySettings settings = new MemorySettings(map);              \r
+               return new LuceneExecutor(settings, GitBlitSuite.REPOSITORIES);\r
        }\r
        \r
        private RepositoryModel newRepositoryModel(Repository repository) {             \r
@@ -164,7 +169,7 @@ public class LuceneExecutorTest {
        @Test\r
        public void testDeleteBlobFromIndex() throws Exception {\r
                // start with a fresh reindex of entire repository\r
-               LuceneExecutor lucene = new LuceneExecutor(null, GitBlitSuite.REPOSITORIES);\r
+               LuceneExecutor lucene = newLuceneExecutor();\r
                Repository repository = GitBlitSuite.getHelloworldRepository();\r
                RepositoryModel model = newRepositoryModel(repository);\r
                lucene.reindex(model, repository);\r
index 8b55935483dd06f4bd1ae3b446936ea56c5bc484..1b3e23822fe644b1ab293e9d02c746b729ab1f75 100644 (file)
@@ -23,9 +23,9 @@ import com.gitblit.IStoredSettings;
 
 public class MemorySettings extends IStoredSettings {
        
-       private Map<Object, Object> backingMap;
+       private Map<String, Object> backingMap;
        
-       public MemorySettings(Map<Object, Object> backingMap) {
+       public MemorySettings(Map<String, Object> backingMap) {
                super(MemorySettings.class);
                this.backingMap = backingMap;
        }
@@ -39,7 +39,7 @@ public class MemorySettings extends IStoredSettings {
        }
        
        public void put(Object key, Object value) {
-               backingMap.put(key, value);
+               backingMap.put(key.toString(), value);
        }
 
        @Override