From 7537af05981958686a99d1ec2e1b9a9eeb0d1d4f Mon Sep 17 00:00:00 2001 From: "Jared.Tan" Date: Tue, 6 Nov 2018 09:21:35 +0800 Subject: [PATCH] Fix the test case. (#1879) --- .../core/alarm/provider/WebhookCallbackTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallbackTest.java b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallbackTest.java index 961acf7757a9..e3ef8b5fecf1 100644 --- a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallbackTest.java +++ b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/WebhookCallbackTest.java @@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.skywalking.oap.server.core.alarm.AlarmMessage; +import org.apache.skywalking.oap.server.core.source.Scope; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -72,8 +73,14 @@ public void testWebhook() { remoteEndpoints.add("http://127.0.0.1:8778/webhook/receiveAlarm"); WebhookCallback webhookCallback = new WebhookCallback(remoteEndpoints); List alarmMessages = new ArrayList<>(2); - alarmMessages.add(new AlarmMessage()); - alarmMessages.add(new AlarmMessage()); + AlarmMessage alarmMessage = new AlarmMessage(); + alarmMessage.setScope(Scope.All); + alarmMessage.setAlarmMessage("alarmMessage with [Scope.All]"); + alarmMessages.add(alarmMessage); + AlarmMessage anotherAlarmMessage = new AlarmMessage(); + anotherAlarmMessage.setScope(Scope.Endpoint); + anotherAlarmMessage.setAlarmMessage("anotherAlarmMessage with [Scope.Endpoint]"); + alarmMessages.add(anotherAlarmMessage); webhookCallback.doAlarm(alarmMessages); Assert.assertTrue(isSuccess);