summaryrefslogtreecommitdiffstats
path: root/tests/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-03-12 20:52:34 -0400
committerJames Moger <james.moger@gitblit.com>2012-03-12 20:52:34 -0400
commit934ada531b4cf78b76f5b458190c1f057ff770c9 (patch)
treef174ef532e0c98ac8aa55c8b5ffe5fb6c182f1ed /tests/com
parent9e2f9ddbe46e88c919834940352dcead61ac7a02 (diff)
downloadgitblit-934ada531b4cf78b76f5b458190c1f057ff770c9.tar.gz
gitblit-934ada531b4cf78b76f5b458190c1f057ff770c9.zip
Revised reindex method per JGit team recommendation
Diffstat (limited to 'tests/com')
-rw-r--r--tests/com/gitblit/tests/LuceneUtilsTest.java26
1 files changed, 8 insertions, 18 deletions
diff --git a/tests/com/gitblit/tests/LuceneUtilsTest.java b/tests/com/gitblit/tests/LuceneUtilsTest.java
index 3b21e712..e7754586 100644
--- a/tests/com/gitblit/tests/LuceneUtilsTest.java
+++ b/tests/com/gitblit/tests/LuceneUtilsTest.java
@@ -35,46 +35,36 @@ import com.gitblit.utils.StringUtils;
public class LuceneUtilsTest {
@Test
- public void testQuickIndex() throws Exception {
+ public void testIndex() throws Exception {
// reindex helloworld
Repository repository = GitBlitSuite.getHelloworldRepository();
String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),
repository.getDirectory().getAbsolutePath());
- LuceneUtils.reindex(name, repository, false);
+ LuceneUtils.reindex(name, repository);
+ SearchResult result = LuceneUtils.search("type:blob AND id:bit.bit", 1, repository).get(0);
+ assertEquals("Mike Donaghy", result.author);
+ result = LuceneUtils.search("type:blob AND id:clipper.prg", 1, repository).get(0);
+ assertEquals("tinogomes", result.author);
repository.close();
// reindex theoretical physics
repository = GitBlitSuite.getTheoreticalPhysicsRepository();
name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),
repository.getDirectory().getAbsolutePath());
- LuceneUtils.reindex(name, repository, false);
+ LuceneUtils.reindex(name, repository);
repository.close();
// reindex JGit
repository = GitBlitSuite.getJGitRepository();
name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),
repository.getDirectory().getAbsolutePath());
- LuceneUtils.reindex(name, repository, false);
+ LuceneUtils.reindex(name, repository);
repository.close();
LuceneUtils.close();
}
@Test
- public void testFullIndex() throws Exception {
- // reindex helloworld
- Repository repository = GitBlitSuite.getHelloworldRepository();
- String name = StringUtils.getRelativePath(GitBlitSuite.REPOSITORIES.getAbsolutePath(),
- repository.getDirectory().getAbsolutePath());
- LuceneUtils.reindex(name, repository, true);
- SearchResult result = LuceneUtils.search("type:blob AND id:bit.bit", 1, repository).get(0);
- repository.close();
- assertEquals("Mike Donaghy", result.author);
- //assertEquals("Mike Donaghy", result.date);
- LuceneUtils.close();
- }
-
- @Test
public void testQuery() throws Exception {
// 2 occurrences on the master branch
Repository repository = GitBlitSuite.getHelloworldRepository();