aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-main
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2019-03-12 11:50:37 +0100
committerFilip Krzywka <filip.krzywka@nokia.com>2019-03-14 08:01:24 +0100
commit007480ce97edd553c093036634a2f7e6ea47ef1e (patch)
treee4c46dfb941f15a841c8d23c313fc3bf43c891a3 /sources/hv-collector-main
parent4d620bf4e700200bf0ece18346143afdc38aca7d (diff)
Extract HV-VES configuration module
To avoid cyclic dependency between "modules trio" configuration-core-ssl some classes from core.model were also extracted. Change-Id: Ie11029ae3500964f67f4d72279ddd68cdb2a1f0c Issue-ID: DCAEGEN2-1332 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
Diffstat (limited to 'sources/hv-collector-main')
-rw-r--r--sources/hv-collector-main/pom.xml26
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt154
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/ConfigFactory.kt46
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/PartialConfiguration.kt59
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/AddressAdapter.kt50
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/OptionAdapter.kt40
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RouteAdapter.kt43
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RoutingAdapter.kt40
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/SecurityKeysAdapter.kt51
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/main.kt6
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt2
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/HealthCheckServer.kt2
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/ServerStarter.kt2
-rw-r--r--sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt2
-rw-r--r--sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt191
-rw-r--r--sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ConfigFactoryTest.kt143
-rw-r--r--sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt4
-rw-r--r--sources/hv-collector-main/src/test/resources/sampleConfig.json35
18 files changed, 23 insertions, 873 deletions
diff --git a/sources/hv-collector-main/pom.xml b/sources/hv-collector-main/pom.xml
index 619616ad..edbdaa36 100644
--- a/sources/hv-collector-main/pom.xml
+++ b/sources/hv-collector-main/pom.xml
@@ -34,7 +34,6 @@
<groupId>org.onap.dcaegen2.collectors.hv-ves</groupId>
<artifactId>hv-collector-sources</artifactId>
<version>1.1.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
</parent>
<artifactId>hv-collector-main</artifactId>
@@ -78,20 +77,19 @@
<dependencies>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>hv-collector-core</artifactId>
- <version>${project.parent.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hv-collector-configuration</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>hv-collector-health-check</artifactId>
- <version>${project.parent.version}</version>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hv-collector-core</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>hv-collector-test-utils</artifactId>
- <version>${project.parent.version}</version>
- <scope>test</scope>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hv-collector-health-check</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.arrow-kt</groupId>
@@ -130,8 +128,10 @@
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>hv-collector-test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
</dependency>
</dependencies>
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt
deleted file mode 100644
index bb484cfe..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018-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.main
-
-import arrow.core.Option
-import arrow.core.fix
-import arrow.core.getOrElse
-import arrow.instances.option.monad.monad
-import arrow.typeclasses.binding
-import org.apache.commons.cli.CommandLine
-import org.apache.commons.cli.DefaultParser
-import org.onap.dcae.collectors.veshv.commandline.ArgBasedConfiguration
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.CONFIGURATION_REQUEST_INTERVAL
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.CONFIGURATION_FIRST_REQUEST_DELAY
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.DUMMY_MODE
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.HEALTH_CHECK_API_PORT
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.IDLE_TIMEOUT_SEC
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.KAFKA_SERVERS
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.KEY_STORE_FILE
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.KEY_STORE_PASSWORD
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.LISTEN_PORT
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.LOG_LEVEL
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.MAXIMUM_PAYLOAD_SIZE_BYTES
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.SSL_DISABLE
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.TRUST_STORE_FILE
-import org.onap.dcae.collectors.veshv.commandline.CommandLineOption.TRUST_STORE_PASSWORD
-import org.onap.dcae.collectors.veshv.commandline.hasOption
-import org.onap.dcae.collectors.veshv.commandline.intValue
-import org.onap.dcae.collectors.veshv.commandline.longValue
-import org.onap.dcae.collectors.veshv.commandline.stringValue
-import org.onap.dcae.collectors.veshv.domain.WireFrameMessage
-import org.onap.dcae.collectors.veshv.model.ConfigurationProviderParams
-import org.onap.dcae.collectors.veshv.model.KafkaConfiguration
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
-import org.onap.dcae.collectors.veshv.model.ServiceContext
-import org.onap.dcae.collectors.veshv.ssl.boundary.createSecurityConfiguration
-import org.onap.dcae.collectors.veshv.utils.arrow.doOnFailure
-import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
-import org.onap.dcae.collectors.veshv.utils.logging.Logger
-import java.net.InetSocketAddress
-import java.time.Duration
-
-
-internal class ArgVesHvConfiguration : ArgBasedConfiguration<ServerConfiguration>(DefaultParser()) {
- override val cmdLineOptionsList = listOf(
- KAFKA_SERVERS,
- HEALTH_CHECK_API_PORT,
- LISTEN_PORT,
- CONFIGURATION_FIRST_REQUEST_DELAY,
- CONFIGURATION_REQUEST_INTERVAL,
- SSL_DISABLE,
- KEY_STORE_FILE,
- KEY_STORE_PASSWORD,
- TRUST_STORE_FILE,
- TRUST_STORE_PASSWORD,
- IDLE_TIMEOUT_SEC,
- MAXIMUM_PAYLOAD_SIZE_BYTES,
- DUMMY_MODE,
- LOG_LEVEL
- )
-
- override fun getConfiguration(cmdLine: CommandLine): Option<ServerConfiguration> =
- Option.monad().binding {
- val healthCheckApiPort = cmdLine.intValue(
- HEALTH_CHECK_API_PORT,
- DefaultValues.HEALTH_CHECK_API_PORT
- )
- val kafkaServers = cmdLine.stringValue(KAFKA_SERVERS).bind()
- val listenPort = cmdLine.intValue(LISTEN_PORT).bind()
- val idleTimeoutSec = cmdLine.longValue(IDLE_TIMEOUT_SEC, DefaultValues.IDLE_TIMEOUT_SEC)
- val maxPayloadSizeBytes = cmdLine.intValue(
- MAXIMUM_PAYLOAD_SIZE_BYTES,
- DefaultValues.MAX_PAYLOAD_SIZE_BYTES
- )
- val dummyMode = cmdLine.hasOption(DUMMY_MODE)
- val security = createSecurityConfiguration(cmdLine)
- .doOnFailure { ex ->
- logger.withError(ServiceContext::mdc) {
- log("Could not read security keys", ex)
- }
- }
- .toOption()
- .bind()
- val logLevel = cmdLine.stringValue(LOG_LEVEL, DefaultValues.LOG_LEVEL)
- val configurationProviderParams = createConfigurationProviderParams(cmdLine).bind()
- ServerConfiguration(
- serverListenAddress = InetSocketAddress(listenPort),
- kafkaConfiguration = KafkaConfiguration(kafkaServers, maxPayloadSizeBytes),
- healthCheckApiListenAddress = InetSocketAddress(healthCheckApiPort),
- configurationProviderParams = configurationProviderParams,
- securityConfiguration = security,
- idleTimeout = Duration.ofSeconds(idleTimeoutSec),
- maximumPayloadSizeBytes = maxPayloadSizeBytes,
- dummyMode = dummyMode,
- logLevel = determineLogLevel(logLevel)
- )
- }.fix()
-
- private fun createConfigurationProviderParams(cmdLine: CommandLine): Option<ConfigurationProviderParams> =
- Option.monad().binding {
- val firstRequestDelay = cmdLine.longValue(
- CONFIGURATION_FIRST_REQUEST_DELAY,
- DefaultValues.CONFIGURATION_FIRST_REQUEST_DELAY
- )
- val requestInterval = cmdLine.longValue(
- CONFIGURATION_REQUEST_INTERVAL,
- DefaultValues.CONFIGURATION_REQUEST_INTERVAL
- )
- ConfigurationProviderParams(
- Duration.ofSeconds(firstRequestDelay),
- Duration.ofSeconds(requestInterval)
- )
- }.fix()
-
- private fun determineLogLevel(logLevel: String) = LogLevel.optionFromString(logLevel)
- .getOrElse {
- logger.warn {
- "Failed to parse $logLevel as $LOG_LEVEL command line. " +
- "Using default log level (${DefaultValues.LOG_LEVEL})"
- }
- LogLevel.valueOf(DefaultValues.LOG_LEVEL)
- }
-
-
- internal object DefaultValues {
- const val HEALTH_CHECK_API_PORT = 6060
- const val CONFIGURATION_FIRST_REQUEST_DELAY = 10L
- const val CONFIGURATION_REQUEST_INTERVAL = 5L
- const val IDLE_TIMEOUT_SEC = 60L
- const val MAX_PAYLOAD_SIZE_BYTES = WireFrameMessage.DEFAULT_MAX_PAYLOAD_SIZE_BYTES
- val LOG_LEVEL = LogLevel.INFO.name
- }
-
- companion object {
- private val logger = Logger(ArgVesHvConfiguration::class)
- }
-}
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/ConfigFactory.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/ConfigFactory.kt
deleted file mode 100644
index 2262b6ff..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/ConfigFactory.kt
+++ /dev/null
@@ -1,46 +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.main.config
-
-import arrow.core.Option
-import com.google.gson.GsonBuilder
-import org.onap.dcae.collectors.veshv.main.config.adapters.*
-import org.onap.dcae.collectors.veshv.model.Route
-import org.onap.dcae.collectors.veshv.model.Routing
-import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
-import java.io.Reader
-import java.net.InetSocketAddress
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since February 2019
- */
-class ConfigFactory {
- 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(SecurityKeys::class.java, SecurityKeysAdapter())
- .create()
-
- fun loadConfig(input: Reader): PartialConfiguration =
- gson.fromJson(input, PartialConfiguration::class.java)
-}
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/PartialConfiguration.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/PartialConfiguration.kt
deleted file mode 100644
index 1bccc217..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/PartialConfiguration.kt
+++ /dev/null
@@ -1,59 +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.main.config
-
-import arrow.core.Option
-import org.onap.dcae.collectors.veshv.model.Routing
-import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
-import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
-import java.net.InetSocketAddress
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since February 2019
- */
-data class PartialConfiguration(
- val server : Option<PartialServerConfig>,
- val cbs : Option<PartialCbsConfig>,
- val security : Option<PartialSecurityConfig>,
- val kafka : Option<PartialKafkaConfig>,
- val logLevel : Option<LogLevel>
-)
-data class PartialSecurityConfig(
- val sslDisable : Option<Boolean>,
- val keys : Option<SecurityKeys>)
-
-data class PartialCbsConfig(
- val firstRequestDelaySec : Option<Int>,
- val requestIntervalSec : Option<Int>
-)
-
-data class PartialServerConfig(
- val healthCheckApiPort : Option<Int>,
- val listenPort : Option<Int>,
- val idleTimeoutSec : Option<Int>,
- val maximumPayloadSizeBytes : Option<Int>,
- val dummyMode : Option<Boolean>
-)
-
-data class PartialKafkaConfig(
- val kafkaServers : Option<Array<InetSocketAddress>>,
- val routing : Option<Routing>
-)
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/AddressAdapter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/AddressAdapter.kt
deleted file mode 100644
index 6e616f58..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/AddressAdapter.kt
+++ /dev/null
@@ -1,50 +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.main.config.adapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import java.lang.reflect.Type
-import java.net.InetSocketAddress
-
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since February 2019
- */
-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-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/OptionAdapter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/OptionAdapter.kt
deleted file mode 100644
index 62d107ab..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/OptionAdapter.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.main.config.adapters
-
-import arrow.core.Option
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import java.lang.reflect.ParameterizedType
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-class OptionAdapter : JsonDeserializer<Option<Any>> {
- override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): Option<Any> {
- val parametrizedType = typeOfT as ParameterizedType
- val typeParameter = parametrizedType.actualTypeArguments.first()
- return Option.fromNullable(context.deserialize<Any>(json, typeParameter))
- }
-
-}
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RouteAdapter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RouteAdapter.kt
deleted file mode 100644
index a617abca..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/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.main.config.adapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import org.onap.dcae.collectors.veshv.model.Route
-import org.onap.dcae.collectors.veshv.model.RouteBuilder
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-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-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RoutingAdapter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/RoutingAdapter.kt
deleted file mode 100644
index d0c5ff37..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/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.main.config.adapters
-
-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.model.Route
-import org.onap.dcae.collectors.veshv.model.Routing
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-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-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/SecurityKeysAdapter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/SecurityKeysAdapter.kt
deleted file mode 100644
index 7c22e0f8..00000000
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/config/adapters/SecurityKeysAdapter.kt
+++ /dev/null
@@ -1,51 +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.main.config.adapters
-
-import com.google.gson.JsonDeserializationContext
-import com.google.gson.JsonDeserializer
-import com.google.gson.JsonElement
-import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeys
-import org.onap.dcaegen2.services.sdk.security.ssl.ImmutableSecurityKeysStore
-import org.onap.dcaegen2.services.sdk.security.ssl.Passwords
-import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
-import java.io.File
-import java.lang.reflect.Type
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since March 2019
- */
-class SecurityKeysAdapter : JsonDeserializer<SecurityKeys> {
- override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext?): SecurityKeys {
- val obj = json.asJsonObject
- return ImmutableSecurityKeys.builder()
- .keyStore(ImmutableSecurityKeysStore.of(
- File(obj["keyStoreFile"].asString).toPath()))
- .keyStorePassword(
- Passwords.fromString(obj["keyStorePassword"].asString))
- .trustStore(ImmutableSecurityKeysStore.of(
- File(obj["trustStoreFile"].asString).toPath()))
- .trustStorePassword(
- Passwords.fromString(obj["trustStorePassword"].asString))
- .build()
- }
-
-}
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/main.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/main.kt
index d21b490c..39fcae21 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/main.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/main.kt
@@ -24,11 +24,12 @@ import arrow.effects.fix
import arrow.effects.instances.io.monad.monad
import arrow.typeclasses.binding
import org.onap.dcae.collectors.veshv.commandline.handleWrongArgumentErrorCurried
+import org.onap.dcae.collectors.veshv.config.api.ConfigurationModule
+import org.onap.dcae.collectors.veshv.config.api.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.healthcheck.api.HealthDescription
import org.onap.dcae.collectors.veshv.healthcheck.api.HealthState
import org.onap.dcae.collectors.veshv.main.servers.HealthCheckServer
import org.onap.dcae.collectors.veshv.main.servers.VesServer
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.model.ServiceContext
import org.onap.dcae.collectors.veshv.utils.Closeable
import org.onap.dcae.collectors.veshv.utils.ServerHandle
@@ -42,7 +43,8 @@ private val logger = Logger("$VESHV_PACKAGE.main")
private const val PROGRAM_NAME = "java $VESHV_PACKAGE.main.MainKt"
fun main(args: Array<String>) =
- ArgVesHvConfiguration().parse(args)
+ ConfigurationModule()
+ .createConfigurationFromCommandLine(args)
.mapLeft(handleWrongArgumentErrorCurried(PROGRAM_NAME))
.map(::startAndAwaitServers)
.unsafeRunEitherSync(
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
index fd1d9c53..2fb44768 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/metrics/MicrometerMetrics.kt
@@ -33,7 +33,7 @@ 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 org.onap.dcae.collectors.veshv.domain.RoutedMessage
import org.onap.dcae.collectors.veshv.utils.TimeUtils.epochMicroToInstant
import java.time.Duration
import java.time.Instant
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/HealthCheckServer.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/HealthCheckServer.kt
index 00123f1a..15472b5e 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/HealthCheckServer.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/HealthCheckServer.kt
@@ -19,10 +19,10 @@
*/
package org.onap.dcae.collectors.veshv.main.servers
+import org.onap.dcae.collectors.veshv.config.api.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.healthcheck.api.HealthState
import org.onap.dcae.collectors.veshv.healthcheck.factory.HealthCheckApiServer
import org.onap.dcae.collectors.veshv.main.metrics.MicrometerMetrics
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.utils.ServerHandle
/**
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/ServerStarter.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/ServerStarter.kt
index 3d1a2a21..74a66324 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/ServerStarter.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/ServerStarter.kt
@@ -20,7 +20,7 @@
package org.onap.dcae.collectors.veshv.main.servers
import arrow.effects.IO
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
+import org.onap.dcae.collectors.veshv.config.api.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.model.ServiceContext
import org.onap.dcae.collectors.veshv.utils.ServerHandle
import org.onap.dcae.collectors.veshv.utils.arrow.then
diff --git a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
index 62c24308..0f5e45ec 100644
--- a/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
+++ b/sources/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
@@ -21,11 +21,11 @@ package org.onap.dcae.collectors.veshv.main.servers
import arrow.effects.IO
import org.onap.dcae.collectors.veshv.boundary.Server
+import org.onap.dcae.collectors.veshv.config.api.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.factory.CollectorFactory
import org.onap.dcae.collectors.veshv.factory.ServerFactory
import org.onap.dcae.collectors.veshv.impl.adapters.AdapterFactory
import org.onap.dcae.collectors.veshv.main.metrics.MicrometerMetrics
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
import org.onap.dcae.collectors.veshv.utils.ServerHandle
/**
diff --git a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt b/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt
deleted file mode 100644
index 6d219106..00000000
--- a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfigurationTest.kt
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * dcaegen2-collectors-veshv
- * ================================================================================
- * Copyright (C) 2018-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.main
-
-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.jetbrains.spek.api.dsl.on
-import org.onap.dcae.collectors.veshv.commandline.WrongArgumentError
-import org.onap.dcae.collectors.veshv.model.ServerConfiguration
-import org.onap.dcae.collectors.veshv.tests.utils.parseExpectingFailure
-import org.onap.dcae.collectors.veshv.tests.utils.parseExpectingSuccess
-import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
-import org.onap.dcaegen2.services.sdk.security.ssl.SecurityKeys
-import java.time.Duration
-import kotlin.test.assertNotNull
-
-/**
- * @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
- * @since May 2018
- */
-object ArgVesHvConfigurationTest : Spek({
- lateinit var cut: ArgVesHvConfiguration
- val kafkaBootstrapServers = "dmaap-mr-wro:6666,dmaap-mr-gda:6666"
- val healthCheckApiPort = "6070"
- val firstRequestDelay = "10"
- val requestInterval = "5"
- val listenPort = "6969"
- val keyStorePassword = "kspass"
- val trustStorePassword = "tspass"
- val logLevel = LogLevel.DEBUG.name
-
- beforeEachTest {
- cut = ArgVesHvConfiguration()
- }
-
- describe("parsing arguments") {
- given("all parameters are present in the long form") {
- lateinit var result: ServerConfiguration
-
- beforeEachTest {
- result = cut.parseExpectingSuccess(
- "--kafka-bootstrap-servers", kafkaBootstrapServers,
- "--health-check-api-port", healthCheckApiPort,
- "--listen-port", listenPort,
- "--first-request-delay", firstRequestDelay,
- "--request-interval", requestInterval,
- "--key-store", "/tmp/keys.p12",
- "--trust-store", "/tmp/trust.p12",
- "--key-store-password", keyStorePassword,
- "--trust-store-password", trustStorePassword,
- "--log-level", logLevel
- )
- }
-
- it("should set proper kafka bootstrap servers") {
- assertThat(result.kafkaConfiguration.bootstrapServers).isEqualTo(kafkaBootstrapServers)
- }
-
- it("should set proper listen port") {
- assertThat(result.serverListenAddress.port).isEqualTo(listenPort.toInt())
- }
-
-
- it("should set default listen address") {
- assertThat(result.serverListenAddress.address.hostAddress).isEqualTo("0.0.0.0")
- }
-
- it("should set proper health check api port") {
- assertThat(result.healthCheckApiListenAddress.port).isEqualTo(healthCheckApiPort.toInt())
- }
-
- it("should set default health check api address") {
- assertThat(result.healthCheckApiListenAddress.address.hostAddress).isEqualTo("0.0.0.0")
- }
-
- it("should set proper first request delay") {
- assertThat(result.configurationProviderParams.firstRequestDelay)
- .isEqualTo(Duration.ofSeconds(firstRequestDelay.toLong()))
- }
-
- it("should set proper request interval") {
- assertThat(result.configurationProviderParams.requestInterval)
- .isEqualTo(Duration.ofSeconds(requestInterval.toLong()))
- }
-
- it("should set proper security configuration") {
- assertThat(result.securityConfiguration.keys.isEmpty()).isFalse()
-
- val keys = result.securityConfiguration.keys.orNull() as SecurityKeys
- assertNotNull(keys.keyStore())
- assertNotNull(keys.trustStore())
- keys.keyStorePassword().useChecked {
- assertThat(it).isEqualTo(keyStorePassword.toCharArray())
-
- }
- keys.trustStorePassword().useChecked {
- assertThat(it).isEqualTo(trustStorePassword.toCharArray())
- }
- }
-
- it("should set proper log level") {
- assertThat(result.logLevel).isEqualTo(LogLevel.DEBUG)
- }
- }
-
- describe("required parameter is absent") {
- on("missing listen port") {
- it("should throw exception") {
- assertThat(
- cut.parseExpectingFailure(
- "--ssl-disable",
- "--first-request-delay", firstRequestDelay,
- "--request-interval", requestInterval
- )
- ).isInstanceOf(WrongArgumentError::class.java)
- }
- }
- on("missing configuration url") {
- it("should throw exception") {
- assertThat(
- cut.parseExpectingFailure(
- "--listen-port", listenPort,
- "--ssl-disable",
- "--first-request-delay", firstRequestDelay,
- "--request-interval", requestInterval
- )
- ).isInstanceOf(WrongArgumentError::class.java)
- }
- }
- }
-
- describe("correct log level not provided") {
- on("missing log level") {
- it("should set default INFO value") {
- val config = cut.parseExpectingSuccess(
- "--kafka-bootstrap-servers", kafkaBootstrapServers,
- "--health-check-api-port", healthCheckApiPort,
- "--listen-port", listenPort,
- "--first-request-delay", firstRequestDelay,
- "--request-interval", requestInterval,
- "--key-store", "/tmp/keys.p12",
- "--trust-store", "/tmp/trust.p12",
- "--key-store-password", keyStorePassword,
- "--trust-store-password", trustStorePassword
- )
-
- assertThat(config.logLevel).isEqualTo(LogLevel.INFO)
- }
- }
-
- on("incorrect log level") {
- it("should set default INFO value") {
- val config = cut.parseExpectingSuccess(
- "--kafka-bootstrap-servers", kafkaBootstrapServers,
- "--health-check-api-port", healthCheckApiPort,
- "--listen-port", listenPort,
- "--first-request-delay", firstRequestDelay,
- "--request-interval", requestInterval,
- "--key-store", "/tmp/keys.p12",
- "--trust-store", "/tmp/trust.p12",
- "--key-store-password", keyStorePassword,
- "--trust-store-password", trustStorePassword,
- "--log-level", "1"
- )
-
- assertThat(config.logLevel).isEqualTo(LogLevel.INFO)
- }
- }
- }
- }
-})
diff --git a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ConfigFactoryTest.kt b/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ConfigFactoryTest.kt
deleted file mode 100644
index c3849238..00000000
--- a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/ConfigFactoryTest.kt
+++ /dev/null
@@ -1,143 +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.main
-
-import arrow.core.Some
-import org.jetbrains.spek.api.Spek
-import org.assertj.core.api.Assertions.assertThat
-import org.jetbrains.spek.api.dsl.describe
-import org.jetbrains.spek.api.dsl.it
-import org.onap.dcae.collectors.veshv.main.config.*
-import org.onap.dcae.collectors.veshv.model.Routing
-import org.onap.dcae.collectors.veshv.utils.logging.LogLevel
-import java.io.InputStreamReader
-import java.io.StringReader
-import java.net.InetSocketAddress
-
-/**
- * @author Pawel Biniek <pawel.biniek@nokia.com>
- * @since February 2019
- */
-internal object ConfigFactoryTest : Spek({
- describe("A configuration loader utility") {
-
- describe("partial configuration loading") {
- it("parses enumerations") {
- val input = """{"logLevel":"ERROR"}"""
-
- val config = ConfigFactory().loadConfig(StringReader(input))
- assertThat(config.logLevel).isEqualTo(Some(LogLevel.ERROR))
- }
-
- it("parses simple structure") {
- val input = """{
- "server" : {
- "healthCheckApiPort" : 12002,
- "listenPort" : 12003
- }
- }
- """.trimIndent()
- val config = ConfigFactory().loadConfig(StringReader(input))
- assertThat(config.server.nonEmpty()).isTrue()
- assertThat(config.server.orNull()?.healthCheckApiPort).isEqualTo(Some(12002))
- assertThat(config.server.orNull()?.listenPort).isEqualTo(Some(12003))
- }
-
- it("parses ip address") {
- val input = """{ "kafka" : {
- "kafkaServers": [
- "192.168.255.1:5005",
- "192.168.255.26:5006"
- ]
- }
- }"""
-
- val config = ConfigFactory().loadConfig(StringReader(input))
- assertThat(config.kafka.nonEmpty()).isTrue()
- val kafka = config.kafka.orNull() as PartialKafkaConfig
- assertThat(kafka.kafkaServers.nonEmpty()).isTrue()
- val addresses = kafka.kafkaServers.orNull() as Array<InetSocketAddress>
- assertThat(addresses)
- .isEqualTo(arrayOf(
- InetSocketAddress("192.168.255.1", 5005),
- InetSocketAddress("192.168.255.26", 5006)
- ))
- }
-
- it("parses routing array with RoutingAdapter") {
- val input = """{
- "kafka" : {
- "routing" : [
- {
- "fromDomain": "perf3gpp",
- "toTopic": "HV_VES_PERF3GPP"
- }
- ]
- }
- }""".trimIndent()
- val config = ConfigFactory().loadConfig(StringReader(input))
- assertThat(config.kafka.nonEmpty()).isTrue()
- val kafka = config.kafka.orNull() as PartialKafkaConfig
- assertThat(kafka.routing.nonEmpty()).isTrue()
- val routing = kafka.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")
- }
- }
- }
-
- describe("complete file loading") {
- it("loads actual file") {
- val config = ConfigFactory().loadConfig(
- InputStreamReader(
- ConfigFactoryTest.javaClass.getResourceAsStream("/sampleConfig.json")))
- assertThat(config).isNotNull
- assertThat(config.logLevel).isEqualTo(Some(LogLevel.ERROR))
-
- assertThat(config.security.nonEmpty()).isTrue()
- val security = config.security.orNull() as PartialSecurityConfig
- assertThat(security.sslDisable.orNull()).isFalse()
- assertThat(security.keys.nonEmpty()).isTrue()
-
- assertThat(config.cbs.nonEmpty()).isTrue()
- val cbs = config.cbs.orNull() as PartialCbsConfig
- assertThat(cbs.firstRequestDelaySec).isEqualTo(Some(7))
- assertThat(cbs.requestIntervalSec).isEqualTo(Some(900))
-
- assertThat(config.kafka.nonEmpty()).isTrue()
- val kafka = config.kafka.orNull() as PartialKafkaConfig
- assertThat(kafka.kafkaServers.nonEmpty()).isTrue()
- assertThat(kafka.routing.nonEmpty()).isTrue()
-
- assertThat(config.server.nonEmpty()).isTrue()
- val server = config.server.orNull() as PartialServerConfig
- server.run {
- assertThat(dummyMode).isEqualTo(Some(false))
- assertThat(healthCheckApiPort).isEqualTo(Some(5000))
- assertThat(idleTimeoutSec).isEqualTo(Some(1200))
- assertThat(listenPort).isEqualTo(Some(6000))
- assertThat(maximumPayloadSizeBytes).isEqualTo(Some(512000))
- }
- }
- }
- }
-}) \ No newline at end of file
diff --git a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt b/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt
index 16d28326..e452a5f4 100644
--- a/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt
+++ b/sources/hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt
@@ -39,8 +39,8 @@ import org.onap.dcae.collectors.veshv.model.ClientRejectionCause.INVALID_WIRE_FR
import org.onap.dcae.collectors.veshv.model.ClientRejectionCause.PAYLOAD_SIZE_EXCEEDED_IN_MESSAGE
import org.onap.dcae.collectors.veshv.model.MessageDropCause.INVALID_MESSAGE
import org.onap.dcae.collectors.veshv.model.MessageDropCause.ROUTE_NOT_FOUND
-import org.onap.dcae.collectors.veshv.model.RoutedMessage
-import org.onap.dcae.collectors.veshv.model.VesMessage
+import org.onap.dcae.collectors.veshv.domain.RoutedMessage
+import org.onap.dcae.collectors.veshv.domain.VesMessage
import org.onap.dcae.collectors.veshv.tests.utils.emptyWireProtocolFrame
import org.onap.dcae.collectors.veshv.tests.utils.vesEvent
import org.onap.dcae.collectors.veshv.tests.utils.wireProtocolFrame
diff --git a/sources/hv-collector-main/src/test/resources/sampleConfig.json b/sources/hv-collector-main/src/test/resources/sampleConfig.json
deleted file mode 100644
index b64df05a..00000000
--- a/sources/hv-collector-main/src/test/resources/sampleConfig.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "server" : {
- "healthCheckApiPort" : 5000,
- "listenPort" : 6000,
- "idleTimeoutSec" : 1200,
- "maximumPayloadSizeBytes" : 512000,
- "dummyMode" : false
- },
- "cbs" : {
- "firstRequestDelaySec": 7,
- "requestIntervalSec": 900
- },
- "security" : {
- "sslDisable": false,
- "keys": {
- "keyStoreFile": "test.ks.pkcs12",
- "keyStorePassword": "changeMe",
- "trustStoreFile": "trust.ks.pkcs12",
- "trustStorePassword": "changeMeToo"
- }
- },
- "kafka" : {
- "kafkaServers": [
- "192.168.255.1:5005",
- "192.168.255.1:5006"
- ],
- "routing": [
- {
- "fromDomain": "perf3gpp",
- "toTopic": "HV_VES_PERF3GPP"
- }
- ]
- },
- "logLevel" : "ERROR"
-} \ No newline at end of file