Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2010-01-06 23:47:34 +0000
committerChris Goldthorpe2010-01-06 23:47:34 +0000
commitadb0f3b0c56dd793b932c18cf3480b5c6f46893c (patch)
treeaf182ec60d0a6bdc9ac43eb5888edabd798ab915
parent8f342f72fccffec70e9a21309daac05914b5d959 (diff)
downloadeclipse.platform.ua-adb0f3b0c56dd793b932c18cf3480b5c6f46893c.tar.gz
eclipse.platform.ua-adb0f3b0c56dd793b932c18cf3480b5c6f46893c.tar.xz
eclipse.platform.ua-adb0f3b0c56dd793b932c18cf3480b5c6f46893c.zip
Enhance LuceneSaerchParticipantTest to check title and summary
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneParticipantTest.java14
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java17
2 files changed, 26 insertions, 5 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneParticipantTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneParticipantTest.java
index 7daf87dc7..f3380019a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneParticipantTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneParticipantTest.java
@@ -11,6 +11,8 @@
package org.eclipse.ua.tests.help.search;
+import org.eclipse.help.internal.search.SearchHit;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
@@ -53,4 +55,16 @@ public class LuceneParticipantTest extends TestCase {
SearchTestUtils.searchAllLocales("nhduehrf", new String[] { "/org.eclipse.help.base/lucene2.xml" });
}
+ public void testReturnedTitle() {
+ SearchHit[] hits = SearchTestUtils.getSearchHits("jduehdye", "en");
+ assertEquals(hits.length,1);
+ assertEquals("Title1", hits[0].getLabel());
+ }
+
+ public void testReturnedSummary() {
+ SearchHit[] hits = SearchTestUtils.getSearchHits("jduehdye", "en");
+ assertEquals(hits.length,1);
+ assertEquals("Summary1", hits[0].getSummary());
+ }
+
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
index a5bb474da..982bda7f3 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,10 +38,8 @@ public class SearchTestUtils {
final Set unexpectedHrefs = new HashSet();
hrefsToFind.addAll(Arrays.asList(hrefs));
- ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), nl);
- SearchResults collector = new SearchResults(null, 500, nl);
- BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor());
- SearchHit[] hits = collector.getSearchHits();
+ SearchHit[] hits;
+ hits = getSearchHits(searchWord, nl);
for (int j=0;j<hits.length;++j) {
String href = hits[j].getHref();
// ignore query params
@@ -83,4 +81,13 @@ public class SearchTestUtils {
}
}
+ public static SearchHit[] getSearchHits(String searchWord, String nl) {
+ SearchHit[] hits;
+ ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), nl);
+ SearchResults collector = new SearchResults(null, 500, nl);
+ BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor());
+ hits = collector.getSearchHits();
+ return hits;
+ }
+
}

Back to the top