Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-05-17 18:10:23 -0400
committerJaxsun McCarthy Huggan2016-05-18 16:44:10 -0400
commitb9a7552f5892b88fb40727c55db62c63864fbd68 (patch)
tree5e6acada4856dc4a4611252786cc54da17efdb4a /org.eclipse.mylyn.tasks.core.tests
parent1cf9130cc747348693e2b3632f0a53ae3aaeeb53 (diff)
downloadorg.eclipse.mylyn.tasks-b9a7552f5892b88fb40727c55db62c63864fbd68.tar.gz
org.eclipse.mylyn.tasks-b9a7552f5892b88fb40727c55db62c63864fbd68.tar.xz
org.eclipse.mylyn.tasks-b9a7552f5892b88fb40727c55db62c63864fbd68.zip
493037: Check if a task is in unmatched before removing from unmatched
This gives a considerable performance increase when loading large task lists where there are more tasks than any one task has parents. Change-Id: I18ccd3ba7387d937b78fb21e766d299f2a88491b Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493037 Signed-off-by: Jaxsun McCarthy Huggan <jaxsun.mccarthy@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.core.tests')
-rw-r--r--org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/TaskListTest.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/TaskListTest.java b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/TaskListTest.java
new file mode 100644
index 000000000..b10536fc3
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/TaskListTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.core;
+
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TaskListTest {
+
+ private TaskList taskList;
+
+ @Before
+ public void setUp() throws Exception {
+ taskList = new TaskList();
+ }
+
+ @Test
+ public void removeMatchedTaskFromUnmatched() {
+ UnmatchedTaskContainer unmatched = spy(new UnmatchedTaskContainer("kind", "repoUrl"));
+ TaskCategory category1 = new TaskCategory("cat1");
+ TaskCategory category2 = new TaskCategory("cat2");
+ AbstractTask task = spy(new TaskTask("kind", "repoUrl", "id"));
+ taskList.addCategory(category1);
+ taskList.addCategory(category2);
+ taskList.addUnmatchedContainer(unmatched);
+
+ // add to unmatched
+ taskList.addTask(task);
+ // should remove from unmatched
+ taskList.addTask(task, category1);
+ verify(unmatched, times(1)).internalRemoveChild(task);
+ // should not remove from unmatched again
+ taskList.addTask(task, category2);
+ verify(unmatched, times(1)).internalRemoveChild(task);
+ }
+
+}

Back to the top