From 5ddee4d3b85c1b180acb506099c44678edcc57d5 Mon Sep 17 00:00:00 2001 From: Filip Krzywka Date: Fri, 29 Mar 2019 14:52:25 +0100 Subject: Merge configurations - changed temporarily HV-VES default log level to DEBUG as in current implementation we are applying LogLevel defined in configuration file only if we successfully retrieve one from configuration-module, which means that inside of this module we are logging on default level (from logback file). This should be fixed in future work - reduced log level on SDK's CbsClientImpl as it's logging frequency was too high Change-Id: If50df18df099c34bfc36d39b045140f9b9ad87f6 Issue-ID: DCAEGEN2-1347 Signed-off-by: Filip Krzywka --- .../onap/dcae/collectors/veshv/utils/arrow/core.kt | 5 +++++ .../onap/dcae/collectors/veshv/utils/reactive.kt | 25 ---------------------- 2 files changed, 5 insertions(+), 25 deletions(-) delete mode 100644 sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/reactive.kt (limited to 'sources/hv-collector-utils/src/main/kotlin/org') diff --git a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/core.kt b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/core.kt index d5b33b91..47b3d559 100644 --- a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/core.kt +++ b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/arrow/core.kt @@ -34,6 +34,7 @@ import arrow.syntax.collections.firstOption import arrow.typeclasses.MonadContinuation import arrow.typeclasses.binding import reactor.core.publisher.Flux +import reactor.core.publisher.Mono import java.util.concurrent.atomic.AtomicReference /** @@ -57,8 +58,12 @@ fun Either.rightOrThrow() = fold({ throw it }, ::identity) fun Either.rightOrThrow(mapper: (A) -> Throwable) = fold({ throw mapper(it) }, ::identity) +fun Flux>.throwOnLeft(): Flux = map { it.rightOrThrow() } + fun Flux>.throwOnLeft(f: (A) -> Exception): Flux = map { it.rightOrThrow(f) } +fun Mono>.throwOnLeft(f: (A) -> Exception): Mono = map { it.rightOrThrow(f) } + fun AtomicReference.getOption() = Option.fromNullable(get()) fun Option.Companion.fromNullablesChain(firstValue: A?, vararg nextValues: () -> A?): Option = diff --git a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/reactive.kt b/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/reactive.kt deleted file mode 100644 index aaa598d2..00000000 --- a/sources/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/reactive.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * dcaegen2-collectors-veshv - * ================================================================================ - * Copyright (C) 2019 NOKIA - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.dcae.collectors.veshv.utils - -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono - -fun Flux.neverComplete(): Mono = then(Mono.never()).then() \ No newline at end of file -- cgit 1.2.3-korg