summaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-configuration
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2019-03-25 12:11:07 +0100
committerFilip Krzywka <filip.krzywka@nokia.com>2019-03-27 08:07:15 +0100
commit2b748ea515290984c5657e4d4a1027ff2e90bd61 (patch)
treed8d5e961acf4ac63c9009e6a58d66d65aacfa6d2 /sources/hv-collector-configuration
parent8e95c1191af4ce0f2e0d87f62657b30d66ddc397 (diff)
Remove routing from configuration file
Routing should only be available from CBS. Change-Id: Idfada36dcda4192d84a5b601907d27fe0db942ce Issue-ID: DCAEGEN2-1347 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'sources/hv-collector-configuration')
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt31
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReader.kt9
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt15
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapter.kt48
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RouteAdapter.kt43
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RoutingAdapter.kt40
-rw-r--r--sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt51
-rw-r--r--sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt54
-rw-r--r--sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapterTest.kt77
-rw-r--r--sources/hv-collector-configuration/src/test/resources/sampleConfig.json13
10 files changed, 57 insertions, 324 deletions
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt
index 330ec7c1..a6dc6887 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt
@@ -27,6 +27,8 @@ import arrow.core.getOrElse
import org.onap.dcae.collectors.veshv.config.api.model.CbsConfiguration
import org.onap.dcae.collectors.veshv.config.api.model.CollectorConfiguration
import org.onap.dcae.collectors.veshv.config.api.model.HvVesConfiguration
+import org.onap.dcae.collectors.veshv.config.api.model.Route
+import org.onap.dcae.collectors.veshv.config.api.model.Routing
import org.onap.dcae.collectors.veshv.config.api.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.ssl.boundary.SecurityConfiguration
import org.onap.dcae.collectors.veshv.utils.arrow.OptionUtils.binding
@@ -54,14 +56,20 @@ internal class ConfigurationValidator {
val securityConfiguration = SecurityConfiguration(partialConfig.security.bind().keys)
- val collectorConfiguration = partialConfig.collector.bind()
- .let { createCollectorConfig(it).bind() }
+// TOD0: retrieve when ConfigurationMerger is implemented
+// val collectorConfiguration = partialConfig.collector.bind()
+// .let { createCollectorConfig(it).bind() }
HvVesConfiguration(
serverConfiguration,
cbsConfiguration,
securityConfiguration,
- collectorConfiguration,
+// TOD0: swap when ConfigurationMerger is implemented
+// collectorConfiguration
+ CollectorConfiguration(-1,
+ "I do not exist. I'm not even a URL :o",
+ Routing(emptyList())),
+// end TOD0
logLevel
)
}.toEither { ValidationError("Some required configuration options are missing") }
@@ -92,14 +100,15 @@ internal class ConfigurationValidator {
)
}
- private fun createCollectorConfig(partial: PartialCollectorConfig) =
- partial.mapBinding {
- CollectorConfiguration(
- it.maxRequestSizeBytes.bind(),
- toKafkaServersString(it.kafkaServers.bind()),
- it.routing.bind()
- )
- }
+// TOD0: retrieve when ConfigurationMerger is implemented
+// private fun createCollectorConfig(partial: PartialCollectorConfig) =
+// partial.mapBinding {
+// CollectorConfiguration(
+// it.maxRequestSizeBytes.bind(),
+// toKafkaServersString(it.kafkaServers.bind()),
+// it.routing.bind()
+// )
+// }
private fun toKafkaServersString(kafkaServers: List<InetSocketAddress>): String =
kafkaServers.joinToString(",") { "${it.hostName}:${it.port}" }
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReader.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReader.kt
index 1e77dde5..d4e3db85 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReader.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReader.kt
@@ -21,14 +21,8 @@ package org.onap.dcae.collectors.veshv.config.impl
import arrow.core.Option
import com.google.gson.GsonBuilder
-import org.onap.dcae.collectors.veshv.config.api.model.Route
-import org.onap.dcae.collectors.veshv.config.api.model.Routing
-import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.AddressAdapter
import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.OptionAdapter
-import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.RouteAdapter
-import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.RoutingAdapter
import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.SecurityAdapter
-import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
import java.io.Reader
import java.net.InetSocketAddress
@@ -38,9 +32,6 @@ import java.net.InetSocketAddress
*/
internal class FileConfigurationReader {
private val gson = GsonBuilder()
- .registerTypeAdapter(InetSocketAddress::class.java, AddressAdapter())
- .registerTypeAdapter(Route::class.java, RouteAdapter())
- .registerTypeAdapter(Routing::class.java, RoutingAdapter())
.registerTypeAdapter(Option::class.java, OptionAdapter())
.registerTypeAdapter(PartialSecurityConfig::class.java, SecurityAdapter())
.create()
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt
index 3cedd6b5..12dac044 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/PartialConfiguration.kt
@@ -34,7 +34,8 @@ internal data class PartialConfiguration(
val server: Option<PartialServerConfig> = None,
val cbs: Option<PartialCbsConfig> = None,
val security: Option<PartialSecurityConfig> = None,
- val collector: Option<PartialCollectorConfig> = None,
+// TOD0: retrieve when ConfigurationMerger is implemented
+// val collector: Option<PartialCollectorConfig> = None,
val logLevel: Option<LogLevel> = None
)
@@ -50,9 +51,9 @@ internal data class PartialCbsConfig(
)
internal data class PartialSecurityConfig(val keys: Option<SecurityKeys> = None)
-
-internal data class PartialCollectorConfig(
- val maxRequestSizeBytes: Option<Int> = None,
- val kafkaServers: Option<List<InetSocketAddress>> = None,
- val routing: Option<Routing> = None
-)
+// TOD0: retrieve when ConfigurationMerger is implemented
+//internal data class PartialCollectorConfig(
+// val maxRequestSizeBytes: Option<Int> = None,
+// val kafkaServers: Option<List<InetSocketAddress>> = None,
+// val routing: Option<Routing> = None
+//)
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapter.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapter.kt
deleted file mode 100644
index 255be03a..00000000
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapter.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2019 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.config.impl.gsonadapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import com.google.gson.JsonParseException
-import java.lang.reflect.Type
-import java.net.InetSocketAddress
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since February 2019
- */
-internal class AddressAdapter : JsonDeserializer<InetSocketAddress> {
- override fun deserialize(
- json: JsonElement,
- typeOfT: Type,
- context: JsonDeserializationContext): InetSocketAddress {
- val portStart = json.asString.lastIndexOf(":")
- if (portStart > 0) {
- val address = json.asString.substring(0, portStart)
- val port = json.asString.substring(portStart + 1)
- return InetSocketAddress(address, port.toInt())
- } else throw InvalidAddressException("Cannot parse '" + json.asString + "' to address")
- }
-
- class InvalidAddressException(reason: String) : RuntimeException(reason)
-}
-
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RouteAdapter.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RouteAdapter.kt
deleted file mode 100644
index 25cb8861..00000000
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RouteAdapter.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2019 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.config.impl.gsonadapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import org.onap.dcae.collectors.veshv.config.api.model.Route
-import org.onap.dcae.collectors.veshv.config.api.model.RouteBuilder
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-internal class RouteAdapter : JsonDeserializer<Route> {
- override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext?): Route {
- val jobj = json.asJsonObject
- return RouteBuilder()
- .fromDomain(jobj["fromDomain"].asString)
- .toTopic(jobj["toTopic"].asString)
- .withFixedPartitioning()
- .build()
- }
-
-}
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RoutingAdapter.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RoutingAdapter.kt
deleted file mode 100644
index 4b299098..00000000
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/RoutingAdapter.kt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2019 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.config.impl.gsonadapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import com.google.gson.reflect.TypeToken
-import org.onap.dcae.collectors.veshv.config.api.model.Route
-import org.onap.dcae.collectors.veshv.config.api.model.Routing
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-internal class RoutingAdapter : JsonDeserializer<Routing> {
- override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): Routing {
- val parametrizedType = TypeToken.getParameterized(List::class.java, Route::class.java).type
- return Routing(context.deserialize<List<Route>>(json, parametrizedType))
- }
-
-}
diff --git a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt b/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt
index 696f42a2..62b43ded 100644
--- a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt
+++ b/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidatorTest.kt
@@ -28,7 +28,7 @@ import org.assertj.core.api.Assertions.fail
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
-import org.onap.dcae.collectors.veshv.config.api.model.routing
+import org.onap.dcae.collectors.veshv.config.api.model.Routing
import org.onap.dcae.collectors.veshv.config.impl.ConfigurationValidator.Companion.DEFAULT_LOG_LEVEL
import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
@@ -63,11 +63,12 @@ internal object ConfigurationValidatorTest : Spek({
Some(PartialSecurityConfig(
Some(mock())
)),
- Some(PartialCollectorConfig(
- Some(4),
- Some(emptyList()),
- Some(routing { }.build())
- )),
+// TOD0: retrieve when ConfigurationMerger is implemented
+// Some(PartialCollectorConfig(
+// Some(4),
+// Some(emptyList()),
+// someFromEmptyRouting
+// )),
None
)
@@ -88,7 +89,6 @@ internal object ConfigurationValidatorTest : Spek({
val idleTimeoutSec = 10
val firstReqDelaySec = 10
val securityKeys = Some(mock<SecurityKeys>())
- val routing = routing { }.build()
val config = PartialConfiguration(
Some(PartialServerConfig(
@@ -103,11 +103,12 @@ internal object ConfigurationValidatorTest : Spek({
Some(PartialSecurityConfig(
securityKeys
)),
- Some(PartialCollectorConfig(
- Some(4),
- Some(emptyList()),
- Some(routing)
- )),
+// TOD0: retrieve when ConfigurationMerger is implemented
+// Some(PartialCollectorConfig(
+// Some(4),
+// Some(emptyList()),
+// someFromEmptyRouting
+// )),
Some(LogLevel.INFO)
)
@@ -127,8 +128,9 @@ internal object ConfigurationValidatorTest : Spek({
assertThat(it.cbs.firstRequestDelay)
.isEqualTo(Duration.ofSeconds(firstReqDelaySec.toLong()))
- assertThat(it.collector.routing)
- .isEqualTo(routing)
+// TOD0: retrieve when ConfigurationMerger is implemented
+// assertThat(it.collector.routing)
+// .isEqualTo(emptyRouting)
}
)
}
@@ -138,7 +140,6 @@ internal object ConfigurationValidatorTest : Spek({
val idleTimeoutSec = 10
val firstReqDelaySec = 10
val securityKeys: Option<SecurityKeys> = None
- val routing = routing { }.build()
val config = PartialConfiguration(
Some(PartialServerConfig(
@@ -153,11 +154,12 @@ internal object ConfigurationValidatorTest : Spek({
Some(PartialSecurityConfig(
securityKeys
)),
- Some(PartialCollectorConfig(
- Some(4),
- Some(emptyList()),
- Some(routing)
- )),
+// TOD0: retrieve when ConfigurationMerger is implemented
+// Some(PartialCollectorConfig(
+// Some(4),
+// Some(emptyList()),
+// someFromEmptyRouting
+// )),
Some(LogLevel.INFO)
)
@@ -177,8 +179,9 @@ internal object ConfigurationValidatorTest : Spek({
assertThat(it.cbs.firstRequestDelay)
.isEqualTo(Duration.ofSeconds(firstReqDelaySec.toLong()))
- assertThat(it.collector.routing)
- .isEqualTo(routing)
+// TOD0: retrieve when ConfigurationMerger is implemented
+// assertThat(it.collector.routing)
+// .isEqualTo(emptyRouting)
}
)
}
@@ -186,3 +189,7 @@ internal object ConfigurationValidatorTest : Spek({
}
})
+
+// TOD0: retrieve when ConfigurationMerger is implemented
+//val emptyRouting = Routing(emptyList())
+//val someFromEmptyRouting = Some(emptyRouting)
diff --git a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt b/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt
index bbf259c7..73be3e43 100644
--- a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt
+++ b/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/FileConfigurationReaderTest.kt
@@ -24,11 +24,9 @@ import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
-import org.onap.dcae.collectors.veshv.config.api.model.Routing
import org.onap.dcae.collectors.veshv.tests.utils.resourceAsStream
import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
import java.io.StringReader
-import java.net.InetSocketAddress
/**
* @author Pawel Biniek <pawel.biniek@nokia.com>
@@ -59,50 +57,6 @@ internal object FileConfigurationReaderTest : Spek({
assertThat(config.server.orNull()?.listenPort).isEqualTo(Some(12003))
}
- it("parses ip address") {
- val input = """{ "collector" : {
- "kafkaServers": [
- "192.168.255.1:5005",
- "192.168.255.26:5006"
- ]
- }
- }"""
-
- val config = cut.loadConfig(StringReader(input))
- assertThat(config.collector.nonEmpty()).isTrue()
- val collector = config.collector.orNull() as PartialCollectorConfig
- assertThat(collector.kafkaServers.nonEmpty()).isTrue()
- val addresses = collector.kafkaServers.orNull() as List<InetSocketAddress>
- assertThat(addresses)
- .isEqualTo(listOf(
- InetSocketAddress("192.168.255.1", 5005),
- InetSocketAddress("192.168.255.26", 5006)
- ))
- }
-
- it("parses routing array with RoutingAdapter") {
- val input = """{
- "collector" : {
- "routing" : [
- {
- "fromDomain": "perf3gpp",
- "toTopic": "HV_VES_PERF3GPP"
- }
- ]
- }
- }""".trimIndent()
- val config = cut.loadConfig(StringReader(input))
- assertThat(config.collector.nonEmpty()).isTrue()
- val collector = config.collector.orNull() as PartialCollectorConfig
- assertThat(collector.routing.nonEmpty()).isTrue()
- val routing = collector.routing.orNull() as Routing
- routing.run {
- assertThat(routes.size).isEqualTo(1)
- assertThat(routes[0].domain).isEqualTo("perf3gpp")
- assertThat(routes[0].targetTopic).isEqualTo("HV_VES_PERF3GPP")
- }
- }
-
it("parses disabled security configuration") {
val input = """{
"security": {
@@ -142,14 +96,6 @@ internal object FileConfigurationReaderTest : Spek({
assertThat(cbs.firstRequestDelaySec).isEqualTo(Some(7))
assertThat(cbs.requestIntervalSec).isEqualTo(Some(900))
- assertThat(config.collector.nonEmpty()).isTrue()
- val collector = config.collector.orNull() as PartialCollectorConfig
- collector.run {
- assertThat(maxRequestSizeBytes).isEqualTo(Some(512000))
- assertThat(kafkaServers.nonEmpty()).isTrue()
- assertThat(routing.nonEmpty()).isTrue()
- }
-
assertThat(config.server.nonEmpty()).isTrue()
val server = config.server.orNull() as PartialServerConfig
server.run {
diff --git a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapterTest.kt b/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapterTest.kt
deleted file mode 100644
index f70c4337..00000000
--- a/sources/hv-collector-configuration/src/test/kotlin/org/onap/dcae/collectors/veshv/config/impl/gsonadapters/AddressAdapterTest.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2019 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.config.impl.gsonadapters
-
-import com.google.gson.Gson
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonParseException
-import com.google.gson.reflect.TypeToken
-import com.nhaarman.mockitokotlin2.mock
-import org.assertj.core.api.Assertions.assertThat
-import org.jetbrains.spek.api.Spek
-import org.jetbrains.spek.api.dsl.describe
-import org.jetbrains.spek.api.dsl.given
-import org.jetbrains.spek.api.dsl.it
-import org.onap.dcae.collectors.veshv.config.impl.gsonadapters.AddressAdapter.InvalidAddressException
-import java.lang.NumberFormatException
-import kotlin.test.assertFailsWith
-
-
-internal object AddressAdapterTest : Spek({
-
- describe("deserialization") {
- val gson = Gson()
- val context = mock<JsonDeserializationContext>()
- val addressAdapterType = TypeToken.get(AddressAdapter::class.java).type
-
- val cut = AddressAdapter()
-
- given("valid string") {
- val address = "hostname:9000"
- val json = gson.toJsonTree(address)
-
- it("should return address") {
- val deserialized = cut.deserialize(json, addressAdapterType, context)
-
- assertThat(deserialized.hostName).isEqualTo("hostname")
- assertThat(deserialized.port).isEqualTo(9000)
- }
- }
-
- val invalidAddresses = mapOf(
- Pair("missingPort", InvalidAddressException::class),
- Pair("NaNPort:Hey", NumberFormatException::class),
- Pair(":6036", InvalidAddressException::class))
-
- invalidAddresses.forEach { address, exception ->
- given("invalid address string: $address") {
-
- val json = gson.toJsonTree(address)
- it("should throw exception") {
- assertFailsWith(exception) {
- cut.deserialize(json, addressAdapterType, context)
- }
- }
- }
- }
- }
-})
-
-
diff --git a/sources/hv-collector-configuration/src/test/resources/sampleConfig.json b/sources/hv-collector-configuration/src/test/resources/sampleConfig.json
index 5ae9fc02..8b440ebe 100644
--- a/sources/hv-collector-configuration/src/test/resources/sampleConfig.json
+++ b/sources/hv-collector-configuration/src/test/resources/sampleConfig.json
@@ -18,18 +18,5 @@
"trustStoreFile": "trust.ks.pkcs12",
"trustStorePassword": "changeMeToo"
}
- },
- "collector": {
- "maxRequestSizeBytes": 512000,
- "kafkaServers": [
- "192.168.255.1:5005",
- "192.168.255.1:5006"
- ],
- "routing": [
- {
- "fromDomain": "perf3gpp",
- "toTopic": "HV_VES_PERF3GPP"
- }
- ]
}
} \ No newline at end of file