aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Krzywka <filip.krzywka@nokia.com>2018-11-27 13:04:48 +0100
committerFilip Krzywka <filip.krzywka@nokia.com>2018-11-28 08:07:22 +0100
commit77f896523f2065b1da1be21545155a29edea5122 (patch)
tree4c310e94f4836d2324f1689ca44f226f158b7886
parent4f683d3e17025131a297baa67300da679bb85141 (diff)
Bump checkstyle version
- changed plugin invocation due to backwards incompatible changes made in detekt's RC9 version - disabled few rules that we actually don't follow in our code and we seem to be fine with it - turned on UnusedPrivateMember as it actually is a code smell/debt - supressed warnings in where it was plausible (according to common sense) - fixed warnings wherever possible Change-Id: I7be97f471ff46786ef1fca3432b759e7820ac681 Issue-ID: DCAEGEN2-996 Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
-rw-r--r--hv-collector-analysis/src/main/resources/onap-detekt-config.yml10
-rw-r--r--hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt3
-rw-r--r--hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt8
-rw-r--r--hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt2
-rw-r--r--hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/PerformanceSpecification.kt4
-rw-r--r--hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt5
-rw-r--r--hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt3
-rw-r--r--hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/ConsumerTest.kt1
-rw-r--r--hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/ByteData.kt1
-rw-r--r--hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt2
-rw-r--r--hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/wire_frame.kt1
-rw-r--r--hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt5
-rw-r--r--hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt3
-rw-r--r--hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt2
-rw-r--r--hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SslContextFactory.kt4
-rw-r--r--hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/ServerSslContextFactoryTest.kt3
-rw-r--r--hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt2
-rw-r--r--hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt10
-rw-r--r--hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt1
-rw-r--r--hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageParametersParserImpl.kt11
-rw-r--r--hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGenerator.kt1
-rw-r--r--hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/CommonEventHeaderParserTest.kt2
-rw-r--r--hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGeneratorTest.kt3
-rw-r--r--hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/parameters.kt4
-rw-r--r--hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt6
-rw-r--r--hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt1
-rw-r--r--pom.xml8
27 files changed, 41 insertions, 65 deletions
diff --git a/hv-collector-analysis/src/main/resources/onap-detekt-config.yml b/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
index 318d48ac..99faaa79 100644
--- a/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
+++ b/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
@@ -200,7 +200,7 @@ formatting:
android: false
autoCorrect: true
ChainWrapping:
- active: true
+ active: false
autoCorrect: true
CommentSpacing:
active: true
@@ -260,7 +260,7 @@ formatting:
active: true
autoCorrect: true
ParameterListWrapping:
- active: true
+ active: false
autoCorrect: true
indentSize: 4
SpacingAroundColon:
@@ -307,7 +307,7 @@ naming:
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
MatchingDeclarationName:
- active: true
+ active: false
MemberNameEqualsClassName:
active: false
ignoreOverriddenFunction: true
@@ -463,8 +463,8 @@ style:
UnusedImports:
active: false
UnusedPrivateMember:
- active: false
- allowedNames: "(_|ignored|expected)"
+ active: true
+ allowedNames: "(_.*|ignored|expected)"
UseDataClass:
active: false
excludeAnnotatedClasses: ""
diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
index 78afe9fd..8c16736d 100644
--- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
+++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/AdapterFactory.kt
@@ -36,6 +36,5 @@ object AdapterFactory {
fun consulConfigurationProvider(configurationProviderParams: ConfigurationProviderParams): ConfigurationProvider =
ConsulConfigurationProvider(httpAdapter(), configurationProviderParams)
- fun httpAdapter(): HttpAdapter = HttpAdapter(HttpClient.create())
+ private fun httpAdapter(): HttpAdapter = HttpAdapter(HttpClient.create())
}
-
diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
index 1672158e..bdce6f73 100644
--- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
+++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
@@ -23,8 +23,6 @@ import io.netty.handler.codec.http.HttpStatusClass
import org.slf4j.LoggerFactory
import reactor.core.publisher.Mono
import reactor.netty.http.client.HttpClient
-import java.lang.IllegalStateException
-import java.nio.charset.Charset
/**
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
@@ -40,8 +38,10 @@ open class HttpAdapter(private val httpClient: HttpClient) {
.responseSingle { response, content ->
if (response.status().codeClass() == HttpStatusClass.SUCCESS)
content.asString()
- else
- Mono.error(IllegalStateException("$url ${response.status().code()} ${response.status().reasonPhrase()}"))
+ else {
+ val errorMessage = "$url ${response.status().code()} ${response.status().reasonPhrase()}"
+ Mono.error(IllegalStateException(errorMessage))
+ }
}
.doOnError {
logger.error("Failed to get resource on path: $url (${it.localizedMessage})")
diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt
index a42b982f..bab95c57 100644
--- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt
+++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/model/routing.kt
@@ -75,7 +75,7 @@ class RouteBuilder {
}
fun withFixedPartitioning(num: Int = 0) {
- partitioning = { _ -> num }
+ partitioning = { num }
}
fun build() = Route(domain, targetTopic, partitioning)
diff --git a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/PerformanceSpecification.kt b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/PerformanceSpecification.kt
index 0c78dd5c..0897e910 100644
--- a/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/PerformanceSpecification.kt
+++ b/hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/component/PerformanceSpecification.kt
@@ -31,11 +31,9 @@ import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
import org.onap.dcae.collectors.veshv.domain.VesEventDomain.PERF3GPP
import org.onap.dcae.collectors.veshv.domain.WireFrameEncoder
-import org.onap.dcae.collectors.veshv.domain.WireFrameMessage
import org.onap.dcae.collectors.veshv.tests.fakes.CountingSink
import org.onap.dcae.collectors.veshv.tests.fakes.basicConfiguration
import org.onap.dcae.collectors.veshv.tests.utils.commonHeader
-import org.onap.dcae.collectors.veshv.ves.message.generator.api.MessageGenerator
import org.onap.dcae.collectors.veshv.ves.message.generator.api.MessageParameters
import org.onap.dcae.collectors.veshv.ves.message.generator.api.MessageType.VALID
import org.onap.dcae.collectors.veshv.ves.message.generator.factory.MessageGeneratorFactory
@@ -43,7 +41,7 @@ import reactor.core.publisher.Flux
import reactor.math.sum
import java.security.MessageDigest
import java.time.Duration
-import java.util.Random
+import java.util.*
import kotlin.system.measureTimeMillis
/**
diff --git a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
index c80b0480..e423191d 100644
--- a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
+++ b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
@@ -67,14 +67,13 @@ class MessageStreamValidation(
private fun shouldValidatePayloads(parameters: List<MessageParameters>) =
parameters.all { it.messageType == MessageType.FIXED_PAYLOAD }
-
- private fun validateHeaders(actual: List<VesEventOuterClass.VesEvent>, expected: List<VesEventOuterClass.VesEvent>): Boolean {
+ private fun validateHeaders(actual: List<VesEventOuterClass.VesEvent>,
+ expected: List<VesEventOuterClass.VesEvent>): Boolean {
val consumedHeaders = actual.map { it.commonEventHeader }
val generatedHeaders = expected.map { it.commonEventHeader }
return generatedHeaders == consumedHeaders
}
-
private fun generateEvents(parameters: List<MessageParameters>): IO<List<VesEventOuterClass.VesEvent>> =
messageGenerator.createMessageFlux(parameters)
.map(WireFrameMessage::payload)
diff --git a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
index 15965174..10dedbdf 100644
--- a/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
+++ b/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
@@ -47,7 +47,8 @@ class KafkaSource(private val receiver: KafkaReceiver<ByteArray, ByteArray>) {
return KafkaSource(KafkaReceiver.create(createReceiverOptions(bootstrapServers, topics)))
}
- fun createReceiverOptions(bootstrapServers: String, topics: Set<String>): ReceiverOptions<ByteArray, ByteArray>? {
+ fun createReceiverOptions(bootstrapServers: String,
+ topics: Set<String>): ReceiverOptions<ByteArray, ByteArray>? {
val props = mapOf<String, Any>(
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG to bootstrapServers,
ConsumerConfig.CLIENT_ID_CONFIG to "hv-collector-dcae-app-simulator",
diff --git a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/ConsumerTest.kt b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/ConsumerTest.kt
index debe9554..08558d76 100644
--- a/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/ConsumerTest.kt
+++ b/hv-collector-dcae-app-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/ConsumerTest.kt
@@ -24,7 +24,6 @@ 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.jetbrains.spek.api.dsl.on
import reactor.kafka.receiver.ReceiverRecord
diff --git a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/ByteData.kt b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/ByteData.kt
index 38be9aee..a1ebba37 100644
--- a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/ByteData.kt
+++ b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/ByteData.kt
@@ -19,7 +19,6 @@
*/
package org.onap.dcae.collectors.veshv.domain
-import com.google.protobuf.MessageLite
import io.netty.buffer.ByteBuf
import java.nio.charset.Charset
diff --git a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt
index 480ec693..7fabdf14 100644
--- a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt
+++ b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/codec.kt
@@ -77,6 +77,7 @@ class WireFrameDecoder(private val maxPayloadSizeBytes: Int) {
}
}
+ @Suppress("ReturnCount")
private fun parsePayloadFrame(byteBuf: ByteBuf): Either<WireFrameDecodingError, WireFrameMessage> {
val versionMajor = byteBuf.readUnsignedByte()
val versionMinor = byteBuf.readUnsignedByte()
@@ -97,6 +98,5 @@ class WireFrameDecoder(private val maxPayloadSizeBytes: Int) {
val payload = ByteData.readFrom(byteBuf, payloadSize)
return Right(WireFrameMessage(payload, versionMajor, versionMinor, payloadTypeRaw, payloadSize))
-
}
}
diff --git a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/wire_frame.kt b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/wire_frame.kt
index de6a5045..de37b140 100644
--- a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/wire_frame.kt
+++ b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/wire_frame.kt
@@ -19,7 +19,6 @@
*/
package org.onap.dcae.collectors.veshv.domain
-
/**
* Wire frame structure is presented bellow using ASN.1 notation. Please note that official supported specification
* should be available on
diff --git a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt
index b4d7c142..f12d9acf 100644
--- a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt
+++ b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt
@@ -53,12 +53,11 @@ class HealthCheckApiServer(private val healthState: HealthState,
NettyServerHandle(ctx.bindNow())
}
- private fun readinessHandler(req: HttpServerRequest, resp: HttpServerResponse) =
+ private fun readinessHandler(_req: HttpServerRequest, resp: HttpServerResponse) =
healthDescription.get().run {
resp.status(status.httpResponseStatus.number).sendString(Flux.just(status.toString(), "\n", message))
}
- private fun livenessHandler(req: HttpServerRequest, resp: HttpServerResponse) =
+ private fun livenessHandler(_req: HttpServerRequest, resp: HttpServerResponse) =
resp.status(HttpResponseStatus.NOT_IMPLEMENTED).sendString(Mono.just("Not implemented yet"))
-
}
diff --git a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt
index 81d916dd..9b985f6f 100644
--- a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt
+++ b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/ArgVesHvConfiguration.kt
@@ -75,7 +75,8 @@ internal class ArgVesHvConfiguration : ArgBasedConfiguration<ServerConfiguration
)
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 maxPayloadSizeBytes = cmdLine.intValue(MAXIMUM_PAYLOAD_SIZE_BYTES,
+ DefaultValues.MAX_PAYLOAD_SIZE_BYTES)
val dummyMode = cmdLine.hasOption(DUMMY_MODE)
val security = createSecurityConfiguration(cmdLine).bind()
val configurationProviderParams = createConfigurationProviderParams(cmdLine).bind()
diff --git a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
index 992a4dc8..d788c164 100644
--- a/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
+++ b/hv-collector-main/src/main/kotlin/org/onap/dcae/collectors/veshv/main/servers/VesServer.kt
@@ -49,4 +49,4 @@ object VesServer : ServerStarter() {
override fun serverStartedMessage(handle: ServerHandle) =
"HighVolume VES Collector is up and listening on ${handle.host}:${handle.port}"
-} \ No newline at end of file
+}
diff --git a/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SslContextFactory.kt b/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SslContextFactory.kt
index 1fa20229..cad81eef 100644
--- a/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SslContextFactory.kt
+++ b/hv-collector-ssl/src/main/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/SslContextFactory.kt
@@ -43,7 +43,9 @@ abstract class SslContextFactory {
}
}
- protected open fun createSslContextWithConfiguredCerts(secConfig: SecurityConfiguration): Option<SslContextBuilder> =
+ protected open fun createSslContextWithConfiguredCerts(
+ secConfig: SecurityConfiguration
+ ): Option<SslContextBuilder> =
secConfig.keys.map { keys ->
when (keys) {
is JdkKeys -> jdkContext(keys)
diff --git a/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/ServerSslContextFactoryTest.kt b/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/ServerSslContextFactoryTest.kt
index b4d72353..7e0bc609 100644
--- a/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/ServerSslContextFactoryTest.kt
+++ b/hv-collector-ssl/src/test/kotlin/org/onap/dcae/collectors/veshv/ssl/boundary/ServerSslContextFactoryTest.kt
@@ -19,9 +19,6 @@
*/
package org.onap.dcae.collectors.veshv.ssl.boundary
-import arrow.core.Left
-import arrow.core.Option
-import arrow.core.Right
import arrow.core.Some
import arrow.core.toOption
import io.netty.handler.ssl.ClientAuth
diff --git a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt
index da5ff918..b14f1be5 100644
--- a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt
+++ b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/commandline/ArgBasedConfiguration.kt
@@ -23,11 +23,9 @@ import arrow.core.Either
import arrow.core.Option
import arrow.core.Try
import arrow.core.flatMap
-import arrow.core.getOrElse
import org.apache.commons.cli.CommandLine
import org.apache.commons.cli.CommandLineParser
import org.apache.commons.cli.Options
-import org.onap.dcae.collectors.veshv.utils.arrow.fromNullablesChain
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
diff --git a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt
index 536fe93c..e8b9f439 100644
--- a/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt
+++ b/hv-collector-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/utils/logging/Logger.kt
@@ -19,9 +19,10 @@
*/
package org.onap.dcae.collectors.veshv.utils.logging
-import org.slf4j.LoggerFactory
import kotlin.reflect.KClass
+import org.slf4j.LoggerFactory
+@Suppress("TooManyFunctions")
class Logger(val logger: org.slf4j.Logger) {
constructor(clazz: KClass<out Any>) : this(LoggerFactory.getLogger(clazz.java))
constructor(name: String) : this(LoggerFactory.getLogger(name))
@@ -39,7 +40,6 @@ class Logger(val logger: org.slf4j.Logger) {
}
}
-
//
// DEBUG
//
@@ -64,7 +64,6 @@ class Logger(val logger: org.slf4j.Logger) {
}
}
-
//
// INFO
//
@@ -72,7 +71,6 @@ class Logger(val logger: org.slf4j.Logger) {
logger.info(message)
}
-
fun info(messageProvider: () -> String) {
if (logger.isInfoEnabled) {
logger.info(messageProvider())
@@ -83,14 +81,12 @@ class Logger(val logger: org.slf4j.Logger) {
logger.info(message, t)
}
-
fun info(t: Throwable, messageProvider: () -> String) {
if (logger.isInfoEnabled) {
logger.info(messageProvider(), t)
}
}
-
//
// WARN
//
@@ -115,7 +111,6 @@ class Logger(val logger: org.slf4j.Logger) {
}
}
-
//
// ERROR
//
@@ -124,7 +119,6 @@ class Logger(val logger: org.slf4j.Logger) {
logger.error(message)
}
-
fun error(message: String, t: Throwable) {
logger.error(message, t)
}
diff --git a/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt b/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt
index 462aabe5..c27fb8c8 100644
--- a/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt
+++ b/hv-collector-utils/src/test/kotlin/org/onap/dcae/collectors/veshv/utils/logging/LoggerTest.kt
@@ -19,7 +19,6 @@
*/
package org.onap.dcae.collectors.veshv.utils.logging
-import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.verify
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
diff --git a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageParametersParserImpl.kt b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageParametersParserImpl.kt
index ea0ee282..6ef6d53a 100644
--- a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageParametersParserImpl.kt
+++ b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/MessageParametersParserImpl.kt
@@ -40,13 +40,13 @@ internal class MessageParametersParserImpl(
Try {
request
.map { it.asJsonObject() }
- .map {
+ .map { json ->
val commonEventHeader = commonEventHeaderParser
- .parse(it.getJsonObject("commonEventHeader"))
+ .parse(json.getJsonObject("commonEventHeader"))
.fold({ throw IllegalStateException("Invalid common header") }, ::identity)
- val messageType = MessageType.valueOf(it.getString("messageType"))
- val messagesAmount = it.getJsonNumber("messagesAmount")?.longValue()
- ?: throw NullPointerException("\"messagesAmount\" could not be parsed from message.")
+ val messageType = MessageType.valueOf(json.getString("messageType"))
+ val messagesAmount = json.getJsonNumber("messagesAmount")?.longValue()
+ ?: throw NullPointerException("\"messagesAmount\" could not be parsed.")
MessageParameters(commonEventHeader, messageType, messagesAmount)
}
}.toEither().mapLeft { ex ->
@@ -54,5 +54,4 @@ internal class MessageParametersParserImpl(
ex.message ?: "Unable to parse message parameters",
Option.fromNullable(ex))
}
-
}
diff --git a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGenerator.kt b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGenerator.kt
index ef7eefa6..545e237c 100644
--- a/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGenerator.kt
+++ b/hv-collector-ves-message-generator/src/main/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGenerator.kt
@@ -37,5 +37,4 @@ internal class PayloadGenerator {
.toString()
.toByteArray()
)
-
}
diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/CommonEventHeaderParserTest.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/CommonEventHeaderParserTest.kt
index ce394cc1..3a33c44a 100644
--- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/CommonEventHeaderParserTest.kt
+++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/CommonEventHeaderParserTest.kt
@@ -79,4 +79,4 @@ class CommonEventHeaderParserTest : Spek({
fun assertFailed(result: Option<CommonEventHeader>) =
result.fold({}, { fail() })
-fun jsonObject(json: ByteArrayInputStream) = Json.createReader(json).readObject() \ No newline at end of file
+fun jsonObject(json: ByteArrayInputStream) = Json.createReader(json).readObject()!! \ No newline at end of file
diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGeneratorTest.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGeneratorTest.kt
index 5249a8d2..bb91245d 100644
--- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGeneratorTest.kt
+++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/PayloadGeneratorTest.kt
@@ -19,12 +19,11 @@
*/
package org.onap.dcae.collectors.veshv.ves.message.generator.impl
+import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import org.jetbrains.spek.api.dsl.it
-import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.spek.api.dsl.on
-import org.onap.dcae.collectors.veshv.ves.message.generator.impl.PayloadGenerator
object PayloadGeneratorTest : Spek({
diff --git a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/parameters.kt b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/parameters.kt
index 5d112bae..78cfa028 100644
--- a/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/parameters.kt
+++ b/hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/parameters.kt
@@ -99,8 +99,8 @@ private const val invalidMessageParameters =
fun validMessagesParametesJson() = Json
.createReader(validMessageParameters.reader())
- .readArray()
+ .readArray()!!
fun invalidMessagesParametesJson() = Json
.createReader(invalidMessageParameters.reader())
- .readArray()
+ .readArray()!!
diff --git a/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt b/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
index 0397111d..0b321362 100644
--- a/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
+++ b/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ArgXnfSimulatorConfiguration.kt
@@ -40,7 +40,6 @@ import org.onap.dcae.collectors.veshv.utils.commandline.CommandLineOption.VES_HV
import org.onap.dcae.collectors.veshv.utils.commandline.intValue
import org.onap.dcae.collectors.veshv.utils.commandline.stringValue
-
/**
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since June 2018
@@ -62,7 +61,8 @@ internal class ArgXnfSimulatorConfiguration : ArgBasedConfiguration<SimulatorCon
val listenPort = cmdLine.intValue(LISTEN_PORT).bind()
val vesHost = cmdLine.stringValue(VES_HV_HOST).bind()
val vesPort = cmdLine.intValue(VES_HV_PORT).bind()
- val maxPayloadSizeBytes = cmdLine.intValue(MAXIMUM_PAYLOAD_SIZE_BYTES, WireFrameMessage.DEFAULT_MAX_PAYLOAD_SIZE_BYTES)
+ val maxPayloadSizeBytes = cmdLine.intValue(MAXIMUM_PAYLOAD_SIZE_BYTES,
+ WireFrameMessage.DEFAULT_MAX_PAYLOAD_SIZE_BYTES)
SimulatorConfiguration(
listenPort,
@@ -71,6 +71,4 @@ internal class ArgXnfSimulatorConfiguration : ArgBasedConfiguration<SimulatorCon
maxPayloadSizeBytes,
createSecurityConfiguration(cmdLine).bind())
}.fix()
-
-
}
diff --git a/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt b/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt
index 70d8ba83..a04da7bf 100644
--- a/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt
+++ b/hv-collector-xnf-simulator/src/test/kotlin/org/onap/dcae/collectors/veshv/main/OngoingSimulationsTest.kt
@@ -32,7 +32,6 @@ import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusNotFound
import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusOngoing
import org.onap.dcae.collectors.veshv.simulators.xnf.impl.StatusSuccess
import org.onap.dcae.collectors.veshv.tests.utils.waitUntilSucceeds
-import java.time.Duration
import java.util.*
import java.util.concurrent.Executors
diff --git a/pom.xml b/pom.xml
index 71a754cd..2381a608 100644
--- a/pom.xml
+++ b/pom.xml
@@ -324,10 +324,8 @@
<arg value="onap-detekt-config.yml"/>
<arg value="--filters"/>
<arg value=".*/target/.*,.*/resources/.*"/>
- <arg value="--output"/>
- <arg value="${basedir}/target/reports"/>
- <arg value="--output-name"/>
- <arg value="detekt-report"/>
+ <arg value="--report"/>
+ <arg value="detekt-report:${basedir}/target/reports"/>
<arg value="--baseline"/>
<arg value="${basedir}/target/reports/baseline.xml"/>
</java>
@@ -339,7 +337,7 @@
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-cli</artifactId>
- <version>1.0.0.RC7</version>
+ <version>1.0.0-RC11</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>