From c7a3e0738abf581640059587dbb81790339340c9 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Wed, 3 Apr 2019 12:12:17 +0200 Subject: Simplify factory/provider logic Change-Id: I59467c41e1de63ead7c190a7c8fd688e3216237a Issue-ID: DCAEGEN2-1385 Signed-off-by: Piotr Jaszczyk --- .../org/onap/dcae/collectors/veshv/tests/component/Sut.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'sources/hv-collector-ct/src') diff --git a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt index 95b9159e..8b2bc13c 100644 --- a/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt +++ b/sources/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/Sut.kt @@ -19,17 +19,16 @@ */ package org.onap.dcae.collectors.veshv.tests.component -import arrow.effects.IO 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 -import org.onap.dcae.collectors.veshv.boundary.SinkProvider +import org.onap.dcae.collectors.veshv.boundary.SinkFactory import org.onap.dcae.collectors.veshv.config.api.model.CollectorConfiguration 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.factory.HvVesCollectorFactory import org.onap.dcae.collectors.veshv.model.ClientContext import org.onap.dcae.collectors.veshv.tests.fakes.AlwaysFailingSink import org.onap.dcae.collectors.veshv.tests.fakes.AlwaysSuccessfulSink @@ -51,17 +50,15 @@ import java.util.concurrent.atomic.AtomicBoolean class Sut(configuration: CollectorConfiguration, sink: Sink = StoringSink()) : Closeable { val alloc: ByteBufAllocator = UnpooledByteBufAllocator.DEFAULT val metrics = FakeMetrics() - val sinkProvider = DummySinkProvider(sink) + val sinkProvider = DummySinkFactory(sink) - private val collectorFactory = CollectorFactory( + private val collectorProvider = HvVesCollectorFactory( configuration, sinkProvider, metrics, MAX_PAYLOAD_SIZE_BYTES ) - private val collectorProvider = collectorFactory.createVesHvCollectorProvider() - val collector: Collector get() = collectorProvider(ClientContext(alloc)) @@ -82,7 +79,7 @@ class Sut(configuration: CollectorConfiguration, sink: Sink = StoringSink()) : C } } -class DummySinkProvider(private val sink: Sink) : SinkProvider { +class DummySinkFactory(private val sink: Sink) : SinkFactory { private val sinkInitialized = AtomicBoolean(false) override fun invoke(stream: SinkStream, ctx: ClientContext) = lazy { -- cgit 1.2.3-korg