diff options
author | Zlatko Murgoski <zlatko.murgoski@nokia.com> | 2019-01-14 11:24:22 +0100 |
---|---|---|
committer | Zlatko Murgoski <zlatko.murgoski@nokia.com> | 2019-01-29 09:50:05 +0100 |
commit | 038e80074e8ad5f466690aef436034fcda0eeab3 (patch) | |
tree | a58263115206f927c31c91b29d8a069c4e7880eb /src/main/java/org/onap/dcae/controller/ConfigSource.java | |
parent | 7ab93201e557976ed8b383cb5652fa129d7b36f7 (diff) |
Fix sonar violation
Fix sonar violation
Issue-ID: DCAEGEN2-1016
Signed-off-by: Zlatko Murgoski <zlatko.murgoski@nokia.com>
Change-Id: I0db722972aeeb57ebb4b61b11f1e302f613890d5
Diffstat (limited to 'src/main/java/org/onap/dcae/controller/ConfigSource.java')
-rw-r--r-- | src/main/java/org/onap/dcae/controller/ConfigSource.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/org/onap/dcae/controller/ConfigSource.java b/src/main/java/org/onap/dcae/controller/ConfigSource.java index 68dc2501..a9e439e4 100644 --- a/src/main/java/org/onap/dcae/controller/ConfigSource.java +++ b/src/main/java/org/onap/dcae/controller/ConfigSource.java @@ -26,6 +26,7 @@ import static org.onap.dcae.common.publishing.VavrUtils.f; import static org.onap.dcae.controller.Conversions.toJson; import static org.onap.dcae.controller.Conversions.toJsonArray; +import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import io.vavr.control.Try; import org.json.JSONArray; @@ -41,11 +42,11 @@ final class ConfigSource { log.info("Fetching app configuration from CBS"); return callConsulForCBSConfiguration(envProps) .peek(strBody -> log.info(f("Received following CBS configuration from Consul '%s'", strBody))) - .flatMap(strBody -> toJsonArray(strBody)) - .flatMap(json -> withdrawCatalog(json)) + .flatMap(Conversions::toJsonArray) + .flatMap(ConfigSource::withdrawCatalog) .flatMap(json -> constructFullCBSUrl(envProps, json)) .flatMap(cbsUrl -> callCBSForAppConfig(envProps, cbsUrl)) - .flatMap(strBody -> toJson(strBody)) + .flatMap(Conversions::toJson) .peek(jsonNode -> log.info(f("Received app configuration: '%s'", jsonNode))) .onFailure(exc -> log.error("Could not fetch application config", exc)); } @@ -83,7 +84,7 @@ final class ConfigSource { res -> res.getStatus() == 200, res -> new RuntimeException(f("HTTP call (GET '%s') failed with status %s and body '%s'", url, res.getStatus(), res.getBody()))) - .map(res -> res.getBody()) + .map(HttpResponse::getBody) .peek(body -> log.info(f("HTTP GET on '%s' returned body '%s'", url, body))); } |