Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2008-04-02 00:26:12 +0000
committerspingel2008-04-02 00:26:12 +0000
commitbd9fdf210403571d124c526a01402c8a35e8fc8b (patch)
tree86f81d96a42bbec92dd576ef85bf79f0375d04b5
parent24a58e3aea97b4c1402aa5419a4ee13c793cf817 (diff)
downloadorg.eclipse.mylyn.tasks-bd9fdf210403571d124c526a01402c8a35e8fc8b.tar.gz
org.eclipse.mylyn.tasks-bd9fdf210403571d124c526a01402c8a35e8fc8b.tar.xz
org.eclipse.mylyn.tasks-bd9fdf210403571d124c526a01402c8a35e8fc8b.zip
NEW - bug 116487: create performance test harness
https://bugs.eclipse.org/bugs/show_bug.cgi?id=116487
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksPerformanceTests.java8
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/ActivateTaskPerformanceTest.java163
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTaskListPerformanceTest.java84
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/TaskListPerformanceTest.java22
4 files changed, 274 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksPerformanceTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksPerformanceTests.java
index 1f9f8016f..77e92fdf9 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksPerformanceTests.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksPerformanceTests.java
@@ -8,16 +8,18 @@
package org.eclipse.mylyn.tasks.tests;
-import org.eclipse.mylyn.tasks.tests.performance.TaskContainerTest;
-import org.eclipse.mylyn.tasks.tests.performance.TaskListPerformanceTest;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.mylyn.tasks.tests.performance.ActivateTaskPerformanceTest;
+import org.eclipse.mylyn.tasks.tests.performance.TaskContainerTest;
+import org.eclipse.mylyn.tasks.tests.performance.TaskListPerformanceTest;
+
public class AllTasksPerformanceTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.mylyn.tests.performance");
+ suite.addTestSuite(ActivateTaskPerformanceTest.class);
suite.addTestSuite(TaskContainerTest.class);
suite.addTestSuite(TaskListPerformanceTest.class);
return suite;
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/ActivateTaskPerformanceTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/ActivateTaskPerformanceTest.java
new file mode 100644
index 000000000..79a3ed5ea
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/ActivateTaskPerformanceTest.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers 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
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests.performance;
+
+import org.eclipse.mylyn.context.core.ContextCorePlugin;
+import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
+import org.eclipse.mylyn.internal.tasks.ui.actions.TaskActivateAction;
+import org.eclipse.mylyn.tasks.core.AbstractTask;
+import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
+import org.eclipse.mylyn.tasks.core.ITaskActivityListener2;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryTask;
+import org.eclipse.mylyn.tasks.ui.TaskListManager;
+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
+import org.eclipse.test.performance.PerformanceTestCase;
+
+/**
+ * @author Jingwen Ou
+ */
+public class ActivateTaskPerformanceTest extends PerformanceTestCase {
+
+ private class MockTaskActivityListener implements ITaskActivityListener2 {
+
+ private boolean hasActivated = false;
+
+ private boolean hasPreActivated = false;
+
+ private boolean hasDeactivated = false;
+
+ private boolean hasPreDeactivated = false;
+
+ public void reset() {
+ hasActivated = false;
+ hasPreActivated = false;
+ hasDeactivated = false;
+ hasPreDeactivated = false;
+ }
+
+ public void preTaskActivated(AbstractTask task) {
+ assertFalse(hasActivated);
+ hasPreActivated = true;
+ }
+
+ public void preTaskDeactivated(AbstractTask task) {
+ assertFalse(hasDeactivated);
+ hasPreDeactivated = true;
+ }
+
+ public void activityChanged(ScheduledTaskContainer week) {
+ // ignore
+ }
+
+ public void taskActivated(AbstractTask task) {
+ assertTrue(hasPreActivated);
+ hasActivated = true;
+ }
+
+ public void taskDeactivated(AbstractTask task) {
+ assertTrue(hasPreDeactivated);
+ hasDeactivated = true;
+ }
+
+ public void taskListRead() {
+ // ignore
+ }
+ }
+
+ private TaskListManager manager = TasksUiPlugin.getTaskListManager();
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ manager.dispose();
+ }
+
+ public void testActivivateMockTask() {
+ MockRepositoryTask task = new MockRepositoryTask("test:activation");
+ MockTaskActivityListener listener = new MockTaskActivityListener();
+
+ manager.addActivityListener(listener);
+
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ manager.activateTask(task);
+ stopMeasuring();
+ //manager.deactivateTask(task);
+ }
+
+ manager.deactivateTask(task);
+ manager.removeActivityListener(listener);
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ public void testActivateLocalTask() {
+ AbstractTask task = manager.createNewLocalTask("Owen's performance test");
+ manager.getTaskList().addTask(task);
+
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ (new TaskActivateAction()).run(task);
+ stopMeasuring();
+ }
+
+ manager.getTaskList().deleteTask(task);
+
+ commitMeasurements();
+ assertPerformance();
+
+ }
+
+ public void testActivateContextTask() {
+ MockRepositoryTask task = new MockRepositoryTask("test:activation");
+ ITaskActivityListener CONTEXT_TASK_ACTIVITY_LISTENER = new ITaskActivityListener() {
+
+ public void taskActivated(final AbstractTask task) {
+ ContextCorePlugin.getContextManager().activateContext(task.getHandleIdentifier());
+ }
+
+ public void taskDeactivated(final AbstractTask task) {
+ ContextCorePlugin.getContextManager().deactivateContext(task.getHandleIdentifier());
+ }
+
+ public void activityChanged(ScheduledTaskContainer week) {
+ // ignore
+ }
+
+ public void taskListRead() {
+ // ignore
+ }
+ };
+
+ manager.addActivityListener(CONTEXT_TASK_ACTIVITY_LISTENER);
+
+ for (int i = 0; i < 6401; i++) {
+ startMeasuring();
+ (new TaskActivateAction()).run(task);
+ stopMeasuring();
+ //manager.deactivateTask(task);
+ }
+
+ manager.deactivateTask(task);
+ manager.removeActivityListener(CONTEXT_TASK_ACTIVITY_LISTENER);
+
+ commitMeasurements();
+ assertPerformance();
+
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTaskListPerformanceTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTaskListPerformanceTest.java
new file mode 100644
index 000000000..fb3e6336d
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTaskListPerformanceTest.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers 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
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests.performance;
+
+import java.io.File;
+
+import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter;
+import org.eclipse.mylyn.tasks.core.TaskList;
+import org.eclipse.mylyn.tasks.tests.TaskTestUtil;
+import org.eclipse.mylyn.tasks.ui.TaskListManager;
+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
+import org.eclipse.test.performance.PerformanceTestCase;
+
+/**
+ * @author Jingwen Ou
+ */
+public class RetrieveTaskListPerformanceTest extends PerformanceTestCase {
+
+ private static final String TASK_LIST_4000 = "testdata/performance/tasklist-4000.xml.zip";
+
+ private TaskList taskList;
+
+ private TaskListManager taskListManager;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ taskListManager = TasksUiPlugin.getTaskListManager();
+ taskList = taskListManager.getTaskList();
+ taskList.reset();
+
+ final File file = TaskTestUtil.getLocalFile(TASK_LIST_4000);
+ final TaskListWriter taskListWriter = taskListManager.getTaskListWriter();
+ taskListWriter.readTaskList(taskList, file, TasksUiPlugin.getTaskDataManager());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+
+ taskList.reset();
+ }
+
+ public void testRetrieveQueriesWith4000Tasks() {
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ taskList.getQueries();
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ public void testRetrieveActiveTasksWith4000Tasks() {
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ taskList.getRepositoryTasks("https://bugs.eclipse.org/bugs");
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ public void testRetrieveTasksWith4000Tasks() {
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ taskList.getAllTasks();
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/TaskListPerformanceTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/TaskListPerformanceTest.java
index 807fff576..f85e16e53 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/TaskListPerformanceTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/performance/TaskListPerformanceTest.java
@@ -17,6 +17,10 @@ import org.eclipse.mylyn.tasks.ui.TaskListManager;
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
import org.eclipse.test.performance.PerformanceTestCase;
+/**
+ * @author Steffen Pingel
+ * @author Jingwen Ou
+ */
public class TaskListPerformanceTest extends PerformanceTestCase {
private static final String TASK_LIST_4000 = "testdata/performance/tasklist-4000.xml.zip";
@@ -71,4 +75,22 @@ public class TaskListPerformanceTest extends PerformanceTestCase {
assertPerformance();
}
+ public void testWriteTaskListWith4000Tasks() throws Exception {
+ final File file = TaskTestUtil.getLocalFile(TASK_LIST_4000);
+ final TaskListWriter taskListWriter = taskListManager.getTaskListWriter();
+ taskListWriter.readTaskList(taskList, file, TasksUiPlugin.getTaskDataManager());
+
+ final File outputFile = File.createTempFile("mylyn", null);
+ outputFile.deleteOnExit();
+
+ for (int i = 0; i < 10; i++) {
+ startMeasuring();
+ taskListWriter.writeTaskList(taskList, outputFile);
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
}

Back to the top