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