diff options
author | relves | 2006-08-30 03:10:54 +0000 |
---|---|---|
committer | relves | 2006-08-30 03:10:54 +0000 |
commit | 6f976ecb8642ca1074f37457cf105716e4374c11 (patch) | |
tree | bc3140991cd43626688bb6948a1185d4df99cde3 /org.eclipse.mylyn.bugzilla.tests | |
parent | 0fa48f98fa8b70471bd9b614f09da8886830f51c (diff) | |
download | org.eclipse.mylyn.tasks-6f976ecb8642ca1074f37457cf105716e4374c11.tar.gz org.eclipse.mylyn.tasks-6f976ecb8642ca1074f37457cf105716e4374c11.tar.xz org.eclipse.mylyn.tasks-6f976ecb8642ca1074f37457cf105716e4374c11.zip |
Progress on: 142783: Generalize issue search
https://bugs.eclipse.org/bugs/show_bug.cgi?id=142783
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
3 files changed, 27 insertions, 21 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java index 53b6b6f0b..c540605a7 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java @@ -39,7 +39,6 @@ import org.eclipse.mylar.internal.bugzilla.core.PossibleBugzillaFailureException import org.eclipse.mylar.internal.bugzilla.core.RepositoryConfiguration; import org.eclipse.mylar.internal.bugzilla.ui.editor.BugSubmissionHandler; import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaResultCollector; -import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchHit; import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchOperation; import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaQueryHit; import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask; @@ -99,10 +98,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { null, collector, "-1"); operation.run(new NullProgressMonitor()); - assertEquals(2, collector.getResults().size()); - for (BugzillaSearchHit hit : collector.getResults()) { - assertTrue(hit.getDescription().startsWith("search-match-test")); - } + assertEquals(2, collector.getResults().size()); //test anonymous update of configuration RepositoryConfiguration config = BugzillaCorePlugin.getRepositoryConfiguration(true, repository.getUrl(), TasksUiPlugin.getDefault().getProxySettings(), repository.getUserName(), repository.getPassword(), repository.getCharacterEncoding()); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java index df1354af9..e3317cf17 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java @@ -11,18 +11,16 @@ package org.eclipse.mylar.bugzilla.tests; -import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryQuery; +import org.eclipse.mylar.internal.tasks.ui.search.AbstractQueryHitCollector; import org.eclipse.mylar.tasks.core.AbstractQueryHit; import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; import org.eclipse.mylar.tasks.core.TaskRepository; @@ -51,7 +49,7 @@ public class BugzillaSearchEngineTest extends TestCase { super.tearDown(); } -// public void testSearching216() throws MalformedURLException { +// public void testSearching216() throws Exception { // TaskRepository repository = new TaskRepository(BugzillaPlugin.REPOSITORY_KIND, // IBugzillaConstants.TEST_BUGZILLA_216_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_216.toString()); // MylarTaskListPlugin.getRepositoryManager().addRepository(repository); @@ -59,28 +57,28 @@ public class BugzillaSearchEngineTest extends TestCase { // assertEquals(NUM_EXPECTED_HITS, hits.size()); // } - public void testSearching218() throws MalformedURLException { + public void testSearching218() throws Exception { TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_218_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_218.toString()); TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath()); assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_218_URL, SEARCH_DESCRIPTION).size()); } - public void testSearching220() throws MalformedURLException { + public void testSearching220() throws Exception { TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_220_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString()); TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath()); assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_220_URL, SEARCH_DESCRIPTION).size()); } - public void testSearching2201() throws MalformedURLException { + public void testSearching2201() throws Exception { TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_2201_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_220.toString()); TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath()); assertEquals(NUM_EXPECTED_HITS, runQuery(IBugzillaConstants.TEST_BUGZILLA_2201_URL, SEARCH_DESCRIPTION).size()); } - public void testSearching222() throws MalformedURLException { + public void testSearching222() throws Exception { TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString()); TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath()); @@ -88,8 +86,8 @@ public class BugzillaSearchEngineTest extends TestCase { assertEquals(NUM_EXPECTED_HITS, hits.size()); } - private List<AbstractQueryHit> runQuery(String repositoryURL, String SearchString) { - ArrayList<AbstractQueryHit> results = new ArrayList<AbstractQueryHit>(); + private List<AbstractQueryHit> runQuery(String repositoryURL, String SearchString) throws Exception { + final ArrayList<AbstractQueryHit> results = new ArrayList<AbstractQueryHit>(); TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL); assertNotNull(repository); @@ -100,7 +98,19 @@ public class BugzillaSearchEngineTest extends TestCase { MAX_HITS, TasksUiPlugin.getTaskListManager().getTaskList()); AbstractRepositoryConnector connector = (AbstractRepositoryConnector) TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND); - results.addAll(connector.performQuery(repositoryQuery, new NullProgressMonitor(), new MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null))); + + AbstractQueryHitCollector collector = new AbstractQueryHitCollector() { + + @Override + public void addMatch(AbstractQueryHit hit) { + results.add(hit); + } + + }; + + connector.performQuery(repositoryQuery, new NullProgressMonitor(), collector); + + //results.addAll(connector.performQuery(repositoryQuery, new NullProgressMonitor(), new MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null))); return results; } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RegularExpressionMatchTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RegularExpressionMatchTest.java index c7cd07d0a..57a69bdd0 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RegularExpressionMatchTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/RegularExpressionMatchTest.java @@ -20,23 +20,23 @@ import junit.framework.TestCase; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchEngine; -import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchHit; +import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaQueryHit; public class RegularExpressionMatchTest extends TestCase { public void testMatchV218() throws IOException { BufferedReader in = new BufferedReader(new StringReader(BUGZILLA_218)); - BugzillaSearchHit hit = BugzillaSearchEngine.createHit(BugzillaSearchEngine.reValue, new NullProgressMonitor(), + BugzillaQueryHit hit = BugzillaSearchEngine.createHit(BugzillaSearchEngine.reValue, new NullProgressMonitor(), in, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, 123); - assertEquals("nor", hit.getSeverity()); + //assertEquals("nor", hit.getSeverity()); assertEquals("P2", hit.getPriority()); } public void testMatchV220() throws IOException { BufferedReader in = new BufferedReader(new StringReader(BUGZILLA_220)); - BugzillaSearchHit hit = BugzillaSearchEngine.createHit(BugzillaSearchEngine.reValueBugzilla220, + BugzillaQueryHit hit = BugzillaSearchEngine.createHit(BugzillaSearchEngine.reValueBugzilla220, new NullProgressMonitor(), in, IBugzillaConstants.ECLIPSE_BUGZILLA_URL, 123); - assertEquals("nor", hit.getSeverity()); + //assertEquals("nor", hit.getSeverity()); assertEquals("P2", hit.getPriority()); } |