Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-04-05 20:05:57 -0400
committerKevin Sawicki2012-04-05 20:05:57 -0400
commit01c1c97687a59883c98932e239997ca614e26545 (patch)
tree3ffce797697adb82fcecf12185c2edfef87806fd
parent6bcc10b1dd2c86626b242e286596ec9424d7f8f1 (diff)
downloadegit-github-01c1c97687a59883c98932e239997ca614e26545.tar.gz
egit-github-01c1c97687a59883c98932e239997ca614e26545.tar.xz
egit-github-01c1c97687a59883c98932e239997ca614e26545.zip
Add support for PullRequestReviewCommentEvent type
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/EventPayloadTest.java25
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestReviewCommentPayloadTest.java43
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java4
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java5
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/PullRequestReviewCommentPayload.java42
5 files changed, 112 insertions, 7 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/EventPayloadTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/EventPayloadTest.java
index 811b0ad7..09eb9149 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/EventPayloadTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/EventPayloadTest.java
@@ -18,12 +18,23 @@ import org.junit.runners.Suite.SuiteClasses;
* Tests for all subclasses of EventPayload
*/
@RunWith(Suite.class)
-@SuiteClasses({ CommitCommentPayloadTest.class, CreatePayloadTest.class,
- DeletePayloadTest.class, DownloadPayloadTest.class, FollowPayloadTest.class,
- ForkApplyPayloadTest.class, ForkPayloadTest.class, GistPayloadTest.class,
- GollumPayloadTest.class, IssueCommentPayloadTest.class, IssuesPayloadTest.class,
- MemberPayloadTest.class, PullRequestPayloadTest.class, PushPayloadTest.class,
- TeamAddPayloadTest.class, WatchPayloadTest.class })
+@SuiteClasses({ CommitCommentPayloadTest.class, //
+ CreatePayloadTest.class, //
+ DeletePayloadTest.class, //
+ DownloadPayloadTest.class, //
+ FollowPayloadTest.class, //
+ ForkApplyPayloadTest.class, //
+ ForkPayloadTest.class, //
+ GistPayloadTest.class, //
+ GollumPayloadTest.class, //
+ IssueCommentPayloadTest.class, //
+ IssuesPayloadTest.class, //
+ MemberPayloadTest.class, //
+ PullRequestPayloadTest.class, //
+ PullRequestReviewCommentPayloadTest.class, //
+ PushPayloadTest.class, //
+ TeamAddPayloadTest.class, //
+ WatchPayloadTest.class })
public class EventPayloadTest {
- //EventPayload is an empty class, no tests to run.
+ // EventPayload is an empty class, no tests to run.
}
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestReviewCommentPayloadTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestReviewCommentPayloadTest.java
new file mode 100644
index 00000000..1ccd514a
--- /dev/null
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/PullRequestReviewCommentPayloadTest.java
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * Copyright (c) 2012 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.egit.github.core.CommitComment;
+import org.eclipse.egit.github.core.event.PullRequestReviewCommentPayload;
+import org.junit.Test;
+
+/**
+ * Unit tests of {@link PullRequestReviewCommentPayload}
+ */
+public class PullRequestReviewCommentPayloadTest {
+
+ /**
+ * Test default state of {@link PullRequestReviewCommentPayload}
+ */
+ @Test
+ public void defaultState() {
+ PullRequestReviewCommentPayload payload = new PullRequestReviewCommentPayload();
+ assertNull(payload.getComment());
+ }
+
+ /**
+ * Test updating {@link PullRequestReviewCommentPayload} fields
+ */
+ @Test
+ public void updateFields() {
+ PullRequestReviewCommentPayload payload = new PullRequestReviewCommentPayload();
+ CommitComment comment = new CommitComment();
+ assertEquals(comment, payload.setComment(comment).getComment());
+ }
+}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
index 94b12a0e..daad25d5 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/EventFormatter.java
@@ -24,6 +24,7 @@ import static org.eclipse.egit.github.core.event.Event.TYPE_ISSUE_COMMENT;
import static org.eclipse.egit.github.core.event.Event.TYPE_MEMBER;
import static org.eclipse.egit.github.core.event.Event.TYPE_PUBLIC;
import static org.eclipse.egit.github.core.event.Event.TYPE_PULL_REQUEST;
+import static org.eclipse.egit.github.core.event.Event.TYPE_PULL_REQUEST_REVIEW_COMMENT;
import static org.eclipse.egit.github.core.event.Event.TYPE_PUSH;
import static org.eclipse.egit.github.core.event.Event.TYPE_TEAM_ADD;
import static org.eclipse.egit.github.core.event.Event.TYPE_WATCH;
@@ -52,6 +53,7 @@ import org.eclipse.egit.github.core.event.IssuesPayload;
import org.eclipse.egit.github.core.event.MemberPayload;
import org.eclipse.egit.github.core.event.PublicPayload;
import org.eclipse.egit.github.core.event.PullRequestPayload;
+import org.eclipse.egit.github.core.event.PullRequestReviewCommentPayload;
import org.eclipse.egit.github.core.event.PushPayload;
import org.eclipse.egit.github.core.event.TeamAddPayload;
import org.eclipse.egit.github.core.event.WatchPayload;
@@ -96,6 +98,8 @@ public class EventFormatter {
clazz = PublicPayload.class;
else if (TYPE_PULL_REQUEST.equals(type))
clazz = PullRequestPayload.class;
+ else if (TYPE_PULL_REQUEST_REVIEW_COMMENT.equals(type))
+ clazz = PullRequestReviewCommentPayload.class;
else if (TYPE_PUSH.equals(type))
clazz = PushPayload.class;
else if (TYPE_TEAM_ADD.equals(type))
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java
index 1b24a12d..4883e909 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/Event.java
@@ -94,6 +94,11 @@ public class Event implements Serializable {
public static final String TYPE_PULL_REQUEST = "PullRequestEvent";
/**
+ * Event type denoting a {@link PullRequestReviewCommentPayload}
+ */
+ public static final String TYPE_PULL_REQUEST_REVIEW_COMMENT = "PullRequestReviewCommentEvent";
+
+ /**
* Event type denoting a {@link PushPayload}
*/
public static final String TYPE_PUSH = "PushEvent";
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/PullRequestReviewCommentPayload.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/PullRequestReviewCommentPayload.java
new file mode 100644
index 00000000..04f6d8a0
--- /dev/null
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/event/PullRequestReviewCommentPayload.java
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * Copyright (c) 2012 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.event;
+
+import java.io.Serializable;
+
+import org.eclipse.egit.github.core.CommitComment;
+
+/**
+ * Payload for an event with type {@link Event#TYPE_PULL_REQUEST_REVIEW_COMMENT}
+ */
+public class PullRequestReviewCommentPayload extends EventPayload implements
+ Serializable {
+
+ private static final long serialVersionUID = -2403658752886394741L;
+
+ private CommitComment comment;
+
+ /**
+ * @return comment
+ */
+ public CommitComment getComment() {
+ return comment;
+ }
+
+ /**
+ * @param comment
+ * @return this payload
+ */
+ public PullRequestReviewCommentPayload setComment(CommitComment comment) {
+ this.comment = comment;
+ return this;
+ }
+}

Back to the top