diff --git a/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifier.java b/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifier.java index e55bf936db6..8fcf2f3a398 100644 --- a/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifier.java +++ b/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifier.java @@ -18,6 +18,7 @@ import java.net.URI; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.jspecify.annotations.Nullable; @@ -31,6 +32,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; +import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; import reactor.core.publisher.Mono; @@ -134,10 +136,10 @@ protected HttpEntity createRequest(InstanceEvent event, Instance instance) { body.put("alias", generateAlias(instance)); body.put("description", getDescription(event, instance)); if (actions != null) { - body.put("actions", actions); + body.put("actions", List.of(StringUtils.tokenizeToStringArray(actions, ","))); } if (tags != null) { - body.put("tags", tags); + body.put("tags", List.of(StringUtils.tokenizeToStringArray(tags, ","))); } if (entity != null) { body.put("entity", entity); diff --git a/spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifierTest.java b/spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifierTest.java index df3c3e6b153..7317749d7dc 100644 --- a/spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifierTest.java +++ b/spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/server/notify/OpsGenieNotifierTest.java @@ -17,6 +17,7 @@ package de.codecentric.boot.admin.server.notify; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.junit.jupiter.api.BeforeEach; @@ -63,7 +64,7 @@ void setUp() { notifier.setUser("--user--"); notifier.setSource("--source--"); notifier.setEntity("--entity--"); - notifier.setTags("--tag1--,--tag2--"); + notifier.setTags("--tag1--, --tag2--"); notifier.setActions("--action1--,--action2--"); } @@ -122,8 +123,8 @@ private HttpEntity> expectedRequest(String expectedOldStatus expected.put("alias", "App_-id-"); expected.put("description", getDescription(expectedOldStatus, expectedNewStatus)); expected.put("entity", "--entity--"); - expected.put("tags", "--tag1--,--tag2--"); - expected.put("actions", "--action1--,--action2--"); + expected.put("tags", List.of("--tag1--", "--tag2--")); + expected.put("actions", List.of("--action1--", "--action2--")); Map details = new HashMap<>(); details.put("type", "link");