diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2024-01-10 11:01:05 +0000 |
---|---|---|
committer | JvD_Ericsson <jeff.van.dam@est.tech> | 2024-01-11 14:36:36 +0000 |
commit | b63a221f95a7c4e3387cf29bf197ee58c7d9e136 (patch) | |
tree | 97b9cc4089e73cfd26fc1f83ba3e39dc5872d405 /cps-ncmp-service/src/main/java/org/onap | |
parent | 958248ec5b935c6608a0f74c8aaf9627a16e2534 (diff) |
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 <jeff.van.dam@est.tech>
Change-Id: I6ba19ac456098f074e634f7cf70fdc141491c635
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/EventsPublisher.java | 8 |
1 files changed, 4 insertions, 4 deletions
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<T> { private void handleLegacyEventCallback(final String topicName, final CompletableFuture<SendResult<String, T>> 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()); } }); } |