From 664e608cba9a8d16e12b1285cf4681845c3e2f74 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Thu, 17 Mar 2022 17:16:52 +0100 Subject: [PATCH] openvidu-test-browsers: total accumulated number of events in CustomWebhook --- .../openvidu/test/browsers/utils/webhook/CustomWebhook.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/webhook/CustomWebhook.java b/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/webhook/CustomWebhook.java index 1be6b3c0..e5190870 100644 --- a/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/webhook/CustomWebhook.java +++ b/openvidu-test-browsers/src/main/java/io/openvidu/test/browsers/utils/webhook/CustomWebhook.java @@ -46,21 +46,25 @@ public class CustomWebhook { private static ConfigurableApplicationContext context; public static CountDownLatch initLatch; + public static int accumulatedNumberOfEvents = 0; static ConcurrentMap> events = new ConcurrentHashMap<>(); public static void main(String[] args, CountDownLatch initLatch) { CustomWebhook.initLatch = initLatch; + accumulatedNumberOfEvents = 0; CustomWebhook.events.clear(); CustomWebhook.context = new SpringApplicationBuilder(CustomWebhook.class) .properties("spring.config.location:classpath:aplication-pro-webhook.properties").build().run(args); } public static void shutDown() { + accumulatedNumberOfEvents = 0; CustomWebhook.events.clear(); CustomWebhook.context.close(); } public static void clean() { + accumulatedNumberOfEvents = 0; CustomWebhook.events.clear(); } @@ -88,6 +92,7 @@ public class CustomWebhook { public void webhook(@RequestBody String eventString) { JsonObject event = JsonParser.parseString(eventString).getAsJsonObject(); System.out.println("Webhook event: " + event.toString()); + accumulatedNumberOfEvents++; final String eventName = event.get("event").getAsString(); final BlockingQueue queue = new LinkedBlockingDeque<>(); if (!CustomWebhook.events.computeIfAbsent(eventName, e -> {