diff options
author | James Moger <james.moger@gitblit.com> | 2012-08-01 09:47:30 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-08-01 09:47:30 -0400 |
commit | 874be0d933eb52d548a07b67d112a0975e900b14 (patch) | |
tree | d1ae618221599112e912728a4447c058c1b90926 /tests/com | |
parent | 37c04f6744f88e8cd2754c40669eb0696c3045e6 (diff) | |
download | gitblit-874be0d933eb52d548a07b67d112a0975e900b14.tar.gz gitblit-874be0d933eb52d548a07b67d112a0975e900b14.zip |
Fixed Lucene unit tests
Diffstat (limited to 'tests/com')
-rw-r--r-- | tests/com/gitblit/tests/LdapUserServiceTest.java | 2 | ||||
-rw-r--r-- | tests/com/gitblit/tests/LuceneExecutorTest.java | 9 | ||||
-rw-r--r-- | tests/com/gitblit/tests/mock/MemorySettings.java | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/tests/com/gitblit/tests/LdapUserServiceTest.java b/tests/com/gitblit/tests/LdapUserServiceTest.java index 390fa001..ffe82640 100644 --- a/tests/com/gitblit/tests/LdapUserServiceTest.java +++ b/tests/com/gitblit/tests/LdapUserServiceTest.java @@ -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"); diff --git a/tests/com/gitblit/tests/LuceneExecutorTest.java b/tests/com/gitblit/tests/LuceneExecutorTest.java index 21454fe4..6b45b9fe 100644 --- a/tests/com/gitblit/tests/LuceneExecutorTest.java +++ b/tests/com/gitblit/tests/LuceneExecutorTest.java @@ -20,7 +20,9 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.jgit.lib.Repository;
import org.junit.Test;
@@ -29,6 +31,7 @@ import com.gitblit.LuceneExecutor; import com.gitblit.models.RefModel;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.SearchResult;
+import com.gitblit.tests.mock.MemorySettings;
import com.gitblit.utils.FileUtils;
import com.gitblit.utils.JGitUtils;
@@ -41,7 +44,9 @@ import com.gitblit.utils.JGitUtils; public class LuceneExecutorTest {
private LuceneExecutor newLuceneExecutor() {
- return new LuceneExecutor(null, GitBlitSuite.REPOSITORIES);
+ Map<String, Object> map = new HashMap<String, Object>();
+ MemorySettings settings = new MemorySettings(map);
+ return new LuceneExecutor(settings, GitBlitSuite.REPOSITORIES);
}
private RepositoryModel newRepositoryModel(Repository repository) {
@@ -164,7 +169,7 @@ public class LuceneExecutorTest { @Test
public void testDeleteBlobFromIndex() throws Exception {
// start with a fresh reindex of entire repository
- LuceneExecutor lucene = new LuceneExecutor(null, GitBlitSuite.REPOSITORIES);
+ LuceneExecutor lucene = newLuceneExecutor();
Repository repository = GitBlitSuite.getHelloworldRepository();
RepositoryModel model = newRepositoryModel(repository);
lucene.reindex(model, repository);
diff --git a/tests/com/gitblit/tests/mock/MemorySettings.java b/tests/com/gitblit/tests/mock/MemorySettings.java index 8b559354..1b3e2382 100644 --- a/tests/com/gitblit/tests/mock/MemorySettings.java +++ b/tests/com/gitblit/tests/mock/MemorySettings.java @@ -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 |