|
9 | 9 | import org.gitlab4j.api.models.Project;
|
10 | 10 | import org.gitlab4j.api.services.ExternalWikiService;
|
11 | 11 | import org.gitlab4j.api.services.JiraService;
|
| 12 | +import org.gitlab4j.api.services.MattermostService; |
12 | 13 | import org.gitlab4j.api.services.SlackService;
|
13 | 14 | import org.junit.Before;
|
14 | 15 | import org.junit.BeforeClass;
|
@@ -188,4 +189,41 @@ public void testDeleteExternalWikiService() throws GitLabApiException {
|
188 | 189 | assertNotNull(deleteExternalWikiService);
|
189 | 190 | assertFalse(deleteExternalWikiService.getActive());
|
190 | 191 | }
|
| 192 | + |
| 193 | + @Test |
| 194 | + public void testGetMattermostService() throws GitLabApiException { |
| 195 | + MattermostService service = gitLabApi.getServicesApi().getMattermostService(testProject); |
| 196 | + assertNotNull(service); |
| 197 | + } |
| 198 | + |
| 199 | + @Test |
| 200 | + public void testUpdateMattermostService() throws GitLabApiException { |
| 201 | + |
| 202 | + try { |
| 203 | + MattermostService service = new MattermostService() |
| 204 | + .withMergeRequestsEvents(true) |
| 205 | + .withWebhook("https://hooks.mattermost.com/services/ABCDEFGHI/KJLMNOPQR/wetrewq7897HKLH8998wfjjj") |
| 206 | + .withUsername("GitLab4J"); |
| 207 | + MattermostService updatedService = gitLabApi.getServicesApi().updateMattermostService(testProject, service); |
| 208 | + assertNotNull(updatedService); |
| 209 | + } finally { |
| 210 | + try { gitLabApi.getServicesApi().deleteMattermostService(testProject); } catch (Exception ignore) {} |
| 211 | + } |
| 212 | + } |
| 213 | + |
| 214 | + @Test |
| 215 | + public void testDeleteMattermostService() throws GitLabApiException { |
| 216 | + MattermostService service = new MattermostService() |
| 217 | + .withMergeRequestsEvents(true) |
| 218 | + .withWebhook("https://hooks.mattermost.com/services/ABCDEFGHI/KJLMNOPQR/wetrewq7897HKLH8998wfjjj") |
| 219 | + .withUsername("GitLab4J"); |
| 220 | + MattermostService updatedService = gitLabApi.getServicesApi().updateMattermostService(testProject, service); |
| 221 | + assertNotNull(updatedService); |
| 222 | + assertTrue(updatedService.getActive()); |
| 223 | + |
| 224 | + gitLabApi.getServicesApi().deleteMattermostService(testProject); |
| 225 | + MattermostService deleteMattermostService = gitLabApi.getServicesApi().getMattermostService(testProject); |
| 226 | + assertNotNull(deleteMattermostService); |
| 227 | + assertFalse(deleteMattermostService.getActive()); |
| 228 | + } |
191 | 229 | }
|
0 commit comments