Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java42
1 files changed, 29 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
index a47cc7289..e71cfe9d4 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java
@@ -18,14 +18,16 @@ import javax.security.auth.login.LoginException;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.context.tests.support.MylarTestUtils;
import org.eclipse.mylar.context.tests.support.MylarTestUtils.Credentials;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaException;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
+import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector;
+import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaServerFacade;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.internal.bugzilla.core.RepositoryQueryResultsFactory;
import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
@@ -101,22 +103,36 @@ public class BugzillaQueryTest extends TestCase {
assertTrue(products.contains("Read Write Test Cases"));
assertTrue(products.contains("TestProduct"));
}
-
- public void testQueryBugs() throws Exception {
-
+
+ public void testQueryViaConnector() throws Exception {
+ String urlString = repository.getUrl()+"/buglist.cgi?ctype=rdf&query_format=advanced&short_desc_type=allwordssubstr&short_desc=search-match-test&product=TestProduct&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=";
+ TaskList taskList = new TaskList();
QueryHitCollector collector = new QueryHitCollector(new TaskList());
-
- // Note need for ctype=rdf in query url
- String urlString = "http://mylar.eclipse.org/bugs222/buglist.cgi?ctype=rdf&query_format=advanced&short_desc_type=allwordssubstr&short_desc=search-match-test&product=TestProduct&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=";
- RepositoryQueryResultsFactory queryFactory = new RepositoryQueryResultsFactory();
-
- // Tasklist can be null but calls to hit.getOrCreateCorrespondingTask() will return null.
- queryFactory.performQuery(null, repository.getUrl(), collector, urlString, null, -1, repository
- .getCharacterEncoding());
-
+ BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
+ connector.init(taskList);
+ BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), urlString, "", "-1", taskList);
+ connector.performQuery(query, repository, null, new NullProgressMonitor(), collector);
assertEquals(2, collector.getHits().size());
for (AbstractQueryHit hit : collector.getHits()) {
assertTrue(hit.getDescription().contains("search-match-test"));
}
}
}
+
+//public void testQueryBugs() throws Exception {
+//
+// QueryHitCollector collector = new QueryHitCollector(new TaskList());
+//
+// // Note need for ctype=rdf in query url
+// String urlString = "http://mylar.eclipse.org/bugs222/buglist.cgi?ctype=rdf&query_format=advanced&short_desc_type=allwordssubstr&short_desc=search-match-test&product=TestProduct&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&deadlinefrom=&deadlineto=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0=";
+// RepositoryQueryResultsFactory queryFactory = new RepositoryQueryResultsFactory();
+//
+// // Tasklist can be null but calls to hit.getOrCreateCorrespondingTask() will return null.
+// queryFactory.performQuery(null, repository.getUrl(), collector, urlString, null, -1, repository
+// .getCharacterEncoding());
+//
+// assertEquals(2, collector.getHits().size());
+// for (AbstractQueryHit hit : collector.getHits()) {
+// assertTrue(hit.getDescription().contains("search-match-test"));
+// }
+// } \ No newline at end of file

Back to the top