aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-configuration/src/main
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2019-04-08 14:09:16 +0200
committerJakub Dudycz <jakub.dudycz@nokia.com>2019-04-10 11:06:03 +0200
commit735469d5003388df3622819c3d1db0e89a64197c (patch)
treec22ff39ee81b84855e936aed1865ed8860c20b96 /sources/hv-collector-configuration/src/main
parentc9829d23c12b2824a0d56ee6efbd00ad67b9046e (diff)
Move maxPayloadSizeBytes to CollectorConfiguration
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com> Issue-ID: DCAEGEN2-1387 Change-Id: I37151a58f5244841243dc531912af2ef50ea5d3c
Diffstat (limited to 'sources/hv-collector-configuration/src/main')
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/ConfigurationModule.kt2
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/configuration.kt11
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt1
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationValidator.kt2
-rw-r--r--sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt2
5 files changed, 10 insertions, 8 deletions
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/ConfigurationModule.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/ConfigurationModule.kt
index 93381572..f0ee3a42 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/ConfigurationModule.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/ConfigurationModule.kt
@@ -53,7 +53,7 @@ class ConfigurationModule {
.throwOnLeft(::MissingArgumentException)
.doOnNext { logger.info { "Using base configuration file: ${it.absolutePath}" } }
.map { it.reader().use(configParser::parse) }
- .doOnNext { logger.info { "Successfully parsed json file to configuration: $it" } }
+ .doOnNext { logger.info { "Successfully parsed configuration file to: $it" } }
.cache()
.flatMapMany { basePartialConfig ->
cbsConfigurationProvider(basePartialConfig, configStateListener, mdc)
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/configuration.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/configuration.kt
index f745d595..8db2f770 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/configuration.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/api/model/configuration.kt
@@ -37,7 +37,6 @@ data class HvVesConfiguration(
data class ServerConfiguration(
val listenPort: Int,
- val maxPayloadSizeBytes: Int,
val idleTimeout: Duration
)
@@ -48,4 +47,12 @@ data class CbsConfiguration(
data class CollectorConfiguration(
val routing: Routing
-)
+) {
+ val maxPayloadSizeBytes by lazy {
+ routing.map { it.sink.maxPayloadSizeBytes() }.max() ?: DEFAULT_MAX_PAYLOAD_SIZE
+ }
+
+ companion object {
+ internal const val DEFAULT_MAX_PAYLOAD_SIZE = 1024 * 1024
+ }
+}
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt
index e782a1e7..56e48038 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/ConfigurationMerger.kt
@@ -33,7 +33,6 @@ internal class ConfigurationMerger {
PartialConfiguration(
listenPort = base.listenPort.updateToGivenOrNone(update.listenPort),
idleTimeoutSec = base.idleTimeoutSec.updateToGivenOrNone(update.idleTimeoutSec),
- maxPayloadSizeBytes = base.maxPayloadSizeBytes.updateToGivenOrNone(update.maxPayloadSizeBytes),
firstRequestDelaySec = base.firstRequestDelaySec.updateToGivenOrNone(update.firstRequestDelaySec),
requestIntervalSec = base.requestIntervalSec.updateToGivenOrNone(update.requestIntervalSec),
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 dddf0bed..613ae302 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
@@ -94,7 +94,6 @@ internal class ConfigurationValidator {
partial.mapBinding {
ServerConfiguration(
it.listenPort.bind(),
- it.maxPayloadSizeBytes.bind(),
Duration.ofSeconds(it.idleTimeoutSec.bind())
)
}
@@ -139,7 +138,6 @@ internal class ConfigurationValidator {
.trustStorePassword(Passwords.fromString(trustStorePassword))
.build()
-
private fun validatedCollectorConfig(partial: PartialConfiguration) =
partial.mapBinding { config ->
CollectorConfiguration(
diff --git a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt
index 30f6c3e3..d09a52e4 100644
--- a/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt
+++ b/sources/hv-collector-configuration/src/main/kotlin/org/onap/dcae/collectors/veshv/config/impl/partial_configuration.kt
@@ -34,8 +34,6 @@ internal data class PartialConfiguration(
val listenPort: Option<Int> = None,
@SerializedName("server.idleTimeoutSec")
val idleTimeoutSec: Option<Long> = None,
- @SerializedName("server.maxPayloadSizeBytes")
- val maxPayloadSizeBytes: Option<Int> = None,
@SerializedName("cbs.firstRequestDelaySec")
val firstRequestDelaySec: Option<Long> = None,