Browse Source

Fixed Lucene unit tests

tags/v1.1.0
James Moger 12 years ago
parent
commit
874be0d933

+ 1
- 1
tests/com/gitblit/tests/LdapUserServiceTest.java View 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");

+ 7
- 2
tests/com/gitblit/tests/LuceneExecutorTest.java View File

@@ -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);

+ 3
- 3
tests/com/gitblit/tests/mock/MemorySettings.java View 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

Loading…
Cancel
Save