Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-05-11 20:59:05 -0400
committerKevin Sawicki2011-05-11 20:59:05 -0400
commit0d93fc473545becca69c0595289ac472afaea68f (patch)
treed13058e842837a7feb2375cb0a48c798976570ae
parent31e119034516c7674964a6c7c87fedefd57376b8 (diff)
downloadegit-github-0d93fc473545becca69c0595289ac472afaea68f.tar.gz
egit-github-0d93fc473545becca69c0595289ac472afaea68f.tar.xz
egit-github-0d93fc473545becca69c0595289ac472afaea68f.zip
Add new core GitHub API plug-in and unit tests.
This moves the current API unit tests from the mylyn test plug-in and creates a new package of live tests that can be run directly against a GitHub instance. The new core API plug-in has no Eclipse dependencies and only relies on GSON and Apache Commons HTTP client. Change-Id: I2b4dc436760818e5fcf1503f7ba80e351aca4fb6 Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.egit.github.core.tests/.classpath7
-rw-r--r--org.eclipse.egit.github.core.tests/.gitignore2
-rw-r--r--org.eclipse.egit.github.core.tests/.project28
-rw-r--r--org.eclipse.egit.github.core.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.egit.github.core.tests/META-INF/MANIFEST.MF18
-rw-r--r--org.eclipse.egit.github.core.tests/build.properties5
-rw-r--r--org.eclipse.egit.github.core.tests/plugin.properties2
-rw-r--r--org.eclipse.egit.github.core.tests/pom.xml46
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java)24
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommentTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java)9
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistRevisionTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java)9
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistServiceTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java)35
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java)9
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java)6
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java)43
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java)9
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/LabelServiceTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/LabelServiceTest.java)26
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneServiceTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneServiceTest.java)14
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java)9
-rwxr-xr-xorg.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestServiceTest.java (renamed from org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java)24
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/GistTest.java56
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java59
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTest.java71
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTests.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java)24
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/PullRequestTest.java66
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/RepositoryTest.java50
-rw-r--r--org.eclipse.egit.github.core/.classpath7
-rw-r--r--org.eclipse.egit.github.core/.gitignore2
-rw-r--r--org.eclipse.egit.github.core/.project28
-rw-r--r--org.eclipse.egit.github.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.egit.github.core/META-INF/MANIFEST.MF19
-rw-r--r--org.eclipse.egit.github.core/build.properties5
-rw-r--r--org.eclipse.egit.github.core/plugin.properties2
-rw-r--r--org.eclipse.egit.github.core/pom.xml26
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Assert.java69
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Comment.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Comment.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/FieldError.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/FieldError.java)24
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java)6
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistChangeStatus.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistChangeStatus.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistFile.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistRevision.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistRevision.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceCollector.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceCollector.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceProvider.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Id.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Id.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Issue.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Issue.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Label.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Label.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/ListResourceCollector.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/ListResourceCollector.java)5
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Milestone.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Milestone.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequest.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestDiscussion.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestDiscussion.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestMarker.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestMarker.java)3
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Repository.java)69
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RequestError.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java)3
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/User.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/DateFormatter.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/DateFormatter.java)7
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java)7
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRequest.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubResponse.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java)12
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PageLinks.java)2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PagedRequest.java)8
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java)18
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java)30
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java)11
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java)68
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelService.java)25
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/MilestoneService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/MilestoneService.java)13
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java)36
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java)23
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java (renamed from org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelComparator.java)5
-rw-r--r--org.eclipse.mylyn.github-feature/feature.xml7
-rw-r--r--org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHub.java6
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubException.java74
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java13
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java13
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java10
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java6
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java12
-rw-r--r--org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF7
-rw-r--r--org.eclipse.mylyn.github.tests/pom.xml19
-rw-r--r--org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java4
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java10
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GistNotificationPopup.java3
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryConnectorUI.java2
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryQueryPage.java10
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java6
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/ImportRepositoriesWizard.java2
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/RepositorySelectionWizardPage.java8
-rw-r--r--org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositorySettingsPage.java4
-rw-r--r--pom.xml4
92 files changed, 1110 insertions, 349 deletions
diff --git a/org.eclipse.egit.github.core.tests/.classpath b/org.eclipse.egit.github.core.tests/.classpath
new file mode 100644
index 00000000..ad32c83a
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.egit.github.core.tests/.gitignore b/org.eclipse.egit.github.core.tests/.gitignore
new file mode 100644
index 00000000..d567ba01
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/.gitignore
@@ -0,0 +1,2 @@
+bin
+target
diff --git a/org.eclipse.egit.github.core.tests/.project b/org.eclipse.egit.github.core.tests/.project
new file mode 100644
index 00000000..70773760
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.egit.github.core.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.egit.github.core.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.egit.github.core.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..25303168
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed May 11 10:20:50 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.egit.github.core.tests/META-INF/MANIFEST.MF b/org.eclipse.egit.github.core.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..bc4e2aea
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.egit.github.core.tests
+Bundle-Version: 0.1.0.qualifier
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: com.google.gson;version="1.6.0",
+ com.google.gson.reflect;version="1.6.0",
+ org.apache.commons.httpclient;version="3.1.0",
+ org.mockito;version="1.8.4",
+ org.mockito.runners;version="1.8.4",
+ org.mockito.stubbing;version="1.8.4"
+Require-Bundle: org.eclipse.egit.github.core;bundle-version="0.1.0",
+ org.junit;bundle-version="4.8.1",
+ org.hamcrest;bundle-version="1.1.0",
+ org.objenesis;bundle-version="1.0.0"
+Bundle-Vendor: %providerName
diff --git a/org.eclipse.egit.github.core.tests/build.properties b/org.eclipse.egit.github.core.tests/build.properties
new file mode 100644
index 00000000..aa1a0082
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/org.eclipse.egit.github.core.tests/plugin.properties b/org.eclipse.egit.github.core.tests/plugin.properties
new file mode 100644
index 00000000..41ee4ddf
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=EGit GitHub API Tests (Incubation)
+providerName=Eclipse EGit \ No newline at end of file
diff --git a/org.eclipse.egit.github.core.tests/pom.xml b/org.eclipse.egit.github.core.tests/pom.xml
new file mode 100644
index 00000000..00bd6426
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Chris Aniszczyk <caniszczyk@gmail.com>
+
+ 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
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.mylyn.github</groupId>
+ <artifactId>github-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.egit.github.core.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <name>Eclipse EGit GitHub API Test Plug-in (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.tycho</groupId>
+ <artifactId>maven-osgi-test-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <excludes>
+ <!-- test mojo matches TestProject be default and treats it as PojoTest -->
+ <exclude>**/Test*.class</exclude>
+ </excludes>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <testSuite>org.eclipse.egit.github.core.tests</testSuite>
+ <testClass>org.eclipse.egit.github.core.tests.AllHeadlessTests</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
index 40065a5d..54aaaaf4 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/AllHeadlessTests.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/AllHeadlessTests.java
@@ -10,19 +10,19 @@
* Christian Trutz <christian.trutz@gmail.com> - initial contribution
* Chris Aniszczyk <caniszczyk@gmail.com> - initial contribution
*******************************************************************************/
-package org.eclipse.mylyn.github.tests;
+package org.eclipse.egit.github.core.tests;
-import org.eclipse.mylyn.github.internal.CommentTest;
-import org.eclipse.mylyn.github.internal.GistRevisionTest;
-import org.eclipse.mylyn.github.internal.GistServiceTest;
-import org.eclipse.mylyn.github.internal.GistTest;
-import org.eclipse.mylyn.github.internal.GitHubClientTest;
-import org.eclipse.mylyn.github.internal.IssueServiceTest;
-import org.eclipse.mylyn.github.internal.IssueTest;
-import org.eclipse.mylyn.github.internal.LabelServiceTest;
-import org.eclipse.mylyn.github.internal.MilestoneServiceTest;
-import org.eclipse.mylyn.github.internal.MilestoneTest;
-import org.eclipse.mylyn.github.internal.PullRequestServiceTest;
+import org.eclipse.egit.github.core.tests.CommentTest;
+import org.eclipse.egit.github.core.tests.GistRevisionTest;
+import org.eclipse.egit.github.core.tests.GistServiceTest;
+import org.eclipse.egit.github.core.tests.GistTest;
+import org.eclipse.egit.github.core.tests.GitHubClientTest;
+import org.eclipse.egit.github.core.tests.IssueServiceTest;
+import org.eclipse.egit.github.core.tests.IssueTest;
+import org.eclipse.egit.github.core.tests.LabelServiceTest;
+import org.eclipse.egit.github.core.tests.MilestoneServiceTest;
+import org.eclipse.egit.github.core.tests.MilestoneTest;
+import org.eclipse.egit.github.core.tests.PullRequestServiceTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommentTest.java
index 95491636..eddc8d96 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommentTest.java
@@ -8,17 +8,18 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.eclipse.egit.github.core.Comment;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* Unit tests for {@link Comment}
*/
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistRevisionTest.java
index a8eb4296..facc6e42 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistRevisionTest.java
@@ -8,17 +8,18 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.eclipse.egit.github.core.GistRevision;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* Unit tests for {@link GistRevision}
*/
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistServiceTest.java
index 833cecf3..d3b158bb 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistServiceTest.java
@@ -8,26 +8,33 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
+import com.google.gson.reflect.TypeToken;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.service.GistService;
+import org.eclipse.egit.github.core.service.IssueService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.reflect.TypeToken;
-
/**
* Unit tests for {@link GistService}
*/
@@ -49,12 +56,12 @@ public class GistServiceTest {
gistService = new GistService(gitHubClient);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new GistService(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getGist_NullId() throws IOException {
gistService.getGist(null);
}
@@ -65,7 +72,7 @@ public class GistServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getGists_NullUser() throws IOException {
gistService.getGists(null);
}
@@ -76,7 +83,7 @@ public class GistServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createGist_NullGist() throws IOException {
gistService.createGist(null);
}
@@ -99,7 +106,7 @@ public class GistServiceTest {
verify(gitHubClient).post("/users/test_user/gists", gist, Gist.class);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createGist_NonNullUser_NullLogin() throws IOException {
Gist gist = new Gist();
User user = new User();
@@ -108,12 +115,12 @@ public class GistServiceTest {
gistService.createGist(gist);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void updateGist_NullGist() throws IOException {
gistService.updateGist(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void updateGist_NullId() throws IOException {
Gist gist = new Gist();
gist.setId(null);
@@ -128,12 +135,12 @@ public class GistServiceTest {
verify(gitHubClient).post("/gists/123", gist, Gist.class);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createComment_NullGistId() throws IOException {
gistService.createComment(null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createComment_NullComment() throws IOException {
gistService.createComment("not null", null);
}
@@ -147,7 +154,7 @@ public class GistServiceTest {
verify(gitHubClient).post("/gists/1/comments", params, Comment.class);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getComments_NullGistId() throws IOException {
gistService.getComments(null);
}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java
index af5a0078..ef12103d 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GistTest.java
@@ -8,17 +8,18 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.eclipse.egit.github.core.Gist;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* Unit tests for {@link Gist}
*/
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java
index a5748298..2354b1e5 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/GitHubClientTest.java
@@ -8,9 +8,9 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.client.GitHubClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
@@ -19,7 +19,7 @@ import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class GitHubClientTest {
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new GitHubClient(null);
}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
index c11f2e71..1fb1dce2 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueServiceTest.java
@@ -8,7 +8,7 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
@@ -18,7 +18,12 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Issue;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.service.IssueService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,22 +51,22 @@ public class IssueServiceTest {
issueService = new IssueService(gitHubClient);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new IssueService(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getIssue_NullUser() throws IOException {
issueService.getIssue(null, "not null", "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getIssue_NullRepository() throws IOException {
issueService.getIssue("not null", null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getIssue_NullId() throws IOException {
issueService.getIssue("not null", "not null", null);
}
@@ -72,17 +77,17 @@ public class IssueServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getComments_NullUser() throws IOException {
issueService.getComments(null, "not null", "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getComments_NullRepository() throws IOException {
issueService.getComments("not null", null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getComments_NullId() throws IOException {
issueService.getComments("not null", "not null", null);
}
@@ -93,12 +98,12 @@ public class IssueServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getIssues_NullUser() throws IOException {
issueService.getIssues(null, "not null", null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getIssues_NullRepository() throws IOException {
issueService.getIssues("not null", null, null);
}
@@ -109,12 +114,12 @@ public class IssueServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createIssue_NullUser() throws IOException {
issueService.createIssue(null, "not null", null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createIssue_NullRepository() throws IOException {
issueService.createIssue("not null", null, null);
}
@@ -126,17 +131,17 @@ public class IssueServiceTest {
new HashMap<String, String>(), Issue.class);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void editIssue_NullUser() throws IOException {
issueService.editIssue(null, "not null", null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void editIssue_NullRepository() throws IOException {
issueService.editIssue("not null", null, null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void editIssue_NullIssue() throws IOException {
issueService.editIssue("not null", "not null", null);
}
@@ -158,17 +163,17 @@ public class IssueServiceTest {
params, Issue.class);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createComment_NullUser() throws IOException {
issueService.createComment(null, "not null", "not null", "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createComment_NullRepository() throws IOException {
issueService.createComment("not null", null, "not null", "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createComment_NullIssueId() throws IOException {
issueService.createComment("not null", "not null", null, "not null");
}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueTest.java
index 65d0673b..9b27e701 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueTest.java
@@ -8,17 +8,18 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.eclipse.egit.github.core.Issue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* Unit tests for {@link Issue}
*/
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/LabelServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/LabelServiceTest.java
index 543c8eca..e1839347 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/LabelServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/LabelServiceTest.java
@@ -8,7 +8,7 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
@@ -20,7 +20,11 @@ import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.Label;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.service.LabelService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,17 +52,17 @@ public class LabelServiceTest {
labelService = new LabelService(gitHubClient);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new LabelService(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getLabels_NullUser() throws IOException {
labelService.getLabels(null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getLabels_NullRepository() throws IOException {
labelService.getLabels("not null", null);
}
@@ -71,19 +75,19 @@ public class LabelServiceTest {
verify(gitHubClient).get(any(GitHubRequest.class));
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void setLabels_NullUser() throws IOException {
labelService.setLabels(null, "not null", "not null",
new LinkedList<Label>());
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void setLabels_NullRepository() throws IOException {
labelService.setLabels("not null", null, "not null",
new LinkedList<Label>());
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void setLabels_NullIssueId() throws IOException {
labelService.setLabels("not null", "not null", null,
new LinkedList<Label>());
@@ -110,17 +114,17 @@ public class LabelServiceTest {
labelsToken.getType());
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createLabel_NullUser() throws IOException {
labelService.createLabel(null, "not null", new Label());
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createLabel_NullRepository() throws IOException {
labelService.createLabel("not null", null, new Label());
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void createLabel_NullLabel() throws IOException {
labelService.createLabel("not null", "not null", null);
}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneServiceTest.java
index d80475a2..47329325 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneServiceTest.java
@@ -8,7 +8,7 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
@@ -19,7 +19,11 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.util.List;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.service.MilestoneService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,17 +51,17 @@ public class MilestoneServiceTest {
milestoneService = new MilestoneService(gitHubClient);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new MilestoneService(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getMilestones_NullUser() throws IOException {
milestoneService.getMilestones(null, "not null", "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getMilestones_NullRepository() throws IOException {
milestoneService.getMilestones("not null", null, "not null");
}
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneTest.java
index 8230e71b..372e570e 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/MilestoneTest.java
@@ -8,17 +8,18 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.eclipse.egit.github.core.Milestone;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* Unit tests for {@link Milestone}
*/
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestServiceTest.java
index 4938f64a..088778f2 100755
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestServiceTest.java
@@ -8,13 +8,15 @@
* Contributors:
* Christian Trutz - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests;
import static org.mockito.Mockito.when;
import java.io.IOException;
-import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.PullRequestService;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -42,44 +44,38 @@ public class PullRequestServiceTest {
pullRequestService = new PullRequestService(gitHubClient);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void constructor_NullArgument() {
new PullRequestService(null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getPullRequest_NullRepository() throws IOException {
pullRequestService.getPullRequest(null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getPullRequest_NullId() throws IOException {
pullRequestService.getPullRequest(repository, null);
}
- @Test(expected = AssertionFailedException.class)
- public void getPullRequest_NullRepositoryId() throws IOException {
- when(repository.getId()).thenReturn(null);
- pullRequestService.getPullRequest(repository, "test_id");
- }
-
@Test
@Ignore
public void getPullRequest_OK() throws IOException {
// the OK unit test is not possible with Mockito, but with JMockit
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getPullRequests_NullRepository() throws IOException {
pullRequestService.getPullRequests(null, "not null");
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getPullRequests_NullState() throws IOException {
pullRequestService.getPullRequests(repository, null);
}
- @Test(expected = AssertionFailedException.class)
+ @Test(expected = IllegalArgumentException.class)
public void getPullRequests_NullRepositoryId() throws IOException {
when(repository.getId()).thenReturn(null);
pullRequestService.getPullRequests(repository, "test_state");
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/GistTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/GistTest.java
new file mode 100644
index 00000000..5b51fb90
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/GistTest.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core.tests.live;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.GistFile;
+import org.eclipse.egit.github.core.service.GistService;
+
+/**
+ * @author Kevin Sawicki (kevin@github.com)
+ */
+public class GistTest extends LiveTest {
+
+ /**
+ * Test list a user's gists
+ *
+ * @throws IOException
+ */
+ public void testList() throws IOException {
+ GistService service = new GistService(client);
+ Collection<Gist> gists = service.getGists("kevinsawicki");
+ assertNotNull(gists);
+ assertFalse(gists.isEmpty());
+ for (Gist gist : gists) {
+ assertNotNull(gist);
+ assertNotNull(gist.getCreatedAt());
+ assertNotNull(gist.getId());
+ assertNotNull(gist.getFiles());
+ for (GistFile file : gist.getFiles().values()) {
+ assertNotNull(file);
+ }
+ List<Comment> comments = service.getComments(gist.getId());
+ assertNotNull(comments);
+ for (Comment comment : comments) {
+ assertNotNull(comment);
+ assertNotNull(comment.getUrl());
+ assertNotNull(comment.getCreatedAt());
+ assertNotNull(comment.getUpdatedAt());
+ assertNotNull(comment.getUser());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java
new file mode 100644
index 00000000..9061fcec
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core.tests.live;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.egit.github.core.Issue;
+import org.eclipse.egit.github.core.service.IssueService;
+
+/**
+ *
+ */
+public class IssueTest extends LiveTest {
+
+ /**
+ * Test fetching an issue
+ *
+ * @throws IOException
+ */
+ public void testFetch() throws IOException {
+ IssueService service = new IssueService(client);
+ Issue issue = service.getIssue("schacon", "showoff", "1");
+ assertNotNull(issue);
+ assertNotNull(issue.getUpdatedAt());
+ assertNotNull(issue.getCreatedAt());
+ assertTrue(issue.getNumber() > 0);
+ assertNotNull(issue.getBody());
+ assertNotNull(issue.getTitle());
+ assertNotNull(issue.getHtmlUrl());
+ assertTrue(issue.getNumber() >= 0);
+ assertNotNull(issue.getUser());
+ }
+
+ /**
+ * Test fetching multiple issues
+ *
+ * @throws IOException
+ */
+ public void testFetchAll() throws IOException {
+ IssueService service = new IssueService(client);
+ List<Issue> issues = service.getIssues("schacon", "showoff",
+ Collections.singletonMap(IssueService.FILTER_STATE,
+ IssueService.STATE_OPEN));
+ assertFalse(issues.isEmpty());
+ for (Issue issue : issues)
+ assertNotNull(issue);
+ }
+
+}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTest.java
new file mode 100644
index 00000000..93e2493d
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core.tests.live;
+
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HostConfiguration;
+import org.eclipse.egit.github.core.client.GitHubClient;
+
+/**
+ * Base live test class.
+ */
+public abstract class LiveTest extends TestCase {
+
+ /**
+ * Configured client
+ */
+ protected GitHubClient client;
+
+ /**
+ * Configure client
+ *
+ * @param client
+ * @return specified client
+ */
+ protected GitHubClient configure(GitHubClient client) {
+ String user = System.getProperty("github.test.user");
+ String password = System.getProperty("github.test.password");
+ client.setCredentials(user, password);
+ return client;
+ }
+
+ /**
+ * Create client for url
+ *
+ * @param url
+ * @return client
+ * @throws IOException
+ */
+ protected GitHubClient createClient(String url) throws IOException {
+ GitHubClient client = null;
+ if (url != null) {
+ HostConfiguration config = new HostConfiguration();
+ URL parsed = new URL(url);
+ config.setHost(parsed.getHost(), parsed.getPort(),
+ parsed.getProtocol());
+ client = new GitHubClient(config);
+ } else
+ client = new GitHubClient();
+ return configure(client);
+ }
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ String testUrl = System.getProperty("github.test.url");
+ this.client = createClient(testUrl);
+ }
+}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTests.java
index df3b0750..7f753277 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/LiveTests.java
@@ -8,24 +8,18 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.tests.live;
-import java.util.List;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
/**
- * Repository container class.
- *
- * @author Kevin Sawicki (kevin@github.com)
+ * All tests against a live GitHub instance.
*/
-public class RepositoryContainer implements IResourceProvider<Repository> {
-
- private List<Repository> repositories;
-
- /**
- * @see org.eclipse.mylyn.github.internal.IResourceProvider#getResources()
- */
- public List<Repository> getResources() {
- return this.repositories;
- }
+@RunWith(Suite.class)
+@SuiteClasses({ GistTest.class, IssueTest.class, PullRequestTest.class,
+ RepositoryTest.class })
+public class LiveTests {
}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/PullRequestTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/PullRequestTest.java
new file mode 100644
index 00000000..b48ab56a
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/PullRequestTest.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core.tests.live;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.egit.github.core.PullRequest;
+import org.eclipse.egit.github.core.PullRequestDiscussion;
+import org.eclipse.egit.github.core.PullRequestMarker;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.service.PullRequestService;
+
+/**
+ * Live pull request tests
+ */
+public class PullRequestTest extends LiveTest {
+
+ private void checkMarker(PullRequestMarker marker) {
+ assertNotNull(marker);
+ assertNotNull(marker.getLabel());
+ assertNotNull(marker.getSha());
+ assertNotNull(marker.getRef());
+
+ User user = marker.getUser();
+ assertNotNull(user);
+ assertNotNull(user.getName());
+
+ Repository repo = marker.getRepository();
+ assertNotNull(repo);
+ assertNotNull(repo.getOwner());
+ assertNotNull(repo.getName());
+ }
+
+ /**
+ * Test fetching a pull request
+ *
+ * @throws IOException
+ */
+ public void testFetch() throws IOException {
+ PullRequestService service = new PullRequestService(
+ createClient(IGitHubConstants.URL_API_V2));
+ PullRequest request = service.getPullRequest(new Repository(
+ "technoweenie", "faraday"), "15");
+ assertNotNull(request);
+ assertNotNull(request.getHtmlUrl());
+ assertNotNull(request.getDiffUrl());
+ assertNotNull(request.getPatchUrl());
+ checkMarker(request.getHead());
+ checkMarker(request.getBase());
+
+ List<PullRequestDiscussion> discussion = request.getDiscussion();
+ assertNotNull(discussion);
+ assertFalse(discussion.isEmpty());
+ }
+}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/RepositoryTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/RepositoryTest.java
new file mode 100644
index 00000000..808273d2
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/RepositoryTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core.tests.live;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.service.RepositoryService;
+
+/**
+ * Live repository test
+ */
+public class RepositoryTest extends LiveTest {
+
+ /**
+ * Test fetching a repository
+ *
+ * @throws IOException
+ */
+ public void testFetch() throws IOException {
+ RepositoryService service = new RepositoryService(
+ createClient(IGitHubConstants.URL_API_V2));
+ List<Repository> repos = service.getRepositories("defunkt");
+ assertNotNull(repos);
+ assertFalse(repos.isEmpty());
+ for (Repository repo : repos) {
+ assertNotNull(repo);
+ assertNotNull(repo.getName());
+ assertNotNull(repo.getOwner());
+ assertNotNull(repo.getId());
+ assertNotNull(repo.getUrl());
+ assertNotNull(repo.getCreatedAt());
+ assertTrue(repo.getSize() >= 0);
+ assertTrue(repo.getForks() >= 0);
+ assertTrue(repo.getOpenIssues() >= 0);
+ assertTrue(repo.getWatchers() >= 0);
+ }
+ }
+
+}
diff --git a/org.eclipse.egit.github.core/.classpath b/org.eclipse.egit.github.core/.classpath
new file mode 100644
index 00000000..ad32c83a
--- /dev/null
+++ b/org.eclipse.egit.github.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.egit.github.core/.gitignore b/org.eclipse.egit.github.core/.gitignore
new file mode 100644
index 00000000..d567ba01
--- /dev/null
+++ b/org.eclipse.egit.github.core/.gitignore
@@ -0,0 +1,2 @@
+bin
+target
diff --git a/org.eclipse.egit.github.core/.project b/org.eclipse.egit.github.core/.project
new file mode 100644
index 00000000..f139a16d
--- /dev/null
+++ b/org.eclipse.egit.github.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.egit.github.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.egit.github.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.egit.github.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..0d90fbeb
--- /dev/null
+++ b/org.eclipse.egit.github.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed May 11 10:19:26 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.egit.github.core/META-INF/MANIFEST.MF b/org.eclipse.egit.github.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..fda2872b
--- /dev/null
+++ b/org.eclipse.egit.github.core/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.egit.github.core
+Bundle-Version: 0.1.0.qualifier
+Bundle-Vendor: %providerName
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: com.google.gson;version="1.6.0",
+ com.google.gson.annotations;version="1.6.0",
+ com.google.gson.reflect;version="1.6.0",
+ org.apache.commons.httpclient;version="3.1.0",
+ org.apache.commons.httpclient.auth;version="3.1.0",
+ org.apache.commons.httpclient.methods;version="3.1.0",
+ org.apache.commons.httpclient.protocol;version="3.1.0"
+Export-Package: org.eclipse.egit.github.core,
+ org.eclipse.egit.github.core.client,
+ org.eclipse.egit.github.core.service,
+ org.eclipse.egit.github.core.util
diff --git a/org.eclipse.egit.github.core/build.properties b/org.eclipse.egit.github.core/build.properties
new file mode 100644
index 00000000..aa1a0082
--- /dev/null
+++ b/org.eclipse.egit.github.core/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/org.eclipse.egit.github.core/plugin.properties b/org.eclipse.egit.github.core/plugin.properties
new file mode 100644
index 00000000..19877154
--- /dev/null
+++ b/org.eclipse.egit.github.core/plugin.properties
@@ -0,0 +1,2 @@
+pluginName=EGit GitHub API Core (Incubation)
+providerName=Eclipse EGit \ No newline at end of file
diff --git a/org.eclipse.egit.github.core/pom.xml b/org.eclipse.egit.github.core/pom.xml
new file mode 100644
index 00000000..7c2a8462
--- /dev/null
+++ b/org.eclipse.egit.github.core/pom.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Chris Aniszczyk <caniszczyk@gmail.com>
+
+ 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
+-->
+<project
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.eclipse.mylyn.github</groupId>
+ <artifactId>github-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.egit.github.core</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>Eclipse EGit GitHub API Core (Incubation)</name>
+ <version>0.1.0-SNAPSHOT</version>
+</project>
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Assert.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Assert.java
new file mode 100644
index 00000000..52663c0d
--- /dev/null
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Assert.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.github.core;
+
+/**
+ *
+ */
+public abstract class Assert {
+
+ /**
+ * Throw an {@link IllegalArgumentException} if the specified object is
+ * null.
+ *
+ * @param message
+ * @param object
+ * @throws IllegalArgumentException
+ */
+ public static void notNull(String message, Object object)
+ throws IllegalArgumentException {
+ if (object == null)
+ throw new IllegalArgumentException(message);
+ }
+
+ /**
+ * Throw an {@link IllegalArgumentException} if the specified object is
+ * null.
+ *
+ * @param object
+ * @throws IllegalArgumentException
+ */
+ public static void notNull(Object object) throws IllegalArgumentException {
+ notNull("Illegal null argument", object); //$NON-NLS-1$
+ }
+
+ /**
+ * Throw an {@link IllegalArgumentException} if the specified string is
+ * empty. This method does not check if the string is null.
+ * {@link #notNull(Object)} should be used to first assert the string is
+ * non-null if that is a requirement of the argument.
+ *
+ * @param message
+ * @param string
+ * @throws IllegalArgumentException
+ */
+ public static void notEmpty(String message, String string)
+ throws IllegalArgumentException {
+ if (string.length() == 0)
+ throw new IllegalArgumentException(message);
+ }
+
+ /**
+ * Throw an {@link IllegalArgumentException} if the specified string is null
+ * or empty.
+ *
+ * @param string
+ * @throws IllegalArgumentException
+ */
+ public static void notEmpty(String string) throws IllegalArgumentException {
+ notEmpty("Illegal empty string argument", string); //$NON-NLS-1$
+ }
+}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Comment.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Comment.java
index d62e0cd0..3f1d109d 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Comment.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Comment.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/FieldError.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/FieldError.java
index 6e38c775..8440e63b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/FieldError.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/FieldError.java
@@ -8,9 +8,8 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
-import java.text.MessageFormat;
/**
* Field error
@@ -73,25 +72,4 @@ public class FieldError {
return this.value;
}
- /**
- * Format into human-readable error message
- *
- * @return error
- */
- public String format() {
- if (CODE_INVALID.equals(code))
- if (value != null)
- return MessageFormat
- .format(Messages.FieldError_InvalidFieldWithValue,
- value, field);
- else
- return MessageFormat.format(Messages.FieldError_InvalidField,
- field, value);
- else if (CODE_MISSING_FIELD.equals(code))
- return MessageFormat
- .format(Messages.FieldError_MissingField, field);
- else
- return MessageFormat.format(Messages.FieldError_ResourceError,
- field, resource);
- }
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java
index a1c1bfe5..bc2ff35a 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Gist.java
@@ -8,14 +8,14 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
+
+import com.google.gson.annotations.SerializedName;
import java.util.Date;
import java.util.List;
import java.util.Map;
-import com.google.gson.annotations.SerializedName;
-
/**
* GitHub gist class.
*/
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistChangeStatus.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistChangeStatus.java
index f164bcc4..b5f90e5d 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistChangeStatus.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistChangeStatus.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
/**
* Gist change status class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistFile.java
index ade2eae2..2817993b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistFile.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistFile.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
/**
* Gist file class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistRevision.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistRevision.java
index 41e81fec..211cfa68 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistRevision.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/GistRevision.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceCollector.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceCollector.java
index 57028d59..273a884f 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceCollector.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceCollector.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Collection;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceProvider.java
index 37d15b37..c0fa58da 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IResourceProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.List;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Id.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Id.java
index 41a8fb7d..93660068 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Id.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Id.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
/**
* Id class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Issue.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Issue.java
index 0c92c9a2..4e673053 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Issue.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Issue.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
import java.util.List;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Label.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Label.java
index 0be3d1ae..8316dbca 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Label.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Label.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
/**
* GitHub issue label class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/ListResourceCollector.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/ListResourceCollector.java
index 1772f95b..ef81dbc2 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/ListResourceCollector.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/ListResourceCollector.java
@@ -8,12 +8,13 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+
/**
* {@link LinkedList} based resource collector
*
@@ -43,7 +44,7 @@ public class ListResourceCollector<V> implements IResourceCollector<V> {
}
/**
- * @see org.eclipse.mylyn.github.internal.IResourceCollector#accept(int,
+ * @see org.eclipse.egit.github.core.IResourceCollector#accept(int,
* java.util.Collection)
*/
public boolean accept(int page, Collection<V> resources) {
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Milestone.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Milestone.java
index adedd2d4..da243dbd 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Milestone.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Milestone.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java
index 4a048a60..3fa65185 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequest.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
import java.util.List;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestDiscussion.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestDiscussion.java
index 58fc11ce..6581c425 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestDiscussion.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestDiscussion.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.Date;
import java.util.List;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestMarker.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestMarker.java
index cd378fc7..ed7bbff7 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestMarker.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/PullRequestMarker.java
@@ -8,7 +8,8 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
+
/**
* Pull request marker model class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Repository.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java
index 05c520d9..badf1760 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Repository.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/Repository.java
@@ -8,21 +8,72 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import com.google.gson.annotations.SerializedName;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Date;
-import org.eclipse.core.runtime.Assert;
-
/**
* GitHub Repository class.
- *
- * @author Kevin Sawicki (kevin@github.com)
*/
public class Repository {
+ /**
+ * Create repository from url.
+ *
+ * @see Repository#createFromId(String)
+ * @param url
+ * @return repository or null if parsing fails
+ */
+ public static Repository createFromUrl(URL url) {
+ return url != null ? createFromId(url.getPath()) : null;
+ }
+
+ /**
+ * Create repository from id. The id is split on the '/' character and the
+ * last two non-empty segments are interpreted to be the repository owner
+ * and name.
+ *
+ * @param id
+ * @return repository
+ */
+ public static Repository createFromId(String id) {
+ if (id == null)
+ return null;
+ String owner = null;
+ String name = null;
+ String[] segments = id.split("/"); //$NON-NLS-1$
+ for (int i = segments.length - 1; i >= 0; i--)
+ if (segments[i].length() > 0)
+ if (name == null)
+ name = segments[i];
+ else if (owner == null)
+ owner = segments[i];
+ else
+ break;
+
+ return owner != null && name != null ? new Repository(owner, name)
+ : null;
+ }
+
+ /**
+ * Create from string url
+ *
+ * @see Repository#createFromUrl(URL)
+ * @param url
+ * @return repository or null if it could not be parsed from url path
+ */
+ public static Repository createFromUrl(String url) {
+ try {
+ return url != null ? createFromUrl(new URL(url)) : null;
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+
private boolean fork;
private boolean hasDownloads;
private boolean hasIssues;
@@ -52,10 +103,10 @@ public class Repository {
* @param name
*/
public Repository(String owner, String name) {
- Assert.isNotNull(owner, "Owner cannot be null"); //$NON-NLS-1$
- Assert.isLegal(owner.length() > 0, "Owner cannot be empty"); //$NON-NLS-1$
- Assert.isNotNull(name, "Name cannot be null"); //$NON-NLS-1$
- Assert.isLegal(name.length() > 0, "Name cannot be empty"); //$NON-NLS-1$
+ Assert.notNull("Owner cannot be null", owner); //$NON-NLS-1$
+ Assert.notEmpty("Owner cannot be empty", owner); //$NON-NLS-1$
+ Assert.notNull("Name cannot be null", name); //$NON-NLS-1$
+ Assert.notEmpty("Name cannot be empty", name); //$NON-NLS-1$
this.owner = owner;
this.name = name;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RequestError.java
index 4efb7871..b3e342d8 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestError.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/RequestError.java
@@ -8,10 +8,11 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
import java.util.List;
+
/**
* GitHub request error class
*
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/User.java
index b1f3ab22..0397ac11 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/User.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/User.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core;
/**
* GitHub user class.
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/DateFormatter.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/DateFormatter.java
index b3420ad0..f0a2d14e 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/DateFormatter.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/DateFormatter.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
@@ -24,10 +24,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
+
/**
- * Date formatter for date format present in the GitHub v3 API.
- *
- * @author Kevin Sawicki (kevin@github.com)
+ * Formatter for date formats present in the GitHub v2 and v3 API.
*/
public class DateFormatter implements JsonDeserializer<Date> {
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java
index cc35e983..6ceaed08 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubClient.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
@@ -38,7 +38,8 @@ import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.protocol.Protocol;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.RequestError;
/**
* Client class for interacting with GitHub HTTP/JSON API.
@@ -77,7 +78,7 @@ public class GitHubClient {
* @param configuration
*/
public GitHubClient(HostConfiguration configuration) {
- Assert.isNotNull(configuration, "Configuration cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Configuration cannot be null", configuration); //$NON-NLS-1$
this.hostConfig = configuration;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java
index bd62411c..b0196258 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubRequest.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import java.lang.reflect.Type;
import java.util.Map;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubResponse.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java
index e10d39af..43c2a3d2 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubResponse.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubResponse.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import org.apache.commons.httpclient.HttpMethod;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java
index a084d2c7..7b0decef 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IGitHubConstants.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/IGitHubConstants.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
/**
* GitHub constants
@@ -91,6 +91,16 @@ public interface IGitHubConstants {
String PROTOCOL_HTTPS = "https"; //$NON-NLS-1$
/**
+ * URL_API
+ */
+ String URL_API = PROTOCOL_HTTPS + "://" + HOST_API; //$NON-NLS-1$
+
+ /**
+ * URL_API_V2
+ */
+ String URL_API_V2 = PROTOCOL_HTTPS + "://" + HOST_API_V2; //$NON-NLS-1$
+
+ /**
* DATE_FORMAT
*/
String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PageLinks.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java
index 0d5a030a..d08cef8d 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PageLinks.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PageLinks.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpMethod;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PagedRequest.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java
index b61f0e07..1137eab5 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PagedRequest.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/PagedRequest.java
@@ -8,9 +8,10 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.IResourceCollector;
/**
* Pages request class that contains a collector for accept resources page by
@@ -26,9 +27,10 @@ public class PagedRequest<V> extends GitHubRequest {
* Create paged request with non-null collector
*
* @param collector
+ * must be non-null
*/
public PagedRequest(IResourceCollector<V> collector) {
- Assert.isNotNull(collector, "Collecto cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Collector cannot be null", collector); //$NON-NLS-1$
this.collector = collector;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java
index 1386180c..c27844ed 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RequestException.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/RequestException.java
@@ -8,10 +8,11 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.client;
import java.io.IOException;
-import java.util.List;
+
+import org.eclipse.egit.github.core.RequestError;
/**
* Request exception class that wraps an {@link RequestError} object.
@@ -40,19 +41,6 @@ public class RequestException extends IOException {
this.status = status;
}
- @Override
- public String getMessage() {
- StringBuilder message = new StringBuilder(error.getMessage());
- List<FieldError> errors = error.getErrors();
- if (errors != null && errors.size() > 0) {
- message.append(':');
- for (FieldError error : errors)
- message.append(' ').append(error.format()).append(',');
- message.deleteCharAt(message.length() - 1);
- }
- return message.toString();
- }
-
/**
* Get error
*
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java
index 31ade336..047e2e37 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GistService.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import com.google.gson.reflect.TypeToken;
@@ -17,7 +17,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.ListResourceCollector;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.client.PagedRequest;
/**
* Service class for getting and list gists.
@@ -41,7 +49,7 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public Gist getGist(String id) throws IOException {
- Assert.isNotNull(id, "Gist id cannot be null");
+ Assert.notNull("Gist id cannot be null", id); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS);
uri.append('/').append(id);
GitHubRequest request = new GitHubRequest();
@@ -58,7 +66,7 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public List<Gist> getGists(String user) throws IOException {
- Assert.isNotNull(user, "User cannot be null");
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_USERS);
uri.append('/').append(user);
uri.append(IGitHubConstants.SEGMENT_GISTS);
@@ -78,12 +86,12 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public Gist createGist(Gist gist) throws IOException {
- Assert.isNotNull(gist, "Gist cannot be null");
+ Assert.notNull("Gist cannot be null", gist);
StringBuilder uri = new StringBuilder();
User user = gist.getUser();
if (user != null) {
String login = user.getLogin();
- Assert.isNotNull(login, "User login name cannot be null");
+ Assert.notNull("User login name cannot be null", login);
uri.append(IGitHubConstants.SEGMENT_USERS);
uri.append('/').append(login);
}
@@ -99,9 +107,9 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public Gist updateGist(Gist gist) throws IOException {
- Assert.isNotNull(gist, "Gist cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Gist cannot be null", gist); //$NON-NLS-1$
String id = gist.getId();
- Assert.isNotNull(id, "Gist id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Gist id cannot be null", id); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS);
uri.append('/').append(id);
return this.client.post(uri.toString(), gist, Gist.class);
@@ -117,8 +125,8 @@ public class GistService extends GitHubService {
*/
public Comment createComment(String gistId, String comment)
throws IOException {
- Assert.isNotNull(gistId, "Gist id cannot be null");
- Assert.isNotNull(comment, "Gist comment cannot be null");
+ Assert.notNull("Gist id cannot be null", gistId); //$NON-NLS-1$
+ Assert.notNull("Gist comment cannot be null", comment);
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS);
uri.append('/').append(gistId);
uri.append(IGitHubConstants.SEGMENT_COMMENTS);
@@ -136,7 +144,7 @@ public class GistService extends GitHubService {
* @throws IOException
*/
public List<Comment> getComments(String gistId) throws IOException {
- Assert.isNotNull(gistId, "Gist id cannot be null");
+ Assert.notNull("Gist id cannot be null", gistId); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS);
uri.append('/').append(gistId);
uri.append(IGitHubConstants.SEGMENT_COMMENTS);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java
index 5c78aee0..39cab331 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/GitHubService.java
@@ -8,13 +8,18 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.IResourceCollector;
+import org.eclipse.egit.github.core.IResourceProvider;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.client.PagedRequest;
/**
* Base GitHub service class.
@@ -32,7 +37,7 @@ public abstract class GitHubService {
* @param client
*/
public GitHubService(GitHubClient client) {
- Assert.isNotNull(client, "Client cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Client cannot be null", client); //$NON-NLS-1$
this.client = client;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java
index e203eeb7..2844029b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IssueService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import com.google.gson.reflect.TypeToken;
@@ -17,7 +17,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Issue;
+import org.eclipse.egit.github.core.ListResourceCollector;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.client.PagedRequest;
/**
* Issue service class for listing, searching, and fetching {@link Issue}
@@ -93,16 +102,15 @@ public class IssueService extends GitHubService {
*/
public Issue getIssue(String user, String repository, String id)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(id, "Id cannot be null"); //$NON-NLS-1$
- StringBuilder builder = new StringBuilder(
- IGitHubConstants.SEGMENT_REPOS);
- builder.append('/').append(user).append('/').append(repository);
- builder.append(IGitHubConstants.SEGMENT_ISSUES);
- builder.append('/').append(id);
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Id cannot be null", id); //$NON-NLS-1$
+ StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
+ uri.append('/').append(user).append('/').append(repository);
+ uri.append(IGitHubConstants.SEGMENT_ISSUES);
+ uri.append('/').append(id);
GitHubRequest request = new GitHubRequest();
- request.setUri(builder.toString());
+ request.setUri(uri);
request.setType(Issue.class);
return (Issue) client.get(request).getBody();
}
@@ -118,9 +126,9 @@ public class IssueService extends GitHubService {
*/
public List<Comment> getComments(String user, String repository, String id)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(id, "Id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Id cannot be null", id); //$NON-NLS-1$
StringBuilder builder = new StringBuilder(
IGitHubConstants.SEGMENT_REPOS);
builder.append('/').append(user).append('/').append(repository);
@@ -147,15 +155,14 @@ public class IssueService extends GitHubService {
*/
public List<Issue> getIssues(String user, String repository,
Map<String, String> filterData) throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- StringBuilder builder = new StringBuilder(
- IGitHubConstants.SEGMENT_REPOS);
- builder.append('/').append(user).append('/').append(repository);
- builder.append(IGitHubConstants.SEGMENT_ISSUES);
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
+ uri.append('/').append(user).append('/').append(repository);
+ uri.append(IGitHubConstants.SEGMENT_ISSUES);
ListResourceCollector<Issue> collector = new ListResourceCollector<Issue>();
PagedRequest<Issue> request = new PagedRequest<Issue>(collector);
- request.setParams(filterData).setUri(builder.toString());
+ request.setParams(filterData).setUri(uri);
request.setType(new TypeToken<List<Issue>>() {
}.getType());
getAll(request);
@@ -203,8 +210,8 @@ public class IssueService extends GitHubService {
*/
public Issue createIssue(String user, String repository, Issue issue)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_ISSUES);
@@ -224,9 +231,9 @@ public class IssueService extends GitHubService {
*/
public Issue editIssue(String user, String repository, Issue issue)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(issue, "Issue cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Issue cannot be null", issue); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_ISSUES);
@@ -234,9 +241,8 @@ public class IssueService extends GitHubService {
Map<String, String> params = createIssueMap(issue, false);
String state = issue.getState();
- if (state != null) {
+ if (state != null)
params.put(FILTER_STATE, state);
- }
return this.client.post(uri.toString(), params, Issue.class);
}
@@ -252,9 +258,9 @@ public class IssueService extends GitHubService {
*/
public Comment createComment(String user, String repository,
String issueId, String comment) throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(issueId, "Issue id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Issue id cannot be null", issueId); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_ISSUES);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java
index 876afd33..557065da 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/LabelService.java
@@ -8,14 +8,19 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.Label;
+import org.eclipse.egit.github.core.ListResourceCollector;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.client.PagedRequest;
/**
* Label service class for listing {@link Label} objects in use for a given user
@@ -42,8 +47,8 @@ public class LabelService extends GitHubService {
*/
public List<Label> getLabels(String user, String repository)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_LABELS);
@@ -67,9 +72,9 @@ public class LabelService extends GitHubService {
*/
public List<Label> setLabels(String user, String repository,
String issueId, List<Label> labels) throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(issueId, "Issue id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Issue id cannot be null", issueId); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_ISSUES).append('/').append(issueId);
@@ -91,9 +96,9 @@ public class LabelService extends GitHubService {
*/
public Label createLabel(String user, String repository, Label label)
throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(label, "Label cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Label cannot be null", label); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_LABELS);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/MilestoneService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/MilestoneService.java
index c2f1459a..1d239c0e 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/MilestoneService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/MilestoneService.java
@@ -8,7 +8,7 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import com.google.gson.reflect.TypeToken;
@@ -16,7 +16,12 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.ListResourceCollector;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.client.PagedRequest;
/**
* Milestone service class for listing the {@link Milestone} objects in use by a
@@ -45,8 +50,8 @@ public class MilestoneService extends GitHubService {
*/
public List<Milestone> getMilestones(String user, String repository,
String state) throws IOException {
- Assert.isNotNull(user, "User cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
+ Assert.notNull("User cannot be null", user); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_REPOS);
uri.append('/').append(user).append('/').append(repository);
uri.append(IGitHubConstants.SEGMENT_MILESTONES);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java
index 0ada6ccf..a7e59c45 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/PullRequestService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/PullRequestService.java
@@ -8,17 +8,23 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import java.io.IOException;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.egit.github.core.Assert;
+import org.eclipse.egit.github.core.PullRequest;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.client.GitHubResponse;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
/**
- * @author Kevin Sawicki (kevin@github.com)
+ * Service class getting and listing pull requests.
*/
-public class PullRequestService {
+public class PullRequestService extends GitHubService {
/**
* Pull request wrapper
@@ -46,17 +52,11 @@ public class PullRequestService {
}
- private GitHubClient client;
-
/**
- * Create pull request service
- *
* @param client
- * cannot be null
*/
public PullRequestService(GitHubClient client) {
- Assert.isNotNull(client, "Client cannot be null"); //$NON-NLS-1$
- this.client = client;
+ super(client);
}
/**
@@ -69,13 +69,11 @@ public class PullRequestService {
*/
public PullRequest getPullRequest(Repository repository, String id)
throws IOException {
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(id, "Id cannot be null"); //$NON-NLS-1$
- String repositoryId = repository.getId();
- Assert.isNotNull(repositoryId, "Repository id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("Id cannot be null", id); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_V2_API);
uri.append(IGitHubConstants.SEGMENT_PULLS);
- uri.append('/').append(repositoryId);
+ uri.append('/').append(repository.getId());
uri.append('/').append(id);
GitHubRequest request = new GitHubRequest();
request.setUri(uri);
@@ -94,10 +92,10 @@ public class PullRequestService {
*/
public List<PullRequest> getPullRequests(Repository repository, String state)
throws IOException {
- Assert.isNotNull(repository, "Repository cannot be null"); //$NON-NLS-1$
- Assert.isNotNull(state, "State cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Repository cannot be null", repository); //$NON-NLS-1$
+ Assert.notNull("State cannot be null", state); //$NON-NLS-1$
String repositoryId = repository.getId();
- Assert.isNotNull(repositoryId, "Repository id cannot be null"); //$NON-NLS-1$
+ Assert.notNull("Repository id cannot be null", repositoryId); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_V2_API);
uri.append(IGitHubConstants.SEGMENT_PULLS);
uri.append('/').append(repositoryId);
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
index 29df41e1..94cb74db 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java
@@ -8,11 +8,18 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.service;
import java.io.IOException;
import java.util.List;
+import org.eclipse.egit.github.core.IResourceProvider;
+import org.eclipse.egit.github.core.ListResourceCollector;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.client.PagedRequest;
+
/**
* Repository service class.
*
@@ -20,6 +27,20 @@ import java.util.List;
*/
public class RepositoryService extends GitHubService {
+ private static class RepositoryContainer implements
+ IResourceProvider<Repository> {
+
+ private List<Repository> repositories;
+
+ /**
+ * @see org.eclipse.egit.github.core.IResourceProvider#getResources()
+ */
+ public List<Repository> getResources() {
+ return this.repositories;
+ }
+
+ }
+
/**
* Create repository service
*
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelComparator.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java
index 39b7b52c..535e1662 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/LabelComparator.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/util/LabelComparator.java
@@ -8,11 +8,14 @@
* Contributors:
* Kevin Sawicki (GitHub Inc.) - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylyn.github.internal;
+package org.eclipse.egit.github.core.util;
import java.io.Serializable;
import java.util.Comparator;
+import org.eclipse.egit.github.core.Label;
+
+
/**
* Label comparator using case-insensitive name comparisons.
*/
diff --git a/org.eclipse.mylyn.github-feature/feature.xml b/org.eclipse.mylyn.github-feature/feature.xml
index 091b2940..b45aefa6 100644
--- a/org.eclipse.mylyn.github-feature/feature.xml
+++ b/org.eclipse.mylyn.github-feature/feature.xml
@@ -43,4 +43,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.egit.github.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF
index c5dcb0f0..1721cbc7 100644
--- a/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.github.core/META-INF/MANIFEST.MF
@@ -10,7 +10,5 @@ Export-Package: org.eclipse.mylyn.github.internal;x-friends:="org.eclipse.mylyn.
org.eclipse.mylyn.internal.github.core.gist;x-friends:="org.eclipse.mylyn.github.ui"
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0",
org.eclipse.mylyn.tasks.core;bundle-version="3.2.0",
- org.eclipse.mylyn.commons.net;bundle-version="3.2.0"
-Import-Package: com.google.gson;version="1.6.0",
- com.google.gson.annotations;version="1.6.0",
- com.google.gson.reflect;version="1.6.0"
+ org.eclipse.mylyn.commons.net;bundle-version="3.2.0",
+ org.eclipse.egit.github.core;bundle-version="0.1.0"
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHub.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHub.java
index ac4b84a6..cf2e1330 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHub.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHub.java
@@ -12,13 +12,13 @@
*******************************************************************************/
package org.eclipse.mylyn.github.internal;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.github.core.Repository;
/**
* GitHub class
@@ -132,9 +132,7 @@ public class GitHub {
* @return repository or null if not present in url
*/
public static Repository getRepository(String repositoryUrl) {
- Matcher matcher = URL_PATTERN.matcher(repositoryUrl);
- return matcher.matches() ? new Repository(matcher.group(1),
- matcher.group(2)) : null;
+ return Repository.createFromUrl(repositoryUrl);
}
/**
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubException.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubException.java
new file mode 100644
index 00000000..6ff1a908
--- /dev/null
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubException.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * 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:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.github.internal;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.eclipse.egit.github.core.FieldError;
+import org.eclipse.egit.github.core.RequestError;
+import org.eclipse.egit.github.core.client.RequestException;
+
+/**
+ * GitHub exception that wraps and formats a {@link RequestException}
+ */
+public class GitHubException extends IOException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1456910662911777231L;
+
+ /**
+ * Create GitHub exception from {@link RequestException}
+ *
+ * @param cause
+ */
+ public GitHubException(RequestException cause) {
+ super(cause);
+ }
+
+ public String getMessage() {
+ RequestError error = ((RequestException) getCause()).getError();
+ StringBuilder message = new StringBuilder(error.getMessage());
+ List<FieldError> errors = error.getErrors();
+ if (errors != null && errors.size() > 0) {
+ message.append(':');
+ for (FieldError fieldError : errors)
+ message.append(' ').append(format(fieldError)).append(',');
+ message.deleteCharAt(message.length() - 1);
+ }
+ return message.toString();
+ }
+
+ private String format(FieldError error) {
+ String code = error.getCode();
+ String value = error.getValue();
+ String field = error.getField();
+ String resource = error.getResource();
+ if (FieldError.CODE_INVALID.equals(code))
+ if (value != null)
+ return MessageFormat
+ .format(Messages.FieldError_InvalidFieldWithValue,
+ value, field);
+ else
+ return MessageFormat.format(Messages.FieldError_InvalidField,
+ field, value);
+ else if (FieldError.CODE_MISSING_FIELD.equals(code))
+ return MessageFormat
+ .format(Messages.FieldError_MissingField, field);
+ else
+ return MessageFormat.format(Messages.FieldError_ResourceError,
+ field, resource);
+ }
+
+}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
index 2757f1a0..24f688b5 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
@@ -27,6 +27,17 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Issue;
+import org.eclipse.egit.github.core.Label;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.RequestException;
+import org.eclipse.egit.github.core.service.IssueService;
+import org.eclipse.egit.github.core.service.LabelService;
+import org.eclipse.egit.github.core.service.MilestoneService;
+import org.eclipse.egit.github.core.util.LabelComparator;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.Policy;
@@ -291,6 +302,8 @@ public class GitHubRepositoryConnector extends AbstractRepositoryConnector {
}
result = Status.OK_STATUS;
+ } catch (RequestException e) {
+ result = GitHub.createErrorStatus(new GitHubException(e));
} catch (IOException e) {
result = GitHub.createErrorStatus(e);
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
index 4cd1d26a..f65b9239 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
@@ -20,6 +20,16 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Issue;
+import org.eclipse.egit.github.core.Label;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.RequestException;
+import org.eclipse.egit.github.core.service.IssueService;
+import org.eclipse.egit.github.core.service.LabelService;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
@@ -426,6 +436,9 @@ public class GitHubTaskDataHandler extends AbstractTaskDataHandler {
return new RepositoryResponse(
taskData.isNew() ? ResponseKind.TASK_CREATED
: ResponseKind.TASK_UPDATED, taskId);
+ } catch (RequestException e) {
+ throw new CoreException(
+ GitHub.createErrorStatus(new GitHubException(e)));
} catch (IOException e) {
throw new CoreException(GitHub.createErrorStatus(e));
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java
index 9f5bdc84..172c9332 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java
@@ -17,14 +17,14 @@ import java.util.Collections;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.GistFile;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.GitHubRequest;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.github.internal.Gist;
-import org.eclipse.mylyn.github.internal.GistFile;
-import org.eclipse.mylyn.github.internal.GistService;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.GitHubClient;
-import org.eclipse.mylyn.github.internal.GitHubRequest;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
index fa7b74a8..fe3760bc 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistConnector.java
@@ -17,12 +17,12 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.github.internal.Gist;
-import org.eclipse.mylyn.github.internal.GistService;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.GitHubClient;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
index b1d7cd19..a09539e9 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistTaskDataHandler.java
@@ -19,16 +19,16 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.github.core.Comment;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.GistFile;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.github.internal.Comment;
-import org.eclipse.mylyn.github.internal.Gist;
-import org.eclipse.mylyn.github.internal.GistFile;
-import org.eclipse.mylyn.github.internal.GistService;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.GitHubClient;
import org.eclipse.mylyn.github.internal.GitHubTaskAttributeMapper;
-import org.eclipse.mylyn.github.internal.User;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
diff --git a/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
index 8d67c594..fb05b133 100644
--- a/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.github.tests/META-INF/MANIFEST.MF
@@ -8,17 +8,12 @@ Require-Bundle: org.eclipse.mylyn.github.core;bundle-version="0.1.0",
org.eclipse.mylyn.github.ui;bundle-version="0.1.0",
org.eclipse.jface.text;bundle-version="3.5.0",
org.eclipse.mylyn.tasks.ui;bundle-version="3.2.0",
- org.eclipse.equinox.security;bundle-version="1.0.100",
org.eclipse.mylyn.tasks.core,
org.eclipse.core.runtime;bundle-version="3.5.0",
org.junit;bundle-version="4.8.1",
org.hamcrest;bundle-version="1.1.0",
org.objenesis;bundle-version="1.0.0"
Bundle-Vendor: Eclipse EGit
-Import-Package: com.google.gson;version="1.6.0",
- com.google.gson.reflect;version="1.6.0",
- org.apache.commons.httpclient;version="3.1.0",
- org.apache.commons.logging;version="1.0.4",
- org.mockito;version="1.8.4",
+Import-Package: org.mockito;version="1.8.4",
org.mockito.runners;version="1.8.4",
org.mockito.stubbing;version="1.8.4"
diff --git a/org.eclipse.mylyn.github.tests/pom.xml b/org.eclipse.mylyn.github.tests/pom.xml
index 8cddc404..5ec7cfb5 100644
--- a/org.eclipse.mylyn.github.tests/pom.xml
+++ b/org.eclipse.mylyn.github.tests/pom.xml
@@ -24,23 +24,4 @@
<name>Eclipse EGit Mylyn GitHub Test Plug-in (Incubation)</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.sonatype.tycho</groupId>
- <artifactId>maven-osgi-test-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <excludes>
- <!-- test mojo matches TestProject be default and treats it as PojoTest -->
- <exclude>**/Test*.class</exclude>
- </excludes>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <testSuite>org.eclipse.mylyn.github.tests</testSuite>
- <testClass>org.eclipse.mylyn.github.tests.AllHeadlessTests</testClass>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
index 8e5b9e8d..f6433a99 100644
--- a/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.github.ui/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0",
org.eclipse.egit.core;bundle-version="0.12.0",
org.eclipse.jgit;bundle-version="0.12.0",
org.eclipse.egit.ui;bundle-version="0.12.0",
- org.eclipse.core.expressions;bundle-version="3.4.0"
+ org.eclipse.core.expressions;bundle-version="3.4.0",
+ org.eclipse.egit.github.core;bundle-version="0.1.0"
Export-Package: org.eclipse.mylyn.github.ui.internal;x-internal:=true
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.egit.ui.internal;version="0.12.0"
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
index e4371b45..e6b1df26 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistHandler.java
@@ -20,13 +20,13 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.github.internal.GistService;
-import org.eclipse.mylyn.github.internal.GitHubClient;
import org.eclipse.mylyn.internal.github.core.gist.GistConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
index db87251d..4797d0bc 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/CreateGistJob.java
@@ -15,14 +15,12 @@ import java.util.Collections;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.github.internal.Gist;
-import org.eclipse.mylyn.github.internal.GistFile;
-import org.eclipse.mylyn.github.internal.GistService;
-import org.eclipse.mylyn.github.internal.User;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.egit.github.core.Gist;
+import org.eclipse.egit.github.core.GistFile;
+import org.eclipse.egit.github.core.User;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.ui.PlatformUI;
public class CreateGistJob extends Job {
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GistNotificationPopup.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GistNotificationPopup.java
index 71adb7f6..deefcf7a 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GistNotificationPopup.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GistNotificationPopup.java
@@ -12,7 +12,7 @@ package org.eclipse.mylyn.github.ui.internal;
import java.util.Set;
-import org.eclipse.mylyn.github.internal.Gist;
+import org.eclipse.egit.github.core.Gist;
import org.eclipse.mylyn.internal.github.core.gist.GistConnector;
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotificationPopup;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -24,7 +24,6 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryConnectorUI.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryConnectorUI.java
index f536654d..c82ffdee 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryConnectorUI.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryConnectorUI.java
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.egit.github.core.Repository;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.hyperlink.URLHyperlink;
@@ -24,7 +25,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.github.internal.GitHub;
import org.eclipse.mylyn.github.internal.GitHubRepositoryConnector;
-import org.eclipse.mylyn.github.internal.Repository;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryQueryPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryQueryPage.java
index 1a2d9410..ba421dfa 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryQueryPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositoryQueryPage.java
@@ -21,6 +21,9 @@ import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.service.IssueService;
+import org.eclipse.egit.github.core.util.LabelComparator;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -32,9 +35,6 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.mylyn.commons.net.Policy;
import org.eclipse.mylyn.github.internal.GitHubRepositoryConnector;
-import org.eclipse.mylyn.github.internal.IssueService;
-import org.eclipse.mylyn.github.internal.LabelComparator;
-import org.eclipse.mylyn.github.internal.Milestone;
import org.eclipse.mylyn.github.internal.QueryUtils;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
@@ -282,11 +282,11 @@ public class GitHubRepositoryQueryPage extends AbstractRepositoryQueryPage {
TaskRepository repository = getTaskRepository();
boolean hasLabels = connector.hasCachedLabels(repository);
if (hasLabels) {
- List<org.eclipse.mylyn.github.internal.Label> labels = connector
+ List<org.eclipse.egit.github.core.Label> labels = connector
.getLabels(repository);
Collections.sort(labels, new LabelComparator());
List<String> labelNames = new ArrayList<String>(labels.size());
- for (org.eclipse.mylyn.github.internal.Label label : labels)
+ for (org.eclipse.egit.github.core.Label label : labels)
labelNames.add(label.getName());
this.labelsViewer.setInput(labelNames);
}
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
index 77749bc7..84550f68 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubRepositorySettingsPage.java
@@ -20,13 +20,13 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.IssueService;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.GitHubClient;
-import org.eclipse.mylyn.github.internal.IssueService;
-import org.eclipse.mylyn.github.internal.Repository;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/ImportRepositoriesWizard.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/ImportRepositoriesWizard.java
index bae092b5..660f43fd 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/ImportRepositoriesWizard.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/ImportRepositoriesWizard.java
@@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.mylyn.github.ui.internal;
+import org.eclipse.egit.github.core.Repository;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.Repository;
import org.eclipse.mylyn.internal.github.core.gist.GistConnector;
import org.eclipse.mylyn.internal.github.ui.gist.GistRepositorySettingsPage;
import org.eclipse.mylyn.internal.github.ui.gist.Messages;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/RepositorySelectionWizardPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/RepositorySelectionWizardPage.java
index b67870f7..2c8293b8 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/RepositorySelectionWizardPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/RepositorySelectionWizardPage.java
@@ -19,6 +19,10 @@ import java.util.List;
import org.apache.commons.httpclient.HostConfiguration;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.client.IGitHubConstants;
+import org.eclipse.egit.github.core.service.RepositoryService;
import org.eclipse.egit.ui.internal.FilteredCheckboxTree;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -30,10 +34,6 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.github.internal.GitHub;
-import org.eclipse.mylyn.github.internal.GitHubClient;
-import org.eclipse.mylyn.github.internal.IGitHubConstants;
-import org.eclipse.mylyn.github.internal.Repository;
-import org.eclipse.mylyn.github.internal.RepositoryService;
import org.eclipse.mylyn.internal.github.core.gist.GistConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositorySettingsPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositorySettingsPage.java
index 9e8d795f..af467e22 100644
--- a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/gist/GistRepositorySettingsPage.java
@@ -18,10 +18,10 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.egit.github.core.client.GitHubClient;
+import org.eclipse.egit.github.core.service.GistService;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.github.internal.GistService;
-import org.eclipse.mylyn.github.internal.GitHubClient;
import org.eclipse.mylyn.github.ui.internal.GitHubUi;
import org.eclipse.mylyn.internal.github.core.gist.GistConnector;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
diff --git a/pom.xml b/pom.xml
index 608f9297..7ad3f689 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,10 +49,12 @@
</properties>
<modules>
+ <module>org.eclipse.egit.github.core</module>
<module>org.eclipse.mylyn.github.core</module>
<module>org.eclipse.mylyn.github.ui</module>
<module>org.eclipse.mylyn.github-feature</module>
- <module>org.eclipse.mylyn.github.tests</module>
+ <module>org.eclipse.egit.github.core.tests</module>
+ <!--module>org.eclipse.mylyn.github.tests</module -->
<module>org.eclipse.mylyn.github-site</module>
<module>org.eclipse.mylyn.github.doc</module>
</modules>

Back to the top