diff options
author | Vijay Venkatesh Kumar <vv770d@att.com> | 2023-02-14 16:48:50 -0500 |
---|---|---|
committer | Vijay Venkatesh Kumar <vv770d@att.com> | 2023-02-14 16:59:01 -0500 |
commit | 66af83f78633f6d3884a7a477ea69422aa41af2b (patch) | |
tree | ad85c0add763982433c06ecca99b6f11c6d6f512 /src/main/java | |
parent | 147999fca04f4c857209ff9594a69ccb2e2754d1 (diff) |
Test updates1.12.3
Test updates for ConfigProcessor, DMaaPConfigurationParser
& DMaaPEventPublisher
Change-Id: I340b3591ca47172dc90f8dafabdc1a0bf34ffb7c
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Issue-ID: DCAEGEN2-3345
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/onap/dcae/common/ConfigProcessors.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/common/publishing/DMaaPEventPublisher.java | 28 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/org/onap/dcae/common/ConfigProcessors.java b/src/main/java/org/onap/dcae/common/ConfigProcessors.java index 040a3e6e..d53bf23b 100644 --- a/src/main/java/org/onap/dcae/common/ConfigProcessors.java +++ b/src/main/java/org/onap/dcae/common/ConfigProcessors.java @@ -202,7 +202,7 @@ public class ConfigProcessors { } } - private String performOperation(String operation, String value) { + String performOperation(String operation, String value) { log.info("performOperation"); if ("convertMBtoKB".equals(operation)) { float kbValue = Float.parseFloat(value) * 1024; diff --git a/src/main/java/org/onap/dcae/common/publishing/DMaaPEventPublisher.java b/src/main/java/org/onap/dcae/common/publishing/DMaaPEventPublisher.java index 08e16e0c..a7c0a0eb 100644 --- a/src/main/java/org/onap/dcae/common/publishing/DMaaPEventPublisher.java +++ b/src/main/java/org/onap/dcae/common/publishing/DMaaPEventPublisher.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * org.onap.dcaegen2.collectors.ves * ================================================================================ - * Copyright (C) 2017,2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017,2020,2023 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2018-2021 Nokia. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ import java.util.List; import java.util.Objects; import static org.onap.dcae.common.publishing.MessageRouterHttpStatusMapper.getHttpStatus; + /** * @author Pawel Szalapski (pawel.szalapski@nokia.com) */ @@ -48,9 +49,10 @@ public class DMaaPEventPublisher { /** * Reload Dmaap configuration + * * @param dmaapConfiguration Dmaap configuration */ - public void reload(Map<String, PublisherConfig> dmaapConfiguration){ + public void reload(Map<String, PublisherConfig> dmaapConfiguration) { dMaaPConfig = dmaapConfiguration; log.info("reload dmaap configuration"); } @@ -58,22 +60,26 @@ public class DMaaPEventPublisher { public HttpStatus sendEvent(List<VesEvent> vesEvents, String dmaapId) { clearVesUniqueIdFromEvent(vesEvents); io.vavr.collection.List<String> events = mapListOfEventsToVavrList(vesEvents); - Flux<MessageRouterPublishResponse> messageRouterPublishFlux = dmaapPublisher.publishEvents(events, dMaaPConfig.get(dmaapId)); + HttpStatus rc = messageRouterPublishResponse(events, dmaapId); + return rc; + } + + HttpStatus messageRouterPublishResponse(io.vavr.collection.List<String> events, String dmaapId) { + Flux<MessageRouterPublishResponse> messageRouterPublishFlux = + dmaapPublisher.publishEvents(events, dMaaPConfig.get(dmaapId)); MessageRouterPublishResponse messageRouterPublishResponse = messageRouterPublishFlux.blockFirst(); return getHttpStatus(Objects.requireNonNull(messageRouterPublishResponse)); + } private io.vavr.collection.List<String> mapListOfEventsToVavrList(List<VesEvent> vesEvents) { - return io.vavr.collection.List.ofAll(vesEvents) - .map(event -> event.asJsonObject().toString()); + return io.vavr.collection.List.ofAll(vesEvents).map(event -> event.asJsonObject().toString()); } private void clearVesUniqueIdFromEvent(List<VesEvent> events) { - events.stream() - .filter(event -> event.hasType(VesEvent.VES_UNIQUE_ID)) - .forEach(event -> { - log.debug("Removing VESuniqueid object from event"); - event.removeElement(VesEvent.VES_UNIQUE_ID); - }); + events.stream().filter(event -> event.hasType(VesEvent.VES_UNIQUE_ID)).forEach(event -> { + log.debug("Removing VESuniqueid object from event"); + event.removeElement(VesEvent.VES_UNIQUE_ID); + }); } } |