Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-10-19 01:10:42 -0400
committermkersten2006-10-19 01:10:42 -0400
commitdae0cfd297541c0dbd352ba514f8b46c896f1256 (patch)
tree32aa07b3b037032bfb810efe19ddc40cead89654 /org.eclipse.mylyn.bugzilla.tests
parent2cd0ef98de382fbc84e829c58a356e9be68907c3 (diff)
downloadorg.eclipse.mylyn.tasks-dae0cfd297541c0dbd352ba514f8b46c896f1256.tar.gz
org.eclipse.mylyn.tasks-dae0cfd297541c0dbd352ba514f8b46c896f1256.tar.xz
org.eclipse.mylyn.tasks-dae0cfd297541c0dbd352ba514f8b46c896f1256.zip
NEW - bug 158674: When hits opened with overlapping queries not all hits become tasks
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java69
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java10
4 files changed, 51 insertions, 36 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 7d1eeb192..6a94ddbbc 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
@@ -225,23 +225,35 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
-// public void testUniqueQueryHitObjects() {
-// init222();
-// BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
-// "queryurl", "description1", "-1", taskList);
-// BugzillaQueryHit query1Hit = new BugzillaQueryHit(taskList, "description1", "P1",
-// IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
-// query1.addHit(query1Hit, taskList);
-// taskList.addQuery(query1);
-//
-// BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
-// "queryurl2", "description2", "-1", taskList);
-// BugzillaQueryHit query2Hit = new BugzillaQueryHit(taskList, "description2", "P1",
-// IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
-// query2.addHit(query2Hit, taskList);
-// taskList.addQuery(query2);
-// assertEquals(2, taskList.getQueries().size());
-//
+ public void testUniqueQueryHitObjects() {
+ init222();
+ BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
+ "queryurl", "description1", "-1", taskList);
+ BugzillaQueryHit query1Hit = new BugzillaQueryHit(taskList, "description1", "P1",
+ IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ query1.addHit(query1Hit);
+ taskList.addQuery(query1);
+
+ BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
+ "queryurl2", "description2", "-1", taskList);
+ BugzillaQueryHit query2Hit = new BugzillaQueryHit(taskList, "description2", "P1",
+ IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ query2.addHit(query2Hit);
+ taskList.addQuery(query2);
+ assertEquals(2, taskList.getQueries().size());
+ assertEquals(1, taskList.getQueryHits().size());
+ for (AbstractQueryHit hit: query1.getHits()) {
+ for (AbstractQueryHit hit2: query2.getHits()) {
+ assertTrue(hit.getClass().equals(hit2.getClass()));
+ }
+ }
+
+ taskList.deleteQuery(query1);
+ taskList.deleteQuery(query2);
+ assertEquals(1, taskList.getQueryHits().size());
+ taskList.removeOrphanedHits();
+ assertEquals(0, taskList.getQueryHits().size());
+
// List<AbstractQueryHit> hitsForHandle = new ArrayList<AbstractQueryHit>();
// for (AbstractRepositoryQuery query : taskList.getQueries()) {
// AbstractQueryHit foundHit = query.findQueryHit(AbstractRepositoryTask.getHandle(
@@ -252,19 +264,18 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// }
//
// // IF two queries have the same hit there should only be one instance of
-// // a hit for a given handle.
+// // a hit with a given handle.
// assertEquals(1, hitsForHandle.size());
-//
-// // IF two queries have the same hit there should only be one instance of
-// // a hit for a given handle.
-// // Note that getQueryHitsForHandle will always return a set of unique
-// // elements (even if there are duplicates among queries because
-// // it returns a set.
-// // assertEquals(1,
-// // taskList.getQueryHitsForHandle(AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL,
-// // "1")).size());
-//
-// }
+
+ // IF two queries have the same hit there should only be one instance of
+ // a hit for a given handle.
+ // Note that getQueryHitsForHandle will always return a set of unique
+ // elements (even if there are duplicates among queries because
+ // it returns a set.
+// assertEquals(1, taskList.getQueryHits(
+// AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1")).size());
+
+ }
public void testAttachToExistingReport() throws Exception {
init222();
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
index 4b50abbe2..c364d0647 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java
@@ -100,7 +100,7 @@ public class TaskListNotificationManagerTest extends TestCase {
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
"description", "10", TasksUiPlugin.getTaskListManager().getTaskList());
- query.addHit(hit, TasksUiPlugin.getTaskListManager().getTaskList());
+ query.addHit(hit);
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
.getTaskListNotificationManager();
@@ -117,7 +117,7 @@ public class TaskListNotificationManagerTest extends TestCase {
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
"description", "10", TasksUiPlugin.getTaskListManager().getTaskList());
- query.addHit(hit, TasksUiPlugin.getTaskListManager().getTaskList());
+ query.addHit(hit);
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
.getTaskListNotificationManager();
@@ -130,7 +130,7 @@ public class TaskListNotificationManagerTest extends TestCase {
assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
assertTrue(TasksUiPlugin.getTaskListManager().readExistingOrCreateNewList());
assertEquals(1, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
- BugzillaQueryHit hitLoaded = (BugzillaQueryHit)TasksUiPlugin.getTaskListManager().getTaskList().getQueryHitForHandle(hitHandle);
+ BugzillaQueryHit hitLoaded = (BugzillaQueryHit)TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(hitHandle);
assertNotNull(hitLoaded);
assertTrue(hitLoaded.isNotified());
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
index 661f3daac..8b61b89b5 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java
@@ -175,7 +175,7 @@ public class TaskReportGeneratorTest extends TestCase {
generator.run(new NullProgressMonitor());
assertEquals(0, generator.getAllCollectedTasks().size());
- bugQuery.addHit(new BugzillaQueryHit(null, "task1description", "low", "repositoryURL", "1", task1, "FIXED"), manager.getTaskList());
+ bugQuery.addHit(new BugzillaQueryHit(null, "task1description", "low", "repositoryURL", "1", task1, "FIXED"));
generator.run(new NullProgressMonitor());
assertEquals(0, generator.getAllCollectedTasks().size());
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 a2b0385c8..3b957e105 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
@@ -82,11 +82,13 @@ public class BugzillaQueryTest extends TestCase {
public void testCredentialsEncoding() throws IOException, BugzillaException, KeyManagementException,
GeneralSecurityException {
- String poundSignUTF8 = BugzillaServerFacade.addCredentials(IBugzillaConstants.TEST_BUGZILLA_222_URL, "UTF-8", "testUser", "");
+ String poundSignUTF8 = BugzillaServerFacade.addCredentials(IBugzillaConstants.TEST_BUGZILLA_222_URL, "UTF-8",
+ "testUser", "");
assertTrue(poundSignUTF8.endsWith("password=%C2%A3"));
- String poundSignISO = BugzillaServerFacade.addCredentials(IBugzillaConstants.TEST_BUGZILLA_222_URL, "ISO-8859-1", "testUser", "");
+ String poundSignISO = BugzillaServerFacade.addCredentials(IBugzillaConstants.TEST_BUGZILLA_222_URL,
+ "ISO-8859-1", "testUser", "");
assertFalse(poundSignISO.contains("%C2%A3"));
- assertTrue(poundSignISO.endsWith("password=%A3"));
+ assertTrue(poundSignISO.endsWith("password=%A3"));
}
public void testGetBug() throws Exception {
@@ -117,6 +119,8 @@ public class BugzillaQueryTest extends TestCase {
public void testQueryViaConnector() throws Exception {
String queryUrlString = 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=";
+
+ // holds onto actual hit objects
TaskList taskList = new TaskList();
QueryHitCollector collector = new QueryHitCollector(new TaskList());
BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();

Back to the top