aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-27 15:15:55 (EDT)
committerKevin Sawicki2011-04-27 15:15:55 (EDT)
commita4642193cb73b4c89f51640087033b124e67d725 (patch)
tree0e687bd89e1955dced4f8d3afff01ce5b3f74836
parentf1928ad3d1cfdbb83bc4e30a11488a1b3d1bf7c5 (diff)
downloadegit-github-a4642193cb73b4c89f51640087033b124e67d725.zip
egit-github-a4642193cb73b4c89f51640087033b124e67d725.tar.gz
egit-github-a4642193cb73b4c89f51640087033b124e67d725.tar.bz2
Remove use of gist repo field.refs/changes/65/3265/2
It was a duplicate of the id field and is being dropped from the API. Change-Id: I0c3f12e2f95939ed256153c4f1d80b7db9ed77df Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java15
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java8
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttachmentHandler.java2
-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.java8
-rw-r--r--org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java8
6 files changed, 19 insertions, 28 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
index 8cabb81..e84e7a4 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/Gist.java
@@ -42,8 +42,6 @@ public class Gist {
private String id;
- private String repo;
-
private String url;
private User user;
@@ -146,18 +144,11 @@ public class Gist {
}
/**
- * @return repo
- */
- public String getRepo() {
- return this.repo;
- }
-
- /**
- * @param repo
+ * @param id
* @return this gist
*/
- public Gist setRepo(String repo) {
- this.repo = repo;
+ public Gist setId(String id) {
+ this.id = id;
return this;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
index 7b301b4..9ed8c69 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
@@ -98,11 +98,11 @@ public class GistService {
* @throws IOException
*/
public Gist updateGist(Gist gist) throws IOException {
- Assert.isNotNull(gist, "Gist cannot be null");
- String repo = gist.getRepo();
- Assert.isNotNull(repo, "Repository cannot be null");
+ Assert.isNotNull(gist, "Gist cannot be null"); //$NON-NLS-1$
+ String id = gist.getId();
+ Assert.isNotNull(id, "Gist id cannot be null"); //$NON-NLS-1$
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS);
- uri.append('/').append(repo).append(IGitHubConstants.SUFFIX_JSON);
+ uri.append('/').append(id).append(IGitHubConstants.SUFFIX_JSON);
return this.client.put(uri.toString(), gist, Gist.class);
}
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 03bc94c..15bb525 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
@@ -90,7 +90,7 @@ public class GistAttachmentHandler extends AbstractTaskAttachmentHandler {
throws CoreException {
TaskAttachmentMapper mapper = TaskAttachmentMapper
.createFrom(attachmentAttribute);
- Gist gist = new Gist().setRepo(task.getTaskId());
+ Gist gist = new Gist().setId(task.getTaskId());
gist.setDescription(attachmentAttribute.getParentAttribute()
.getAttribute(GistAttribute.DESCRIPTION.getId()).getValue());
GistFile file = new GistFile();
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 29498d2..93e10fd 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
@@ -126,12 +126,12 @@ public class GistConnector extends AbstractRepositoryConnector {
.getAttributeMapper(repository);
Gist gist = service.getGist(taskId);
TaskData data = new TaskData(mapper, getConnectorKind(),
- repository.getUrl(), gist.getRepo());
+ repository.getUrl(), gist.getId());
data.setPartial(false);
this.dataHandler.fillTaskData(repository, data, gist);
if (gist.getComments() > 0)
this.dataHandler.fillComments(repository, data,
- service.getComments(gist.getRepo()));
+ service.getComments(gist.getId()));
return data;
} catch (IOException e) {
@@ -184,7 +184,7 @@ public class GistConnector extends AbstractRepositoryConnector {
.getAttributeMapper(repository);
for (Gist gist : service.getGists(user)) {
TaskData data = new TaskData(mapper, getConnectorKind(),
- repository.getUrl(), gist.getRepo());
+ repository.getUrl(), gist.getId());
data.setPartial(true);
this.dataHandler.fillTaskData(repository, data, gist);
collector.accept(data);
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 bbf7197..420e7d9 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
@@ -91,7 +91,7 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
* @return url
*/
public String getGistUrl(String repositoryUrl, Gist gist) {
- return repositoryUrl + '/' + gist.getRepo();
+ return repositoryUrl + '/' + gist.getId();
}
/**
@@ -107,7 +107,7 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
TaskAttributeMapper mapper = data.getAttributeMapper();
TaskAttribute key = GistAttribute.KEY.create(data);
- mapper.setValue(key, gist.getRepo());
+ mapper.setValue(key, gist.getId());
TaskAttribute description = GistAttribute.DESCRIPTION.create(data);
String gistDescription = gist.getDescription();
@@ -220,7 +220,7 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
GistService service = new GistService(client);
TaskAttribute root = taskData.getRoot();
- gist.setRepo(taskData.getTaskId());
+ gist.setId(taskData.getTaskId());
gist.setDescription(root
.getAttribute(GistAttribute.DESCRIPTION.getId()).getValue());
@@ -231,7 +231,7 @@ public class GistTaskDataHandler extends AbstractTaskDataHandler {
throw new CoreException(GitHub.createErrorStatus(e));
}
response = new RepositoryResponse(ResponseKind.TASK_CREATED,
- gist.getRepo());
+ gist.getId());
} else {
try {
String newComment = root.getAttribute(
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java
index 0d95bae..e751ab5 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java
+++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistServiceTest.java
@@ -112,18 +112,18 @@ public class GistServiceTest {
}
@Test(expected = AssertionFailedException.class)
- public void updateGist_NullRepository() throws IOException {
+ public void updateGist_NullId() throws IOException {
Gist gist = new Gist();
- gist.setRepo(null);
+ gist.setId(null);
gistService.updateGist(gist);
}
@Test
public void updateGist_OK() throws IOException {
Gist gist = new Gist();
- gist.setRepo("test_repository");
+ gist.setId("123");
gistService.updateGist(gist);
- verify(gitHubClient).put("/gists/test_repository.json", gist,
+ verify(gitHubClient).put("/gists/123.json", gist,
Gist.class);
}