Include msg generator module in coverage report 37/58837/1
authorfkrzywka <filip.krzywka@nokia.com>
Mon, 16 Jul 2018 06:17:29 +0000 (08:17 +0200)
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>
Fri, 3 Aug 2018 05:09:48 +0000 (07:09 +0200)
* Reordered alphabetically modules in main pom file
* Removed unused imports
* Corrected visibility for fields/methods
* Fix typos in tests

Change-Id: I35c515b3844bc8517cc6ffb0c6557596505536c9
Signed-off-by: fkrzywka <filip.krzywka@nokia.com>
Issue-ID: DCAEGEN2-601

16 files changed:
hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/boundary/adapters.kt
hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt
hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProvider.kt
hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSink.kt
hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt
hv-collector-coverage/pom.xml
hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt
hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/messages.kt
hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/kafka/consumer.kt
hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/remote/ApiServer.kt
hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt
hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt
hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt
hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt
hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/PayloadGeneratorTest.kt
pom.xml

index e4f0200..6b1bab8 100644 (file)
@@ -21,7 +21,6 @@ package org.onap.dcae.collectors.veshv.boundary
 
 import org.onap.dcae.collectors.veshv.model.CollectorConfiguration
 import org.onap.dcae.collectors.veshv.model.RoutedMessage
-import org.onap.dcae.collectors.veshv.model.VesMessage
 import reactor.core.publisher.Flux
 
 interface Sink {
index 8d10a40..4586d30 100644 (file)
@@ -24,7 +24,7 @@ import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader
 
 internal object MessageValidator {
 
-    val requiredFieldDescriptors = listOf(
+    private val requiredFieldDescriptors = listOf(
             "version",
             "eventName",
             // "domain", TODO to be restored back when GPB schema will include default value
index 786bc7c..621c63f 100644 (file)
@@ -27,13 +27,9 @@ import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain.forNumber
 import org.slf4j.LoggerFactory
 import reactor.core.publisher.Flux
 import reactor.core.publisher.Mono
-import reactor.ipc.netty.http.client.HttpClientException
-import reactor.retry.Retry
-import reactor.retry.retryExponentialBackoff
 import java.io.StringReader
 import java.time.Duration
 import java.util.*
-import java.util.concurrent.TimeUnit
 import java.util.concurrent.atomic.AtomicReference
 import javax.json.Json
 import javax.json.JsonObject
index f8fa72a..b611e9a 100644 (file)
 package org.onap.dcae.collectors.veshv.impl.adapters.kafka
 
 import org.onap.dcae.collectors.veshv.boundary.Sink
-import org.onap.dcae.collectors.veshv.impl.adapters.LoggingSinkProvider
-import org.onap.dcae.collectors.veshv.model.CollectorConfiguration
 import org.onap.dcae.collectors.veshv.model.RoutedMessage
 import org.onap.dcae.collectors.veshv.model.VesMessage
-import org.onap.dcae.collectors.veshv.model.routing
 import org.onap.dcae.collectors.veshv.utils.logging.Logger
 import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader
 import reactor.core.publisher.Flux
index c98c97a..322ec4e 100644 (file)
@@ -21,7 +21,6 @@ package org.onap.dcae.collectors.veshv.impl.adapters
 
 import com.nhaarman.mockito_kotlin.eq
 import com.nhaarman.mockito_kotlin.mock
-import com.nhaarman.mockito_kotlin.verify
 import com.nhaarman.mockito_kotlin.whenever
 import org.jetbrains.spek.api.Spek
 import org.jetbrains.spek.api.dsl.given
@@ -29,7 +28,6 @@ import org.jetbrains.spek.api.dsl.it
 import org.mockito.Mockito
 import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain
 import reactor.core.publisher.Mono
-import reactor.ipc.netty.http.client.HttpClient
 import reactor.test.StepVerifier
 import java.time.Duration
 import java.util.*
index 1c03936..a046f29 100644 (file)
         </dependency>
         <dependency>
             <groupId>${project.parent.groupId}</groupId>
-            <artifactId>hv-collector-xnf-simulator</artifactId>
+            <artifactId>hv-collector-dcae-app-simulator</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
         <dependency>
             <groupId>${project.parent.groupId}</groupId>
-            <artifactId>hv-collector-dcae-app-simulator</artifactId>
+            <artifactId>hv-collector-ves-message-generator</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.parent.groupId}</groupId>
+            <artifactId>hv-collector-xnf-simulator</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
     </dependencies>
index d78463b..aaadcc7 100644 (file)
@@ -20,6 +20,7 @@
 package org.onap.dcae.collectors.veshv.tests.component
 
 import io.netty.buffer.ByteBuf
+import io.netty.buffer.ByteBufAllocator
 import io.netty.buffer.UnpooledByteBufAllocator
 import org.onap.dcae.collectors.veshv.boundary.Collector
 import org.onap.dcae.collectors.veshv.boundary.Sink
@@ -39,10 +40,10 @@ import java.time.Duration
 class Sut(sink: Sink = StoringSink()) {
     val configurationProvider = FakeConfigurationProvider()
 
-    val alloc = UnpooledByteBufAllocator.DEFAULT
-    val metrics = FakeMetrics()
+    val alloc: ByteBufAllocator = UnpooledByteBufAllocator.DEFAULT
+    private val metrics = FakeMetrics()
     private val collectorFactory = CollectorFactory(configurationProvider, SinkProvider.just(sink), metrics)
-    val collectorProvider = collectorFactory.createVesHvCollectorProvider()
+    private val collectorProvider = collectorFactory.createVesHvCollectorProvider()
 
     val collector: Collector
         get() = collectorProvider()
index 64b4ba2..a63aa9d 100644 (file)
@@ -24,6 +24,7 @@ import io.netty.buffer.ByteBuf
 import io.netty.buffer.ByteBufAllocator
 import io.netty.buffer.PooledByteBufAllocator
 import org.onap.dcae.collectors.veshv.domain.PayloadWireFrameMessage.Companion.MAX_PAYLOAD_SIZE
+import org.onap.ves.VesEventV5
 import org.onap.ves.VesEventV5.VesEvent
 import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader
 import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain
@@ -85,7 +86,7 @@ fun vesMessageWithTooBigPayload(domain: Domain = Domain.OTHER, id: String = UUID
 
 fun vesEvent(domain: Domain = Domain.HVRANMEAS,
              id: String = UUID.randomUUID().toString(),
-             hvRanMeasFields: ByteString = ByteString.EMPTY) =
+             hvRanMeasFields: ByteString = ByteString.EMPTY): VesEventV5.VesEvent =
         VesEvent.newBuilder()
                 .setCommonEventHeader(
                         CommonEventHeader.getDefaultInstance().toBuilder()
index 7db6920..869c5ab 100644 (file)
@@ -67,7 +67,7 @@ class Consumer : ConsumerStateProvider {
     }
 }
 
-class ConsumerFactory(val kafkaBootstrapServers: String) {
+class ConsumerFactory(private val kafkaBootstrapServers: String) {
     fun createConsumerForTopics(kafkaTopics: Set<String>): ConsumerStateProvider {
         return KafkaSource.create(kafkaBootstrapServers, kafkaTopics.toSet()).start().unsafeRunSync()
     }
index 39b4fe2..d1d90b0 100644 (file)
@@ -54,7 +54,7 @@ class ApiServer(private val consumerFactory: ConsumerFactory) {
         chain
                 .put("configuration/topics") { ctx ->
                     ctx.request.body.then { it ->
-                        val topics = extractTopics(it.getText())
+                        val topics = extractTopics(it.text)
                         logger.info("Received new configuration. Creating consumer for topics: $topics")
                         consumerState = consumerFactory.createConsumerForTopics(topics)
                         ctx.response.contentType(CONTENT_TEXT)
index b73a788..4084ee8 100644 (file)
@@ -19,8 +19,6 @@
  */
 package org.onap.dcae.collectors.veshv.simulators.dcaeapp.config
 
-import arrow.core.Failure
-import arrow.core.Success
 import arrow.core.identity
 import org.assertj.core.api.Assertions.assertThat
 import org.jetbrains.spek.api.Spek
@@ -69,7 +67,7 @@ internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
             }
 
 
-            it("should set proper kafka boostrap servers") {
+            it("should set proper kafka bootstrap servers") {
                 assertThat(result.kafkaBootstrapServers).isEqualTo(kafkaBootstrapServers)
             }
 
@@ -92,7 +90,7 @@ internal class ArgBasedDcaeAppSimConfigurationTest : Spek({
                 assertThat(result.apiPort).isEqualTo(666)
             }
 
-            it("should set proper kafka boostrap servers") {
+            it("should set proper kafka bootstrap servers") {
                 assertThat(result.kafkaBootstrapServers).isEqualTo(kafkaBootstrapServers)
             }
 
index ab82dc0..cbc18fd 100644 (file)
@@ -30,7 +30,7 @@ import org.onap.dcae.collectors.veshv.domain.PayloadWireFrameMessage.Companion.M
  * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
  * @since June 2018
  */
-class WireFrameEncoder(val allocator: ByteBufAllocator) {
+class WireFrameEncoder(private val allocator: ByteBufAllocator) {
 
     fun encode(frame: PayloadWireFrameMessage): ByteBuf {
         val bb = allocator.buffer(PayloadWireFrameMessage.HEADER_SIZE + frame.payload.size())
index d5855ca..4921953 100644 (file)
@@ -23,7 +23,6 @@ import arrow.core.Either
 import arrow.core.Option
 import arrow.core.Try
 import arrow.core.getOrElse
-import arrow.core.recoverWith
 import org.apache.commons.cli.CommandLine
 import org.apache.commons.cli.CommandLineParser
 import org.apache.commons.cli.Options
index 9760208..3695ca4 100644 (file)
@@ -58,7 +58,7 @@ object PayloadGeneratorTest : Spek({
 
         on("call with specified parameters") {
             val numOfCountPerMeas: Long = 5
-            val numOfMeasPerObject: Int = 10
+            val numOfMeasPerObject = 10
             val generatedPayload = payloadGenerator.generatePayload(numOfCountPerMeas, numOfMeasPerObject)
             it("should contain specified number of measurements") {
                 assertThat(generatedPayload.getPmObject(0).hvRanMeasCount).isEqualTo(numOfMeasPerObject)
diff --git a/pom.xml b/pom.xml
index ca31d5a..45fa496 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,6 @@
 
     <modules>
         <module>hv-collector-analysis</module>
-        <module>hv-collector-xnf-simulator</module>
         <module>hv-collector-core</module>
         <module>hv-collector-coverage</module>
         <module>hv-collector-ct</module>
@@ -48,6 +47,7 @@
         <module>hv-collector-main</module>
         <module>hv-collector-utils</module>
         <module>hv-collector-ves-message-generator</module>
+        <module>hv-collector-xnf-simulator</module>
     </modules>
 
     <properties>