Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Ander Peñalba2015-03-05 04:51:14 -0500
committerJon Ander Peñalba2015-03-10 19:39:35 -0400
commit25724ff0dfa9ff7adec2c4b428c9e2809b881f6d (patch)
tree4df7653db046e8c232cfb1d2570f0b7fbeff3f78
parent76dc8a6ef060de819a3e3c99d535fdca2a8785d9 (diff)
downloadegit-github-25724ff0dfa9ff7adec2c4b428c9e2809b881f6d.tar.gz
egit-github-25724ff0dfa9ff7adec2c4b428c9e2809b881f6d.tar.xz
egit-github-25724ff0dfa9ff7adec2c4b428c9e2809b881f6d.zip
Improve the IssueEvent class adding more fields
Relevant GitHub API docs: https://developer.github.com/v3/issues/events/ Change-Id: I5f4e64558ca3eb010bdd01680c0056676c0f7738 Signed-off-by: Jon Ander Peñalba <jonan88@gmail.com>
-rw-r--r--org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java19
-rw-r--r--org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java413
2 files changed, 280 insertions, 152 deletions
diff --git a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
index 67f372b2..4068b07e 100644
--- a/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
+++ b/org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/IssueEventTest.java
@@ -19,6 +19,7 @@ import java.util.Date;
import org.eclipse.egit.github.core.Issue;
import org.eclipse.egit.github.core.IssueEvent;
import org.eclipse.egit.github.core.Label;
+import org.eclipse.egit.github.core.Milestone;
import org.eclipse.egit.github.core.User;
import org.junit.Test;
@@ -33,13 +34,15 @@ public class IssueEventTest {
@Test
public void defaultState() {
IssueEvent event = new IssueEvent();
+ assertEquals(0, event.getId());
+ assertNull(event.getUrl());
assertNull(event.getActor());
assertNull(event.getCommitId());
- assertNull(event.getCreatedAt());
assertNull(event.getEvent());
- assertEquals(0, event.getId());
+ assertNull(event.getCreatedAt());
assertNull(event.getLabel());
- assertNull(event.getUrl());
+ assertNull(event.getAssignee());
+ assertNull(event.getMilestone());
assertNull(event.getIssue());
}
@@ -49,16 +52,20 @@ public class IssueEventTest {
@Test
public void updateFields() {
IssueEvent event = new IssueEvent();
+ assertEquals(4356, event.setId(4356).getId());
+ assertEquals("url://a", event.setUrl("url://a").getUrl());
User actor = new User().setName("Act Tor");
assertEquals(actor, event.setActor(actor).getActor());
assertEquals("a12b", event.setCommitId("a12b").getCommitId());
+ assertEquals(IssueEvent.TYPE_CLOSED, event.setEvent("closed").getEvent());
assertEquals(new Date(60000), event.setCreatedAt(new Date(60000))
.getCreatedAt());
- assertEquals(4356, event.setId(4356).getId());
Label label = new Label().setName("Lab El").setColor("563d7c");
assertEquals(label, event.setLabel(label).getLabel());
- assertEquals("commit", event.setEvent("commit").getEvent());
- assertEquals("url://a", event.setUrl("url://a").getUrl());
+ User assignee = new User().setName("Assig Nee");
+ assertEquals(assignee, event.setAssignee(assignee).getAssignee());
+ Milestone milestone = new Milestone().setTitle("Milestone");
+ assertEquals(milestone, event.setMilestone(milestone).getMilestone());
Issue issue = new Issue().setNumber(30);
assertEquals(issue, event.setIssue(issue).getIssue());
}
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
index 68772f0f..a1e63312 100644
--- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
+++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/IssueEvent.java
@@ -20,150 +20,271 @@ import org.eclipse.egit.github.core.util.DateUtils;
*/
public class IssueEvent implements Serializable {
- /** serialVersionUID */
- private static final long serialVersionUID = -842754108817725707L;
-
- private Date createdAt;
-
- private Issue issue;
-
- private long id;
-
- private String commitId;
-
- private String event;
-
- private String url;
-
- private User actor;
-
- private Label label;
-
- /**
- * @return createdAt
- */
- public Date getCreatedAt() {
- return DateUtils.clone(createdAt);
- }
-
- /**
- * @param createdAt
- * @return this issue event
- */
- public IssueEvent setCreatedAt(Date createdAt) {
- this.createdAt = DateUtils.clone(createdAt);
- return this;
- }
-
- /**
- * @return issue
- */
- public Issue getIssue() {
- return issue;
- }
-
- /**
- * @param issue
- * @return this issue event
- */
- public IssueEvent setIssue(Issue issue) {
- this.issue = issue;
- return this;
- }
-
- /**
- * @return id
- */
- public long getId() {
- return id;
- }
-
- /**
- * @param id
- * @return this issue event
- */
- public IssueEvent setId(long id) {
- this.id = id;
- return this;
- }
-
- /**
- * @return commitId
- */
- public String getCommitId() {
- return commitId;
- }
-
- /**
- * @param commitId
- * @return this issue event
- */
- public IssueEvent setCommitId(String commitId) {
- this.commitId = commitId;
- return this;
- }
-
- /**
- * @return event
- */
- public String getEvent() {
- return event;
- }
-
- /**
- * @param event
- * @return this issue event
- */
- public IssueEvent setEvent(String event) {
- this.event = event;
- return this;
- }
-
- /**
- * @return url
- */
- public String getUrl() {
- return url;
- }
-
- /**
- * @param url
- * @return this issue event
- */
- public IssueEvent setUrl(String url) {
- this.url = url;
- return this;
- }
-
- /**
- * @return actor
- */
- public User getActor() {
- return actor;
- }
-
- /**
- * @param actor
- * @return this issue event
- */
- public IssueEvent setActor(User actor) {
- this.actor = actor;
- return this;
- }
-
- /**
- * @return label
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * @param label
- * @return this issue event
- */
- public IssueEvent setLabel(Label label) {
- this.label = label;
- return this;
- }
+ /**
+ * Closed event
+ */
+ public static final String TYPE_CLOSED = "closed"; //$NON-NLS-1$
+
+ /**
+ * Reopened event
+ */
+ public static final String TYPE_REOPENED = "reopened"; //$NON-NLS-1$
+
+ /**
+ * Subscribed event
+ */
+ public static final String TYPE_SUBSCRIBED = "subscribed"; //$NON-NLS-1$
+
+ /**
+ * Merged event
+ */
+ public static final String TYPE_MERGED = "merged"; //$NON-NLS-1$
+
+ /**
+ * Referenced event
+ */
+ public static final String TYPE_REFERENCED = "referenced"; //$NON-NLS-1$
+
+ /**
+ * Mentioned event
+ */
+ public static final String TYPE_MENTIONED = "mentioned"; //$NON-NLS-1$
+
+ /**
+ * Assigned event
+ */
+ public static final String TYPE_ASSIGNED = "assigned"; //$NON-NLS-1$
+
+ /**
+ * Unassigned event
+ */
+ public static final String TYPE_UNASSIGNED = "unassigned"; //$NON-NLS-1$
+
+ /**
+ * Labeled event
+ */
+ public static final String TYPE_LABELED = "labeled"; //$NON-NLS-1$
+
+ /**
+ * Unlabeled event
+ */
+ public static final String TYPE_UNLABELED = "unlabeled"; //$NON-NLS-1$
+
+ /**
+ * Milestoned event
+ */
+ public static final String TYPE_MILESTONED = "milestoned"; //$NON-NLS-1$
+
+ /**
+ * Demilestoned event
+ */
+ public static final String TYPE_DEMILESTONED = "demilestoned"; //$NON-NLS-1$
+
+ /**
+ * Renamed event
+ */
+ public static final String TYPE_RENAMED = "renamed"; //$NON-NLS-1$
+
+ /**
+ * Locked event
+ */
+ public static final String TYPE_LOCKED = "locked"; //$NON-NLS-1$
+
+ /**
+ * Unlocked event
+ */
+ public static final String TYPE_UNLOCKED = "unlocked"; //$NON-NLS-1$
+
+ /**
+ * HEAD ref deleted event
+ */
+ public static final String TYPE_HEAD_REF_DELETED = "head_ref_deleted"; //$NON-NLS-1$
+
+ /**
+ * HEAD ref restored event
+ */
+ public static final String TYPE_HEAD_REF_RESTORED = "head_ref_restored"; //$NON-NLS-1$
+
+ /** serialVersionUID */
+ private static final long serialVersionUID = -842754108817725707L;
+
+ private long id;
+
+ private String url;
+
+ private User actor;
+
+ private String commitId;
+
+ private String event;
+
+ private Date createdAt;
+
+ private Label label;
+
+ private User assignee;
+
+ private Milestone milestone;
+
+ private Issue issue;
+
+ /**
+ * @return id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * @return this issue event
+ */
+ public IssueEvent setId(long id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * @return url
+ */
+ public String getUrl() {
+ return url;
+ }
+
+ /**
+ * @param url
+ * @return this issue event
+ */
+ public IssueEvent setUrl(String url) {
+ this.url = url;
+ return this;
+ }
+
+ /**
+ * @return actor
+ */
+ public User getActor() {
+ return actor;
+ }
+
+ /**
+ * @param actor
+ * @return this issue event
+ */
+ public IssueEvent setActor(User actor) {
+ this.actor = actor;
+ return this;
+ }
+
+ /**
+ * @return commitId
+ */
+ public String getCommitId() {
+ return commitId;
+ }
+
+ /**
+ * @param commitId
+ * @return this issue event
+ */
+ public IssueEvent setCommitId(String commitId) {
+ this.commitId = commitId;
+ return this;
+ }
+
+ /**
+ * @return event
+ */
+ public String getEvent() {
+ return event;
+ }
+
+ /**
+ * @param event
+ * @return this issue event
+ */
+ public IssueEvent setEvent(String event) {
+ this.event = event;
+ return this;
+ }
+
+ /**
+ * @return createdAt
+ */
+ public Date getCreatedAt() {
+ return DateUtils.clone(createdAt);
+ }
+
+ /**
+ * @param createdAt
+ * @return this issue event
+ */
+ public IssueEvent setCreatedAt(Date createdAt) {
+ this.createdAt = DateUtils.clone(createdAt);
+ return this;
+ }
+
+ /**
+ * @return label
+ */
+ public Label getLabel() {
+ return label;
+ }
+
+ /**
+ * @param label
+ * @return this issue event
+ */
+ public IssueEvent setLabel(Label label) {
+ this.label = label;
+ return this;
+ }
+
+ /**
+ * @return actor
+ */
+ public User getAssignee() {
+ return assignee;
+ }
+
+ /**
+ * @param assignee
+ * @return this issue event
+ */
+ public IssueEvent setAssignee(User assignee) {
+ this.assignee = assignee;
+ return this;
+ }
+
+ /**
+ * @return milestone
+ */
+ public Milestone getMilestone() {
+ return milestone;
+ }
+
+ /**
+ * @param milestone
+ * @return this issue event
+ */
+ public IssueEvent setMilestone(Milestone milestone) {
+ this.milestone = milestone;
+ return this;
+ }
+
+ /**
+ * @return issue
+ */
+ public Issue getIssue() {
+ return issue;
+ }
+
+ /**
+ * @param issue
+ * @return this issue event
+ */
+ public IssueEvent setIssue(Issue issue) {
+ this.issue = issue;
+ return this;
+ }
}

Back to the top