From b63a221f95a7c4e3387cf29bf197ee58c7d9e136 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Wed, 10 Jan 2024 11:01:05 +0000 Subject: Create tests for EventPublisher error scenarios - Added tests for error scenarios - Added tests for expected scenarios Issue-ID: CPS-1978 Signed-off-by: JvD_Ericsson Change-Id: I6ba19ac456098f074e634f7cf70fdc141491c635 --- .../java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cps-ncmp-service/src/main/java/org/onap') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java index dddad63923..03d440e640 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation + * Copyright (C) 2022-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,11 +118,11 @@ public class EventsPublisher { private void handleLegacyEventCallback(final String topicName, final CompletableFuture> eventFuture) { eventFuture.whenComplete((result, e) -> { - if (e != null) { - log.error("Unable to publish event to topic : {} due to {}", topicName, e.getMessage()); - } else { + if (e == null) { log.debug("Successfully published event to topic : {} , Event : {}", result.getRecordMetadata().topic(), result.getProducerRecord().value()); + } else { + log.error("Unable to publish event to topic : {} due to {}", topicName, e.getMessage()); } }); } -- cgit 1.2.3-korg