Unverified Commit b1ea42e3 authored by Julien Millau's avatar Julien Millau Committed by GitHub
Browse files

Add instance, group, project audit events (#584)

parent b2dedc5f
......@@ -268,6 +268,7 @@ The following is a list of the available sub APIs along with a sample use of eac
---
&nbsp;&nbsp;[ApplicationsApi](#applicationsapi)<br/>
&nbsp;&nbsp;[ApplicationSettingsApi](#applicationsettingsapi)<br/>
&nbsp;&nbsp;[AuditEventApi](#auditeventapi)<br/>
&nbsp;&nbsp;[AwardEmojiApi](#awardemojiapi)<br/>
&nbsp;&nbsp;[BoardsApi](#boardsapi)<br/>
&nbsp;&nbsp;[CommitsApi](#commitsapi)<br/>
......@@ -326,6 +327,15 @@ gitLabApi.getApplicationsApi().createApplication("My OAUTH Application", "https/
ApplicationSettings appSettings = gitLabApi.getApplicationSettingsApi().getAppliationSettings();
```
#### AuditEventApi
```java
// Get the current GitLab server audit events for entity
// This uses the ISO8601 date utilities the in org.gitlab4j.api.utils.ISO8601 class
Date since = ISO8601.toDate("2017-01-01T00:00:00Z");
Date until = new Date(); // now
List<AuditEvent> auditEvents = gitLabApi.getAuditEventApi().getAuditEvents(since, until, EntityType.USER, 1);
```
#### AwardEmojiApi
```java
// Get a list of AwardEmoji belonging to the specified issue (group ID = 1, issues IID = 1)
......
......@@ -155,7 +155,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<version>3.2.0</version>
<configuration>
<source>8</source>
</configuration>
......
package org.gitlab4j.api;
import org.gitlab4j.api.models.AuditEvent;
import org.gitlab4j.api.utils.ISO8601;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.Response;
import java.util.Date;
import java.util.List;
import java.util.stream.Stream;
/**
* This class implements the client side API for the GitLab Instance Audit Event API.
* See <a href="https://docs.gitlab.com/ee/api/audit_events.html">Audit Event API at GitLab</a> for more information.
*/
public class AuditEventApi extends AbstractApi {
public AuditEventApi(GitLabApi gitLabApi) {
super(gitLabApi);
}
/**
* Get a List of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /audit_events/</code></pre>
*
* @param created_after Return group audit events created on or after the given time.
* @param created_before Return group audit events created on or before the given time.
* @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project.
* @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present.
* @return a List of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Integer entityId) throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).all());
}
/**
* Get a Pager of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /audit_events</code></pre>
*
* @param created_after Return group audit events created on or after the given time.
* @param created_before Return group audit events created on or before the given time.
* @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project.
* @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Integer entityId, int itemsPerPage) throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_before, false))
.withParam("created_after", ISO8601.toString(created_after, false))
.withParam("entity_type", entityType)
.withParam("entity_id", entityId);
return (new Pager<AuditEvent>(this, AuditEvent.class, itemsPerPage, form.asMap(), "audit_events"));
}
/**
* Get a Stream of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /audit_events</code></pre>
*
* @param created_after Return group audit events created on or after the given time.
* @param created_before Return group audit events created on or before the given time.
* @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project.
* @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present.
* @return a Stream of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Date created_after, Date created_before, String entityType, Integer entityId) throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage()).stream());
}
/**
* Get a specific instance audit event.
*
* <pre><code>GitLab Endpoint: GET /audit_events/:id</code></pre>
*
* @param auditEventId the auditEventId, required
* @return the group Audit event
* @throws GitLabApiException if any exception occurs
*/
public AuditEvent getAuditEvent(Integer auditEventId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "audit_events", auditEventId);
return (response.readEntity(AuditEvent.class));
}
}
package org.gitlab4j.api;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.Constants.TokenType;
import org.gitlab4j.api.models.OauthTokenResponse;
import org.gitlab4j.api.models.User;
......@@ -19,6 +8,16 @@ import org.gitlab4j.api.utils.MaskingLoggingFilter;
import org.gitlab4j.api.utils.Oauth2LoginStreamingOutput;
import org.gitlab4j.api.utils.SecretString;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* This class is provides a simplified interface to a GitLab API server, and divides the API up into
* a separate API class for each concern.
......@@ -51,6 +50,7 @@ public class GitLabApi implements AutoCloseable {
private ApplicationsApi applicationsApi;
private ApplicationSettingsApi applicationSettingsApi;
private AuditEventApi auditEventApi;
private AwardEmojiApi awardEmojiApi;
private BoardsApi boardsApi;
private CommitsApi commitsApi;
......@@ -547,7 +547,7 @@ public class GitLabApi implements AutoCloseable {
/**
* Enable the logging of the requests to and the responses from the GitLab server API using the
* specified logger. Logging will NOT include entity logging and will mask PRIVATE-TOKEN
* specified logger. Logging will NOT include entity logging and will mask PRIVATE-TOKEN
* and Authorization headers..
*
* @param logger the Logger instance to log to
......@@ -846,6 +846,25 @@ public class GitLabApi implements AutoCloseable {
return (applicationSettingsApi);
}
/**
* Gets the AuditEventApi instance owned by this GitLabApi instance. The AuditEventApi is used
* to perform all instance audit event API calls.
*
* @return the AuditEventApi instance owned by this GitLabApi instance
*/
public AuditEventApi getAuditEventApi() {
if (auditEventApi == null) {
synchronized (this) {
if (auditEventApi == null) {
auditEventApi = new AuditEventApi(this);
}
}
}
return (auditEventApi);
}
/**
* Gets the AwardEmojiApi instance owned by this GitLabApi instance. The AwardEmojiApi is used
* to perform all award emoji related API calls.
......
package org.gitlab4j.api;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.models.AccessRequest;
import org.gitlab4j.api.models.AuditEvent;
import org.gitlab4j.api.models.Badge;
import org.gitlab4j.api.models.Group;
import org.gitlab4j.api.models.GroupFilter;
......@@ -22,6 +13,16 @@ import org.gitlab4j.api.models.Member;
import org.gitlab4j.api.models.Project;
import org.gitlab4j.api.models.Variable;
import org.gitlab4j.api.models.Visibility;
import org.gitlab4j.api.utils.ISO8601;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
/**
* This class implements the client side API for the GitLab groups calls.
......@@ -29,6 +30,7 @@ import org.gitlab4j.api.models.Visibility;
* @see <a href="https://docs.gitlab.com/ce/api/members.html">Group and project members API at GitLab</a>
* @see <a href="https://docs.gitlab.com/ce/api/access_requests.html">Group and project access requests API</a>
* @see <a href="https://docs.gitlab.com/ce/api/group_badges.html">Group badges API</a>
* @see <a href="https://docs.gitlab.com/ee/api/audit_events.html#retrieve-all-group-audit-events">Group audit events API</a>
*/
public class GroupApi extends AbstractApi {
......@@ -1356,7 +1358,7 @@ public class GroupApi extends AbstractApi {
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
* @return the transfered Project instance
* @return the transferred Project instance
* @throws GitLabApiException if any exception occurs during execution
*/
public Project transferProject(Object groupIdOrPath, Object projectIdOrPath) throws GitLabApiException {
......@@ -1365,6 +1367,71 @@ public class GroupApi extends AbstractApi {
return (response.readEntity(Project.class));
}
/**
* Get a List of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @return a List of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Object groupIdOrPath, Date created_after, Date created_before) throws GitLabApiException {
return (getAuditEvents(groupIdOrPath, created_after, created_before, getDefaultPerPage()).all());
}
/**
* Get a Pager of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(Object groupIdOrPath, Date created_after, Date created_before, int itemsPerPage) throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_after, false))
.withParam("created_after", ISO8601.toString(created_before, false));
return (new Pager<AuditEvent>(this, AuditEvent.class, itemsPerPage, form.asMap(),
"groups", getGroupIdOrPath(groupIdOrPath), "audit_events"));
}
/**
* Get a Stream of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @return a Stream of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Object groupIdOrPath, Date created_after, Date created_before) throws GitLabApiException {
return (getAuditEvents(groupIdOrPath, created_after, created_before, getDefaultPerPage()).stream());
}
/**
* Get a specific audit event of a group.
*
* <pre><code>GitLab Endpoint: GET /groups/:id/audit_events/:id_audit_event</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param auditEventId the auditEventId, required
* @return the group Audit event
* @throws GitLabApiException if any exception occurs
*/
public AuditEvent getAuditEvent(Object groupIdOrPath, Integer auditEventId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "audit_events", auditEventId);
return (response.readEntity(AuditEvent.class));
}
/**
* Get a List of the group access requests viewable by the authenticated user.
*
......
......@@ -23,25 +23,12 @@
package org.gitlab4j.api;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.gitlab4j.api.GitLabApi.ApiVersion;
import org.gitlab4j.api.models.AccessLevel;
import org.gitlab4j.api.models.AccessRequest;
import org.gitlab4j.api.models.ApprovalRule;
import org.gitlab4j.api.models.ApprovalRuleParams;
import org.gitlab4j.api.models.AuditEvent;
import org.gitlab4j.api.models.Badge;
import org.gitlab4j.api.models.Event;
import org.gitlab4j.api.models.FileUpload;
......@@ -58,16 +45,31 @@ import org.gitlab4j.api.models.PushRules;
import org.gitlab4j.api.models.Snippet;
import org.gitlab4j.api.models.Variable;
import org.gitlab4j.api.models.Visibility;
import org.gitlab4j.api.utils.ISO8601;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
/**
* This class provides an entry point to all the GitLab API project calls.
*
*
* @see <a href="https://docs.gitlab.com/ce/api/projects.html">Projects API at GitLab</a>
* @see <a href="https://docs.gitlab.com/ce/api/project_statistics.html">Project statistics API</a>
* @see <a href="https://docs.gitlab.com/ce/api/members.html">Group and project members API at GitLab</a>
* @see <a href="https://docs.gitlab.com/ce/api/access_requests.html#group-and-project-access-requests-api">Group and project access requests API</a>
* @see <a href="https://docs.gitlab.com/ee/api/project_badges.html">Project badges API</a>
* @see <a href="https://docs.gitlab.com/ce/api/merge_request_approvals.html">
* @see <a href="https://docs.gitlab.com/ee/api/audit_events.html#retrieve-all-project-audit-events">Project audit events API</a>
* Merge request approvals API (Project-level) at GitLab</a>
*/
public class ProjectApi extends AbstractApi implements Constants {
......@@ -1559,7 +1561,7 @@ public class ProjectApi extends AbstractApi implements Constants {
return (GitLabApi.createOptionalFromException(glae));
}
}
/**
* Gets a project team member, optionally including inherited member.
*
......@@ -2732,6 +2734,71 @@ public class ProjectApi extends AbstractApi implements Constants {
return (response.readEntity(Project.class));
}
/**
* Get a List of the project audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @return a List of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Object projectIdOrPath, Date created_after, Date created_before) throws GitLabApiException {
return (getAuditEvents(projectIdOrPath, created_after, created_before, getDefaultPerPage()).all());
}
/**
* Get a Pager of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(Object projectIdOrPath, Date created_after, Date created_before, int itemsPerPage) throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_before, false))
.withParam("created_after", ISO8601.toString(created_after, false));
return (new Pager<AuditEvent>(this, AuditEvent.class, itemsPerPage, form.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "audit_events"));
}
/**
* Get a Stream of the group audit events viewable by Maintainer or an Owner of the group.
*
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @return a Stream of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Object projectIdOrPath, Date created_after, Date created_before) throws GitLabApiException {
return (getAuditEvents(projectIdOrPath, created_after, created_before, getDefaultPerPage()).stream());
}
/**
* Get a specific audit event of a project.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/audit_events/:id_audit_event</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path
* @param auditEventId the auditEventId, required
* @return the project Audit event
* @throws GitLabApiException if any exception occurs
*/
public AuditEvent getAuditEvent(Object projectIdOrPath, Integer auditEventId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "audit_events", auditEventId);
return (response.readEntity(AuditEvent.class));
}
/**
* Get list of a project's variables.
*
......@@ -2867,7 +2934,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param value the value for the variable, required
* @param variableType the type of variable. Available types are: env_var (default) and file
* @param isProtected whether the variable is protected, optional
* @param isMasked whether the variable is masked, optional
* @param isMasked whether the variable is masked, optional
* @return a Variable instance with the newly created variable
* @throws GitLabApiException if any exception occurs during execution
*/
......@@ -2888,7 +2955,7 @@ public class ProjectApi extends AbstractApi implements Constants {
* @param value the value for the variable, required
* @param variableType the type of variable. Available types are: env_var (default) and file
* @param isProtected whether the variable is protected, optional
* @param isMasked whether the variable is masked, optional
* @param isMasked whether the variable is masked, optional
* @param environmentScope the environment_scope of the variable, optional
* @return a Variable instance with the newly created variable
* @throws GitLabApiException if any exception occurs during execution
......
package org.gitlab4j.api.models;
import org.gitlab4j.api.utils.JacksonJson;
import java.util.Date;
public class AuditEvent {
private Integer id;
private Integer authorId;
private Integer entityId;
private String entityType;
private AuditEventDetail details;
private Date createdAt;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAuthorId() {
return authorId;
}
public void setAuthorId(Integer authorId) {
this.authorId = authorId;
}
public Integer getEntityId() {
return entityId;
}
public void setEntityId(Integer entityId) {
this.entityId = entityId;
}
public String getEntityType() {
return entityType;
}
public void setEntityType(String entityType) {
this.entityType = entityType;
}
public AuditEventDetail getDetails() {
return details;
}
public void setDetails(AuditEventDetail details) {
this.details = details;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
package org.gitlab4j.api.models;
import org.gitlab4j.api.utils.JacksonJson;
public class AuditEventDetail {
private String change;
private String from;
private String to;
private String add;
private String customMessage;
private String authorName;
private Object targetId;
private String targetType;
private String targetDetails;
private String ipAddress;
private String entityPath;
public String getCustomMessage() {
return customMessage;
}
public void setCustomMessage(String customMessage) {
this.customMessage = customMessage;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public Object getTargetId() {
return targetId;
}
public void setTargetId(Object targetId) {
this.targetId = targetId;
}
public String getTargetType() {
return targetType;
}
public void setTargetType(String targetType) {
this.targetType = targetType;
}
public String getTargetDetails() {
return targetDetails;
}
public void setTargetDetails(String targetDetails) {
this.targetDetails = targetDetails;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getEntityPath() {
return entityPath;
}
public void setEntityPath(String entityPath) {
this.entityPath = entityPath;
}
public String getChange() {
return change;
}
public void setChange(String change) {
this.change = change;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getAdd() {
return add;
}
public void setAdd(String add) {
this.add = add;
}
@Override
public String toString() {
return (JacksonJson.toJsonString(this));
}
}
......@@ -23,21 +23,13 @@
package org.gitlab4j.api;
import static org.gitlab4j.api.JsonUtils.compareJson;
import static org.gitlab4j.api.JsonUtils.readTreeFromResource;
import static org.gitlab4j.api.JsonUtils.unmarshalResource;
import static org.gitlab4j.api.JsonUtils.unmarshalResourceList;
import static org.gitlab4j.api.JsonUtils.unmarshalResourceMap;
import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import org.gitlab4j.api.models.AccessRequest;
import org.gitlab4j.api.models.Application;
import org.gitlab4j.api.models.ApplicationSettings;
import org.gitlab4j.api.models.ApprovalRule;
import org.gitlab4j.api.models.ArtifactsFile;
import org.gitlab4j.api.models.AuditEvent;
import org.gitlab4j.api.models.AwardEmoji;
import org.gitlab4j.api.models.Badge;
import org.gitlab4j.api.models.Blame;
......@@ -111,7 +103,15 @@ import org.gitlab4j.api.services.JiraService;
import org.gitlab4j.api.services.SlackService;
import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.List;
import java.util.Map;
import static org.gitlab4j.api.JsonUtils.compareJson;
import static org.gitlab4j.api.JsonUtils.readTreeFromResource;
import static org.gitlab4j.api.JsonUtils.unmarshalResource;
import static org.gitlab4j.api.JsonUtils.unmarshalResourceList;
import static org.gitlab4j.api.JsonUtils.unmarshalResourceMap;
import static org.junit.Assert.assertTrue;
public class TestGitLabApiBeans {
......@@ -127,6 +127,12 @@ public class TestGitLabApiBeans {
assertTrue(compareJson(applications, "applications.json"));
}
@Test
public void testAuditEvent() throws Exception {
List<AuditEvent> auditEvents = unmarshalResourceList(AuditEvent.class, "audit-events.json");
assertTrue(compareJson(auditEvents, "audit-events.json"));
}
@Test
public void testAwardEmoji() throws Exception {
AwardEmoji awardEmoji = unmarshalResource(AwardEmoji.class, "award-emoji.json");
......
[
{
"id": 1,
"author_id": 1,
"entity_id": 6,
"entity_type": "Project",
"details": {
"custom_message": "Project archived",
"author_name": "Administrator",
"target_id": "flightjs/flight",
"target_type": "Project",
"target_details": "flightjs/flight",
"ip_address": "127.0.0.1",
"entity_path": "flightjs/flight"
},
"created_at": "2019-08-30T07:00:41.885Z"
},
{
"id": 2,
"author_id": 1,
"entity_id": 60,
"entity_type": "Group",
"details": {
"add": "group",
"author_name": "Administrator",
"target_id": "flightjs",
"target_type": "Group",
"target_details": "flightjs",
"ip_address": "127.0.0.1",
"entity_path": "flightjs"
},
"created_at": "2019-08-27T18:36:44.162Z"
},
{
"id": 3,
"author_id": 51,
"entity_id": 51,
"entity_type": "User",
"details": {
"change": "email address",
"from": "hello@flightjs.com",
"to": "maintainer@flightjs.com",
"author_name": "Andreas",
"target_id": 51,
"target_type": "User",
"target_details": "Andreas",
"entity_path": "Andreas"
},
"created_at": "2019-08-22T16:34:25.639Z"
}
]
[
{
"id": 5,
"author_id": 1,
"entity_id": 7,
"entity_type": "Project",
"details": {
"change": "prevent merge request approval from reviewers",
"from": "",
"to": "true",
"author_name": "Administrator",
"target_id": 7,
"target_type": "Project",
"target_details": "twitter/typeahead-js",
"ip_address": "127.0.0.1",
"entity_path": "twitter/typeahead-js"
},
"created_at": "2020-05-26T22:55:04.230Z"
},
{
"id": 4,
"author_id": 1,
"entity_id": 7,
"entity_type": "Project",
"details": {
"change": "prevent merge request approval from authors",
"from": "false",
"to": "true",
"author_name": "Administrator",
"target_id": 7,
"target_type": "Project",
"target_details": "twitter/typeahead-js",
"ip_address": "127.0.0.1",
"entity_path": "twitter/typeahead-js"
},
"created_at": "2020-05-26T22:55:04.218Z"
}
]
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