Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-06-27 13:19:51 +0000
committerSteffen Pingel2013-06-28 11:46:53 +0000
commit7d54bbdcace41210385cab6463fae1f096231866 (patch)
tree761e62265f9e58da6073ecc78dca20b3e64bd792 /org.eclipse.mylyn.tasks.tests
parent6f2fb1fab8edcec43f683dda4e5e96f722d3daa6 (diff)
downloadorg.eclipse.mylyn.tasks-7d54bbdcace41210385cab6463fae1f096231866.tar.gz
org.eclipse.mylyn.tasks-7d54bbdcace41210385cab6463fae1f096231866.tar.xz
org.eclipse.mylyn.tasks-7d54bbdcace41210385cab6463fae1f096231866.zip
408511: [api] provide an extension to dynamically contribute connectors
Change-Id: If0acbbd24a543d13414ed4bf862a145803b6121c Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=408511
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/plugin.xml6
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryConnectorContributorTest.java31
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorContributor.java27
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorDescriptor.java55
5 files changed, 121 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/plugin.xml b/org.eclipse.mylyn.tasks.tests/plugin.xml
index 166ddab6d..25485ebd8 100644
--- a/org.eclipse.mylyn.tasks.tests/plugin.xml
+++ b/org.eclipse.mylyn.tasks.tests/plugin.xml
@@ -207,5 +207,11 @@
name="Invalid Test Provider">
</provider>
</extension>
+ <extension
+ point="org.eclipse.mylyn.tasks.core.repositoryConnectorContributor">
+ <contributor
+ class="org.eclipse.mylyn.tasks.tests.support.MockRepositoryConnectorContributor">
+ </contributor>
+ </extension>
</plugin>
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
index 96a6a9b91..f1180231e 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
@@ -19,6 +19,7 @@ import org.eclipse.mylyn.tasks.tests.core.FileTaskAttachmentSourceTest;
import org.eclipse.mylyn.tasks.tests.core.ITasksCoreConstantsTest;
import org.eclipse.mylyn.tasks.tests.core.PriorityLevelTest;
import org.eclipse.mylyn.tasks.tests.core.RepositoryClientManagerTest;
+import org.eclipse.mylyn.tasks.tests.core.RepositoryConnectorContributorTest;
import org.eclipse.mylyn.tasks.tests.core.SynchronizeTasksJobTest;
import org.eclipse.mylyn.tasks.tests.core.TaskListUnmatchedContainerTest;
import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryLocationTest;
@@ -139,6 +140,7 @@ public class AllTasksTests {
suite.addTestSuite(SynchronizeTasksJobTest.class);
suite.addTestSuite(TaskAttributeTest.class);
suite.addTestSuite(ScheduledTaskContainerTest.class);
+ suite.addTestSuite(RepositoryConnectorContributorTest.class);
return suite;
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryConnectorContributorTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryConnectorContributorTest.java
new file mode 100644
index 000000000..80a92345b
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/RepositoryConnectorContributorTest.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.tasks.tests.core;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylyn.tasks.tests.support.MockRepositoryConnectorDescriptor.DynamicMockRepositoryConnector;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
+import org.junit.Test;
+
+public class RepositoryConnectorContributorTest extends TestCase {
+
+ @Test
+ public void testConnectorContributed() {
+ AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(DynamicMockRepositoryConnector.CONNECTOR_KIND);
+ assertNotNull("Expected dynamically contributed mock connector", connector);
+ assertEquals(DynamicMockRepositoryConnector.class, connector.getClass());
+ assertEquals(DynamicMockRepositoryConnector.CONNECTOR_KIND, connector.getConnectorKind());
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorContributor.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorContributor.java
new file mode 100644
index 000000000..2f9afd044
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorContributor.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.tasks.tests.support;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.mylyn.tasks.core.spi.RepositoryConnectorContributor;
+import org.eclipse.mylyn.tasks.core.spi.RepositoryConnectorDescriptor;
+
+public class MockRepositoryConnectorContributor extends RepositoryConnectorContributor {
+
+ @Override
+ public List<RepositoryConnectorDescriptor> getDescriptors() {
+ return Collections.<RepositoryConnectorDescriptor> singletonList(new MockRepositoryConnectorDescriptor());
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorDescriptor.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorDescriptor.java
new file mode 100644
index 000000000..e23742e2d
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/support/MockRepositoryConnectorDescriptor.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.tasks.tests.support;
+
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
+import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
+import org.eclipse.mylyn.tasks.core.spi.RepositoryConnectorDescriptor;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
+
+public class MockRepositoryConnectorDescriptor extends RepositoryConnectorDescriptor {
+
+ public static class DynamicMockRepositoryConnector extends MockRepositoryConnector {
+
+ public final static String CONNECTOR_KIND = MockRepositoryConnector.CONNECTOR_KIND + ".dynamic";
+
+ @Override
+ public String getConnectorKind() {
+ return CONNECTOR_KIND;
+ }
+
+ @Override
+ public String getLabel() {
+ return super.getLabel() + " (contributed at runtime)";
+ }
+ };
+
+ public MockRepositoryConnectorDescriptor() {
+ }
+
+ @Override
+ public AbstractRepositoryConnector createRepositoryConnector() {
+ return new DynamicMockRepositoryConnector();
+ }
+
+ @Override
+ public AbstractTaskListMigrator createTaskListMigrator() {
+ return null;
+ }
+
+ @Override
+ public AbstractRepositoryMigrator createRepositoryMigrator() {
+ return null;
+ }
+
+}

Back to the top