summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src
diff options
context:
space:
mode:
authorMarcin Migdal <marcin.migdal@nokia.com>2019-03-25 11:02:18 +0100
committerMarcin Migdal <marcin.migdal@nokia.com>2019-03-25 11:29:14 +0100
commit8b0068a7fd94c656402f2ef85f5152a14760cb21 (patch)
tree0d5feda6d7a9d2184cb8a9e1cd5fb636685820fb /prh-app-server/src
parent2f1c390f984a9b61b7b218243f06e26f5173fd9b (diff)
Fix logic and log in DMaapConsumerJsonParser
Change-Id: Idf236a1c85423f29eb3f1dc9b9f27cead80046c0 Issue-ID: DCAEGEN2-1361 Signed-off-by: Marcin Migdal <marcin.migdal@nokia.com>
Diffstat (limited to 'prh-app-server/src')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java8
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
index b628d961..f1483321 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
@@ -83,9 +83,13 @@ public class DmaapConsumerJsonParser {
.flatMapMany(this::getConsumerDmaapModelFromJsonArray);
}
- private Flux<ConsumerDmaapModel> getConsumerDmaapModelFromJsonArray(JsonArray jsonElement) {
+ private Flux<ConsumerDmaapModel> getConsumerDmaapModelFromJsonArray(JsonArray jsonArray) {
+ if(jsonArray.size() == 0) {
+ LOGGER.debug("Nothing to consume from DMaaP");
+ return Flux.empty();
+ }
return create(
- Flux.defer(() -> Flux.fromStream(StreamSupport.stream(jsonElement.spliterator(), false)
+ Flux.defer(() -> Flux.fromStream(StreamSupport.stream(jsonArray.spliterator(), false)
.map(jsonElementFromArray -> getJsonObjectFromAnArray(jsonElementFromArray)
.orElseGet(JsonObject::new)))));
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
index a34549d8..d0926e7a 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
@@ -30,6 +30,7 @@ import org.onap.dcaegen2.services.prh.model.utils.HttpUtils;
import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.AaiHttpClientFactory;
import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiHttpPatchClient;
+import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.CloudHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -69,7 +70,7 @@ public class AaiProducerTaskImpl extends AaiProducerTask {
@Override
AaiHttpPatchClient resolveClient() {
return new AaiHttpPatchClient(resolveConfiguration(),
- new AaiJsonBodyBuilderImpl()).createAaiHttpClient(new AaiHttpClientFactory(resolveConfiguration()).build());
+ new AaiJsonBodyBuilderImpl(), new CloudHttpClient());
}
@Override