From 0ba97c7eac5a821c813bfa8ac31b1063956d3824 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Wed, 13 Jun 2018 15:45:00 +0200 Subject: Add monitoring support by means of micrometer.io Closes ONAP-345 Change-Id: I58c145b1d37a6b32fbe5b157723c152eb571a2dd Signed-off-by: Piotr Jaszczyk Issue-ID: DCAEGEN2-601 --- .../dcae/collectors/veshv/tests/component/Sut.kt | 4 ++- .../dcae/collectors/veshv/tests/fakes/metrics.kt | 38 ++++++++++++++++++++++ .../onap/dcae/collectors/veshv/tests/fakes/sink.kt | 4 +-- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt (limited to 'hv-collector-ct') 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 c4e9874f..5099ae4c 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 @@ -26,6 +26,7 @@ import org.onap.dcae.collectors.veshv.boundary.SinkProvider import org.onap.dcae.collectors.veshv.model.RoutedMessage import org.onap.dcae.collectors.veshv.factory.CollectorFactory import org.onap.dcae.collectors.veshv.tests.fakes.FakeConfigurationProvider +import org.onap.dcae.collectors.veshv.tests.fakes.FakeMetrics import org.onap.dcae.collectors.veshv.tests.fakes.FakeSink import org.onap.dcae.collectors.veshv.utils.logging.Logger import reactor.core.Exceptions @@ -40,7 +41,8 @@ internal class Sut { val configurationProvider = FakeConfigurationProvider() val sink = FakeSink() val alloc = UnpooledByteBufAllocator.DEFAULT - private val collectorFactory = CollectorFactory(configurationProvider, SinkProvider.just(sink)) + val metrics = FakeMetrics() + private val collectorFactory = CollectorFactory(configurationProvider, SinkProvider.just(sink), metrics) val collectorProvider = collectorFactory.createVesHvCollectorProvider() val collector: Collector diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt new file mode 100644 index 00000000..cfc44bcd --- /dev/null +++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt @@ -0,0 +1,38 @@ +/* + * ============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.tests.fakes + +import org.onap.dcae.collectors.veshv.boundary.Metrics + +/** + * @author Piotr Jaszczyk + * @since June 2018 + */ +class FakeMetrics: Metrics { + override fun notifyBytesReceived(size: Int) { + } + + override fun notifyMessageReceived(size: Int) { + } + + override fun notifyMessageSent(topic: String) { + } + +} \ No newline at end of file diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/sink.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/sink.kt index 5d592e42..b0dbd0f5 100644 --- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/sink.kt +++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/sink.kt @@ -36,7 +36,7 @@ class FakeSink : Sink { val sentMessages: List get() = sent.toList() - override fun send(messages: Flux): Flux { - return messages.doOnNext(sent::addLast).map { it.message } + override fun send(messages: Flux): Flux { + return messages.doOnNext(sent::addLast) } } -- cgit 1.2.3-korg