Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Doninger2011-08-23 00:23:30 +0000
committerSteffen Pingel2011-08-23 00:23:30 +0000
commit322adb87a8732b447c0c271762fe3b861c19c269 (patch)
tree1d6419ef6053e54a1c022ce5dfada1bf2692dc31 /org.eclipse.mylyn.tasks.tests/src
parentcc66518916118a0146170ef002e25612710e62d0 (diff)
downloadorg.eclipse.mylyn.tasks-322adb87a8732b447c0c271762fe3b861c19c269.tar.gz
org.eclipse.mylyn.tasks-322adb87a8732b447c0c271762fe3b861c19c269.tar.xz
org.eclipse.mylyn.tasks-322adb87a8732b447c0c271762fe3b861c19c269.zip
ASSIGNED - bug 349924: [patch][api] provide extension point for task
activation listeners https://bugs.eclipse.org/bugs/show_bug.cgi?id=349924
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/MockTaskActivationListenerExtension.java68
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java9
2 files changed, 77 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/MockTaskActivationListenerExtension.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/MockTaskActivationListenerExtension.java
new file mode 100644
index 000000000..854b32a6c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/MockTaskActivationListenerExtension.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Manuel Doninger 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:
+ * Manuel Doninger - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests;
+
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
+
+/**
+ * A task activation listener that is registered through an extension point.
+ *
+ * @author Manuel Doninger
+ */
+public class MockTaskActivationListenerExtension extends TaskActivationAdapter {
+
+ public static MockTaskActivationListenerExtension INSTANCE;
+
+ public boolean hasActivated = false;
+
+ public boolean hasPreActivated = false;
+
+ public boolean hasDeactivated = false;
+
+ public boolean hasPreDeactivated = false;
+
+ public MockTaskActivationListenerExtension() {
+ super();
+ INSTANCE = this;
+ }
+
+ public void reset() {
+ hasActivated = false;
+ hasPreActivated = false;
+
+ hasDeactivated = false;
+ hasPreDeactivated = false;
+
+ }
+
+ @Override
+ public void preTaskActivated(ITask task) {
+ hasPreActivated = true;
+ }
+
+ @Override
+ public void preTaskDeactivated(ITask task) {
+ hasPreDeactivated = true;
+ }
+
+ @Override
+ public void taskActivated(ITask task) {
+ hasActivated = true;
+ }
+
+ @Override
+ public void taskDeactivated(ITask task) {
+ hasDeactivated = true;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
index de82fcfae..3ec02ffc1 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskActivityManagerTest.java
@@ -137,7 +137,12 @@ public class TaskActivityManagerTest extends TestCase {
assertTrue(listener.hasActivated);
assertFalse(listener.hasPreDeactivated);
assertFalse(listener.hasDeactivated);
+ assertTrue(MockTaskActivationListenerExtension.INSTANCE.hasPreActivated);
+ assertTrue(MockTaskActivationListenerExtension.INSTANCE.hasActivated);
+ assertFalse(MockTaskActivationListenerExtension.INSTANCE.hasPreDeactivated);
+ assertFalse(MockTaskActivationListenerExtension.INSTANCE.hasDeactivated);
+ MockTaskActivationListenerExtension.INSTANCE.reset();
listener.reset();
} finally {
taskActivityManager.deactivateTask(task);
@@ -146,6 +151,10 @@ public class TaskActivityManagerTest extends TestCase {
assertFalse(listener.hasActivated);
assertTrue(listener.hasPreDeactivated);
assertTrue(listener.hasDeactivated);
+ assertFalse(MockTaskActivationListenerExtension.INSTANCE.hasPreActivated);
+ assertFalse(MockTaskActivationListenerExtension.INSTANCE.hasActivated);
+ assertTrue(MockTaskActivationListenerExtension.INSTANCE.hasPreDeactivated);
+ assertTrue(MockTaskActivationListenerExtension.INSTANCE.hasDeactivated);
} finally {
taskActivityManager.removeActivationListener(listener);
}

Back to the top