Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Filtering by label never matches anything #709

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@
*/
@GeneratePojoBuilder(intoPackage = "*.builder.generated", withFactoryMethod = "*")
public class Label {

/*
"name" : "bug",
"title" : "bug",
"color" : "#d9534f",
"description": "Bug reported by user",
"open_issues_count": 1,
"closed_issues_count": 0,
"open_merge_requests_count": 1
*/
private String name;
private String title;
private String color;
private String description;
private long openIssuesCount;
private long closedIssuesCount;
private long openMergeRequestsCount;

public String getName() {
return name;
public String getTitle() {
return title;
}

public void setName(String name) {
this.name = name;
public void setTitle(String title) {
this.title = title;
}

public String getColor() {
Expand Down Expand Up @@ -86,7 +87,7 @@ public boolean equals(Object o) {
.append(openIssuesCount, label.openIssuesCount)
.append(closedIssuesCount, label.closedIssuesCount)
.append(openMergeRequestsCount, label.openMergeRequestsCount)
.append(name, label.name)
.append(title, label.title)
.append(color, label.color)
.append(description, label.description)
.isEquals();
Expand All @@ -95,7 +96,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(name)
.append(title)
.append(color)
.append(description)
.append(openIssuesCount)
Expand All @@ -107,7 +108,7 @@ public int hashCode() {
@Override
public String toString() {
return new ToStringBuilder(this)
.append("name", name)
.append("name", title)
.append("color", color)
.append("description", description)
.append("openIssuesCount", openIssuesCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class MergeRequest {
private User assignee;
private Integer sourceProjectId;
private Integer targetProjectId;
private List<String> labels;
private List<Label> labels;
private String description;
private Boolean workInProgress;
private Boolean mergeWhenBuildSucceeds;
Expand Down Expand Up @@ -152,11 +152,11 @@ public void setTargetProjectId(Integer targetProjectId) {
this.targetProjectId = targetProjectId;
}

public List<String> getLabels() {
public List<Label> getLabels() {
return labels;
}

public void setLabels(List<String> labels) {
public void setLabels(List<Label> labels) {
this.labels = labels;
}

Expand Down Expand Up @@ -202,72 +202,72 @@ public boolean equals(Object o) {
}
MergeRequest that = (MergeRequest) o;
return new EqualsBuilder()
.append(id, that.id)
.append(iid, that.iid)
.append(sourceBranch, that.sourceBranch)
.append(targetBranch, that.targetBranch)
.append(projectId, that.projectId)
.append(title, that.title)
.append(state, that.state)
.append(upvotes, that.upvotes)
.append(downvotes, that.downvotes)
.append(author, that.author)
.append(assignee, that.assignee)
.append(sourceProjectId, that.sourceProjectId)
.append(targetProjectId, that.targetProjectId)
.append(labels, that.labels)
.append(description, that.description)
.append(workInProgress, that.workInProgress)
.append(mergeWhenBuildSucceeds, that.mergeWhenBuildSucceeds)
.append(mergeStatus, that.mergeStatus)
.isEquals();
.append(id, that.id)
.append(iid, that.iid)
.append(sourceBranch, that.sourceBranch)
.append(targetBranch, that.targetBranch)
.append(projectId, that.projectId)
.append(title, that.title)
.append(state, that.state)
.append(upvotes, that.upvotes)
.append(downvotes, that.downvotes)
.append(author, that.author)
.append(assignee, that.assignee)
.append(sourceProjectId, that.sourceProjectId)
.append(targetProjectId, that.targetProjectId)
.append(labels, that.labels)
.append(description, that.description)
.append(workInProgress, that.workInProgress)
.append(mergeWhenBuildSucceeds, that.mergeWhenBuildSucceeds)
.append(mergeStatus, that.mergeStatus)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(id)
.append(iid)
.append(sourceBranch)
.append(targetBranch)
.append(projectId)
.append(title)
.append(state)
.append(upvotes)
.append(downvotes)
.append(author)
.append(assignee)
.append(sourceProjectId)
.append(targetProjectId)
.append(labels)
.append(description)
.append(workInProgress)
.append(mergeWhenBuildSucceeds)
.append(mergeStatus)
.toHashCode();
.append(id)
.append(iid)
.append(sourceBranch)
.append(targetBranch)
.append(projectId)
.append(title)
.append(state)
.append(upvotes)
.append(downvotes)
.append(author)
.append(assignee)
.append(sourceProjectId)
.append(targetProjectId)
.append(labels)
.append(description)
.append(workInProgress)
.append(mergeWhenBuildSucceeds)
.append(mergeStatus)
.toHashCode();
}

@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("iid", iid)
.append("sourceBranch", sourceBranch)
.append("targetBranch", targetBranch)
.append("projectId", projectId)
.append("title", title)
.append("state", state)
.append("upvotes", upvotes)
.append("downvotes", downvotes)
.append("author", author)
.append("assignee", assignee)
.append("sourceProjectId", sourceProjectId)
.append("targetProjectId", targetProjectId)
.append("labels", labels)
.append("description", description)
.append("workInProgress", workInProgress)
.append("mergeWhenBuildSucceeds", mergeWhenBuildSucceeds)
.append("mergeStatus", mergeStatus)
.toString();
.append("id", id)
.append("iid", iid)
.append("sourceBranch", sourceBranch)
.append("targetBranch", targetBranch)
.append("projectId", projectId)
.append("title", title)
.append("state", state)
.append("upvotes", upvotes)
.append("downvotes", downvotes)
.append("author", author)
.append("assignee", assignee)
.append("sourceProjectId", sourceProjectId)
.append("targetProjectId", targetProjectId)
.append("labels", labels)
.append("description", description)
.append("workInProgress", workInProgress)
.append("mergeWhenBuildSucceeds", mergeWhenBuildSucceeds)
.append("mergeStatus", mergeStatus)
.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.dabsquared.gitlabjenkins.gitlab.hook.model;


import com.dabsquared.gitlabjenkins.gitlab.api.model.Label;
import net.karneim.pojobuilder.GeneratePojoBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.util.List;

/**
* @author Robin Müller
*/
Expand All @@ -16,6 +19,7 @@ public class MergeRequestHook extends WebHook {
private User assignee;
private Project project;
private MergeRequestObjectAttributes objectAttributes;
private List<Label> labels;

public User getUser() {
return user;
Expand All @@ -42,14 +46,21 @@ public void setObjectAttributes(MergeRequestObjectAttributes objectAttributes) {
}

public User getAssignee() {
return assignee;
}

public void setAssignee(User assignee) {
this.assignee = assignee;
}

@Override
return assignee;
}

public void setAssignee(User assignee) {
this.assignee = assignee;
}

public List<Label> getLabels() {
return labels;
}

public void setLabels(List<Label> labels) {
this.labels = labels;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
Expand All @@ -59,30 +70,33 @@ public boolean equals(Object o) {
}
MergeRequestHook that = (MergeRequestHook) o;
return new EqualsBuilder()
.append(user, that.user)
.append(assignee, that.assignee)
.append(project, that.project)
.append(objectAttributes, that.objectAttributes)
.isEquals();
.append(user, that.user)
.append(assignee, that.assignee)
.append(project, that.project)
.append(objectAttributes, that.objectAttributes)
.append(labels, that.labels)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(user)
.append(assignee)
.append(project)
.append(objectAttributes)
.toHashCode();
.append(user)
.append(assignee)
.append(project)
.append(objectAttributes)
.append(labels)
.toHashCode();
}

@Override
public String toString() {
return new ToStringBuilder(this)
.append("user", user)
.append("assignee", assignee)
.append("project", project)
.append("objectAttributes", objectAttributes)
.toString();
.append("user", user)
.append("assignee", assignee)
.append("project", project)
.append("objectAttributes", objectAttributes)
.append("labels", labels)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class MergeRequestObjectAttributes {
private String url;
private Action action;
private Boolean workInProgress;
private List<String> labels;

public Integer getId() {
return id;
Expand Down Expand Up @@ -196,14 +195,6 @@ public void setWorkInProgress(Boolean workInProgress) {
this.workInProgress = workInProgress;
}

public List<String> getLabels() {
return labels;
}

public void setLabels(List<String> labels) {
this.labels = labels;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down Expand Up @@ -234,7 +225,6 @@ public boolean equals(Object o) {
.append(url, that.url)
.append(action, that.action)
.append(workInProgress, that.workInProgress)
.append(labels, that.labels)
.isEquals();
}

Expand All @@ -261,7 +251,6 @@ public int hashCode() {
.append(url)
.append(action)
.append(workInProgress)
.append(labels)
.toHashCode();
}

Expand All @@ -288,7 +277,6 @@ public String toString() {
.append("url", url)
.append("action", action)
.append("workInProgress", workInProgress)
.append("labels", labels)
.toString();
}
}
Loading