Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-06-05 02:55:58 +0000
committerrelves2007-06-05 02:55:58 +0000
commitc666a527bedd03bb02b0232a651dd04ed7d08f15 (patch)
treeeb9a548584d8b2cea370ec11856fe4a9f4f83d19 /org.eclipse.mylyn.bugzilla.tests
parent77b03f518715908344326384e6f585a84cf3d243 (diff)
downloadorg.eclipse.mylyn.tasks-c666a527bedd03bb02b0232a651dd04ed7d08f15.tar.gz
org.eclipse.mylyn.tasks-c666a527bedd03bb02b0232a651dd04ed7d08f15.tar.xz
org.eclipse.mylyn.tasks-c666a527bedd03bb02b0232a651dd04ed7d08f15.zip
NEW - bug 161734: [api] clean up schitzophrenia between tasks and hits
https://bugs.eclipse.org/bugs/show_bug.cgi?id=161734
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java7
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java156
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaSearchEngineTest.java18
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskListNotificationManagerTest.java48
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/TaskReportGeneratorTest.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaQueryTest.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt1
8 files changed, 106 insertions, 141 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
index 34c19c6d8..930253e9e 100644
--- a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.mylar.context.core,
org.eclipse.mylar.tasks.core,
org.eclipse.ui.forms,
- org.eclipse.mylar
+ org.eclipse.mylar,
+ org.eclipse.search
Eclipse-AutoStart: true
Bundle-Vendor: Eclipse.org
Bundle-ClassPath: bugzilla-test.jar
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
index 0ed59d695..88158386b 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
@@ -25,11 +25,13 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.ITaskFactory;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -48,6 +50,8 @@ public abstract class AbstractBugzillaTest extends TestCase {
protected TaskRepository repository;
protected TaskList taskList;
+
+ protected ITaskFactory taskFactory;
public AbstractBugzillaTest() {
super();
@@ -57,6 +61,7 @@ public abstract class AbstractBugzillaTest extends TestCase {
protected void setUp() throws Exception {
super.setUp();
manager = TasksUiPlugin.getRepositoryManager();
+ TasksUiPlugin.getTaskListManager().getTaskList().reset();
manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
}
@@ -99,6 +104,8 @@ public abstract class AbstractBugzillaTest extends TestCase {
assertEquals(abstractRepositoryClient.getRepositoryType(), DEFAULT_KIND);
connector = (BugzillaRepositoryConnector) abstractRepositoryClient;
+
+ taskFactory = new TaskFactory(repository);
// connector.setForceSynchExecForTesting(true);
TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
}
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 0952ef045..e6ee56a95 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
@@ -25,22 +25,20 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.RepositoryConfiguration;
import org.eclipse.mylar.internal.tasks.core.RepositoryTaskHandleUtil;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.LocalAttachment;
import org.eclipse.mylar.tasks.core.RepositoryAttachment;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylar.tasks.ui.search.RepositorySearchResult;
import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
/**
@@ -49,36 +47,33 @@ import org.eclipse.mylar.tasks.ui.search.SearchHitCollector;
* @author Nathan Hapke
*/
public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
-
-
-
-
+
public void testFocedQuerySynchronization() throws CoreException {
init222();
TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
TasksUiPlugin.getDefault().getTaskDataManager().clear();
assertEquals(0, taskList.getAllTasks().size());
- BugzillaRepositoryQuery bugQuery = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, "http://mylar.eclipse.org/bugs222/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Read+Only+Test+Cases&long_desc_type=allwordssubstr&long_desc=&bug_status=NEW&order=Importance",
+ BugzillaRepositoryQuery bugQuery = new BugzillaRepositoryQuery(
+ IBugzillaConstants.TEST_BUGZILLA_222_URL,
+ "http://mylar.eclipse.org/bugs222/buglist.cgi?short_desc_type=allwordssubstr&short_desc=&product=Read+Only+Test+Cases&long_desc_type=allwordssubstr&long_desc=&bug_status=NEW&order=Importance",
"testFocedQuerySynchronization", taskList);
taskList.addQuery(bugQuery);
-
+
TasksUiPlugin.getSynchronizationManager().synchronize(connector, bugQuery, null, false);
-
+
assertEquals(1, bugQuery.getHits().size());
- AbstractQueryHit hit = (AbstractQueryHit) bugQuery.getHits().toArray()[0];
+ AbstractRepositoryTask hit = (AbstractRepositoryTask) bugQuery.getHits().toArray()[0];
assertTrue(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(hit.getHandleIdentifier()) != null);
TasksUiPlugin.getDefault().getTaskDataManager().remove(hit.getHandleIdentifier());
- assertTrue(hit.getCorrespondingTask() == null);
-
+
TasksUiPlugin.getSynchronizationManager().synchronize(connector, bugQuery, null, true);
assertEquals(1, bugQuery.getHits().size());
- hit = (AbstractQueryHit) bugQuery.getHits().toArray()[0];
+ hit = (AbstractRepositoryTask) bugQuery.getHits().toArray()[0];
assertTrue(TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(hit.getHandleIdentifier()) != null);
-
+
}
-
-
+
public void testCreateTaskFromExistingId() throws Exception {
init222();
try {
@@ -119,15 +114,16 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
BugzillaRepositoryQuery bugzillaQuery = new BugzillaRepositoryQuery(repository.getUrl(), queryUrl, "search",
taskList);
- SearchHitCollector collector = new SearchHitCollector(TasksUiPlugin.getTaskListManager().getTaskList(),
- repository, bugzillaQuery);
-
+ SearchHitCollector collector = new SearchHitCollector(taskList, repository, bugzillaQuery, taskFactory);
+ RepositorySearchResult result = (RepositorySearchResult)collector.getSearchResult();
+
+
// operation.run(new NullProgressMonitor());
// BugzillaSearchQuery searchQuery = new BugzillaSearchQuery(collector);
collector.run(new NullProgressMonitor());
- assertEquals(2, collector.getHits().size());
+ assertEquals(2, result.getElements().length);
- for (AbstractQueryHit hit : collector.getHits()) {
+ for (AbstractRepositoryTask hit : collector.getTaskHits()) {
assertTrue(hit.getSummary().contains("search-match-test"));
}
@@ -136,7 +132,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertNotNull(config);
assertTrue(config.getComponents().size() > 0);
}
-
+
public void testUpdate() throws Exception {
init222();
String taskNumber = "3";
@@ -148,7 +144,8 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertEquals("P1", task.getPriority());
assertEquals("blocker", task.getSeverity());
assertEquals("nhapke@cs.ubc.ca", task.getOwner());
- //assertEquals("2007-04-18 14:21:40", task.getCompletionDate().toString());
+ // assertEquals("2007-04-18 14:21:40",
+ // task.getCompletionDate().toString());
assertFalse(task.isCompleted());
assertEquals("http://mylar.eclipse.org/bugs222/show_bug.cgi?id=3", task.getTaskUrl());
}
@@ -162,7 +159,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
assertNotNull(task.getChildren());
assertEquals(2, task.getChildren().size());
}
-
+
public void testContextAttachFailure() throws Exception {
init218();
BugzillaTask task = this.generateLocalTaskAndDownload("3");
@@ -242,75 +239,30 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
- public void testUniqueTaskObjects() {
- init222();
- String repositoryURL = "repositoryURL";
- BugzillaQueryHit hit1 = new BugzillaQueryHit(taskList, "summary", "P1", repositoryURL, "1", null, "status");
- ITask task1 = hit1.getOrCreateCorrespondingTask();
- assertNotNull(task1);
- // taskList.renameTask(task1, "testing");
- // task1.setDescription("testing");
-
- BugzillaQueryHit hit1Twin = new BugzillaQueryHit(taskList, "summary", "P1", repositoryURL, "1", null, "status");
- ITask task2 = hit1Twin.getOrCreateCorrespondingTask();
- assertEquals(task1.getSummary(), task2.getSummary());
-
- }
-
public void testUniqueQueryHitObjects() {
init222();
BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
"queryurl", "description1", taskList);
- BugzillaQueryHit query1Hit = new BugzillaQueryHit(taskList, "description1", "P1",
- IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1", true);
query1.addHit(query1Hit);
taskList.addQuery(query1);
BugzillaRepositoryQuery query2 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
"queryurl2", "description2", taskList);
- BugzillaQueryHit query2Hit = new BugzillaQueryHit(taskList, "description2", "P1",
- IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", null, "status");
+ BugzillaTask query2Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description2", true);
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()) {
+ assertEquals(1, taskList.getAllTasks().size());
+ for (AbstractRepositoryTask hit : query1.getHits()) {
+ for (AbstractRepositoryTask 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(
- // IBugzillaConstants.TEST_BUGZILLA_222_URL, "1"));
- // if (foundHit != null) {
- // hitsForHandle.add(foundHit);
- // }
- // }
- //
- // // IF two queries have the same hit there should only be one instance
- // of
- // // 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.getQueryHits(
- // AbstractRepositoryTask.getHandle(IBugzillaConstants.TEST_BUGZILLA_222_URL,
- // "1")).size());
-
+ assertEquals(1, taskList.getAllTasks().size());
}
public void testAttachToExistingReport() throws Exception {
@@ -606,8 +558,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
synchAndAssertState(tasks, RepositoryTaskSyncState.SYNCHRONIZED);
- bugtaskdata = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(
- bugtask.getHandleIdentifier());
+ bugtaskdata = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(bugtask.getHandleIdentifier());
assertEquals(estimatedTime, Float.parseFloat(bugtaskdata.getAttributeValue(BugzillaReportElement.ESTIMATED_TIME
.getKeyString())));
@@ -659,36 +610,39 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
private boolean validateAttachmentAttributes(RepositoryAttachment att, boolean isPatch, boolean isObsolete) {
return (att.isPatch() == isPatch) && (att.isObsolete() == isObsolete);
}
-
-
-// public void testSimpleLoad() throws Exception {
-// repository = new TaskRepository(DEFAULT_KIND, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
-// //Credentials credentials = MylarTestUtils.readCredentials();
-// //repository.setAuthenticationCredentials(credentials.username, credentials.password);
+
+// public void testSimpleLoad() throws Exception {
+// repository = new TaskRepository(DEFAULT_KIND,
+// IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
+// //Credentials credentials = MylarTestUtils.readCredentials();
+// //repository.setAuthenticationCredentials(credentials.username,
+// credentials.password);
//
-// //repository.setTimeZoneId("Canada/Eastern");
-// assertNotNull(manager);
-// manager.addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+// //repository.setTimeZoneId("Canada/Eastern");
+// assertNotNull(manager);
+// manager.addRepository(repository,
+// TasksUiPlugin.getDefault().getRepositoriesFilePath());
//
-// taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+// taskList = TasksUiPlugin.getTaskListManager().getTaskList();
//
-// AbstractRepositoryConnector abstractRepositoryConnector = manager.getRepositoryConnector(DEFAULT_KIND);
+// AbstractRepositoryConnector abstractRepositoryConnector =
+// manager.getRepositoryConnector(DEFAULT_KIND);
//
-// assertEquals(abstractRepositoryConnector.getRepositoryType(), DEFAULT_KIND);
+// assertEquals(abstractRepositoryConnector.getRepositoryType(), DEFAULT_KIND);
//
-// connector = (BugzillaRepositoryConnector) abstractRepositoryConnector;
+// connector = (BugzillaRepositoryConnector) abstractRepositoryConnector;
//
-// long start = System.currentTimeMillis();
-// BugzillaTask task = null;
-// for(int x = 1; x < 5; x++) {
-// if(task != null)
-// taskList.deleteTask(task);
+// long start = System.currentTimeMillis();
+// BugzillaTask task = null;
+// for(int x = 1; x < 5; x++) {
+// if(task != null)
+// taskList.deleteTask(task);
//
-// task = this.generateLocalTaskAndDownload("154100");
-// assertNotNull(task);
-// }
-// System.err.println("Total: "+((System.currentTimeMillis() - start)/1000));
-// }
+// task = this.generateLocalTaskAndDownload("154100");
+// assertNotNull(task);
+// }
+// System.err.println("Total: "+((System.currentTimeMillis() - start)/1000));
+// }
// class MockBugzillaReportSubmitForm extends BugzillaReportSubmitForm {
//
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 8c5a8205c..d9966f3c3 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,7 +11,7 @@
package org.eclipse.mylar.bugzilla.tests;
-import java.util.List;
+import java.util.Set;
import junit.framework.TestCase;
@@ -19,10 +19,12 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
+import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
/**
@@ -82,11 +84,11 @@ public class BugzillaSearchEngineTest extends TestCase {
TaskRepository repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND,
IBugzillaConstants.TEST_BUGZILLA_222_URL, IBugzillaConstants.BugzillaServerVersion.SERVER_222.toString());
TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
- List<AbstractQueryHit> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, SEARCH_DESCRIPTION);
+ Set<AbstractRepositoryTask> hits = runQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL, SEARCH_DESCRIPTION);
assertEquals(NUM_EXPECTED_HITS, hits.size());
}
- private List<AbstractQueryHit> runQuery(String repositoryURL, String SearchString) throws Exception {
+ private Set<AbstractRepositoryTask> runQuery(String repositoryURL, String SearchString) throws Exception {
TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(BugzillaCorePlugin.REPOSITORY_KIND, repositoryURL);
assertNotNull(repository);
@@ -97,13 +99,13 @@ public class BugzillaSearchEngineTest extends TestCase {
TasksUiPlugin.getTaskListManager().getTaskList());
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(BugzillaCorePlugin.REPOSITORY_KIND);
+ TaskList taskList = TasksUiPlugin.getTaskListManager().getTaskList();
+ QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
- QueryHitCollector collector = new QueryHitCollector(TasksUiPlugin.getTaskListManager().getTaskList());
-
- connector.performQuery(repositoryQuery, repository, new NullProgressMonitor(), collector);
+ connector.performQuery(repositoryQuery, repository, new NullProgressMonitor(), collector, false);
//results.addAll(connector.performQuery(repositoryQuery, new NullProgressMonitor(), new MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", null)));
- return collector.getHits();
+ return collector.getTaskHits();
}
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 002fbcc70..b40903aff 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
@@ -15,12 +15,11 @@ import java.util.Date;
import junit.framework.TestCase;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
+import org.eclipse.mylar.internal.tasks.ui.ITaskListNotification;
import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationIncoming;
import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationManager;
-import org.eclipse.mylar.internal.tasks.ui.TaskListNotificationQueryIncoming;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.Task;
@@ -59,8 +58,7 @@ public class TaskListNotificationManagerTest extends TestCase {
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task1);
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task2);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
task0 = TasksUiPlugin.getTaskListManager().getTaskList().getTask("t0");
@@ -78,14 +76,14 @@ public class TaskListNotificationManagerTest extends TestCase {
public void testTaskListNotificationIncoming() {
TaskRepository repository = new TaskRepository("bugzilla", "https://bugs.eclipse.org/bugs");
- TasksUiPlugin.getRepositoryManager().addRepository(repository, TasksUiPlugin.getDefault().getRepositoriesFilePath());
+ TasksUiPlugin.getRepositoryManager().addRepository(repository,
+ TasksUiPlugin.getDefault().getRepositoriesFilePath());
AbstractRepositoryTask task = new BugzillaTask("https://bugs.eclipse.org/bugs", "142891", "label", true);
assertTrue(task.getSyncState() == RepositoryTaskSyncState.INCOMING);
- assertTrue(task.isNotified());
+ assertFalse(task.isNotified());
task.setNotified(false);
TasksUiPlugin.getTaskListManager().getTaskList().addTask(task);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationIncoming(task)));
task = (AbstractRepositoryTask) TasksUiPlugin.getTaskListManager().getTaskList().getTask(
@@ -95,45 +93,47 @@ public class TaskListNotificationManagerTest extends TestCase {
}
public void testTaskListNotificationQueryIncoming() {
- BugzillaQueryHit hit = new BugzillaQueryHit(null, "summary", "priority", "https://bugs.eclipse.org/bugs", "1",
- null, "status");
+ BugzillaTask hit = new BugzillaTask("https://bugs.eclipse.org/bugs", "1", "summary", true);
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
"summary", TasksUiPlugin.getTaskListManager().getTaskList());
query.addHit(hit);
TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
+ assertFalse(hit.isNotified());
notificationManager.collectNotifications();
- assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
+ for (ITaskListNotification notification : notificationManager.getNotifications()) {
+ notification.getLabel().equals(hit.getSummary());
+ }
+ //assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
assertTrue(hit.isNotified());
}
-
+
public void testTaskListNotificationQueryIncomingRepeats() {
TasksUiPlugin.getTaskListManager().resetTaskList();
- BugzillaQueryHit hit = new BugzillaQueryHit(null, "summary", "priority", "https://bugs.eclipse.org/bugs", "1",
- null, "status");
+ BugzillaTask hit = new BugzillaTask("https://bugs.eclipse.org/bugs", "1", "summary", true);
String hitHandle = hit.getHandleIdentifier();
assertFalse(hit.isNotified());
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery("https://bugs.eclipse.org/bugs", "queryUrl",
- "summary", TasksUiPlugin.getTaskListManager().getTaskList());
+ "summary", TasksUiPlugin.getTaskListManager().getTaskList());
query.addHit(hit);
- TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
- TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault()
- .getTaskListNotificationManager();
+ TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
+ TaskListNotificationManager notificationManager = TasksUiPlugin.getDefault().getTaskListNotificationManager();
notificationManager.collectNotifications();
- assertTrue(notificationManager.getNotifications().contains(new TaskListNotificationQueryIncoming(hit)));
+ for (ITaskListNotification notification : notificationManager.getNotifications()) {
+ notification.getLabel().equals(hit.getSummary());
+ }
+ //assertTrue(notificationManager.getNotifications().iterator().next().equals(new TaskListNotificationQueryIncoming(hit)));
assertTrue(hit.isNotified());
-
+
TasksUiPlugin.getTaskListManager().saveTaskList();
TasksUiPlugin.getTaskListManager().resetTaskList();
assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
assertTrue(TasksUiPlugin.getTaskListManager().readExistingOrCreateNewList());
assertEquals(1, TasksUiPlugin.getTaskListManager().getTaskList().getQueries().size());
- BugzillaQueryHit hitLoaded = (BugzillaQueryHit)TasksUiPlugin.getTaskListManager().getTaskList().getQueryHit(hitHandle);
+ BugzillaTask hitLoaded = (BugzillaTask) TasksUiPlugin.getTaskListManager().getTaskList().getTask(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 43e18baa2..fc4668494 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
@@ -19,7 +19,6 @@ import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.tasks.ui.planner.CompletedTaskCollector;
@@ -176,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"));
+ bugQuery.addHit(task1);
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 7a7ae36a5..5f43da257 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
@@ -21,12 +21,13 @@ 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.IBugzillaConstants;
-import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.TaskFactory;
// import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -131,14 +132,14 @@ public class BugzillaQueryTest extends TestCase {
// holds onto actual hit objects
TaskList taskList = new TaskList();
- QueryHitCollector collector = new QueryHitCollector(new TaskList());
+ QueryHitCollector collector = new QueryHitCollector(taskList, new TaskFactory(repository));
BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
connector.init(taskList);
BugzillaRepositoryQuery query = new BugzillaRepositoryQuery(repository.getUrl(), queryUrlString, "summary",
taskList);
- connector.performQuery(query, repository, new NullProgressMonitor(), collector);
- assertEquals(2, collector.getHits().size());
- for (AbstractQueryHit hit : collector.getHits()) {
+ connector.performQuery(query, repository, new NullProgressMonitor(), collector, false);
+ assertEquals(2, collector.getTaskHits().size());
+ for (ITask hit : collector.getTaskHits()) {
assertTrue(hit.getSummary().contains("search-match-test"));
}
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt b/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt
new file mode 100644
index 000000000..bdf08de0f
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/test-attach-1181009324093.txt
@@ -0,0 +1 @@
+test file \ No newline at end of file

Back to the top