Remove dummyMode configuration option 48/83348/4
authorFilip Krzywka <filip.krzywka@nokia.com>
Tue, 26 Mar 2019 12:14:09 +0000 (13:14 +0100)
committerFilip Krzywka <filip.krzywka@nokia.com>
Wed, 27 Mar 2019 07:07:15 +0000 (08:07 +0100)
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>
13 files changed:
development/configuration/base.json
sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/Configuration.kt
sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt
sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt
sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt
sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt
sources/hv-collector-configuration/src/test/resources/sampleConfig.json
sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/LoggingSinkProvider.kt [deleted file]
sources/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSinkProviderTest.kt
sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt
sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/configuration.kt
sources/hv-collector-main/src/main/docker/base.json

index 5233f02..a88b8fb 100644 (file)
@@ -18,7 +18,6 @@
     }
   },
   "collector": {
-    "dummyMode": false,
     "maxRequestSizeBytes": 1048576,
     "kafkaServers": [
       "message-router-kafka:9092"
index 566f2c0..3375821 100644 (file)
@@ -49,6 +49,5 @@ data class CbsConfiguration(
 data class CollectorConfiguration(
         val maxRequestSizeBytes: Int,
         val kafkaServers: String,
-        val routing: Routing,
-        val dummyMode: Boolean = false
+        val routing: Routing
 )
index 90be3db..330ec7c 100644 (file)
@@ -97,8 +97,7 @@ internal class ConfigurationValidator {
                 CollectorConfiguration(
                         it.maxRequestSizeBytes.bind(),
                         toKafkaServersString(it.kafkaServers.bind()),
-                        it.routing.bind(),
-                        it.dummyMode.bind()
+                        it.routing.bind()
                 )
             }
 
index 3e6df3e..3cedd6b 100644 (file)
@@ -52,7 +52,6 @@ internal data class PartialCbsConfig(
 internal data class PartialSecurityConfig(val keys: Option<SecurityKeys> = None)
 
 internal data class PartialCollectorConfig(
-        val dummyMode: Option<Boolean> = None,
         val maxRequestSizeBytes: Option<Int> = None,
         val kafkaServers: Option<List<InetSocketAddress>> = None,
         val routing: Option<Routing> = None
index beb5df6..696f42a 100644 (file)
@@ -64,7 +64,6 @@ internal object ConfigurationValidatorTest : Spek({
                             Some(mock())
                     )),
                     Some(PartialCollectorConfig(
-                            Some(true),
                             Some(4),
                             Some(emptyList()),
                             Some(routing { }.build())
@@ -105,7 +104,6 @@ internal object ConfigurationValidatorTest : Spek({
                             securityKeys
                     )),
                     Some(PartialCollectorConfig(
-                            Some(true),
                             Some(4),
                             Some(emptyList()),
                             Some(routing)
@@ -156,7 +154,6 @@ internal object ConfigurationValidatorTest : Spek({
                             securityKeys
                     )),
                     Some(PartialCollectorConfig(
-                            Some(true),
                             Some(4),
                             Some(emptyList()),
                             Some(routing)
index 8267e30..bbf259c 100644 (file)
@@ -145,7 +145,6 @@ internal object FileConfigurationReaderTest : Spek({
                 assertThat(config.collector.nonEmpty()).isTrue()
                 val collector = config.collector.orNull() as PartialCollectorConfig
                 collector.run {
-                    assertThat(dummyMode).isEqualTo(Some(false))
                     assertThat(maxRequestSizeBytes).isEqualTo(Some(512000))
                     assertThat(kafkaServers.nonEmpty()).isTrue()
                     assertThat(routing.nonEmpty()).isTrue()
index b49085e..5ae9fc0 100644 (file)
@@ -20,7 +20,6 @@
     }
   },
   "collector": {
-    "dummyMode": false,
     "maxRequestSizeBytes": 512000,
     "kafkaServers": [
       "192.168.255.1:5005",
index c362020..10fe0a5 100644 (file)
@@ -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 (file)
index 3a9467f..0000000
+++ /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)
-    }
-}
index 1e3f2e7..8ea53fb 100644 (file)
@@ -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())
index eb3ba26..d965b78 100644 (file)
@@ -27,7 +27,6 @@ import io.netty.buffer.UnpooledByteBufAllocator
 import org.onap.dcae.collectors.veshv.boundary.Collector
 import org.onap.dcae.collectors.veshv.boundary.Sink
 import org.onap.dcae.collectors.veshv.boundary.SinkProvider
-import org.onap.dcae.collectors.veshv.config.api.model.Routing
 import org.onap.dcae.collectors.veshv.domain.RoutedMessage
 import org.onap.dcae.collectors.veshv.factory.CollectorFactory
 import org.onap.dcae.collectors.veshv.model.ClientContext
index 6599d40..6425601 100644 (file)
@@ -36,11 +36,11 @@ const val ALTERNATE_PERF3GPP_TOPIC = "HV_VES_PERF3GPP_ALTERNATIVE"
 const val SAMPLE_BOOTSTRAP_SERVERS = "dmaap-mr-kafka-0:6060,dmaap-mr-kafka-1:6060"
 
 val configWithBasicRouting = sequenceOf(
-    ImmutableKafkaSink.builder()
-            .name(PERF3GPP.domainName)
-            .topicName(PERF3GPP_TOPIC)
-            .bootstrapServers(SAMPLE_BOOTSTRAP_SERVERS)
-            .build()
+        ImmutableKafkaSink.builder()
+                .name(PERF3GPP.domainName)
+                .topicName(PERF3GPP_TOPIC)
+                .bootstrapServers(SAMPLE_BOOTSTRAP_SERVERS)
+                .build()
 )
 
 val configWithTwoDomainsToOneTopicRouting = sequenceOf(
@@ -62,12 +62,12 @@ val configWithTwoDomainsToOneTopicRouting = sequenceOf(
 )
 
 val configWithDifferentRouting = sequenceOf(
-                ImmutableKafkaSink.builder()
-                        .name(PERF3GPP.domainName)
-                        .topicName(ALTERNATE_PERF3GPP_TOPIC)
-                        .bootstrapServers(SAMPLE_BOOTSTRAP_SERVERS)
-                        .build()
-        )
+        ImmutableKafkaSink.builder()
+                .name(PERF3GPP.domainName)
+                .topicName(ALTERNATE_PERF3GPP_TOPIC)
+                .bootstrapServers(SAMPLE_BOOTSTRAP_SERVERS)
+                .build()
+)
 
 val configWithEmptyRouting = emptySequence<KafkaSink>()
 
index 7f88cb6..67576c8 100644 (file)
@@ -12,7 +12,6 @@
   "security": {
   },
   "collector": {
-    "dummyMode": false,
     "maxRequestSizeBytes": 1048576,
     "kafkaServers": [
       "message-router-kafka:9092"