Skip to content

Commit cda16bb

Browse files
committed
add groups to test rule
Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
1 parent 108dc87 commit cda16bb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/test/java/org/dependencytrack/resources/v1/NotificationPublisherResourceTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@
1818
*/
1919
package org.dependencytrack.resources.v1;
2020

21+
import java.util.HashSet;
22+
import java.util.Set;
2123
import java.util.UUID;
2224

2325
import org.dependencytrack.JerseyTestRule;
2426
import org.dependencytrack.ResourceTest;
2527
import org.dependencytrack.model.ConfigPropertyConstants;
2628
import org.dependencytrack.model.NotificationPublisher;
2729
import org.dependencytrack.model.NotificationRule;
30+
import org.dependencytrack.notification.NotificationGroup;
2831
import org.dependencytrack.notification.NotificationScope;
2932
import org.dependencytrack.notification.publisher.DefaultNotificationPublishers;
3033
import org.dependencytrack.notification.publisher.Publisher;
@@ -347,7 +350,15 @@ public void testNotificationRuleTest() {
347350
"Example Publisher", "Publisher description",
348351
SlackPublisher.class, "template", "text/html",
349352
false);
353+
350354
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+
351362
rule.setPublisherConfig("{\"destination\":\"https://example.com/webhook\"}");
352363

353364
Response sendMailResponse = jersey.target(V1_NOTIFICATION_PUBLISHER + "/test/" + rule.getUuid()).request()

0 commit comments

Comments
 (0)