aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-core/src
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2019-03-26 13:14:09 +0100
committerFilip Krzywka <filip.krzywka@nokia.com>2019-03-27 08:07:15 +0100
commit8e95c1191af4ce0f2e0d87f62657b30d66ddc397 (patch)
tree0090fdd97ddbbaf3aa1c0fbef0c5da778fd675a1 /sources/hv-collector-core/src
parent58ae1a831a6fe85abda8c4d866e5170c70499ac1 (diff)
Remove dummyMode configuration option
As it's not really used by anyone and it's functionality does not bring much value Change-Id: I99b07e484a8494a036f1f1b07e21666e044edbdb Issue-ID: DCAEGEN2-1347 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'sources/hv-collector-core/src')
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt5
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/LoggingSinkProvider.kt65
-rw-r--r--sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt1
3 files changed, 1 insertions, 70 deletions
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
index c362020e..10fe0a51 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
@@ -33,10 +33,7 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.EnvProperti
*/
object AdapterFactory {
fun sinkCreatorFactory(config: CollectorConfiguration): SinkProvider =
- if (config.dummyMode)
- LoggingSinkProvider()
- else
- KafkaSinkProvider(config)
+ KafkaSinkProvider(config)
fun configurationProvider(config: CbsConfiguration): ConfigurationProvider =
ConfigurationProviderImpl(
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/LoggingSinkProvider.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/LoggingSinkProvider.kt
deleted file mode 100644
index 3a9467f7..00000000
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/LoggingSinkProvider.kt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018 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.impl.adapters
-
-import org.onap.dcae.collectors.veshv.boundary.Sink
-import org.onap.dcae.collectors.veshv.boundary.SinkProvider
-import org.onap.dcae.collectors.veshv.impl.adapters.ClientContextLogging.info
-import org.onap.dcae.collectors.veshv.impl.adapters.ClientContextLogging.trace
-import org.onap.dcae.collectors.veshv.model.ClientContext
-import org.onap.dcae.collectors.veshv.model.ConsumedMessage
-import org.onap.dcae.collectors.veshv.domain.RoutedMessage
-import org.onap.dcae.collectors.veshv.model.SuccessfullyConsumedMessage
-import org.onap.dcae.collectors.veshv.utils.logging.Logger
-import reactor.core.publisher.Flux
-import java.util.concurrent.atomic.AtomicLong
-
-/**
- * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
- * @since June 2018
- */
-internal class LoggingSinkProvider : SinkProvider {
-
- override fun invoke(ctx: ClientContext): Sink {
- return object : Sink {
- private val totalMessages = AtomicLong()
- private val totalBytes = AtomicLong()
-
- override fun send(messages: Flux<RoutedMessage>): Flux<ConsumedMessage> =
- messages.doOnNext(this::logMessage).map(::SuccessfullyConsumedMessage)
-
- private fun logMessage(msg: RoutedMessage) {
- val msgs = totalMessages.addAndGet(1)
- val bytes = totalBytes.addAndGet(msg.message.wtpFrame.payloadSize.toLong())
- val logMessageSupplier = { "Message routed to ${msg.topic}. Total = $msgs ($bytes B)" }
- if (msgs % INFO_LOGGING_FREQ == 0L)
- logger.info(ctx, logMessageSupplier)
- else
- logger.trace(ctx, logMessageSupplier)
- }
-
- }
- }
-
- companion object {
- const val INFO_LOGGING_FREQ = 100_000
- private val logger = Logger(LoggingSinkProvider::class)
- }
-}
diff --git a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt
index 1e3f2e7a..8ea53fbe 100644
--- a/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt
+++ b/sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt
@@ -43,7 +43,6 @@ internal object KafkaSinkProviderTest : Spek({
describe("non functional requirements") {
given("sample configuration") {
val config = CollectorConfiguration(
- dummyMode = false,
maxRequestSizeBytes = 1024 * 1024,
kafkaServers = "localhost:9090",
routing = routing { }.build())