From 27ae9095639bb228a1b7ff86a3ebe4264abf05be Mon Sep 17 00:00:00 2001
From: mschaefers <mschaefers@scoop-gmbh.de>
Date: Thu, 29 Nov 2012 12:33:09 -0500
Subject: [PATCH] feature: when using LdapUserService one can configure Gitblit to fetch all users from ldap that can possibly login. This allows to see newly generated LDAP users instantly in Gitblit. By now an LDAP user had to log in once to appear in GitBlit.
---
tests/com/gitblit/tests/LuceneExecutorTest.java | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/tests/com/gitblit/tests/LuceneExecutorTest.java b/tests/com/gitblit/tests/LuceneExecutorTest.java
index ec81fd8..6b45b9f 100644
--- a/tests/com/gitblit/tests/LuceneExecutorTest.java
+++ b/tests/com/gitblit/tests/LuceneExecutorTest.java
@@ -16,21 +16,24 @@
package com.gitblit.tests;
import static org.junit.Assert.assertEquals;
+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;
-import com.gitblit.GitBlit;
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;
-import com.gitblit.utils.StringUtils;
/**
* Tests Lucene indexing and querying.
@@ -41,7 +44,9 @@
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) {
@@ -160,4 +165,17 @@
lucene.close();
assertEquals(10, results.size());
}
+
+ @Test
+ public void testDeleteBlobFromIndex() throws Exception {
+ // start with a fresh reindex of entire repository
+ LuceneExecutor lucene = newLuceneExecutor();
+ Repository repository = GitBlitSuite.getHelloworldRepository();
+ RepositoryModel model = newRepositoryModel(repository);
+ lucene.reindex(model, repository);
+
+ // now delete a blob
+ assertTrue(lucene.deleteBlob(model.name, "refs/heads/master", "java.java"));
+ assertFalse(lucene.deleteBlob(model.name, "refs/heads/master", "java.java"));
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1