Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexei.trebounskikh2018-06-14 15:18:00 -0400
committerSam Davis2018-06-19 14:08:53 -0400
commit3e12a215f3e68d8cf11ccf84196afb42178f2cfa (patch)
tree04c9fbcccceb363263b1d34d7fbf5c40e28def64 /org.eclipse.mylyn.tasks.core.tests
parentb65458b4c9707dcbbc0deaca9b65508f0b5c1a20 (diff)
downloadorg.eclipse.mylyn.tasks-3e12a215f3e68d8cf11ccf84196afb42178f2cfa.tar.gz
org.eclipse.mylyn.tasks-3e12a215f3e68d8cf11ccf84196afb42178f2cfa.tar.xz
org.eclipse.mylyn.tasks-3e12a215f3e68d8cf11ccf84196afb42178f2cfa.zip
535879: [performance] Loading a large tasklist.xml takes a long time
Changed the order the tasks are added to the task list to prevent unnecessary removals from UnmatchedTaskContainer when loading tasklist.xml Change-Id: I1931578f3c9cdd3e47fc5f2324577ec83874fc27 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=535879 Signed-off-by: alexei.trebounskikh <alexei.trebounskikh@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/externalization/LazyTransferListTest.java81
1 files changed, 81 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/externalization/LazyTransferListTest.java b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/externalization/LazyTransferListTest.java
new file mode 100644
index 000000000..c66e67797
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/internal/tasks/core/externalization/LazyTransferListTest.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2018 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.externalization;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.core.ITransferList;
+import org.eclipse.mylyn.internal.tasks.core.TaskList;
+import org.eclipse.mylyn.internal.tasks.core.TaskTask;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LazyTransferListTest {
+
+ private ITransferList taskList;
+
+ private LazyTransferList lazyList;
+
+ @Before
+ public void setUp() throws Exception {
+ taskList = mock(TaskList.class);
+ lazyList = new LazyTransferList(taskList);
+ }
+
+ @Test
+ public void addUnmatchedTask() {
+ AbstractTask task = spy(new TaskTask("kind", "repoUrl", "id"));
+
+ // add to unmatched
+ lazyList.addTask(task);
+
+ // should not add task to task list
+ verify(taskList, never()).addTask(task);
+ verify(taskList, never()).addTask(eq(task), any());
+
+ // commit should add the task to task list
+ lazyList.commit();
+ verify(taskList).addTask(task);
+
+ // subsequent commit should not add task again
+ lazyList.commit();
+ verifyNoMoreInteractions(taskList);
+ }
+
+ @Test
+ public void addSubTask() {
+ AbstractTask task = spy(new TaskTask("kind", "repoUrl", "parent"));
+ AbstractTask subTask = spy(new TaskTask("kind", "repoUrl", "child"));
+
+ // add subtask to a task container
+ lazyList.addTask(subTask);
+ lazyList.addTask(task);
+ lazyList.addTask(subTask, task);
+
+ // should add task and subtask to task list
+ verify(taskList).addTask(task);
+ verify(taskList).addTask(subTask, task);
+ verifyNoMoreInteractions(taskList);
+
+ // commit should not add anything to task list
+ lazyList.commit();
+ verifyNoMoreInteractions(taskList);
+ }
+
+}

Back to the top