Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2014-01-13 17:39:28 +0000
committerSteffen Pingel2014-01-13 18:20:31 +0000
commit9cf9041d9f8f453ace9d724dc17d3730eaf72ad8 (patch)
tree64b3c803b5c9fa70a02393f13ed426043d246afd
parentae40f6d214cf4cee26d1bad19afb8a6bd059242b (diff)
downloadorg.eclipse.mylyn.tasks-9cf9041d9f8f453ace9d724dc17d3730eaf72ad8.tar.gz
org.eclipse.mylyn.tasks-9cf9041d9f8f453ace9d724dc17d3730eaf72ad8.tar.xz
org.eclipse.mylyn.tasks-9cf9041d9f8f453ace9d724dc17d3730eaf72ad8.zip
425458: [api] provide API in connector core to validate repositories
Change-Id: Ibe8909f301ff3da2cdac9c9383bd9132e4988c81 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=425458
-rw-r--r--org.eclipse.mylyn-feature/feature.xml1
-rw-r--r--org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryInfoTest.java37
-rw-r--r--org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryVersionTest.java36
-rw-r--r--org.eclipse.mylyn.tasks.core/.settings/org.moreunit.core.prefs4
-rw-r--r--org.eclipse.mylyn.tasks.core/.settings/org.moreunit.prefs4
-rw-r--r--org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java18
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java38
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java38
9 files changed, 177 insertions, 0 deletions
diff --git a/org.eclipse.mylyn-feature/feature.xml b/org.eclipse.mylyn-feature/feature.xml
index 81127147d..ce3f2362e 100644
--- a/org.eclipse.mylyn-feature/feature.xml
+++ b/org.eclipse.mylyn-feature/feature.xml
@@ -39,6 +39,7 @@
<import plugin="org.apache.commons.logging" version="1.0.4" match="compatible"/>
<import plugin="org.apache.commons.httpclient" version="3.1.0" match="compatible"/>
<import plugin="org.apache.lucene.core" version="2.9.1" match="greaterOrEqual"/>
+ <import plugin="com.google.guava" version="10.0.0" match="greaterOrEqual"/>
<import feature="org.eclipse.mylyn.discovery" version="3.11.0" match="compatible"/>
<import feature="org.eclipse.mylyn.monitor" version="3.11.0" match="compatible"/>
<import feature="org.eclipse.mylyn.commons" version="3.11.0" match="compatible"/>
diff --git a/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryInfoTest.java b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryInfoTest.java
new file mode 100644
index 000000000..3a3a90052
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryInfoTest.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core;
+
+import static org.junit.Assert.assertSame;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class RepositoryInfoTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void constructWitNullVersion() throws Exception {
+ thrown.expect(NullPointerException.class);
+ new RepositoryInfo(null);
+ }
+
+ @Test
+ public void getVersion() {
+ RepositoryVersion version = new RepositoryVersion("1");
+ assertSame(version, new RepositoryInfo(version).getVersion());
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryVersionTest.java b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryVersionTest.java
new file mode 100644
index 000000000..c4046cecf
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core.tests/src/org/eclipse/mylyn/tasks/core/RepositoryVersionTest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class RepositoryVersionTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void constructWithNullVersion() throws Exception {
+ thrown.expect(NullPointerException.class);
+ new RepositoryVersion(null);
+ }
+
+ @Test
+ public void getVersion() {
+ assertEquals("1", new RepositoryVersion("1").toString());
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.core.prefs b/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.core.prefs
new file mode 100644
index 000000000..efd9d77f2
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.moreunit.core.anyLanguage.srcFolderPathTemplate=${srcProject}
+org.moreunit.core.anyLanguage.testFileNameTemplate=${srcFile}Test
+org.moreunit.core.anyLanguage.testFolderPathTemplate=${srcProject}
diff --git a/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.prefs b/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.prefs
new file mode 100644
index 000000000..35354fc42
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/.settings/org.moreunit.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.moreunit.preferences.version=2
+org.moreunit.unitsourcefolder=org.eclipse.mylyn.tasks.core\:src\:org.eclipse.mylyn.tasks.core.tests\:src
+org.moreunit.useprojectsettings=true
diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
index 584e55a57..af86bbfbe 100644
--- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.commons.core;bundle-version="3.8.0",
org.eclipse.mylyn.commons.net;bundle-version="3.8.0",
org.eclipse.mylyn.commons.repositories.core;bundle-version="1.0.0",
+ com.google.guava;bundle-version="12.0.0",
org.eclipse.core.runtime.compatibility.auth;resolution:=optional;x-installation:=greedy,
org.apache.xerces;bundle-version="2.9.0";resolution:=optional
Export-Package: org.eclipse.mylyn.internal.provisional.tasks.core;x-internal:=true,
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index 0acbe7520..65ba2e22d 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -615,4 +615,22 @@ public abstract class AbstractRepositoryConnector {
throw new UnsupportedOperationException();
}
+ /**
+ * Validates the connection to {@code repository} and returns information about the repository. This typically
+ * requires connecting to the repository.
+ * <p>
+ * Throws {@link UnsupportedOperationException} if not implemented by clients.
+ *
+ * @param repository
+ * the repository
+ * @param monitor
+ * a progress monitor
+ * @throws CoreException
+ * thrown in case the operation fails
+ * @since 3.11
+ */
+ public RepositoryInfo validateRepository(TaskRepository repository, IProgressMonitor monitor) throws CoreException {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java
new file mode 100644
index 000000000..739978cba
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryInfo.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * Provides information about a {@link TaskRepository} such as the version of the repository.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ * @see AbstractRepositoryConnector#validate(TaskRepository, org.eclipse.core.runtime.IProgressMonitor)
+ * @since 3.11
+ */
+public class RepositoryInfo {
+
+ private final RepositoryVersion version;
+
+ public RepositoryInfo(@NonNull RepositoryVersion version) {
+ this.version = checkNotNull(version);
+ }
+
+ @NonNull
+ public RepositoryVersion getVersion() {
+ return version;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java
new file mode 100644
index 000000000..21f7297de
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryVersion.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.core;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * Represents the version of a {@link TaskRepository}.
+ *
+ * @since 3.11
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+// FIXME bug 425593 make this class more generic
+public class RepositoryVersion {
+
+ private final String version;
+
+ public RepositoryVersion(@NonNull String version) {
+ this.version = checkNotNull(version);
+ }
+
+ @Override
+ public String toString() {
+ return version;
+ }
+
+}

Back to the top