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
fabfb5c0
Commit
fabfb5c0
authored
Apr 27, 2023
by
Jeremie Bresson
Browse files
Merge branch '6.x' into update-mockito
Apply replacement: * "Mockito.<Object>any()" => "Mockito.any(Object[].class)"
parents
582bd665
98c4b996
Changes
27
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/IssuesApi.java
View file @
fabfb5c0
...
...
@@ -16,6 +16,7 @@ import org.gitlab4j.api.models.IssueFilter;
import
org.gitlab4j.api.models.IssueLink
;
import
org.gitlab4j.api.models.IssuesStatistics
;
import
org.gitlab4j.api.models.IssuesStatisticsFilter
;
import
org.gitlab4j.api.models.LinkType
;
import
org.gitlab4j.api.models.MergeRequest
;
import
org.gitlab4j.api.models.Participant
;
import
org.gitlab4j.api.models.TimeStats
;
...
...
@@ -889,10 +890,31 @@ public class IssuesApi extends AbstractApi implements Constants {
*/
public
IssueLink
createIssueLink
(
Object
projectIdOrPath
,
Long
issueIid
,
Object
targetProjectIdOrPath
,
Long
targetIssueIid
)
throws
GitLabApiException
{
return
createIssueLink
(
projectIdOrPath
,
issueIid
,
targetProjectIdOrPath
,
targetIssueIid
,
null
);
}
/**
* Creates a two-way relation between two issues. User must be allowed to update both issues in order to succeed.
*
* <p>NOTE: Only available in GitLab Starter, GitLab Bronze, and higher tiers.</p>
*
* <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/links</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @param issueIid the internal ID of a project's issue
* @param targetProjectIdOrPath the project in the form of an Long(ID), String(path), or Project instance of the target project
* @param targetIssueIid the internal ID of a target project’s issue
* @param linkType the type of the relation (optional), defaults to {@link LinkType#RELATES_TO}.
* @return an instance of IssueLink holding the link relationship
* @throws GitLabApiException if any exception occurs
*/
public
IssueLink
createIssueLink
(
Object
projectIdOrPath
,
Long
issueIid
,
Object
targetProjectIdOrPath
,
Long
targetIssueIid
,
LinkType
linkType
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"target_project_id"
,
getProjectIdOrPath
(
targetProjectIdOrPath
),
true
)
.
withParam
(
"target_issue_iid"
,
targetIssueIid
,
true
);
.
withParam
(
"target_issue_iid"
,
targetIssueIid
,
true
)
.
withParam
(
"link_type"
,
linkType
,
false
);
Response
response
=
post
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"issues"
,
issueIid
,
"links"
);
...
...
src/main/java/org/gitlab4j/api/Pager.java
View file @
fabfb5c0
...
...
@@ -69,7 +69,7 @@ public class Pager<T> implements Iterator<List<T>>, Constants {
* @param pathArgs HTTP path arguments
* @throws GitLabApiException if any error occurs
*/
Pager
(
AbstractApi
api
,
Class
<
T
>
type
,
int
itemsPerPage
,
MultivaluedMap
<
String
,
String
>
queryParams
,
Object
...
pathArgs
)
throws
GitLabApiException
{
public
Pager
(
AbstractApi
api
,
Class
<
T
>
type
,
int
itemsPerPage
,
MultivaluedMap
<
String
,
String
>
queryParams
,
Object
...
pathArgs
)
throws
GitLabApiException
{
javaType
=
mapper
.
getTypeFactory
().
constructCollectionType
(
List
.
class
,
type
);
...
...
src/main/java/org/gitlab4j/api/RepositorySubmodulesApi.java
0 → 100644
View file @
fabfb5c0
package
org.gitlab4j.api
;
import
jakarta.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Commit
;
/**
* <p>This class provides an entry point to all the GitLab API repository submodules calls.
* For more information on the repository APIs see:</p>
*
* @see <a href="https://docs.gitlab.com/ee/api/repository_submodules.html">Repository Submodules API</a>
*/
public
class
RepositorySubmodulesApi
extends
AbstractApi
{
public
RepositorySubmodulesApi
(
GitLabApi
gitLabApi
)
{
super
(
gitLabApi
);
}
/**
* Update existing submodule reference in repository.
*
* <pre><code>GitLab Endpoint: PUT /projects/:id/repository/submodules/:submodule</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @param submodule full path to the submodule
* @param branch name of the branch to commit into
* @param commitSha full commit SHA to update the submodule to
* @param commitMessage commit message (optional). If no message is provided, a default is set
* @return the created commit
* @throws GitLabApiException if any exception occurs
*/
public
Commit
updateExistingSubmoduleReference
(
Object
projectIdOrPath
,
String
submodule
,
String
branch
,
String
commitSha
,
String
commitMessage
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"branch"
,
branch
,
true
)
.
withParam
(
"commit_sha"
,
commitSha
,
true
)
.
withParam
(
"commit_message"
,
commitMessage
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"submodules"
,
urlEncode
(
submodule
));
return
(
response
.
readEntity
(
Commit
.
class
));
}
}
src/main/java/org/gitlab4j/api/models/AbstractIssue.java
0 → 100644
View file @
fabfb5c0
package
org.gitlab4j.api.models
;
import
java.util.Date
;
import
java.util.List
;
import
org.gitlab4j.api.Constants.IssueState
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.node.IntNode
;
import
com.fasterxml.jackson.databind.node.LongNode
;
import
com.fasterxml.jackson.databind.node.TextNode
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
public
abstract
class
AbstractIssue
{
public
static
class
TaskCompletionStatus
{
private
Integer
count
;
private
Integer
completedCount
;
public
Integer
getCount
()
{
return
count
;
}
public
void
setCount
(
Integer
count
)
{
this
.
count
=
count
;
}
public
Integer
getCompletedCount
()
{
return
completedCount
;
}
public
void
setCompletedCount
(
Integer
completedCount
)
{
this
.
completedCount
=
completedCount
;
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
private
Assignee
assignee
;
private
List
<
Assignee
>
assignees
;
private
Author
author
;
private
Boolean
confidential
;
private
Date
createdAt
;
private
Date
updatedAt
;
private
Date
closedAt
;
private
User
closedBy
;
private
String
description
;
private
Date
dueDate
;
@JsonProperty
(
"id"
)
private
ValueNode
actualId
;
@JsonIgnore
private
String
externalId
;
@JsonIgnore
private
Long
id
;
private
Long
iid
;
private
List
<
String
>
labels
;
private
Milestone
milestone
;
private
Long
projectId
;
private
IssueState
state
;
private
String
title
;
private
Integer
userNotesCount
;
private
String
webUrl
;
private
Integer
weight
;
private
Boolean
discussionLocked
;
private
TimeStats
timeStats
;
private
Integer
upvotes
;
private
Integer
downvotes
;
private
Integer
mergeRequestsCount
;
private
Boolean
hasTasks
;
private
String
taskStatus
;
private
TaskCompletionStatus
taskCompletionStatus
;
public
Assignee
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
Assignee
assignee
)
{
this
.
assignee
=
assignee
;
}
public
List
<
Assignee
>
getAssignees
()
{
return
assignees
;
}
public
void
setAssignees
(
List
<
Assignee
>
assignees
)
{
this
.
assignees
=
assignees
;
}
public
Author
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
Author
author
)
{
this
.
author
=
author
;
}
public
Boolean
getConfidential
()
{
return
confidential
;
}
public
void
setConfidential
(
Boolean
confidential
)
{
this
.
confidential
=
confidential
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Date
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
ValueNode
getActualId
()
{
return
actualId
;
}
public
void
setActualId
(
ValueNode
id
)
{
actualId
=
id
;
if
(
actualId
instanceof
TextNode
)
{
externalId
=
actualId
.
asText
();
}
else
if
(
actualId
instanceof
IntNode
||
actualId
instanceof
LongNode
)
{
this
.
id
=
actualId
.
asLong
();
}
}
public
Long
getId
()
{
return
(
id
);
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
if
(
id
!=
null
)
{
actualId
=
new
LongNode
(
id
);
externalId
=
null
;
}
}
public
String
getExternalId
()
{
return
(
externalId
);
}
public
void
setExternalId
(
String
externalId
)
{
this
.
externalId
=
externalId
;
if
(
externalId
!=
null
)
{
actualId
=
new
TextNode
(
externalId
);
id
=
null
;
}
}
public
Long
getIid
()
{
return
iid
;
}
public
void
setIid
(
Long
iid
)
{
this
.
iid
=
iid
;
}
public
List
<
String
>
getLabels
()
{
return
labels
;
}
public
void
setLabels
(
List
<
String
>
labels
)
{
this
.
labels
=
labels
;
}
public
Milestone
getMilestone
()
{
return
milestone
;
}
public
void
setMilestone
(
Milestone
milestone
)
{
this
.
milestone
=
milestone
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Long
projectId
)
{
this
.
projectId
=
projectId
;
}
public
IssueState
getState
()
{
return
state
;
}
public
void
setState
(
IssueState
state
)
{
this
.
state
=
state
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getClosedAt
()
{
return
closedAt
;
}
public
void
setClosedAt
(
Date
closedAt
)
{
this
.
closedAt
=
closedAt
;
}
public
User
getClosedBy
()
{
return
closedBy
;
}
public
void
setClosedBy
(
User
closedBy
)
{
this
.
closedBy
=
closedBy
;
}
public
Integer
getUserNotesCount
()
{
return
userNotesCount
;
}
public
void
setUserNotesCount
(
Integer
userNotesCount
)
{
this
.
userNotesCount
=
userNotesCount
;
}
public
String
getWebUrl
()
{
return
webUrl
;
}
public
void
setWebUrl
(
String
webUrl
)
{
this
.
webUrl
=
webUrl
;
}
public
Integer
getWeight
()
{
return
weight
;
}
public
void
setWeight
(
Integer
weight
)
{
this
.
weight
=
weight
;
}
public
Boolean
getDiscussionLocked
()
{
return
discussionLocked
;
}
public
void
setDiscussionLocked
(
Boolean
discussionLocked
)
{
this
.
discussionLocked
=
discussionLocked
;
}
public
TimeStats
getTimeStats
()
{
return
timeStats
;
}
public
void
setTimeStats
(
TimeStats
timeStats
)
{
this
.
timeStats
=
timeStats
;
}
public
Integer
getUpvotes
()
{
return
upvotes
;
}
public
void
setUpvotes
(
Integer
upvotes
)
{
this
.
upvotes
=
upvotes
;
}
public
Integer
getDownvotes
()
{
return
downvotes
;
}
public
void
setDownvotes
(
Integer
downvotes
)
{
this
.
downvotes
=
downvotes
;
}
public
Integer
getMergeRequestsCount
()
{
return
mergeRequestsCount
;
}
public
void
setMergeRequestsCount
(
Integer
mergeRequestsCount
)
{
this
.
mergeRequestsCount
=
mergeRequestsCount
;
}
public
Boolean
getHasTasks
()
{
return
hasTasks
;
}
public
void
setHasTasks
(
Boolean
hasTasks
)
{
this
.
hasTasks
=
hasTasks
;
}
public
String
getTaskStatus
()
{
return
taskStatus
;
}
public
void
setTaskStatus
(
String
taskStatus
)
{
this
.
taskStatus
=
taskStatus
;
}
public
TaskCompletionStatus
getTaskCompletionStatus
()
{
return
taskCompletionStatus
;
}
public
void
setTaskCompletionStatus
(
TaskCompletionStatus
taskCompletionStatus
)
{
this
.
taskCompletionStatus
=
taskCompletionStatus
;
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
src/main/java/org/gitlab4j/api/models/Commit.java
View file @
fabfb5c0
...
...
@@ -26,6 +26,7 @@ public class Commit {
private
String
title
;
private
String
url
;
private
String
webUrl
;
private
Long
projectId
;
private
Pipeline
lastPipeline
;
public
Author
getAuthor
()
{
...
...
@@ -172,6 +173,14 @@ public class Commit {
this
.
webUrl
=
webUrl
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Long
projectId
)
{
this
.
projectId
=
projectId
;
}
public
Pipeline
getLastPipeline
()
{
return
lastPipeline
;
}
...
...
src/main/java/org/gitlab4j/api/models/Epic.java
View file @
fabfb5c0
...
...
@@ -2,22 +2,66 @@ package org.gitlab4j.api.models;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.gitlab4j.api.utils.JacksonJsonEnumHelper
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonValue
;
public
class
Epic
{
public
enum
EpicState
{
OPENED
,
CLOSED
,
ALL
;
private
static
JacksonJsonEnumHelper
<
EpicState
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
EpicState
.
class
);
@JsonCreator
public
static
EpicState
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
}
public
String
toString
()
{
return
(
enumHelper
.
toString
(
this
));
}
}
private
Long
id
;
private
Long
iid
;
private
Long
groupId
;
private
Long
parentId
;
private
Long
parentIid
;
private
String
title
;
private
String
description
;
private
EpicState
state
;
private
String
webUrl
;
private
String
reference
;
private
References
references
;
private
Author
author
;
private
List
<
String
>
labels
;
private
Date
startDate
;
private
Boolean
startDateIsFixed
;
private
Date
dueDate
;
private
Boolean
dueDateIsFixed
;
private
Date
dueDateFromInheritedSource
;
private
Date
endDate
;
private
Date
createdAt
;
private
Date
updatedAt
;
private
Date
closedAt
;
private
Integer
downvotes
;
private
Integer
upvotes
;
private
String
color
;
private
Boolean
subscribed
;
@JsonProperty
(
"_links"
)
private
Map
<
String
,
String
>
links
;
public
Long
getId
()
{
return
id
;
...
...
@@ -43,6 +87,22 @@ public class Epic {
this
.
groupId
=
groupId
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Long
getParentIid
()
{
return
parentIid
;
}
public
void
setParentIid
(
Long
parentIid
)
{
this
.
parentIid
=
parentIid
;
}
public
String
getTitle
()
{
return
title
;
}
...
...
@@ -69,6 +129,38 @@ public class Epic {
return
(
this
);
}
public
EpicState
getState
()
{
return
state
;
}
public
void
setState
(
EpicState
state
)
{
this
.
state
=
state
;
}
public
String
getWebUrl
()
{
return
webUrl
;
}
public
void
setWebUrl
(
String
webUrl
)
{
this
.
webUrl
=
webUrl
;
}
public
String
getReference
()
{
return
reference
;
}
public
void
setReference
(
String
reference
)
{
this
.
reference
=
reference
;
}
public
References
getReferences
()
{
return
references
;
}
public
void
setReferences
(
References
references
)
{
this
.
references
=
references
;
}
public
Author
getAuthor
()
{
return
author
;
}
...
...
@@ -108,6 +200,38 @@ public class Epic {
return
(
this
);
}
public
Boolean
getStartDateIsFixed
()
{
return
startDateIsFixed
;
}
public
void
setStartDateIsFixed
(
Boolean
startDateIsFixed
)
{
this
.
startDateIsFixed
=
startDateIsFixed
;
}
public
Date
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
Boolean
getDueDateIsFixed
()
{
return
dueDateIsFixed
;
}
public
void
setDueDateIsFixed
(
Boolean
dueDateIsFixed
)
{
this
.
dueDateIsFixed
=
dueDateIsFixed
;
}
public
Date
getDueDateFromInheritedSource
()
{
return
dueDateFromInheritedSource
;
}
public
void
setDueDateFromInheritedSource
(
Date
dueDateFromInheritedSource
)
{
this
.
dueDateFromInheritedSource
=
dueDateFromInheritedSource
;
}
public
Date
getEndDate
()
{
return
endDate
;
}
...
...
@@ -137,7 +261,63 @@ public class Epic {
this
.
updatedAt
=
updatedAt
;
}
@Override
public
Date
getClosedAt
()
{
return
closedAt
;
}
public
void
setClosedAt
(
Date
closedAt
)
{
this
.
closedAt
=
closedAt
;
}
public
Integer
getDownvotes
()
{
return
downvotes
;
}
public
void
setDownvotes
(
Integer
downvotes
)
{
this
.
downvotes
=
downvotes
;
}
public
Integer
getUpvotes
()
{
return
upvotes
;
}
public
void
setUpvotes
(
Integer
upvotes
)
{
this
.
upvotes
=
upvotes
;
}
public
String
getColor
()
{
return
color
;
}
public
void
setColor
(
String
color
)
{
this
.
color
=
color
;
}
public
Boolean
getSubscribed
()
{
return
subscribed
;
}
public
void
setSubscribed
(
Boolean
subscribed
)
{
this
.
subscribed
=
subscribed
;
}
public
Map
<
String
,
String
>
getLinks
()
{
return
links
;
}
public
void
setLinks
(
Map
<
String
,
String
>
links
)
{
this
.
links
=
links
;
}
@JsonIgnore
public
String
getLinkByName
(
String
name
)
{
if
(
links
==
null
||
links
.
isEmpty
())
{
return
(
null
);
}
return
(
links
.
get
(
name
));
}
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
...
...
src/main/java/org/gitlab4j/api/models/Event.java
View file @
fabfb5c0
...
...
@@ -8,6 +8,7 @@ import org.gitlab4j.api.utils.JacksonJson;
public
class
Event
{
private
Long
id
;
private
String
actionName
;
private
Author
author
;
private
Long
authorId
;
...
...
@@ -24,6 +25,14 @@ public class Event {
private
Note
note
;
private
PushData
pushData
;
public
Long
getId
()
{
return
this
.
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getActionName
()
{
return
actionName
;
}
...
...
src/main/java/org/gitlab4j/api/models/Issue.java
View file @
fabfb5c0
...
...
@@ -2,226 +2,17 @@
package
org.gitlab4j.api.models
;
import
java.util.Date
;
import
java.util.List
;
import
org.gitlab4j.api.Constants.IssueState
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.node.IntNode
;
import
com.fasterxml.jackson.databind.node.LongNode
;
import
com.fasterxml.jackson.databind.node.TextNode
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
public
class
Issue
extends
AbstractIssue
{
public
class
Issue
{
public
static
class
TaskCompletionStatus
{
private
Integer
count
;
private
Integer
completedCount
;
public
Integer
getCount
()
{
return
count
;
}
public
void
setCount
(
Integer
count
)
{
this
.
count
=
count
;
}
public
Integer
getCompletedCount
()
{
return
completedCount
;
}
public
void
setCompletedCount
(
Integer
completedCount
)
{
this
.
completedCount
=
completedCount
;
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
private
Assignee
assignee
;
private
List
<
Assignee
>
assignees
;
private
Author
author
;
private
Boolean
confidential
;
private
Date
createdAt
;
private
Date
updatedAt
;
private
Date
closedAt
;
private
User
closedBy
;
private
String
description
;
private
Date
dueDate
;
@JsonProperty
(
"id"
)
private
ValueNode
actualId
;
@JsonIgnore
private
String
externalId
;
@JsonIgnore
private
Long
id
;
private
Long
iid
;
private
Long
issueLinkId
;
private
List
<
String
>
labels
;
private
Milestone
milestone
;
private
Long
projectId
;
private
IssueState
state
;
private
Boolean
subscribed
;
private
String
title
;
private
Integer
userNotesCount
;
private
String
webUrl
;
private
Integer
weight
;
private
Boolean
discussionLocked
;
private
TimeStats
timeStats
;
private
Integer
upvotes
;
private
Integer
downvotes
;
private
Integer
mergeRequestsCount
;
private
Boolean
hasTasks
;
private
String
taskStatus
;
private
TaskCompletionStatus
taskCompletionStatus
;
public
Assignee
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
Assignee
assignee
)
{
this
.
assignee
=
assignee
;
}
public
List
<
Assignee
>
getAssignees
()
{
return
assignees
;
}
public
void
setAssignees
(
List
<
Assignee
>
assignees
)
{
this
.
assignees
=
assignees
;
}
public
Author
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
Author
author
)
{
this
.
author
=
author
;
}
public
Boolean
getConfidential
()
{
return
confidential
;
}
public
void
setConfidential
(
Boolean
confidential
)
{
this
.
confidential
=
confidential
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Date
getDueDate
()
{
return
dueDate
;
}
public
void
setDueDate
(
Date
dueDate
)
{
this
.
dueDate
=
dueDate
;
}
public
ValueNode
getActualId
()
{
return
actualId
;
}
public
void
setActualId
(
ValueNode
id
)
{
actualId
=
id
;
if
(
actualId
instanceof
TextNode
)
{
externalId
=
actualId
.
asText
();
}
else
if
(
actualId
instanceof
IntNode
||
actualId
instanceof
LongNode
)
{
this
.
id
=
actualId
.
asLong
();
}
}
public
Long
getId
()
{
return
(
id
);
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
if
(
id
!=
null
)
{
actualId
=
new
LongNode
(
id
);
externalId
=
null
;
}
}
public
String
getExternalId
()
{
return
(
externalId
);
}
public
void
setExternalId
(
String
externalId
)
{
this
.
externalId
=
externalId
;
if
(
externalId
!=
null
)
{
actualId
=
new
TextNode
(
externalId
);
id
=
null
;
}
}
public
Long
getIid
()
{
return
iid
;
}
public
void
setIid
(
Long
iid
)
{
this
.
iid
=
iid
;
}
public
Long
getIssueLinkId
()
{
return
issueLinkId
;
}
public
void
setIssueLinkId
(
Long
issueLinkId
)
{
this
.
issueLinkId
=
issueLinkId
;
}
public
List
<
String
>
getLabels
()
{
return
labels
;
}
public
void
setLabels
(
List
<
String
>
labels
)
{
this
.
labels
=
labels
;
}
public
Milestone
getMilestone
()
{
return
milestone
;
}
public
void
setMilestone
(
Milestone
milestone
)
{
this
.
milestone
=
milestone
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Long
projectId
)
{
this
.
projectId
=
projectId
;
}
public
IssueState
getState
()
{
return
state
;
}
public
void
setState
(
IssueState
state
)
{
this
.
state
=
state
;
}
private
Long
issueLinkId
;
private
LinkType
linkType
;
private
Date
linkCreatedAt
;
private
Date
linkUpdatedAt
;
public
Boolean
getSubscribed
()
{
return
subscribed
;
...
...
@@ -231,124 +22,36 @@ public class Issue {
this
.
subscribed
=
subscribed
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getClosedAt
()
{
return
closedAt
;
}
public
void
setClosedAt
(
Date
closedAt
)
{
this
.
closedAt
=
closedAt
;
}
public
User
getClosedBy
()
{
return
closedBy
;
}
public
void
setClosedBy
(
User
closedBy
)
{
this
.
closedBy
=
closedBy
;
}
public
Integer
getUserNotesCount
()
{
return
userNotesCount
;
}
public
void
setUserNotesCount
(
Integer
userNotesCount
)
{
this
.
userNotesCount
=
userNotesCount
;
}
public
String
getWebUrl
()
{
return
webUrl
;
}
public
void
setWebUrl
(
String
webUrl
)
{
this
.
webUrl
=
webUrl
;
}
public
Integer
getWeight
()
{
return
weight
;
}
public
void
setWeight
(
Integer
weight
)
{
this
.
weight
=
weight
;
}
public
Boolean
getDiscussionLocked
()
{
return
discussionLocked
;
}
public
void
setDiscussionLocked
(
Boolean
discussionLocked
)
{
this
.
discussionLocked
=
discussionLocked
;
}
public
TimeStats
getTimeStats
()
{
return
timeStats
;
}
public
void
setTimeStats
(
TimeStats
timeStats
)
{
this
.
timeStats
=
timeStats
;
}
public
Integer
getUpvotes
()
{
return
upvotes
;
}
public
void
setUpvotes
(
Integer
upvotes
)
{
this
.
upvotes
=
upvotes
;
}
public
Integer
getDownvotes
()
{
return
downvotes
;
}
public
void
setDownvotes
(
Integer
downvotes
)
{
this
.
downvotes
=
downvotes
;
}
public
Integer
getMergeRequestsCount
()
{
return
mergeRequestsCount
;
public
Long
getIssueLinkId
()
{
return
issueLinkId
;
}
public
void
set
MergeRequestsCount
(
Integer
mergeRequestsCount
)
{
this
.
mergeRequestsCount
=
mergeRequestsCount
;
public
void
set
IssueLinkId
(
Long
issueLinkId
)
{
this
.
issueLinkId
=
issueLinkId
;
}
public
Boolean
getHasTasks
()
{
return
hasTasks
;
public
LinkType
getLinkType
()
{
return
linkType
;
}
public
void
set
HasTasks
(
Boolean
hasTasks
)
{
this
.
hasTasks
=
hasTasks
;
public
void
set
LinkType
(
LinkType
linkType
)
{
this
.
linkType
=
linkType
;
}
public
String
getTaskStatus
()
{
return
taskStatus
;
public
Date
getLinkCreatedAt
()
{
return
linkCreatedAt
;
}
public
void
set
TaskStatus
(
String
taskStatus
)
{
this
.
taskStatus
=
taskStatus
;
public
void
set
LinkCreatedAt
(
Date
linkCreatedAt
)
{
this
.
linkCreatedAt
=
linkCreatedAt
;
}
public
TaskCompletionStatus
getTaskCompletionStatus
()
{
return
taskCompletionStatus
;
public
Date
getLinkUpdatedAt
()
{
return
linkUpdatedAt
;
}
public
void
set
TaskCompletionStatus
(
TaskCompletionStatus
taskCompletionStatus
)
{
this
.
taskCompletionStatus
=
taskCompletionStatus
;
public
void
set
LinkUpdatedAt
(
Date
linkUpdatedAt
)
{
this
.
linkUpdatedAt
=
linkUpdatedAt
;
}
@Override
...
...
src/main/java/org/gitlab4j/api/models/IssueLink.java
View file @
fabfb5c0
...
...
@@ -6,6 +6,7 @@ public class IssueLink {
private
Issue
sourceIssue
;
private
Issue
targetIssue
;
private
LinkType
linkType
;
public
Issue
getSourceIssue
()
{
return
sourceIssue
;
...
...
@@ -23,6 +24,14 @@ public class IssueLink {
this
.
targetIssue
=
targetIssue
;
}
public
LinkType
getLinkType
()
{
return
linkType
;
}
public
void
setLinkType
(
LinkType
linkType
)
{
this
.
linkType
=
linkType
;
}
@Override
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
...
...
src/main/java/org/gitlab4j/api/models/LinkType.java
0 → 100644
View file @
fabfb5c0
package
org.gitlab4j.api.models
;
import
org.gitlab4j.api.utils.JacksonJsonEnumHelper
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
com.fasterxml.jackson.annotation.JsonValue
;
/**
* Enum to model the type of link between issues or epics
*/
public
enum
LinkType
{
RELATES_TO
,
BLOCKS
,
IS_BLOCKED_BY
;
private
static
JacksonJsonEnumHelper
<
LinkType
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
LinkType
.
class
);
@JsonCreator
public
static
LinkType
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
}
@Override
public
String
toString
()
{
return
(
enumHelper
.
toString
(
this
));
}
}
src/main/java/org/gitlab4j/api/models/MergeRequest.java
View file @
fabfb5c0
...
...
@@ -54,6 +54,7 @@ public class MergeRequest {
private
String
mergeError
;
private
Milestone
milestone
;
private
Pipeline
pipeline
;
private
Pipeline
headPipeline
;
private
Long
projectId
;
private
String
sha
;
private
Boolean
shouldRemoveSourceBranch
;
...
...
@@ -374,6 +375,14 @@ public class MergeRequest {
this
.
pipeline
=
pipeline
;
}
public
Pipeline
getHeadPipeline
()
{
return
headPipeline
;
}
public
void
setHeadPipeline
(
Pipeline
headPipeline
)
{
this
.
headPipeline
=
headPipeline
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
...
...
src/main/java/org/gitlab4j/api/models/Pipeline.java
View file @
fabfb5c0
...
...
@@ -8,7 +8,10 @@ import org.gitlab4j.api.utils.JacksonJson;
public
class
Pipeline
{
private
Long
id
;
private
Long
iid
;
private
Long
projectId
;
private
PipelineStatus
status
;
private
String
source
;
private
String
ref
;
private
String
sha
;
private
String
beforeSha
;
...
...
@@ -34,6 +37,22 @@ public class Pipeline {
this
.
id
=
id
;
}
public
Long
getIid
()
{
return
iid
;
}
public
void
setIid
(
Long
iid
)
{
this
.
iid
=
iid
;
}
public
Long
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Long
projectId
)
{
this
.
projectId
=
projectId
;
}
public
PipelineStatus
getStatus
()
{
return
status
;
}
...
...
@@ -42,6 +61,14 @@ public class Pipeline {
this
.
status
=
status
;
}
public
String
getSource
()
{
return
source
;
}
public
void
setSource
(
String
source
)
{
this
.
source
=
source
;
}
public
String
getRef
()
{
return
ref
;
}
...
...
src/main/java/org/gitlab4j/api/models/SearchBlob.java
View file @
fabfb5c0
...
...
@@ -7,7 +7,7 @@ public class SearchBlob {
private
String
basename
;
private
String
data
;
private
String
filename
;
private
Lo
ng
id
;
private
Stri
ng
id
;
private
String
ref
;
private
Integer
startline
;
private
Long
projectId
;
...
...
@@ -36,11 +36,11 @@ public class SearchBlob {
this
.
filename
=
filename
;
}
public
Lo
ng
getId
()
{
public
Stri
ng
getId
()
{
return
id
;
}
public
void
setId
(
Lo
ng
id
)
{
public
void
setId
(
Stri
ng
id
)
{
this
.
id
=
id
;
}
...
...
src/main/java/org/gitlab4j/api/webhook/EventChanges.java
View file @
fabfb5c0
...
...
@@ -114,12 +114,12 @@ public abstract class EventChanges {
}
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
ChangeContainer
<
T
>
get
(
String
property
){
public
<
T
>
ChangeContainer
<
T
>
get
(
String
property
)
{
if
(
otherProperties
.
containsKey
(
property
)){
if
(
otherProperties
.
containsKey
(
property
))
{
try
{
final
ChangeContainer
<
Object
>
container
=
otherProperties
.
get
(
property
);
// noinspection unchecked :
It's duty from caller to be sure to do that
// noinspection unchecked : It's duty from caller to be sure to do that
return
container
!=
null
?
(
ChangeContainer
<
T
>)
container
:
null
;
}
catch
(
ClassCastException
e
)
{
return
null
;
...
...
src/main/java/org/gitlab4j/api/webhook/MergeRequestChanges.java
View file @
fabfb5c0
package
org.gitlab4j.api.webhook
;
import
java.util.List
;
import
org.gitlab4j.api.models.Reviewer
;
public
class
MergeRequestChanges
extends
EventChanges
{
private
ChangeContainer
<
String
>
mergeStatus
;
private
ChangeContainer
<
List
<
Reviewer
>>
reviewers
;
public
ChangeContainer
<
String
>
getMergeStatus
()
{
return
mergeStatus
;
...
...
@@ -11,4 +16,13 @@ public class MergeRequestChanges extends EventChanges {
public
void
setMergeStatus
(
ChangeContainer
<
String
>
mergeStatus
)
{
this
.
mergeStatus
=
mergeStatus
;
}
public
ChangeContainer
<
List
<
Reviewer
>>
getReviewers
()
{
return
reviewers
;
}
public
void
setReviewers
(
ChangeContainer
<
List
<
Reviewer
>>
reviewers
)
{
this
.
reviewers
=
reviewers
;
}
}
src/test/java/org/gitlab4j/api/TestImportExportApi.java
View file @
fabfb5c0
...
...
@@ -138,7 +138,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
System
.
out
.
println
(
"Downloading exported project"
);
exportDownload
=
gitLabApi
.
getImportExportApi
().
downloadExport
(
testProject
,
null
);
assertNotNull
(
exportDownload
);
assertTrue
(
exportDownload
.
length
()
>
1
000
0
);
assertTrue
(
exportDownload
.
length
()
>
2
000
,
"length is not as expected. Current value: "
+
exportDownload
.
length
()
);
ImportStatus
importStatus
=
gitLabApi
.
getImportExportApi
().
startImport
(
null
,
exportDownload
,
TEST_IMPORT_PROJECT_NAME
,
true
,
null
);
...
...
src/test/java/org/gitlab4j/api/TestRepositorySubmodulesApi.java
0 → 100644
View file @
fabfb5c0
package
org.gitlab4j.api
;
import
static
org
.
gitlab4j
.
api
.
JsonUtils
.
compareJson
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertTrue
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
MockitoAnnotations
.
openMocks
;
import
java.io.IOException
;
import
jakarta.ws.rs.core.MultivaluedMap
;
import
org.gitlab4j.api.models.Commit
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.Captor
;
import
org.mockito.Mock
;
import
org.mockito.Mockito
;
public
class
TestRepositorySubmodulesApi
implements
Constants
{
@Mock
private
GitLabApi
gitLabApi
;
@Mock
private
GitLabApiClient
gitLabApiClient
;
@Captor
private
ArgumentCaptor
<
MultivaluedMap
<
String
,
String
>>
attributeCaptor
;
private
MockResponse
response
;
@BeforeEach
public
void
setUp
()
throws
Exception
{
openMocks
(
this
);
}
@Test
public
void
testUpdateExistingSubmoduleReference
()
throws
Exception
{
init
();
Commit
result
=
new
RepositorySubmodulesApi
(
gitLabApi
).
updateExistingSubmoduleReference
(
6L
,
"my-sub"
,
"patch-1"
,
"33e2ee8579fda5bc36accc9c6fbd0b4fefda9e30"
,
"message"
);
assertNotNull
(
result
);
assertTrue
(
compareJson
(
result
,
"commit.json"
));
}
private
void
init
()
throws
Exception
,
IOException
{
response
=
new
MockResponse
(
Commit
.
class
,
"commit.json"
,
null
);
when
(
gitLabApi
.
getApiClient
()).
thenReturn
(
gitLabApiClient
);
when
(
gitLabApiClient
.
validateSecretToken
(
any
())).
thenReturn
(
true
);
when
(
gitLabApiClient
.
put
(
attributeCaptor
.
capture
(),
Mockito
.
any
(
Object
[].
class
))).
thenReturn
(
response
);
}
}
src/test/resources/org/gitlab4j/api/commit.json
View file @
fabfb5c0
...
...
@@ -20,5 +20,18 @@
},
"status"
:
"running"
,
"url"
:
"http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d"
,
"web_url"
:
"http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d"
"web_url"
:
"http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d"
,
"project_id"
:
15
,
"last_pipeline"
:
{
"id"
:
16282
,
"iid"
:
688
,
"project_id"
:
15
,
"sha"
:
"6104942438c14ec7bd21c6cd5bd995272b3faff6"
,
"ref"
:
"patch-1"
,
"status"
:
"success"
,
"source"
:
"external"
,
"created_at"
:
"2023-04-03T21:17:04.026Z"
,
"updated_at"
:
"2023-04-03T21:17:04.157Z"
,
"web_url"
:
"http://localhost/diaspora/diaspora-project-site/-/pipelines/16282"
}
}
src/test/resources/org/gitlab4j/api/epic.json
View file @
fabfb5c0
...
...
@@ -2,16 +2,42 @@
"id"
:
30
,
"iid"
:
5
,
"group_id"
:
7
,
"parent_id"
:
3
,
"parent_iid"
:
8
,
"title"
:
"Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non."
,
"description"
:
"Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum."
,
"state"
:
"opened"
,
"web_url"
:
"http://gitlab.example.com/groups/test/-/epics/5"
,
"reference"
:
"&5"
,
"references"
:
{
"short"
:
"&5"
,
"relative"
:
"&5"
,
"full"
:
"test&5"
},
"author"
:{
"id"
:
7
,
"name"
:
"Pamella Huel"
,
"username"
:
"arnita"
,
"state"
:
"active"
,
"avatar_url"
:
"http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon"
,
"web_url"
:
"http://
localhost:3001
/arnita"
"web_url"
:
"http://
gitlab.example.com
/arnita"
},
"created_at"
:
"2018-01-21T06:21:13.165Z"
,
"updated_at"
:
"2018-01-22T12:41:41.166Z"
"start_date"
:
"2018-07-01T00:00:00Z"
,
"start_date_is_fixed"
:
false
,
"due_date"
:
"2018-07-31T00:00:00Z"
,
"due_date_is_fixed"
:
false
,
"due_date_from_inherited_source"
:
"2018-07-31T00:00:00Z"
,
"created_at"
:
"2018-07-17T13:36:22.770Z"
,
"updated_at"
:
"2018-07-18T12:22:05.239Z"
,
"closed_at"
:
"2018-08-18T12:22:05.239Z"
,
"labels"
:
[],
"upvotes"
:
4
,
"downvotes"
:
0
,
"color"
:
"#1068bf"
,
"subscribed"
:
true
,
"_links"
:{
"self"
:
"http://gitlab.example.com/api/v4/groups/7/epics/5"
,
"epic_issues"
:
"http://gitlab.example.com/api/v4/groups/7/epics/5/issues"
,
"group"
:
"http://gitlab.example.com/api/v4/groups/7"
}
}
\ No newline at end of file
src/test/resources/org/gitlab4j/api/event.json
View file @
fabfb5c0
{
"id"
:
2
,
"title"
:
"this is a title"
,
"project_id"
:
15
,
"action_name"
:
"pushed"
,
...
...
Prev
1
2
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