Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerwinvaneyk2014-11-01 09:23:54 -0400
committerMatthias Sohn2015-03-04 18:10:31 -0500
commiteb83c17e47247e19c41aaba497f4c91d6e2a96c5 (patch)
tree0028d982ff3335d70c33b4fec3ded79712459fd9
parentd379923cbc1effe0f1b5ebdd2f51d7aad866d5be (diff)
downloadegit-github-eb83c17e47247e19c41aaba497f4c91d6e2a96c5.tar.gz
egit-github-eb83c17e47247e19c41aaba497f4c91d6e2a96c5.tar.xz
egit-github-eb83c17e47247e19c41aaba497f4c91d6e2a96c5.zip
Add context support in CommitService.createStatus()
- Relevant page in the API: https://developer.github.com/v3/repos/statuses/ - Added tests for context-field of CommitStatus Change-Id: Ia8520191115469017d38597676e960303a6c31c3 Signed-off-by: erwinvaneyk <erwinvaneyk@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitServiceTest.java15
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java2
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java4
3 files changed, 15 insertions, 6 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitServiceTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitServiceTest.java
index bcb01855..1f4adb5d 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitServiceTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitServiceTest.java
@@ -385,12 +385,14 @@ public class CommitServiceTest {
CommitStatus status = new CommitStatus();
status.setDescription("description");
status.setTargetUrl("http://target/url");
- status.setState("success");
+ status.setState(CommitStatus.STATE_SUCCESS);
+ status.setContext("context");
service.createStatus(repo, "123", status);
Map<String, String> params = new HashMap<String, String>();
params.put("description", status.getDescription());
params.put("target_url", status.getTargetUrl());
params.put("state", status.getState());
+ params.put("context", status.getContext());
verify(client).post("/repos/o/n/statuses/123", params,
CommitStatus.class);
}
@@ -405,7 +407,8 @@ public class CommitServiceTest {
CommitStatus status = new CommitStatus();
status.setDescription("description");
status.setTargetUrl("http://target/url");
- status.setState("success");
+ status.setState(CommitStatus.STATE_SUCCESS);
+ status.setContext("context");
service.createStatus(null, "123", status);
}
@@ -419,7 +422,8 @@ public class CommitServiceTest {
CommitStatus status = new CommitStatus();
status.setDescription("description");
status.setTargetUrl("http://target/url");
- status.setState("success");
+ status.setState(CommitStatus.STATE_SUCCESS);
+ status.setContext("context");
service.createStatus(new RepositoryId("o", "n"), null, status);
}
@@ -433,7 +437,8 @@ public class CommitServiceTest {
CommitStatus status = new CommitStatus();
status.setDescription("description");
status.setTargetUrl("http://target/url");
- status.setState("success");
+ status.setState(CommitStatus.STATE_SUCCESS);
+ status.setContext("context");
service.createStatus(new RepositoryId("o", "n"), "", status);
}
@@ -446,4 +451,4 @@ public class CommitServiceTest {
public void createStatusNullStatus() throws IOException {
service.createStatus(new RepositoryId("o", "n"), "123", null);
}
-}
+} \ No newline at end of file
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
index bdd85220..9b12b23a 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/CommitStatusTest.java
@@ -39,6 +39,7 @@ public class CommitStatusTest {
assertNull(status.getTargetUrl());
assertNull(status.getUpdatedAt());
assertNull(status.getUrl());
+ assertNull(status.getContext());
}
/**
@@ -60,5 +61,6 @@ public class CommitStatusTest {
assertEquals(new Date(5678), status.setUpdatedAt(new Date(5678))
.getUpdatedAt());
assertEquals("url", status.setUrl("url").getUrl());
+ assertEquals("context", status.setContext("context").getContext());
}
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
index 7e39d5c3..75fb5ec8 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/CommitService.java
@@ -417,6 +417,8 @@ public class CommitService extends GitHubService {
params.put("target_url", status.getTargetUrl());
if (status.getDescription() != null)
params.put("description", status.getDescription());
+ if (status.getContext() != null)
+ params.put("context", status.getContext());
StringBuilder uri = new StringBuilder(SEGMENT_REPOS);
uri.append('/').append(id);
@@ -482,4 +484,4 @@ public class CommitService extends GitHubService {
}.getType());
return createPageIterator(request);
}
-}
+} \ No newline at end of file

Back to the top