diff options
author | 2018-08-03 05:17:40 +0000 | |
---|---|---|
committer | 2018-08-03 05:17:40 +0000 | |
commit | 8e31525e1003bede54c23a061cee2ca7e59a4be5 (patch) | |
tree | 2c96c523409caed0b13639827c5168c7728d371c | |
parent | fe7b836e9642cd523bceea6314f91f1174e04c71 (diff) | |
parent | 2a8d4e37f01386c59379b9f974dddbf595ee0a18 (diff) |
Merge "Include msg generator module in coverage report"
16 files changed, 21 insertions, 29 deletions
diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/boundary/adapters.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/boundary/adapters.kt index 2fc23952..dd0111bc 100644 --- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/boundary/adapters.kt +++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/boundary/adapters.kt @@ -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 { diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt index 8d10a407..4586d30c 100644 --- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt +++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt @@ -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 diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProvider.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProvider.kt index 786bc7ce..621c63f8 100644 --- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProvider.kt +++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProvider.kt @@ -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 diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSink.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSink.kt index f8fa72a6..b611e9aa 100644 --- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSink.kt +++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/KafkaSink.kt @@ -20,11 +20,8 @@ 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 diff --git a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt index c98c97a6..322ec4e8 100644 --- a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt +++ b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt @@ -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.* diff --git a/hv-collector-coverage/pom.xml b/hv-collector-coverage/pom.xml index 1c039367..a046f29b 100644 --- a/hv-collector-coverage/pom.xml +++ b/hv-collector-coverage/pom.xml @@ -97,12 +97,17 @@ </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> diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt index d78463bf..aaadcc7d 100644 --- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt +++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt @@ -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() diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/messages.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/messages.kt index 64b4ba26..a63aa9d5 100644 --- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/messages.kt +++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/messages.kt @@ -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() diff --git a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/kafka/consumer.kt b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/kafka/consumer.kt index 7db69205..869c5ab6 100644 --- a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/kafka/consumer.kt +++ b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/kafka/consumer.kt @@ -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() } diff --git a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/remote/ApiServer.kt b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/remote/ApiServer.kt index 39b4fe2f..d1d90b00 100644 --- a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/remote/ApiServer.kt +++ b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/remote/ApiServer.kt @@ -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) diff --git a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt index b73a788e..4084ee8d 100644 --- a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt +++ b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/config/ArgBasedDcaeAppSimConfigurationTest.kt @@ -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) } diff --git a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt index ab82dc04..cbc18fd0 100644 --- a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt +++ b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt @@ -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()) diff --git a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt index 8f0c2af9..b56b1b1d 100644 --- a/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt +++ b/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgBasedServerConfigurationTest.kt @@ -19,8 +19,6 @@ */ package org.onap.dcae.collectors.veshv.main -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 diff --git a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt index d5855caa..49219531 100644 --- a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt +++ b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt @@ -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 diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/PayloadGeneratorTest.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/PayloadGeneratorTest.kt index 9760208f..3695ca4d 100644 --- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/PayloadGeneratorTest.kt +++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/PayloadGeneratorTest.kt @@ -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) @@ -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> |