Commit 98c4b996 authored by Jeremie Bresson's avatar Jeremie Bresson
Browse files

Merge branch 'main' into 6.x

And apply replacement:
* "javax.ws.rs.core" => "jakarta.ws.rs.core"

TestImportExportApi: change the file length expectation
parents 33ca0c5f ddd4304b
...@@ -16,6 +16,7 @@ import org.gitlab4j.api.models.IssueFilter; ...@@ -16,6 +16,7 @@ import org.gitlab4j.api.models.IssueFilter;
import org.gitlab4j.api.models.IssueLink; import org.gitlab4j.api.models.IssueLink;
import org.gitlab4j.api.models.IssuesStatistics; import org.gitlab4j.api.models.IssuesStatistics;
import org.gitlab4j.api.models.IssuesStatisticsFilter; import org.gitlab4j.api.models.IssuesStatisticsFilter;
import org.gitlab4j.api.models.LinkType;
import org.gitlab4j.api.models.MergeRequest; import org.gitlab4j.api.models.MergeRequest;
import org.gitlab4j.api.models.Participant; import org.gitlab4j.api.models.Participant;
import org.gitlab4j.api.models.TimeStats; import org.gitlab4j.api.models.TimeStats;
...@@ -889,10 +890,31 @@ public class IssuesApi extends AbstractApi implements Constants { ...@@ -889,10 +890,31 @@ public class IssuesApi extends AbstractApi implements Constants {
*/ */
public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid, public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid,
Object targetProjectIdOrPath, Long targetIssueIid) throws GitLabApiException { 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() GitLabApiForm formData = new GitLabApiForm()
.withParam("target_project_id", getProjectIdOrPath(targetProjectIdOrPath), true) .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(), Response response = post(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "links"); "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "links");
......
...@@ -69,7 +69,7 @@ public class Pager<T> implements Iterator<List<T>>, Constants { ...@@ -69,7 +69,7 @@ public class Pager<T> implements Iterator<List<T>>, Constants {
* @param pathArgs HTTP path arguments * @param pathArgs HTTP path arguments
* @throws GitLabApiException if any error occurs * @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); javaType = mapper.getTypeFactory().constructCollectionType(List.class, type);
......
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));
}
}
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));
}
}
...@@ -26,6 +26,7 @@ public class Commit { ...@@ -26,6 +26,7 @@ public class Commit {
private String title; private String title;
private String url; private String url;
private String webUrl; private String webUrl;
private Long projectId;
private Pipeline lastPipeline; private Pipeline lastPipeline;
public Author getAuthor() { public Author getAuthor() {
...@@ -172,6 +173,14 @@ public class Commit { ...@@ -172,6 +173,14 @@ public class Commit {
this.webUrl = webUrl; this.webUrl = webUrl;
} }
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public Pipeline getLastPipeline() { public Pipeline getLastPipeline() {
return lastPipeline; return lastPipeline;
} }
......
...@@ -2,22 +2,66 @@ package org.gitlab4j.api.models; ...@@ -2,22 +2,66 @@ package org.gitlab4j.api.models;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
import org.gitlab4j.api.utils.JacksonJson; 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 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 id;
private Long iid; private Long iid;
private Long groupId; private Long groupId;
private Long parentId;
private Long parentIid;
private String title; private String title;
private String description; private String description;
private EpicState state;
private String webUrl;
private String reference;
private References references;
private Author author; private Author author;
private List<String> labels; private List<String> labels;
private Date startDate; private Date startDate;
private Boolean startDateIsFixed;
private Date dueDate;
private Boolean dueDateIsFixed;
private Date dueDateFromInheritedSource;
private Date endDate; private Date endDate;
private Date createdAt; private Date createdAt;
private Date updatedAt; 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() { public Long getId() {
return id; return id;
...@@ -43,6 +87,22 @@ public class Epic { ...@@ -43,6 +87,22 @@ public class Epic {
this.groupId = groupId; 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() { public String getTitle() {
return title; return title;
} }
...@@ -69,6 +129,38 @@ public class Epic { ...@@ -69,6 +129,38 @@ public class Epic {
return (this); 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() { public Author getAuthor() {
return author; return author;
} }
...@@ -108,6 +200,38 @@ public class Epic { ...@@ -108,6 +200,38 @@ public class Epic {
return (this); 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() { public Date getEndDate() {
return endDate; return endDate;
} }
...@@ -137,7 +261,63 @@ public class Epic { ...@@ -137,7 +261,63 @@ public class Epic {
this.updatedAt = updatedAt; 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() { public String toString() {
return (JacksonJson.toJsonString(this)); return (JacksonJson.toJsonString(this));
} }
......
...@@ -8,6 +8,7 @@ import org.gitlab4j.api.utils.JacksonJson; ...@@ -8,6 +8,7 @@ import org.gitlab4j.api.utils.JacksonJson;
public class Event { public class Event {
private Long id;
private String actionName; private String actionName;
private Author author; private Author author;
private Long authorId; private Long authorId;
...@@ -24,6 +25,14 @@ public class Event { ...@@ -24,6 +25,14 @@ public class Event {
private Note note; private Note note;
private PushData pushData; private PushData pushData;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getActionName() { public String getActionName() {
return actionName; return actionName;
} }
......
...@@ -2,226 +2,17 @@ ...@@ -2,226 +2,17 @@
package org.gitlab4j.api.models; package org.gitlab4j.api.models;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.gitlab4j.api.Constants.IssueState;
import org.gitlab4j.api.utils.JacksonJson; import org.gitlab4j.api.utils.JacksonJson;
import com.fasterxml.jackson.annotation.JsonIgnore; public class Issue extends AbstractIssue {
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 {
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 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() { private Long issueLinkId;
return labels; private LinkType linkType;
} private Date linkCreatedAt;
private Date linkUpdatedAt;
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 Boolean getSubscribed() { public Boolean getSubscribed() {
return subscribed; return subscribed;
...@@ -231,124 +22,36 @@ public class Issue { ...@@ -231,124 +22,36 @@ public class Issue {
this.subscribed = subscribed; this.subscribed = subscribed;
} }
public String getTitle() { public Long getIssueLinkId() {
return title; return issueLinkId;
}
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) { public void setIssueLinkId(Long issueLinkId) {
this.mergeRequestsCount = mergeRequestsCount; this.issueLinkId = issueLinkId;
} }
public Boolean getHasTasks() { public LinkType getLinkType() {
return hasTasks; return linkType;
} }
public void setHasTasks(Boolean hasTasks) { public void setLinkType(LinkType linkType) {
this.hasTasks = hasTasks; this.linkType = linkType;
} }
public String getTaskStatus() { public Date getLinkCreatedAt() {
return taskStatus; return linkCreatedAt;
} }
public void setTaskStatus(String taskStatus) { public void setLinkCreatedAt(Date linkCreatedAt) {
this.taskStatus = taskStatus; this.linkCreatedAt = linkCreatedAt;
} }
public TaskCompletionStatus getTaskCompletionStatus() { public Date getLinkUpdatedAt() {
return taskCompletionStatus; return linkUpdatedAt;
} }
public void setTaskCompletionStatus(TaskCompletionStatus taskCompletionStatus) { public void setLinkUpdatedAt(Date linkUpdatedAt) {
this.taskCompletionStatus = taskCompletionStatus; this.linkUpdatedAt = linkUpdatedAt;
} }
@Override @Override
......
...@@ -6,6 +6,7 @@ public class IssueLink { ...@@ -6,6 +6,7 @@ public class IssueLink {
private Issue sourceIssue; private Issue sourceIssue;
private Issue targetIssue; private Issue targetIssue;
private LinkType linkType;
public Issue getSourceIssue() { public Issue getSourceIssue() {
return sourceIssue; return sourceIssue;
...@@ -23,6 +24,14 @@ public class IssueLink { ...@@ -23,6 +24,14 @@ public class IssueLink {
this.targetIssue = targetIssue; this.targetIssue = targetIssue;
} }
public LinkType getLinkType() {
return linkType;
}
public void setLinkType(LinkType linkType) {
this.linkType = linkType;
}
@Override @Override
public String toString() { public String toString() {
return (JacksonJson.toJsonString(this)); return (JacksonJson.toJsonString(this));
......
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));
}
}
...@@ -8,8 +8,10 @@ import org.gitlab4j.api.utils.JacksonJson; ...@@ -8,8 +8,10 @@ import org.gitlab4j.api.utils.JacksonJson;
public class Pipeline { public class Pipeline {
private Long id; private Long id;
private Long iid;
private Long projectId; private Long projectId;
private PipelineStatus status; private PipelineStatus status;
private String source;
private String ref; private String ref;
private String sha; private String sha;
private String beforeSha; private String beforeSha;
...@@ -35,6 +37,14 @@ public class Pipeline { ...@@ -35,6 +37,14 @@ public class Pipeline {
this.id = id; this.id = id;
} }
public Long getIid() {
return iid;
}
public void setIid(Long iid) {
this.iid = iid;
}
public Long getProjectId() { public Long getProjectId() {
return projectId; return projectId;
} }
...@@ -51,6 +61,14 @@ public class Pipeline { ...@@ -51,6 +61,14 @@ public class Pipeline {
this.status = status; this.status = status;
} }
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getRef() { public String getRef() {
return ref; return ref;
} }
......
...@@ -7,7 +7,7 @@ public class SearchBlob { ...@@ -7,7 +7,7 @@ public class SearchBlob {
private String basename; private String basename;
private String data; private String data;
private String filename; private String filename;
private Long id; private String id;
private String ref; private String ref;
private Integer startline; private Integer startline;
private Long projectId; private Long projectId;
...@@ -36,11 +36,11 @@ public class SearchBlob { ...@@ -36,11 +36,11 @@ public class SearchBlob {
this.filename = filename; this.filename = filename;
} }
public Long getId() { public String getId() {
return id; return id;
} }
public void setId(Long id) { public void setId(String id) {
this.id = id; this.id = id;
} }
......
...@@ -138,7 +138,7 @@ public class TestImportExportApi extends AbstractIntegrationTest { ...@@ -138,7 +138,7 @@ public class TestImportExportApi extends AbstractIntegrationTest {
System.out.println("Downloading exported project"); System.out.println("Downloading exported project");
exportDownload = gitLabApi.getImportExportApi().downloadExport(testProject, null); exportDownload = gitLabApi.getImportExportApi().downloadExport(testProject, null);
assertNotNull(exportDownload); assertNotNull(exportDownload);
assertTrue(exportDownload.length() > 10000); assertTrue(exportDownload.length() > 2000, "length is not as expected. Current value: " + exportDownload.length());
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);
......
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.<Object>any())).thenReturn(response);
}
}
...@@ -20,5 +20,18 @@ ...@@ -20,5 +20,18 @@
}, },
"status": "running", "status": "running",
"url": "http://localhost/diaspora/diaspora-project-site/-/commit/9df4dd1f0dfae80c05eac4b2bd461b86db5c8e2d", "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"
}
} }
...@@ -2,16 +2,42 @@ ...@@ -2,16 +2,42 @@
"id": 30, "id": 30,
"iid": 5, "iid": 5,
"group_id": 7, "group_id": 7,
"parent_id": 3,
"parent_iid": 8,
"title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.", "title": "Ea cupiditate dolores ut vero consequatur quasi veniam voluptatem et non.",
"description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.", "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":{ "author":{
"id": 7, "id": 7,
"name": "Pamella Huel", "name": "Pamella Huel",
"username": "arnita", "username": "arnita",
"state": "active", "state": "active",
"avatar_url": "http://www.gravatar.com/avatar/a2f5c6fcef64c9c69cb8779cb292be1b?s=80&d=identicon", "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", "start_date": "2018-07-01T00:00:00Z",
"updated_at": "2018-01-22T12:41:41.166Z" "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
{ {
"id": 2,
"title": "this is a title", "title": "this is a title",
"project_id": 15, "project_id": 15,
"action_name": "pushed", "action_name": "pushed",
......
[ [
{ {
"id": 8,
"title": "no title", "title": "no title",
"project_id": 15, "project_id": 15,
"action_name": "closed", "action_name": "closed",
"target_id": 830, "target_id": 830,
"target_iid": 160,
"target_type": "Issue", "target_type": "Issue",
"author_id": 1, "author_id": 1,
"target_title": "Public project search field", "target_title": "Public project search field",
"created_at": "2017-02-09T10:43:19.667Z",
"author": { "author": {
"name": "Dmitriy Zaporozhets", "name": "Dmitriy Zaporozhets",
"username": "root", "username": "root",
...@@ -18,6 +21,7 @@ ...@@ -18,6 +21,7 @@
"author_username": "root" "author_username": "root"
}, },
{ {
"id": 9,
"title": "no title 2", "title": "no title 2",
"project_id": 15, "project_id": 15,
"action_name": "pushed", "action_name": "pushed",
...@@ -42,6 +46,7 @@ ...@@ -42,6 +46,7 @@
} }
}, },
{ {
"id": 21,
"project_id": 15, "project_id": 15,
"action_name": "closed", "action_name": "closed",
"target_id": 840, "target_id": 840,
...@@ -59,10 +64,12 @@ ...@@ -59,10 +64,12 @@
"author_username": "root" "author_username": "root"
}, },
{ {
"id": 10,
"title": "no title again", "title": "no title again",
"project_id": 15, "project_id": 15,
"action_name": "commented on", "action_name": "commented on",
"target_id": 1312, "target_id": 1312,
"target_iid": 1312,
"target_type": "Note", "target_type": "Note",
"author_id": 1, "author_id": 1,
"created_at": "2015-12-04T10:33:58.089Z", "created_at": "2015-12-04T10:33:58.089Z",
...@@ -80,7 +87,8 @@ ...@@ -80,7 +87,8 @@
"created_at": "2015-12-04T10:33:56.698Z", "created_at": "2015-12-04T10:33:56.698Z",
"system": false, "system": false,
"noteable_id": 377, "noteable_id": 377,
"noteable_type": "Issue" "noteable_type": "Issue",
"noteable_iid": 377
}, },
"author": { "author": {
"name": "Dmitriy Zaporozhets", "name": "Dmitriy Zaporozhets",
......
...@@ -46,5 +46,6 @@ ...@@ -46,5 +46,6 @@
"user_notes_count": 0, "user_notes_count": 0,
"web_url": "http://example.com/example/example/issues/14", "web_url": "http://example.com/example/example/issues/14",
"confidential": false "confidential": false
} },
"link_type": "is_blocked_by"
} }
\ No newline at end of file
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
"subscribed" : true, "subscribed" : true,
"user_notes_count": 0, "user_notes_count": 0,
"web_url": "http://example.com/example/example/issues/14", "web_url": "http://example.com/example/example/issues/14",
"confidential": false "confidential": false,
"link_type": "relates_to",
"link_created_at": "2016-01-07T12:44:33.959Z",
"link_updated_at": "2016-01-07T12:44:33.959Z"
} }
] ]
\ No newline at end of file
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