Skip to content

Commit 4844253

Browse files
add tests
1 parent c527984 commit 4844253

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

src/test/java/org/gitlab4j/api/TestGitLabApiEvents.java

+7-11
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,7 @@
2525
import org.gitlab4j.api.systemhooks.SystemHookManager;
2626
import org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent;
2727
import org.gitlab4j.api.utils.JacksonJson;
28-
import org.gitlab4j.api.webhook.BuildEvent;
29-
import org.gitlab4j.api.webhook.ChangeContainer;
30-
import org.gitlab4j.api.webhook.Event;
31-
import org.gitlab4j.api.webhook.IssueEvent;
32-
import org.gitlab4j.api.webhook.JobEvent;
33-
import org.gitlab4j.api.webhook.MergeRequestEvent;
34-
import org.gitlab4j.api.webhook.NoteEvent;
35-
import org.gitlab4j.api.webhook.PipelineEvent;
36-
import org.gitlab4j.api.webhook.PushEvent;
37-
import org.gitlab4j.api.webhook.TagPushEvent;
38-
import org.gitlab4j.api.webhook.WikiPageEvent;
28+
import org.gitlab4j.api.webhook.*;
3929
import org.junit.jupiter.api.AfterAll;
4030
import org.junit.jupiter.api.BeforeAll;
4131
import org.junit.jupiter.api.Test;
@@ -65,6 +55,12 @@ public static void teardown() {
6555
GitLabApi.getLogger().setLevel(savedLevel);
6656
}
6757

58+
@Test
59+
public void testDeploymentEvent() throws Exception {
60+
Event event = unmarshalResource(DeploymentEvent.class, "deployment-event.json");
61+
assertTrue(compareJson(event, "deployment-event.json"));
62+
}
63+
6864
@Test
6965
public void testIssueEvent() throws Exception {
7066

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"commit_title": "Add new file",
3+
"commit_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/commit/279484c09fbe69ededfced8c1bb6e6d24616b468",
4+
"deployment_id": 15,
5+
"deployable_id": 796,
6+
"deployable_url": "http://10.126.0.2:3000/root/test-deployment-webhooks/-/jobs/796",
7+
"environment": "staging",
8+
"object_kind": "deployment",
9+
"project": {
10+
"ci_config_path": "",
11+
"default_branch": "master",
12+
"description": "",
13+
"git_http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git",
14+
"git_ssh_url": "ssh://[email protected]:2222/root/test-deployment-webhooks.git",
15+
"homepage": "http://10.126.0.2:3000/root/test-deployment-webhooks",
16+
"http_url": "http://10.126.0.2:3000/root/test-deployment-webhooks.git",
17+
"id": 30,
18+
"name": "test-deployment-webhooks",
19+
"namespace": "Administrator",
20+
"path_with_namespace": "root/test-deployment-webhooks",
21+
"ssh_url": "ssh://[email protected]:2222/root/test-deployment-webhooks.git",
22+
"url": "ssh://[email protected]:2222/root/test-deployment-webhooks.git",
23+
"visibility_level": 0,
24+
"web_url": "http://10.126.0.2:3000/root/test-deployment-webhooks"
25+
},
26+
"short_sha": "279484c0",
27+
"status": "success",
28+
"status_changed_at": "2021-04-28 21:50:00 +0200",
29+
"user": {
30+
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
31+
"email": "[email protected]",
32+
"id": 1,
33+
"name": "Administrator",
34+
"username": "root"
35+
},
36+
"user_url": "http://10.126.0.2:3000/root"
37+
}

src/test/resources/org/gitlab4j/api/environment.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"external_url": "https://review-fix-foo-dfjre3.example.gitlab.com",
66
"state": "available",
77
"tier": "testing",
8+
"auto_stop_at": "2024-11-27T13:34:49.812Z",
89
"last_deployment": {
910
"id": 100,
1011
"iid": 34,

0 commit comments

Comments
 (0)