|
18 | 18 | */ |
19 | 19 | package org.dependencytrack.resources.v1; |
20 | 20 |
|
| 21 | +import java.util.HashSet; |
| 22 | +import java.util.Set; |
21 | 23 | import java.util.UUID; |
22 | 24 |
|
23 | 25 | import org.dependencytrack.JerseyTestRule; |
24 | 26 | import org.dependencytrack.ResourceTest; |
25 | 27 | import org.dependencytrack.model.ConfigPropertyConstants; |
26 | 28 | import org.dependencytrack.model.NotificationPublisher; |
27 | 29 | import org.dependencytrack.model.NotificationRule; |
| 30 | +import org.dependencytrack.notification.NotificationGroup; |
28 | 31 | import org.dependencytrack.notification.NotificationScope; |
29 | 32 | import org.dependencytrack.notification.publisher.DefaultNotificationPublishers; |
30 | 33 | import org.dependencytrack.notification.publisher.Publisher; |
@@ -347,7 +350,15 @@ public void testNotificationRuleTest() { |
347 | 350 | "Example Publisher", "Publisher description", |
348 | 351 | SlackPublisher.class, "template", "text/html", |
349 | 352 | false); |
| 353 | + |
350 | 354 | NotificationRule rule = qm.createNotificationRule("Example Rule 1", NotificationScope.PORTFOLIO, NotificationLevel.INFORMATIONAL, publisher); |
| 355 | + |
| 356 | + Set<NotificationGroup> groups = new HashSet<>(Set.of(NotificationGroup.BOM_CONSUMED, NotificationGroup.BOM_PROCESSED, NotificationGroup.BOM_PROCESSING_FAILED, |
| 357 | + NotificationGroup.BOM_VALIDATION_FAILED, NotificationGroup.NEW_VULNERABILITY, NotificationGroup.NEW_VULNERABLE_DEPENDENCY, |
| 358 | + NotificationGroup.POLICY_VIOLATION, NotificationGroup.PROJECT_CREATED, NotificationGroup.PROJECT_AUDIT_CHANGE, |
| 359 | + NotificationGroup.VEX_CONSUMED, NotificationGroup.VEX_PROCESSED)); |
| 360 | + rule.setNotifyOn(groups); |
| 361 | + |
351 | 362 | rule.setPublisherConfig("{\"destination\":\"https://example.com/webhook\"}"); |
352 | 363 |
|
353 | 364 | Response sendMailResponse = jersey.target(V1_NOTIFICATION_PUBLISHER + "/test/" + rule.getUuid()).request() |
|
0 commit comments