Unverified Commit 09ed795b authored by Gautier de Saint Martin Lacaze's avatar Gautier de Saint Martin Lacaze Committed by GitHub
Browse files

Merge pull request #811 from gitlab4j/issue-810

Fix #810 : Change all model Ids to Long
parents 594bc6c2 f237167c
...@@ -6,17 +6,17 @@ import org.gitlab4j.api.utils.JacksonJson; ...@@ -6,17 +6,17 @@ import org.gitlab4j.api.utils.JacksonJson;
public class EventIssue { public class EventIssue {
private Integer assigneeId; private Long assigneeId;
private Integer authorId; private Long authorId;
private String branchName; private String branchName;
private Date createdAt; private Date createdAt;
private String description; private String description;
private Integer id; private Long id;
private Integer iid; private Long iid;
private String milestoneId; private String milestoneId;
private Integer position; private Integer position;
private Integer projectId; private Long projectId;
private String state; private String state;
...@@ -26,19 +26,19 @@ public class EventIssue { ...@@ -26,19 +26,19 @@ public class EventIssue {
private String url; private String url;
private String action; private String action;
public Integer getAssigneeId() { public Long getAssigneeId() {
return this.assigneeId; return this.assigneeId;
} }
public void setAssigneeId(Integer assigneeId) { public void setAssigneeId(Long assigneeId) {
this.assigneeId = assigneeId; this.assigneeId = assigneeId;
} }
public Integer getAuthorId() { public Long getAuthorId() {
return this.authorId; return this.authorId;
} }
public void setAuthorId(Integer authorId) { public void setAuthorId(Long authorId) {
this.authorId = authorId; this.authorId = authorId;
} }
...@@ -66,19 +66,19 @@ public class EventIssue { ...@@ -66,19 +66,19 @@ public class EventIssue {
this.description = description; this.description = description;
} }
public Integer getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
public Integer getIid() { public Long getIid() {
return this.iid; return this.iid;
} }
public void setIid(Integer iid) { public void setIid(Long iid) {
this.iid = iid; this.iid = iid;
} }
...@@ -98,11 +98,11 @@ public class EventIssue { ...@@ -98,11 +98,11 @@ public class EventIssue {
this.position = position; this.position = position;
} }
public Integer getProjectId() { public Long getProjectId() {
return this.projectId; return this.projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
......
...@@ -11,43 +11,43 @@ import com.fasterxml.jackson.annotation.JsonValue; ...@@ -11,43 +11,43 @@ import com.fasterxml.jackson.annotation.JsonValue;
public class EventLabel { public class EventLabel {
public enum LabelType { public enum LabelType {
PROJECT_LABEL; PROJECT_LABEL;
private static JacksonJsonEnumHelper<LabelType> enumHelper = new JacksonJsonEnumHelper<>(LabelType.class, true, true); private static JacksonJsonEnumHelper<LabelType> enumHelper = new JacksonJsonEnumHelper<>(LabelType.class, true, true);
@JsonCreator @JsonCreator
public static LabelType forValue(String value) { public static LabelType forValue(String value) {
return enumHelper.forValue(value); return enumHelper.forValue(value);
} }
@JsonValue @JsonValue
public String toValue() { public String toValue() {
return (enumHelper.toString(this)); return (enumHelper.toString(this));
} }
@Override @Override
public String toString() { public String toString() {
return (enumHelper.toString(this)); return (enumHelper.toString(this));
} }
} }
private Integer id; private Long id;
private String title; private String title;
private String color; private String color;
private Integer projectId; private Long projectId;
private Date createdAt; private Date createdAt;
private Date updatedAt; private Date updatedAt;
private Boolean template; private Boolean template;
private String description; private String description;
private LabelType type; private LabelType type;
private Integer groupId; private Long groupId;
public Integer getId() { public Long getId() {
return id; return id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
...@@ -67,11 +67,11 @@ public class EventLabel { ...@@ -67,11 +67,11 @@ public class EventLabel {
this.color = color; this.color = color;
} }
public Integer getProjectId() { public Long getProjectId() {
return projectId; return projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
...@@ -115,11 +115,11 @@ public class EventLabel { ...@@ -115,11 +115,11 @@ public class EventLabel {
this.type = type; this.type = type;
} }
public Integer getGroupId() { public Long getGroupId() {
return groupId; return groupId;
} }
public void setGroupId(Integer groupId) { public void setGroupId(Long groupId) {
this.groupId = groupId; this.groupId = groupId;
} }
......
...@@ -9,27 +9,27 @@ import org.gitlab4j.api.models.Duration; ...@@ -9,27 +9,27 @@ import org.gitlab4j.api.models.Duration;
import org.gitlab4j.api.utils.JacksonJson; import org.gitlab4j.api.utils.JacksonJson;
public class EventMergeRequest { public class EventMergeRequest {
private Integer assigneeId; private Long assigneeId;
private Integer authorId; private Long authorId;
private String branchName; private String branchName;
private Date createdAt; private Date createdAt;
private String description; private String description;
private Integer id; private Long id;
private Integer iid; private Long iid;
private String mergeCommitSha; private String mergeCommitSha;
private String mergeStatus; private String mergeStatus;
private Integer milestoneId; private Long milestoneId;
private Integer position; private Integer position;
private Date lockedAt; private Date lockedAt;
private Integer projectId; private Long projectId;
private String sourceBranch; private String sourceBranch;
private Integer sourceProjectId; private Long sourceProjectId;
private String stCommits; private String stCommits;
private String stDiffs; private String stDiffs;
private String state; private String state;
private String targetBranch; private String targetBranch;
private Integer targetProjectId; private Long targetProjectId;
private String title; private String title;
private Date updatedAt; private Date updatedAt;
...@@ -41,39 +41,39 @@ public class EventMergeRequest { ...@@ -41,39 +41,39 @@ public class EventMergeRequest {
private String action; private String action;
private Assignee assignee; private Assignee assignee;
private Integer updatedById; private Long updatedById;
private String mergeError; private String mergeError;
private Map<String, String> mergeParams; private Map<String, String> mergeParams;
private Boolean mergeWhenPipelineSucceeds; private Boolean mergeWhenPipelineSucceeds;
private Integer mergeUserId; private Long mergeUserId;
private Date deletedAt; private Date deletedAt;
private String inProgressMergeCommitSha; private String inProgressMergeCommitSha;
private Integer lockVersion; private Integer lockVersion;
private Date last_editedAt; private Date last_editedAt;
private Integer lastEditedById; private Long lastEditedById;
private Integer headPipelineId; private Long headPipelineId;
private Boolean refFetched; private Boolean refFetched;
private Integer mergeIid; private Long mergeIid;
private Integer totalTimeSpent; private Integer totalTimeSpent;
private Duration humanTotalTimeSpent; private Duration humanTotalTimeSpent;
private Integer timeEstimate; private Integer timeEstimate;
private Duration humanTimeEstimate; private Duration humanTimeEstimate;
private List<Integer> assigneeIds; private List<Long> assigneeIds;
public Integer getAssigneeId() { public Long getAssigneeId() {
return this.assigneeId; return this.assigneeId;
} }
public void setAssigneeId(Integer assigneeId) { public void setAssigneeId(Long assigneeId) {
this.assigneeId = assigneeId; this.assigneeId = assigneeId;
} }
public Integer getAuthorId() { public Long getAuthorId() {
return this.authorId; return this.authorId;
} }
public void setAuthorId(Integer authorId) { public void setAuthorId(Long authorId) {
this.authorId = authorId; this.authorId = authorId;
} }
...@@ -101,19 +101,19 @@ public class EventMergeRequest { ...@@ -101,19 +101,19 @@ public class EventMergeRequest {
this.description = description; this.description = description;
} }
public Integer getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
public Integer getIid() { public Long getIid() {
return this.iid; return this.iid;
} }
public void setIid(Integer iid) { public void setIid(Long iid) {
this.iid = iid; this.iid = iid;
} }
...@@ -133,11 +133,11 @@ public class EventMergeRequest { ...@@ -133,11 +133,11 @@ public class EventMergeRequest {
this.mergeStatus = mergeStatus; this.mergeStatus = mergeStatus;
} }
public Integer getMilestoneId() { public Long getMilestoneId() {
return this.milestoneId; return this.milestoneId;
} }
public void setMilestoneId(Integer milestoneId) { public void setMilestoneId(Long milestoneId) {
this.milestoneId = milestoneId; this.milestoneId = milestoneId;
} }
...@@ -157,11 +157,11 @@ public class EventMergeRequest { ...@@ -157,11 +157,11 @@ public class EventMergeRequest {
this.lockedAt = lockedAt; this.lockedAt = lockedAt;
} }
public Integer getProjectId() { public Long getProjectId() {
return this.projectId; return this.projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
...@@ -173,11 +173,11 @@ public class EventMergeRequest { ...@@ -173,11 +173,11 @@ public class EventMergeRequest {
this.sourceBranch = sourceBranch; this.sourceBranch = sourceBranch;
} }
public Integer getSourceProjectId() { public Long getSourceProjectId() {
return this.sourceProjectId; return this.sourceProjectId;
} }
public void setSourceProjectId(Integer sourceProjectId) { public void setSourceProjectId(Long sourceProjectId) {
this.sourceProjectId = sourceProjectId; this.sourceProjectId = sourceProjectId;
} }
...@@ -213,11 +213,11 @@ public class EventMergeRequest { ...@@ -213,11 +213,11 @@ public class EventMergeRequest {
this.targetBranch = targetBranch; this.targetBranch = targetBranch;
} }
public Integer getTargetProjectId() { public Long getTargetProjectId() {
return this.targetProjectId; return this.targetProjectId;
} }
public void setTargetProjectId(Integer targetProjectId) { public void setTargetProjectId(Long targetProjectId) {
this.targetProjectId = targetProjectId; this.targetProjectId = targetProjectId;
} }
...@@ -293,11 +293,11 @@ public class EventMergeRequest { ...@@ -293,11 +293,11 @@ public class EventMergeRequest {
this.assignee = assignee; this.assignee = assignee;
} }
public Integer getUpdatedById() { public Long getUpdatedById() {
return updatedById; return updatedById;
} }
public void setUpdatedById(Integer updatedById) { public void setUpdatedById(Long updatedById) {
this.updatedById = updatedById; this.updatedById = updatedById;
} }
...@@ -325,11 +325,11 @@ public class EventMergeRequest { ...@@ -325,11 +325,11 @@ public class EventMergeRequest {
this.mergeWhenPipelineSucceeds = mergeWhenPipelineSucceeds; this.mergeWhenPipelineSucceeds = mergeWhenPipelineSucceeds;
} }
public Integer getMergeUserId() { public Long getMergeUserId() {
return mergeUserId; return mergeUserId;
} }
public void setMergeUserId(Integer mergeUserId) { public void setMergeUserId(Long mergeUserId) {
this.mergeUserId = mergeUserId; this.mergeUserId = mergeUserId;
} }
...@@ -365,19 +365,19 @@ public class EventMergeRequest { ...@@ -365,19 +365,19 @@ public class EventMergeRequest {
this.last_editedAt = last_editedAt; this.last_editedAt = last_editedAt;
} }
public Integer getLastEditedById() { public Long getLastEditedById() {
return lastEditedById; return lastEditedById;
} }
public void setLastEditedById(Integer lastEditedById) { public void setLastEditedById(Long lastEditedById) {
this.lastEditedById = lastEditedById; this.lastEditedById = lastEditedById;
} }
public Integer getHeadPipelineId() { public Long getHeadPipelineId() {
return headPipelineId; return headPipelineId;
} }
public void setHeadPipelineId(Integer headPipelineId) { public void setHeadPipelineId(Long headPipelineId) {
this.headPipelineId = headPipelineId; this.headPipelineId = headPipelineId;
} }
...@@ -389,11 +389,11 @@ public class EventMergeRequest { ...@@ -389,11 +389,11 @@ public class EventMergeRequest {
this.refFetched = refFetched; this.refFetched = refFetched;
} }
public Integer getMergeIid() { public Long getMergeIid() {
return mergeIid; return mergeIid;
} }
public void setMergeIid(Integer mergeIid) { public void setMergeIid(Long mergeIid) {
this.mergeIid = mergeIid; this.mergeIid = mergeIid;
} }
...@@ -429,11 +429,11 @@ public class EventMergeRequest { ...@@ -429,11 +429,11 @@ public class EventMergeRequest {
this.humanTimeEstimate = humanTimeEstimate; this.humanTimeEstimate = humanTimeEstimate;
} }
public List<Integer> getAssigneeIds() { public List<Long> getAssigneeIds() {
return assigneeIds; return assigneeIds;
} }
public void setAssigneeIds(List<Integer> assigneeIds) { public void setAssigneeIds(List<Long> assigneeIds) {
this.assigneeIds = assigneeIds; this.assigneeIds = assigneeIds;
} }
......
...@@ -5,7 +5,7 @@ import org.gitlab4j.api.utils.JacksonJson; ...@@ -5,7 +5,7 @@ import org.gitlab4j.api.utils.JacksonJson;
public class EventProject { public class EventProject {
private Integer id; private Long id;
private String name; private String name;
private String description; private String description;
private String webUrl; private String webUrl;
...@@ -22,11 +22,11 @@ public class EventProject { ...@@ -22,11 +22,11 @@ public class EventProject {
private String sshUrl; private String sshUrl;
private String httpUrl; private String httpUrl;
public Integer getId() { public Long getId() {
return id; return id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
......
...@@ -3,17 +3,17 @@ package org.gitlab4j.api.webhook; ...@@ -3,17 +3,17 @@ package org.gitlab4j.api.webhook;
import org.gitlab4j.api.utils.JacksonJson; import org.gitlab4j.api.utils.JacksonJson;
public class EventReleaseLink { public class EventReleaseLink {
private Integer id; private Long id;
private Boolean external; private Boolean external;
private String linkType; private String linkType;
private String name; private String name;
private String url; private String url;
public Integer getId() { public Long getId() {
return id; return id;
} }
public void setId(final Integer id) { public void setId(final Long id) {
this.id = id; this.id = id;
} }
......
...@@ -7,11 +7,11 @@ import org.gitlab4j.api.utils.JacksonJson; ...@@ -7,11 +7,11 @@ import org.gitlab4j.api.utils.JacksonJson;
public class EventSnippet { public class EventSnippet {
private Integer id; private Long id;
private String title; private String title;
private String content; private String content;
private Integer authorId; private Long authorId;
private Integer projectId; private Long projectId;
private Date createdAt; private Date createdAt;
private Date updatedAt; private Date updatedAt;
private String fileName; private String fileName;
...@@ -19,11 +19,11 @@ public class EventSnippet { ...@@ -19,11 +19,11 @@ public class EventSnippet {
private String type; private String type;
private AccessLevel visibilityLevel; private AccessLevel visibilityLevel;
public Integer getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
...@@ -43,19 +43,19 @@ public class EventSnippet { ...@@ -43,19 +43,19 @@ public class EventSnippet {
this.content = content; this.content = content;
} }
public Integer getAuthorId() { public Long getAuthorId() {
return this.authorId; return this.authorId;
} }
public void setAuthorId(Integer authorId) { public void setAuthorId(Long authorId) {
this.authorId = authorId; this.authorId = authorId;
} }
public Integer getProjectId() { public Long getProjectId() {
return this.projectId; return this.projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
......
...@@ -14,7 +14,7 @@ public class JobEvent extends AbstractEvent { ...@@ -14,7 +14,7 @@ public class JobEvent extends AbstractEvent {
private Boolean tag; private Boolean tag;
private String beforeSha; private String beforeSha;
private String sha; private String sha;
private Integer jobId; private Long jobId;
private String jobName; private String jobName;
private String jobStage; private String jobStage;
private String jobStatus; private String jobStatus;
...@@ -23,13 +23,14 @@ public class JobEvent extends AbstractEvent { ...@@ -23,13 +23,14 @@ public class JobEvent extends AbstractEvent {
private Integer jobDuration; private Integer jobDuration;
private Boolean jobAllowFailure; private Boolean jobAllowFailure;
private String jobFailureReason; private String jobFailureReason;
private Integer projectId; private Long projectId;
private String projectName; private String projectName;
private User user; private User user;
private BuildCommit commit; private BuildCommit commit;
private EventRepository repository; private EventRepository repository;
public String getObjectKind() { @Override
public String getObjectKind() {
return (OBJECT_KIND); return (OBJECT_KIND);
} }
...@@ -70,11 +71,11 @@ public class JobEvent extends AbstractEvent { ...@@ -70,11 +71,11 @@ public class JobEvent extends AbstractEvent {
this.sha = sha; this.sha = sha;
} }
public Integer getJobId() { public Long getJobId() {
return jobId; return jobId;
} }
public void setJobId(Integer jobId) { public void setJobId(Long jobId) {
this.jobId = jobId; this.jobId = jobId;
} }
...@@ -142,11 +143,11 @@ public class JobEvent extends AbstractEvent { ...@@ -142,11 +143,11 @@ public class JobEvent extends AbstractEvent {
this.jobFailureReason = jobFailureReason; this.jobFailureReason = jobFailureReason;
} }
public Integer getProjectId() { public Long getProjectId() {
return projectId; return projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
......
...@@ -16,7 +16,7 @@ public class NoteEvent extends AbstractEvent { ...@@ -16,7 +16,7 @@ public class NoteEvent extends AbstractEvent {
public static final String OBJECT_KIND = "note"; public static final String OBJECT_KIND = "note";
private User user; private User user;
private Integer projectId; private Long projectId;
private EventProject project; private EventProject project;
private EventRepository repository; private EventRepository repository;
private ObjectAttributes objectAttributes; private ObjectAttributes objectAttributes;
...@@ -25,7 +25,8 @@ public class NoteEvent extends AbstractEvent { ...@@ -25,7 +25,8 @@ public class NoteEvent extends AbstractEvent {
private EventMergeRequest mergeRequest; private EventMergeRequest mergeRequest;
private EventSnippet snippet; private EventSnippet snippet;
public String getObjectKind() { @Override
public String getObjectKind() {
return (OBJECT_KIND); return (OBJECT_KIND);
} }
...@@ -42,11 +43,11 @@ public class NoteEvent extends AbstractEvent { ...@@ -42,11 +43,11 @@ public class NoteEvent extends AbstractEvent {
this.user = user; this.user = user;
} }
public Integer getProjectId() { public Long getProjectId() {
return this.projectId; return this.projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
...@@ -129,28 +130,28 @@ public class NoteEvent extends AbstractEvent { ...@@ -129,28 +130,28 @@ public class NoteEvent extends AbstractEvent {
public static class ObjectAttributes { public static class ObjectAttributes {
private Integer id; private Long id;
private String note; private String note;
private String discussionId; private String discussionId;
private String type; private String type;
private NoteableType noteableType; private NoteableType noteableType;
private Integer authorId; private Long authorId;
private Date createdAt; private Date createdAt;
private Date updatedAt; private Date updatedAt;
private Integer projectId; private Long projectId;
private String attachment; private String attachment;
private String lineCode; private String lineCode;
private String commitId; private String commitId;
private Integer noteableId; private Long noteableId;
private Boolean system; private Boolean system;
private Diff stDiff; private Diff stDiff;
private String url; private String url;
public Integer getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
...@@ -186,11 +187,11 @@ public class NoteEvent extends AbstractEvent { ...@@ -186,11 +187,11 @@ public class NoteEvent extends AbstractEvent {
this.noteableType = notableType; this.noteableType = notableType;
} }
public Integer getAuthorId() { public Long getAuthorId() {
return this.authorId; return this.authorId;
} }
public void setAuthorId(Integer authorId) { public void setAuthorId(Long authorId) {
this.authorId = authorId; this.authorId = authorId;
} }
...@@ -210,11 +211,11 @@ public class NoteEvent extends AbstractEvent { ...@@ -210,11 +211,11 @@ public class NoteEvent extends AbstractEvent {
this.updatedAt = updatedAt; this.updatedAt = updatedAt;
} }
public Integer getProjectId() { public Long getProjectId() {
return this.projectId; return this.projectId;
} }
public void setProjectId(Integer projectId) { public void setProjectId(Long projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
...@@ -242,11 +243,11 @@ public class NoteEvent extends AbstractEvent { ...@@ -242,11 +243,11 @@ public class NoteEvent extends AbstractEvent {
this.commitId = commitId; this.commitId = commitId;
} }
public Integer getNoteableId() { public Long getNoteableId() {
return noteableId; return noteableId;
} }
public void setNoteableId(Integer noteableId) { public void setNoteableId(Long noteableId) {
this.noteableId = noteableId; this.noteableId = noteableId;
} }
......
...@@ -70,7 +70,7 @@ public class PipelineEvent extends AbstractEvent { ...@@ -70,7 +70,7 @@ public class PipelineEvent extends AbstractEvent {
public static class ObjectAttributes { public static class ObjectAttributes {
private Integer id; private Long id;
private String ref; private String ref;
private Boolean tag; private Boolean tag;
private String sha; private String sha;
...@@ -83,11 +83,11 @@ public class PipelineEvent extends AbstractEvent { ...@@ -83,11 +83,11 @@ public class PipelineEvent extends AbstractEvent {
private Integer duration; private Integer duration;
private List<Variable> variables; private List<Variable> variables;
public Integer getId() { public Long getId() {
return id; return id;
} }
public void setId(Integer id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
......
...@@ -7,7 +7,7 @@ public class ReleaseEvent extends AbstractEvent { ...@@ -7,7 +7,7 @@ public class ReleaseEvent extends AbstractEvent {
public static final String X_GITLAB_EVENT = "Release Hook"; public static final String X_GITLAB_EVENT = "Release Hook";
public static final String OBJECT_KIND = "release"; public static final String OBJECT_KIND = "release";
private Integer id; private Long id;
private String createdAt; private String createdAt;
private String description; private String description;
private String name; private String name;
...@@ -19,7 +19,8 @@ public class ReleaseEvent extends AbstractEvent { ...@@ -19,7 +19,8 @@ public class ReleaseEvent extends AbstractEvent {
private EventReleaseAssets assets; private EventReleaseAssets assets;
private EventCommit commit; private EventCommit commit;
public String getObjectKind() { @Override
public String getObjectKind() {
return (OBJECT_KIND); return (OBJECT_KIND);
} }
...@@ -28,11 +29,11 @@ public class ReleaseEvent extends AbstractEvent { ...@@ -28,11 +29,11 @@ public class ReleaseEvent extends AbstractEvent {
throw new RuntimeException("Invalid object_kind (" + objectKind + "), must be '" + OBJECT_KIND + "'"); throw new RuntimeException("Invalid object_kind (" + objectKind + "), must be '" + OBJECT_KIND + "'");
} }
public Integer getId() { public Long getId() {
return id; return id;
} }
public void setId(final Integer id) { public void setId(final Long id) {
this.id = id; this.id = id;
} }
......
package org.gitlab4j.api; package org.gitlab4j.api;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
......
...@@ -39,28 +39,28 @@ public class TestEpicDiscussionsApi implements Constants { ...@@ -39,28 +39,28 @@ public class TestEpicDiscussionsApi implements Constants {
@Test @Test
public void testGetEpicDiscussionsByList() throws Exception { public void testGetEpicDiscussionsByList() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussions(1, 1); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussions(1, 1L);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "epic-discussions.json")); assertTrue(compareJson(discussions, "epic-discussions.json"));
} }
@Test @Test
public void testGetEpicDiscussionsByListWithMaxItems() throws Exception { public void testGetEpicDiscussionsByListWithMaxItems() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussions(1, 1, 20); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussions(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "epic-discussions.json")); assertTrue(compareJson(discussions, "epic-discussions.json"));
} }
@Test @Test
public void testGetEpicDiscussionsByPager() throws Exception { public void testGetEpicDiscussionsByPager() throws Exception {
Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussionsPager(1, 1, 20); Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getEpicDiscussionsPager(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions.all(), "epic-discussions.json")); assertTrue(compareJson(discussions.all(), "epic-discussions.json"));
} }
@Test @Test
public void testGetEpicDiscussionsByStream() throws Exception { public void testGetEpicDiscussionsByStream() throws Exception {
Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getEpicDiscussionsStream(1, 1); Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getEpicDiscussionsStream(1, 1L);
assertNotNull(stream); assertNotNull(stream);
List<Discussion> discussions = stream.collect(Collectors.toList()); List<Discussion> discussions = stream.collect(Collectors.toList());
assertTrue(compareJson(discussions, "epic-discussions.json")); assertTrue(compareJson(discussions, "epic-discussions.json"));
......
...@@ -27,13 +27,13 @@ import org.junit.experimental.categories.Category; ...@@ -27,13 +27,13 @@ import org.junit.experimental.categories.Category;
/** /**
* In order for these tests to run you must set the following properties in test-gitlab4j.properties * In order for these tests to run you must set the following properties in test-gitlab4j.properties
* *
* TEST_HOST_URL * TEST_HOST_URL
* TEST_PRIVATE_TOKEN * TEST_PRIVATE_TOKEN
* TEST_USERNAME * TEST_USERNAME
* TEST_GROUP * TEST_GROUP
* TEST_GROUP_MEMBER_USERNAME * TEST_GROUP_MEMBER_USERNAME
* *
* If any of the above are NULL, all tests in this class will be skipped. * If any of the above are NULL, all tests in this class will be skipped.
* *
*/ */
...@@ -101,7 +101,7 @@ public class TestGroupApi extends AbstractIntegrationTest { ...@@ -101,7 +101,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
if (TEST_REQUEST_ACCESS_USERNAME != null) { if (TEST_REQUEST_ACCESS_USERNAME != null) {
Optional<User> user = gitLabApi.getUserApi().getOptionalUser(TEST_REQUEST_ACCESS_USERNAME); Optional<User> user = gitLabApi.getUserApi().getOptionalUser(TEST_REQUEST_ACCESS_USERNAME);
if (user.isPresent()) { if (user.isPresent()) {
Integer userId = user.get().getId(); Long userId = user.get().getId();
try { try {
gitLabApi.getGroupApi().denyAccessRequest(testGroup, userId); gitLabApi.getGroupApi().denyAccessRequest(testGroup, userId);
} catch (Exception e) { } catch (Exception e) {
...@@ -204,7 +204,7 @@ public class TestGroupApi extends AbstractIntegrationTest { ...@@ -204,7 +204,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME); gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME);
User user = gitLabApi.getUserApi().getCurrentUser(); User user = gitLabApi.getUserApi().getCurrentUser();
assertNotNull(user); assertNotNull(user);
final Integer userId = user.getId(); final Long userId = user.getId();
try { try {
try { try {
...@@ -249,7 +249,7 @@ public class TestGroupApi extends AbstractIntegrationTest { ...@@ -249,7 +249,7 @@ public class TestGroupApi extends AbstractIntegrationTest {
gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME); gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME);
User user = gitLabApi.getUserApi().getCurrentUser(); User user = gitLabApi.getUserApi().getCurrentUser();
assertNotNull(user); assertNotNull(user);
final Integer userId = user.getId(); final Long userId = user.getId();
try { try {
try { try {
......
...@@ -141,7 +141,7 @@ public class TestImportExportApi extends AbstractIntegrationTest { ...@@ -141,7 +141,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
ImportStatus importStatus = gitLabApi.getImportExportApi().startImport(null, exportDownload, ImportStatus importStatus = gitLabApi.getImportExportApi().startImport(null, exportDownload,
TEST_IMPORT_PROJECT_NAME, true, null); TEST_IMPORT_PROJECT_NAME, true, null);
assertNotNull(importStatus); assertNotNull(importStatus);
Integer newProjectId = importStatus.getId(); Long newProjectId = importStatus.getId();
// Wait up to 40 seconds for the import to complete // Wait up to 40 seconds for the import to complete
System.out.print("Waiting for import to complete"); System.out.print("Waiting for import to complete");
......
...@@ -39,28 +39,28 @@ public class TestIssueDiscussionsApi implements Constants { ...@@ -39,28 +39,28 @@ public class TestIssueDiscussionsApi implements Constants {
@Test @Test
public void testGetIssueDiscussionsByList() throws Exception { public void testGetIssueDiscussionsByList() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussions(1, 1); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussions(1, 1L);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "issue-discussions.json")); assertTrue(compareJson(discussions, "issue-discussions.json"));
} }
@Test @Test
public void testGetIssueDiscussionsByListWithMaxItems() throws Exception { public void testGetIssueDiscussionsByListWithMaxItems() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussions(1, 1, 20); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussions(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "issue-discussions.json")); assertTrue(compareJson(discussions, "issue-discussions.json"));
} }
@Test @Test
public void testGetIssueDiscussionsByPager() throws Exception { public void testGetIssueDiscussionsByPager() throws Exception {
Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussionsPager(1, 1, 20); Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getIssueDiscussionsPager(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions.all(), "issue-discussions.json")); assertTrue(compareJson(discussions.all(), "issue-discussions.json"));
} }
@Test @Test
public void testGetIssueDiscussionsByStream() throws Exception { public void testGetIssueDiscussionsByStream() throws Exception {
Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getIssueDiscussionsStream(1, 1); Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getIssueDiscussionsStream(1, 1L);
assertNotNull(stream); assertNotNull(stream);
List<Discussion> discussions = stream.collect(Collectors.toList()); List<Discussion> discussions = stream.collect(Collectors.toList());
assertTrue(compareJson(discussions, "issue-discussions.json")); assertTrue(compareJson(discussions, "issue-discussions.json"));
......
...@@ -52,12 +52,12 @@ import org.junit.experimental.categories.Category; ...@@ -52,12 +52,12 @@ import org.junit.experimental.categories.Category;
/** /**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties * In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* *
* TEST_NAMESPACE * TEST_NAMESPACE
* TEST_PROJECT_NAME * TEST_PROJECT_NAME
* TEST_HOST_URL * TEST_HOST_URL
* TEST_PRIVATE_TOKEN * TEST_PRIVATE_TOKEN
* *
* If any of the above are NULL, all tests in this class will be skipped. * If any of the above are NULL, all tests in this class will be skipped.
*/ */
@Category(IntegrationTest.class) @Category(IntegrationTest.class)
...@@ -127,7 +127,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -127,7 +127,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testGetIssue() throws GitLabApiException { public void testGetIssue() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
Issue foundIssue = gitLabApi.getIssuesApi().getIssue(projectId, issue.getIid()); Issue foundIssue = gitLabApi.getIssuesApi().getIssue(projectId, issue.getIid());
assertNotNull(foundIssue); assertNotNull(foundIssue);
...@@ -138,7 +138,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -138,7 +138,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testGetIssues() throws GitLabApiException { public void testGetIssues() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
List<Issue> issues = gitLabApi.getIssuesApi().getIssues(projectId); List<Issue> issues = gitLabApi.getIssuesApi().getIssues(projectId);
assertNotNull(issues); assertNotNull(issues);
...@@ -166,7 +166,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -166,7 +166,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testCreateIssue() throws GitLabApiException { public void testCreateIssue() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
String title = getUniqueTitle(); String title = getUniqueTitle();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION);
assertNotNull(issue); assertNotNull(issue);
...@@ -174,7 +174,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -174,7 +174,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
assertEquals(ISSUE_DESCRIPTION, issue.getDescription()); assertEquals(ISSUE_DESCRIPTION, issue.getDescription());
assertEquals(IssueState.OPENED, issue.getState()); assertEquals(IssueState.OPENED, issue.getState());
List<Integer> assigneeIds = Arrays.asList(issue.getAuthor().getId()); List<Long> assigneeIds = Arrays.asList(issue.getAuthor().getId());
issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION, null, assigneeIds, null, null, new Date(), null, null, null); issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION, null, assigneeIds, null, null, new Date(), null, null, null);
assertNotNull(issue); assertNotNull(issue);
assertEquals(title, issue.getTitle()); assertEquals(title, issue.getTitle());
...@@ -186,7 +186,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -186,7 +186,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testCloseIssueJustCreated() throws GitLabApiException { public void testCloseIssueJustCreated() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
Issue closedIssue = gitLabApi.getIssuesApi().closeIssue(projectId, issue.getIid()); Issue closedIssue = gitLabApi.getIssuesApi().closeIssue(projectId, issue.getIid());
...@@ -199,7 +199,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -199,7 +199,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testCloseIssueClosedAt() throws GitLabApiException { public void testCloseIssueClosedAt() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
assertNull(issue.getClosedAt()); assertNull(issue.getClosedAt());
assertNull(issue.getClosedBy()); assertNull(issue.getClosedBy());
...@@ -219,7 +219,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -219,7 +219,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testDeleteIssue() throws GitLabApiException { public void testDeleteIssue() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
gitLabApi.getIssuesApi().deleteIssue(projectId, issue.getIid()); gitLabApi.getIssuesApi().deleteIssue(projectId, issue.getIid());
...@@ -233,12 +233,12 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -233,12 +233,12 @@ public class TestIssuesApi extends AbstractIntegrationTest {
/** /**
* Simplify creation of issues * Simplify creation of issues
* *
* @return * @return
* @throws GitLabApiException * @throws GitLabApiException
*/ */
private Issue ensureIssue() throws GitLabApiException { private Issue ensureIssue() throws GitLabApiException {
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
String title = getUniqueTitle(); String title = getUniqueTitle();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, title, ISSUE_DESCRIPTION);
...@@ -256,7 +256,7 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -256,7 +256,7 @@ public class TestIssuesApi extends AbstractIntegrationTest {
/** /**
* Expect the given {@link TimeStats} object to have the values * Expect the given {@link TimeStats} object to have the values
* *
* @param timeStats * @param timeStats
* @param timeEstimate * @param timeEstimate
* @param totalTimeSpent * @param totalTimeSpent
...@@ -271,10 +271,10 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -271,10 +271,10 @@ public class TestIssuesApi extends AbstractIntegrationTest {
Issue issue = ensureIssue(); Issue issue = ensureIssue();
TimeStats timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), "1h"); TimeStats timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), "1h");
assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0); assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0);
timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), 60 * 60); timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), 60 * 60);
assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0); assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0);
timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), new Duration(60 * 60)); timeStats = gitLabApi.getIssuesApi().estimateTime(issue.getProjectId(), issue.getIid(), new Duration(60 * 60));
assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0); assertTimeStats(timeStats, (60 /* seconds */ * 60 /* minutes */), 0);
} }
...@@ -293,10 +293,10 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -293,10 +293,10 @@ public class TestIssuesApi extends AbstractIntegrationTest {
Issue issue = ensureIssue(); Issue issue = ensureIssue();
TimeStats timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), "1h"); TimeStats timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), "1h");
assertTimeStats(timeStats, 0, (60 /* seconds */ * 60 /* minutes */)); assertTimeStats(timeStats, 0, (60 /* seconds */ * 60 /* minutes */));
timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), 60 * 60); timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), 60 * 60);
assertTimeStats(timeStats, 0, 60 * 60 * 2); assertTimeStats(timeStats, 0, 60 * 60 * 2);
timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), new Duration(60 * 60)); timeStats = gitLabApi.getIssuesApi().addSpentTime(issue.getProjectId(), issue.getIid(), new Duration(60 * 60));
assertTimeStats(timeStats, 0, 60 * 60 * 3); assertTimeStats(timeStats, 0, 60 * 60 * 3);
} }
...@@ -314,20 +314,20 @@ public class TestIssuesApi extends AbstractIntegrationTest { ...@@ -314,20 +314,20 @@ public class TestIssuesApi extends AbstractIntegrationTest {
public void testGetIssuesWithOptions() throws GitLabApiException { public void testGetIssuesWithOptions() throws GitLabApiException {
assertNotNull(testProject); assertNotNull(testProject);
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issueOpen = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issueOpen = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
Issue issueClose = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION); Issue issueClose = gitLabApi.getIssuesApi().createIssue(projectId, getUniqueTitle(), ISSUE_DESCRIPTION);
issueClose = gitLabApi.getIssuesApi().closeIssue(projectId, issueClose.getIid()); issueClose = gitLabApi.getIssuesApi().closeIssue(projectId, issueClose.getIid());
final Integer openIid = issueOpen.getIid(); final Long openIid = issueOpen.getIid();
IssueFilter openFilter = new IssueFilter().withState(IssueState.OPENED); IssueFilter openFilter = new IssueFilter().withState(IssueState.OPENED);
List<Issue> opens = gitLabApi.getIssuesApi().getIssues(projectId, openFilter); List<Issue> opens = gitLabApi.getIssuesApi().getIssues(projectId, openFilter);
assertNotNull(opens); assertNotNull(opens);
assertTrue(opens.stream().map(Issue::getIid).anyMatch(iid -> iid.equals(openIid))); assertTrue(opens.stream().map(Issue::getIid).anyMatch(iid -> iid.equals(openIid)));
final Integer closedIid = issueClose.getIid(); final Long closedIid = issueClose.getIid();
IssueFilter closeFilter = new IssueFilter().withState(IssueState.CLOSED); IssueFilter closeFilter = new IssueFilter().withState(IssueState.CLOSED);
List<Issue> closes = gitLabApi.getIssuesApi().getIssues(projectId, closeFilter); List<Issue> closes = gitLabApi.getIssuesApi().getIssues(projectId, closeFilter);
assertNotNull(closes); assertNotNull(closes);
assertTrue(closes.stream().map(Issue::getIid).anyMatch(iid -> iid.equals(closedIid))); assertTrue(closes.stream().map(Issue::getIid).anyMatch(iid -> iid.equals(closedIid)));
......
...@@ -39,28 +39,28 @@ public class TestMergeRequestDiscussionsApi implements Constants { ...@@ -39,28 +39,28 @@ public class TestMergeRequestDiscussionsApi implements Constants {
@Test @Test
public void testGetMergeRequestDiscussionsByList() throws Exception { public void testGetMergeRequestDiscussionsByList() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussions(1, 1); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussions(1, 1L);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "merge-request-discussions.json")); assertTrue(compareJson(discussions, "merge-request-discussions.json"));
} }
@Test @Test
public void testGetMergeRequestDiscussionsByListMaxItems() throws Exception { public void testGetMergeRequestDiscussionsByListMaxItems() throws Exception {
List<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussions(1, 1, 20); List<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussions(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions, "merge-request-discussions.json")); assertTrue(compareJson(discussions, "merge-request-discussions.json"));
} }
@Test @Test
public void testGetMergeRequestDiscussionsByPager() throws Exception { public void testGetMergeRequestDiscussionsByPager() throws Exception {
Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussionsPager(1, 1, 20); Pager<Discussion> discussions = new DiscussionsApi(gitLabApi).getMergeRequestDiscussionsPager(1, 1L, 20);
assertNotNull(discussions); assertNotNull(discussions);
assertTrue(compareJson(discussions.all(), "merge-request-discussions.json")); assertTrue(compareJson(discussions.all(), "merge-request-discussions.json"));
} }
@Test @Test
public void testGetMergeRequestDiscussionsByStream() throws Exception { public void testGetMergeRequestDiscussionsByStream() throws Exception {
Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getMergeRequestDiscussionsStream(1, 1); Stream<Discussion> stream = new DiscussionsApi(gitLabApi).getMergeRequestDiscussionsStream(1, 1L);
assertNotNull(stream); assertNotNull(stream);
List<Discussion> discussions = stream.collect(Collectors.toList()); List<Discussion> discussions = stream.collect(Collectors.toList());
assertTrue(compareJson(discussions, "merge-request-discussions.json")); assertTrue(compareJson(discussions, "merge-request-discussions.json"));
......
...@@ -59,13 +59,13 @@ import org.junit.runners.MethodSorters; ...@@ -59,13 +59,13 @@ import org.junit.runners.MethodSorters;
/** /**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties * In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* *
* TEST_NAMESPACE * TEST_NAMESPACE
* TEST_PROJECT_NAME * TEST_PROJECT_NAME
* TEST_HOST_URL * TEST_HOST_URL
* TEST_PRIVATE_TOKEN * TEST_PRIVATE_TOKEN
* TEST_GROUP_PROJECT * TEST_GROUP_PROJECT
* *
* If any of the above are NULL, all tests in this class will be skipped. * If any of the above are NULL, all tests in this class will be skipped.
* *
* NOTE: &amp;FixMethodOrder(MethodSorters.NAME_ASCENDING) is very important to insure that the tests are in the correct order * NOTE: &amp;FixMethodOrder(MethodSorters.NAME_ASCENDING) is very important to insure that the tests are in the correct order
...@@ -174,7 +174,7 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -174,7 +174,7 @@ public class TestProjectApi extends AbstractIntegrationTest {
if (TEST_REQUEST_ACCESS_USERNAME != null) { if (TEST_REQUEST_ACCESS_USERNAME != null) {
Optional<User> user = gitLabApi.getUserApi().getOptionalUser(TEST_REQUEST_ACCESS_USERNAME); Optional<User> user = gitLabApi.getUserApi().getOptionalUser(TEST_REQUEST_ACCESS_USERNAME);
if (user.isPresent()) { if (user.isPresent()) {
Integer userId = user.get().getId(); Long userId = user.get().getId();
try { try {
gitLabApi.getProjectApi().denyAccessRequest(testProject, userId); gitLabApi.getProjectApi().denyAccessRequest(testProject, userId);
} catch (Exception e) { } catch (Exception e) {
...@@ -627,7 +627,7 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -627,7 +627,7 @@ public class TestProjectApi extends AbstractIntegrationTest {
assertTrue(optional.isPresent()); assertTrue(optional.isPresent());
assertEquals(TEST_PROJECT_NAME, optional.get().getName()); assertEquals(TEST_PROJECT_NAME, optional.get().getName());
Integer projectId = optional.get().getId(); Long projectId = optional.get().getId();
optional = gitLabApi.getProjectApi().getOptionalProject(projectId); optional = gitLabApi.getProjectApi().getOptionalProject(projectId);
assertNotNull(optional); assertNotNull(optional);
assertTrue(optional.isPresent()); assertTrue(optional.isPresent());
...@@ -787,7 +787,7 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -787,7 +787,7 @@ public class TestProjectApi extends AbstractIntegrationTest {
gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME); gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME);
User user = gitLabApi.getUserApi().getCurrentUser(); User user = gitLabApi.getUserApi().getCurrentUser();
assertNotNull(user); assertNotNull(user);
final Integer userId = user.getId(); final Long userId = user.getId();
try { try {
try { try {
...@@ -832,7 +832,7 @@ public class TestProjectApi extends AbstractIntegrationTest { ...@@ -832,7 +832,7 @@ public class TestProjectApi extends AbstractIntegrationTest {
gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME); gitLabApi.sudo(TEST_REQUEST_ACCESS_USERNAME);
User user = gitLabApi.getUserApi().getCurrentUser(); User user = gitLabApi.getUserApi().getCurrentUser();
assertNotNull(user); assertNotNull(user);
final Integer userId = user.getId(); final Long userId = user.getId();
try { try {
try { try {
......
...@@ -41,12 +41,12 @@ import org.junit.experimental.categories.Category; ...@@ -41,12 +41,12 @@ import org.junit.experimental.categories.Category;
/** /**
* In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties * In order for these tests to run you must set the following properties in ~/test-gitlab4j.properties
* *
* TEST_NAMESPACE * TEST_NAMESPACE
* TEST_PROJECT_NAME * TEST_PROJECT_NAME
* TEST_HOST_URL * TEST_HOST_URL
* TEST_PRIVATE_TOKEN * TEST_PRIVATE_TOKEN
* *
* If any of the above are NULL, all tests in this class will be skipped. * If any of the above are NULL, all tests in this class will be skipped.
*/ */
@Category(IntegrationTest.class) @Category(IntegrationTest.class)
...@@ -96,7 +96,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest { ...@@ -96,7 +96,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest {
assumeNotNull(gitLabApi); assumeNotNull(gitLabApi);
} }
private Snippet createSnippet(String title, String filename, String description, private Snippet createSnippet(String title, String filename, String description,
String code, Visibility visibility) throws GitLabApiException { String code, Visibility visibility) throws GitLabApiException {
return (gitLabApi.getProjectApi().createSnippet(testProject, title, filename, description, code, visibility)); return (gitLabApi.getProjectApi().createSnippet(testProject, title, filename, description, code, visibility));
} }
...@@ -147,7 +147,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest { ...@@ -147,7 +147,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest {
Snippet newSnippet = createSnippet(title, filename, description, code, visibility); Snippet newSnippet = createSnippet(title, filename, description, code, visibility);
assertNotNull(newSnippet); assertNotNull(newSnippet);
int snippetId = newSnippet.getId(); long snippetId = newSnippet.getId();
List<Snippet> snippets = gitLabApi.getProjectApi().getSnippets(testProject); List<Snippet> snippets = gitLabApi.getProjectApi().getSnippets(testProject);
assertNotNull(snippets); assertNotNull(snippets);
for (Snippet snippet : snippets) { for (Snippet snippet : snippets) {
...@@ -172,7 +172,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest { ...@@ -172,7 +172,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest {
Snippet createdSnippet = createSnippet(title, filename, description, code, visibility); Snippet createdSnippet = createSnippet(title, filename, description, code, visibility);
assertNotNull(createdSnippet); assertNotNull(createdSnippet);
int snippetId = createdSnippet.getId(); long snippetId = createdSnippet.getId();
gitLabApi.getProjectApi().deleteSnippet(testProject, snippetId); gitLabApi.getProjectApi().deleteSnippet(testProject, snippetId);
List<Snippet> snippets = gitLabApi.getProjectApi().getSnippets(testProject); List<Snippet> snippets = gitLabApi.getProjectApi().getSnippets(testProject);
if (snippets != null) { if (snippets != null) {
...@@ -181,7 +181,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest { ...@@ -181,7 +181,7 @@ public class TestProjectApiSnippets extends AbstractIntegrationTest {
fail("Snippet was not deleted."); fail("Snippet was not deleted.");
} }
} }
} }
} }
@Test @Test
......
...@@ -39,7 +39,7 @@ public class TestResourceStateEventsApi extends AbstractIntegrationTest { ...@@ -39,7 +39,7 @@ public class TestResourceStateEventsApi extends AbstractIntegrationTest {
@Test @Test
public void testGetCloseReopenIssueEvents() throws GitLabApiException { public void testGetCloseReopenIssueEvents() throws GitLabApiException {
Integer projectId = testProject.getId(); Long projectId = testProject.getId();
Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, ISSUE_TITLE, ISSUE_DESCRIPTION); Issue issue = gitLabApi.getIssuesApi().createIssue(projectId, ISSUE_TITLE, ISSUE_DESCRIPTION);
Issue closedIssue = gitLabApi.getIssuesApi().closeIssue(projectId, issue.getIid()); Issue closedIssue = gitLabApi.getIssuesApi().closeIssue(projectId, issue.getIid());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment