diff options
author | John Arthorne | 2012-06-26 17:28:20 +0000 |
---|---|---|
committer | John Arthorne | 2012-07-24 17:19:07 +0000 |
commit | 669fa15cc859773492bf292b70ec998e921293aa (patch) | |
tree | a62029c3141170a2271da13b620a1d413c2672be /org.eclipse.ua.tests/help/org/eclipse | |
parent | 6e3a775e71e0862084e1664b8fd3e4913b85f33d (diff) | |
download | eclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.tar.gz eclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.tar.xz eclipse.platform.ua-669fa15cc859773492bf292b70ec998e921293aa.zip |
Bug 350103 - [Help] Remove extension point luceneSearchParticipants
Diffstat (limited to 'org.eclipse.ua.tests/help/org/eclipse')
5 files changed, 6 insertions, 208 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java index 4216e92ee..ed620f7d7 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AllSearchTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -42,7 +42,6 @@ public class AllSearchTests extends TestSuite { addTest(SearchParticipantXMLTest.suite()); addTest(SearchRanking.suite()); addTest(LuceneParticipantTest.suite()); - addTest(LuceneXMLParticipantTest.suite()); addTestSuite(WorkingSetManagerTest.class); addTestSuite(InfocenterWorkingSetManagerTest.class); addTestSuite(PrebuiltIndexCompatibility.class); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java deleted file mode 100644 index 794b10b92..000000000 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LuceneXMLParticipantTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -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; - - -public class LuceneXMLParticipantTest extends TestCase { - - /* - * Returns an instance of this Test. - */ - public static Test suite() { - return new TestSuite(LuceneXMLParticipantTest.class); - } - - public void testSearchFirstWordInFirstDoc() { - SearchTestUtils.searchAllLocales("hujnjujnh", new String[] { MockLuceneXMLParticipant.DOC_1 }); - } - - public void testSearchLastWordInFirstDoc() { - SearchTestUtils.searchAllLocales("dusudusud", new String[] { MockLuceneXMLParticipant.DOC_1 }); - } - - public void testSearchWordFromOuterElement() { - SearchTestUtils.searchAllLocales("kfkkfjeeej", new String[] { MockLuceneXMLParticipant.DOC_2 }); - } - - public void testSearchWordFromNestedElement() { - SearchTestUtils.searchAllLocales("syueuduehj", new String[] { MockLuceneXMLParticipant.DOC_2 }); - } - - public void testReturnedTitle() { - SearchHit[] hits = SearchTestUtils.getSearchHits("hujnjujnh", "en"); - assertEquals(hits.length,1); - assertEquals("Lucene XML 1", hits[0].getLabel()); - } - - public void testReturnedSummary() { - SearchHit[] hits = SearchTestUtils.getSearchHits("hujnjujnh", "en"); - assertEquals(hits.length,1); - assertEquals("Summary for file Lucene XML1", hits[0].getSummary()); - } - - public void testReturnedTitleNestedCase() { - SearchHit[] hits = SearchTestUtils.getSearchHits("kfkkfjeeej", "en"); - assertEquals(hits.length,1); - assertEquals("Lucene XML 2 - tests nesting", hits[0].getLabel()); - } - - public void testReturnedSummaryNestedCase() { - SearchHit[] hits = SearchTestUtils.getSearchHits("kfkkfjeeej", "en"); - assertEquals(hits.length,1); - assertEquals("Summary for file Lucene XML2", hits[0].getSummary()); - } - -} diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java deleted file mode 100644 index f72c3d426..000000000 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneParticipant.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ua.tests.help.search; - -import java.io.StringReader; -import java.net.URL; -import java.util.HashSet; -import java.util.Set; - -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.help.search.ISearchIndex; -import org.eclipse.help.search.LuceneSearchParticipant; - -@SuppressWarnings("deprecation") -public class MockLuceneParticipant extends LuceneSearchParticipant { - - private static final String DOC_1 = "/org.eclipse.help.base/lucene1.xml"; - private static final String DOC_2 = "/org.eclipse.help.base/lucene2.xml"; - - public IStatus addDocument(ISearchIndex index, String pluginId, - String name, URL url, String id, Document doc) { - boolean isDoc1 = url.getPath().equals(DOC_1) ; - String title = isDoc1 ? "Title1" : "Title2"; - String summary = isDoc1? "Summary1" : "Summary2"; - String contents = isDoc1? "sehdtegd jduehdye" : "nhduehrf ldoekfij"; - addTitle(title, doc); - doc.add(new Field("summary", summary, Field.Store.YES, Field.Index.NO)); //$NON-NLS-1$ - doc.add(new Field("contents", new StringReader(contents))); //$NON-NLS-1$ - doc.add(new Field("exact_contents", new StringReader(contents))); //$NON-NLS-1$ - return Status.OK_STATUS; - } - - public Set<String> getAllDocuments(String locale) { - HashSet<String> set = new HashSet<String>(); - set.add(DOC_1); - set.add(DOC_2); - return set; - } - - public String getId() { - return super.getId(); - } - -} diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java deleted file mode 100644 index 7537681d7..000000000 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockLuceneXMLParticipant.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ua.tests.help.search; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.help.search.XMLSearchParticipant; -import org.xml.sax.Attributes; - -@SuppressWarnings("deprecation") -public class MockLuceneXMLParticipant extends XMLSearchParticipant { - - public static final String DOC_1 = "/org.eclipse.ua.tests/data/help/search/lucene_xml_1.xml"; - public static final String DOC_2 = "/org.eclipse.ua.tests/data/help/search/lucene_xml_2.xml"; - - public Set<String> getAllDocuments(String locale) { - HashSet<String> set = new HashSet<String>(); - set.add(DOC_1 + "?id=xml1" + "?id=xml2"); - set.add(DOC_2); - return set; - } - - public Set<String> getContributingPlugins() { - Set<String> result = new HashSet<String>(); - result.add("org.eclipse.ua.tests"); - return result; - } - - protected void handleStartElement(String name, Attributes attributes, - IParsedXMLContent data) { - if ("searchable".equalsIgnoreCase(name)) { - data.setTitle(attributes.getValue("title")); - } - String summary = attributes.getValue("summary"); - if (summary != null) { - data.addToSummary(summary); - } - } - - protected void handleEndElement(String name, IParsedXMLContent data) { - } - - protected void handleText(String text, IParsedXMLContent data) { - String top = getTopElement(); - if ("text".equalsIgnoreCase(top)) { - data.addText(text); - } - } - - public boolean open(String id) { - System.out.println("Open " + id); - return true; - } - -} diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java index 9cd5d8b45..08ec1e290 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 2012 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 @@ -15,24 +15,14 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.util.ArrayList; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - +import junit.framework.*; import org.apache.lucene.index.CorruptIndexException; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.Query; -import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.*; import org.apache.lucene.store.Directory; import org.apache.lucene.store.NIOFSDirectory; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.*; import org.eclipse.help.internal.base.BaseHelpSystem; -import org.eclipse.help.internal.search.AnalyzerDescriptor; -import org.eclipse.help.internal.search.PluginIndex; -import org.eclipse.help.internal.search.QueryBuilder; -import org.eclipse.help.internal.search.SearchIndexWithIndexingProgress; +import org.eclipse.help.internal.search.*; import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin; import org.osgi.framework.Bundle; |