Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb3b944

Browse filesBrowse files
committed
use empty config in test
Signed-off-by: Ross Murphy <RossMurphy@ibm.com>
1 parent cb318a5 commit cb3b944
Copy full SHA for cb3b944

File tree

Expand file treeCollapse file tree

2 files changed

+8
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-6
lines changed

‎src/main/java/org/dependencytrack/resources/v1/NotificationPublisherResource.java

Copy file name to clipboardExpand all lines: src/main/java/org/dependencytrack/resources/v1/NotificationPublisherResource.java
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,9 @@ public Response testRuleConfiguration (
353353
JsonObject configObject = jsonReader.readObject();
354354
jsonReader.close();
355355
final JsonObject config = Json.createObjectBuilder()
356-
.add(Publisher.CONFIG_DESTINATION, configObject.getString("destination"))
356+
.add(Publisher.CONFIG_DESTINATION, configObject.containsKey("destination") &&
357+
!configObject.isNull("destination") ? configObject.getString("destination") : "")
358+
357359
.add(Publisher.CONFIG_TEMPLATE_KEY, rule.getPublisher().getTemplate())
358360
.add(Publisher.CONFIG_TEMPLATE_MIME_TYPE_KEY, rule.getPublisher().getTemplateMimeType())
359361
.build();

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

Copy file name to clipboardExpand all lines: src/test/java/org/dependencytrack/resources/v1/NotificationPublisherResourceTest.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ public void testEmailNotificationRuleTest() {
392392
rule.setTeams(teams);
393393

394394
Set<NotificationGroup> groups = new HashSet<>(Set.of(NotificationGroup.BOM_CONSUMED, NotificationGroup.BOM_PROCESSED, NotificationGroup.BOM_PROCESSING_FAILED,
395-
NotificationGroup.BOM_VALIDATION_FAILED, NotificationGroup.NEW_VULNERABILITY, NotificationGroup.NEW_VULNERABLE_DEPENDENCY,
396-
NotificationGroup.POLICY_VIOLATION, NotificationGroup.PROJECT_CREATED, NotificationGroup.PROJECT_AUDIT_CHANGE,
397-
NotificationGroup.VEX_CONSUMED, NotificationGroup.VEX_PROCESSED));
395+
NotificationGroup.BOM_VALIDATION_FAILED, NotificationGroup.NEW_VULNERABILITY, NotificationGroup.NEW_VULNERABLE_DEPENDENCY,
396+
NotificationGroup.POLICY_VIOLATION, NotificationGroup.PROJECT_CREATED, NotificationGroup.PROJECT_AUDIT_CHANGE,
397+
NotificationGroup.VEX_CONSUMED, NotificationGroup.VEX_PROCESSED));
398398
rule.setNotifyOn(groups);
399-
400-
rule.setPublisherConfig("{\"destination\":\"https://example.com/webhook\"}");
401399

400+
rule.setPublisherConfig("{}");
401+
402402
Response sendMailResponse = jersey.target(V1_NOTIFICATION_PUBLISHER + "/test/" + rule.getUuid()).request()
403403
.header(X_API_KEY, apiKey)
404404
.post(Entity.entity("", MediaType.APPLICATION_FORM_URLENCODED_TYPE));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.