summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-09-30 16:22:15 -0400
committerJames Moger <james.moger@gitblit.com>2013-09-30 16:22:15 -0400
commitc00577e5ddded5e53c9074da7def30bd9c350a1e (patch)
treed8786c719807c30104b727516e0d33d41b485674 /src/test/java/com/gitblit/tests/LuceneExecutorTest.java
parent699e71e76b15081baf746c6ce9c9144f7e5f1ff9 (diff)
downloadgitblit-c00577e5ddded5e53c9074da7def30bd9c350a1e.tar.gz
gitblit-c00577e5ddded5e53c9074da7def30bd9c350a1e.zip
Remove trailing whitespace from unit tests
Change-Id: I172bd4d493eee1013ec542ab97f1be29040f816d
Diffstat (limited to 'src/test/java/com/gitblit/tests/LuceneExecutorTest.java')
-rw-r--r--src/test/java/com/gitblit/tests/LuceneExecutorTest.java52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
index 0b67f5dd..ec25c519 100644
--- a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
+++ b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
@@ -39,25 +39,25 @@ import com.gitblit.utils.JGitUtils;
/**
* Tests Lucene indexing and querying.
- *
+ *
* @author James Moger
- *
+ *
*/
public class LuceneExecutorTest {
LuceneExecutor lucene;
-
+
private LuceneExecutor newLuceneExecutor() {
Map<String, Object> map = new HashMap<String, Object>();
- MemorySettings settings = new MemorySettings(map);
+ MemorySettings settings = new MemorySettings(map);
return new LuceneExecutor(settings, GitBlitSuite.REPOSITORIES);
}
-
- private RepositoryModel newRepositoryModel(Repository repository) {
+
+ private RepositoryModel newRepositoryModel(Repository repository) {
RepositoryModel model = new RepositoryModel();
model.name = FileUtils.getRelativePath(GitBlitSuite.REPOSITORIES, repository.getDirectory());
model.hasCommits = JGitUtils.hasCommits(repository);
-
+
// index all local branches
model.indexedBranches = new ArrayList<String>();
for (RefModel ref : JGitUtils.getLocalBranches(repository, true, -1)) {
@@ -65,17 +65,17 @@ public class LuceneExecutorTest {
}
return model;
}
-
+
@Before
public void setup() {
lucene = newLuceneExecutor();
}
-
+
@After
public void tearDown() {
lucene.close();
}
-
+
@Test
public void testIndex() throws Exception {
// reindex helloworld
@@ -83,11 +83,11 @@ public class LuceneExecutorTest {
RepositoryModel model = newRepositoryModel(repository);
lucene.reindex(model, repository);
repository.close();
-
- SearchResult result = lucene.search("type:blob AND path:bit.bit", 1, 1, model.name).get(0);
+
+ SearchResult result = lucene.search("type:blob AND path:bit.bit", 1, 1, model.name).get(0);
assertEquals("Mike Donaghy", result.author);
- result = lucene.search("type:blob AND path:clipper.prg", 1, 1, model.name).get(0);
- assertEquals("tinogomes", result.author);
+ result = lucene.search("type:blob AND path:clipper.prg", 1, 1, model.name).get(0);
+ assertEquals("tinogomes", result.author);
// reindex JGit
repository = GitBlitSuite.getJGitRepository();
@@ -99,10 +99,10 @@ public class LuceneExecutorTest {
@Test
public void testQuery() throws Exception {
// 2 occurrences on the master branch
- Repository repository = GitBlitSuite.getHelloworldRepository();
+ Repository repository = GitBlitSuite.getHelloworldRepository();
RepositoryModel model = newRepositoryModel(repository);
repository.close();
-
+
List<SearchResult> results = lucene.search("ada", 1, 10, model.name);
assertEquals(2, results.size());
for (SearchResult res : results) {
@@ -112,37 +112,37 @@ public class LuceneExecutorTest {
// author test
results = lucene.search("author: tinogomes AND type:commit", 1, 10, model.name);
assertEquals(2, results.size());
-
+
// blob test
results = lucene.search("type: blob AND \"import std.stdio\"", 1, 10, model.name);
assertEquals(1, results.size());
assertEquals("d.D", results.get(0).path);
-
+
// commit test
repository = GitBlitSuite.getJGitRepository();
model = newRepositoryModel(repository);
repository.close();
-
+
results = lucene.search("\"initial jgit contribution to eclipse.org\"", 1, 10, model.name);
assertEquals(1, results.size());
assertEquals("Git Development Community", results.get(0).author);
assertEquals("1a6964c8274c50f0253db75f010d78ef0e739343", results.get(0).commitId);
assertEquals("refs/heads/master", results.get(0).branch);
-
+
// hash id tests
results = lucene.search("type:commit AND commit:1a6964c8274c50f0253db75f010d78ef0e739343", 1, 10, model.name);
assertEquals(1, results.size());
results = lucene.search("type:commit AND commit:1a6964c8274*", 1, 10, model.name);
assertEquals("Shawn O. Pearce", results.get(0).committer);
- assertEquals(1, results.size());
-
+ assertEquals(1, results.size());
+
// annotated tag test
results = lucene.search("I663208919f297836a9c16bf458e4a43ffaca4c12", 1, 10, model.name);
assertEquals(1, results.size());
- assertEquals("[v1.3.0.201202151440-r]", results.get(0).tags.toString());
+ assertEquals("[v1.3.0.201202151440-r]", results.get(0).tags.toString());
}
-
+
@Test
public void testMultiSearch() throws Exception {
List<String> list = new ArrayList<String>();
@@ -157,14 +157,14 @@ public class LuceneExecutorTest {
List<SearchResult> results = lucene.search("test", 1, 10, list);
assertEquals(10, results.size());
}
-
+
@Test
public void testDeleteBlobFromIndex() throws Exception {
// start with a fresh reindex of entire repository
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"));