diff options
Diffstat (limited to 'sources/hv-collector-ct')
2 files changed, 17 insertions, 12 deletions
diff --git a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/MetricsSpecification.kt b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/MetricsSpecification.kt index 572cc796..f457aeaf 100644 --- a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/MetricsSpecification.kt +++ b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/MetricsSpecification.kt @@ -175,7 +175,6 @@ object MetricsSpecification : Spek({ } describe("clients rejected metrics") { - given("rejection causes") { mapOf( ClientRejectionCause.PAYLOAD_SIZE_EXCEEDED_IN_MESSAGE to @@ -192,7 +191,7 @@ object MetricsSpecification : Spek({ assertThat(metrics.clientRejectionCause.size) .describedAs("metrics were notified with only one rejection cause") .isOne() - assertThat(metrics.clientRejectionCause.get(cause)) + assertThat(metrics.clientRejectionCause[cause]) .describedAs("metrics were notified only once with correct client rejection cause") .isOne() } diff --git a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt index a27d167a..8573d86f 100644 --- a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt +++ b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/metrics.kt @@ -21,12 +21,11 @@ package org.onap.dcae.collectors.veshv.tests.fakes import org.onap.dcae.collectors.veshv.boundary.Metrics import org.onap.dcae.collectors.veshv.domain.WireFrameMessage +import org.onap.dcae.collectors.veshv.model.ClientRejectionCause import org.onap.dcae.collectors.veshv.model.MessageDropCause import org.onap.dcae.collectors.veshv.model.RoutedMessage import java.time.Duration import java.time.Instant -import org.onap.dcae.collectors.veshv.model.ClientRejectionCause -import java.util.concurrent.ConcurrentHashMap import kotlin.test.fail /** @@ -35,14 +34,15 @@ import kotlin.test.fail */ class FakeMetrics : Metrics { - var bytesReceived: Int = 0 ; private set - var messageBytesReceived: Int = 0 ; private set - var messagesDroppedCount: Int = 0 ; private set - var lastProcessingTimeMicros: Double = -1.0 ; private set - private val messagesDroppedCause: MutableMap<MessageDropCause, Int> = ConcurrentHashMap() - var messagesSentCount: Int = 0 ; private set - val messagesSentToTopic: MutableMap<String, Int> = ConcurrentHashMap() - var clientRejectionCause = mutableMapOf<ClientRejectionCause, Int>() ; private set + var bytesReceived: Int = 0; private set + var messageBytesReceived: Int = 0; private set + var messagesDroppedCount: Int = 0; private set + var lastProcessingTimeMicros: Double = -1.0; private set + var messagesSentCount: Int = 0; private set + var clientRejectionCause = mutableMapOf<ClientRejectionCause, Int>(); private set + + private val messagesSentToTopic = mutableMapOf<String, Int>() + private val messagesDroppedCause = mutableMapOf<MessageDropCause, Int>() override fun notifyBytesReceived(size: Int) { bytesReceived += size @@ -69,6 +69,12 @@ class FakeMetrics : Metrics { clientRejectionCause.compute(cause) { k, _ -> clientRejectionCause[k]?.inc() ?: 1 } } + override fun notifyClientDisconnected() { + } + + override fun notifyClientConnected() { + } + fun messagesOnTopic(topic: String) = messagesSentToTopic[topic] ?: fail("No messages were sent to topic $topic") |