aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIzabela Zawadzka <izabela.zawadzka@nokia.com>2019-04-15 13:03:45 +0200
committerIzabela Zawadzka <izabela.zawadzka@nokia.com>2019-04-16 09:18:12 +0200
commit482ff719edbb728827976622cef63c876cb6676e (patch)
tree151630129e37fbc751e54cea1922c5432f0125bf
parent1b4aebbfeb932de091cad98ea66210f472fc2420 (diff)
Add internal modifiers to comply with new HvVesCustomRule
Change-Id: I33ad24179d05ded58f6784544be9bbdd56210720 Signed-off-by: Izabela Zawadzka <izabela.zawadzka@nokia.com> Issue-ID: DCAEGEN2-1438
-rw-r--r--build/hv-collector-analysis/src/main/kotlin/org/onap/dcae/collectors/veshv/analysis/PublicModifiersInImpl.kt37
-rw-r--r--build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/HeaderValidator.kt4
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/Router.kt2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/ValidationError.kt2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/ProtobufSerializer.kt2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/VesMessageSerializer.kt2
-rw-r--r--sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireFrameException.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/DcaeAppSimulator.kt4
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/DcaeAppApiServer.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/ArgDcaeAppSimConfiguration.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/DcaeAppSimConfiguration.kt2
-rw-r--r--sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/consumer.kt8
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulator.kt2
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClient.kt2
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ClientConfiguration.kt2
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SimulatorConfiguration.kt2
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt10
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/factory/ClientFactory.kt2
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt12
23 files changed, 58 insertions, 51 deletions
diff --git a/build/hv-collector-analysis/src/main/kotlin/org/onap/dcae/collectors/veshv/analysis/PublicModifiersInImpl.kt b/build/hv-collector-analysis/src/main/kotlin/org/onap/dcae/collectors/veshv/analysis/PublicModifiersInImpl.kt
index 027cadea..45e80069 100644
--- a/build/hv-collector-analysis/src/main/kotlin/org/onap/dcae/collectors/veshv/analysis/PublicModifiersInImpl.kt
+++ b/build/hv-collector-analysis/src/main/kotlin/org/onap/dcae/collectors/veshv/analysis/PublicModifiersInImpl.kt
@@ -25,25 +25,32 @@ import org.jetbrains.kotlin.psi.psiUtil.isPublic
class PublicModifiersInImpl(config: Config = Config.empty) : Rule(config) {
override val issue: Issue = Issue(javaClass.simpleName, Severity.Maintainability,
- ISSUE_DESCRIPTION, Debt(mins=10))
+ ISSUE_DESCRIPTION, Debt(mins = 10))
override fun visitKtFile(file: KtFile) {
super.visitKtFile(file)
- if(file.packageFqName.toString().contains("impl")) {
- ImplVisitor.also {
- file.accept(it)
- if(it.publicDeclarations.isNotEmpty()){
- for(entity in it.publicDeclarations)
- report(CodeSmell(issue, entity, REPORT_MESSAGE))
- it.publicDeclarations.clear()
- }
- }
+ if (file.packageFqName.toString().contains("impl")) {
+ checkAccessModifiers(file)
}
}
+ private fun checkAccessModifiers(file: KtFile) {
+ val implVisitor = ImplVisitor()
+
+ file.accept(implVisitor)
+ if (implVisitor.publicDeclarations.isNotEmpty()) {
+ reportCodeSmells(implVisitor)
+ }
+ }
+
+ private fun reportCodeSmells(it: ImplVisitor) {
+ for (entity in it.publicDeclarations)
+ report(CodeSmell(issue, entity, REPORT_MESSAGE))
+ }
+
companion object {
- private val REPORT_MESSAGE = """
+ private val REPORT_MESSAGE = """
Implementation package members cannot have public declarations.
Please, add `internal` modifier for this element to disallow usage outside of module
""".trimIndent()
@@ -51,22 +58,22 @@ class PublicModifiersInImpl(config: Config = Config.empty) : Rule(config) {
}
}
-private object ImplVisitor: DetektVisitor(){
+private class ImplVisitor : DetektVisitor() {
var publicDeclarations = mutableListOf<Entity>()
override fun visitClassOrObject(classOrObject: KtClassOrObject) {
- if(classOrObject.isTopLevel() && classOrObject.isPublic){
+ if (classOrObject.isTopLevel() && classOrObject.isPublic) {
publicDeclarations.add(Entity.from(classOrObject))
}
}
override fun visitNamedFunction(function: KtNamedFunction) {
- if(function.isTopLevel && function.isPublic){
+ if (function.isTopLevel && function.isPublic) {
publicDeclarations.add(Entity.from(function))
}
}
override fun visitProperty(property: KtProperty) {
- if(property.isTopLevel && property.isPublic) publicDeclarations.add(Entity.from(property))
+ if (property.isTopLevel && property.isPublic) publicDeclarations.add(Entity.from(property))
}
} \ No newline at end of file
diff --git a/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml b/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
index b45f6b64..a5dd275e 100644
--- a/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
+++ b/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml
@@ -480,4 +480,4 @@ HvVesCustomRules:
SuboptimalLoggerUsage:
active: false
PublicModifiersInImpl:
- active: false
+ active: true
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/HeaderValidator.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/HeaderValidator.kt
index 9d8accae..b88fe7fa 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/HeaderValidator.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/HeaderValidator.kt
@@ -28,9 +28,9 @@ import org.onap.dcae.collectors.veshv.domain.headerRequiredFieldDescriptors
import org.onap.dcae.collectors.veshv.domain.vesEventListenerVersionRegex
import org.onap.ves.VesEventOuterClass.CommonEventHeader
-typealias Validator = (CommonEventHeader) -> List<ValidationError>
+internal typealias Validator = (CommonEventHeader) -> List<ValidationError>
-object HeaderValidator {
+internal object HeaderValidator {
private val validators = (listOf(validateEventListenerVersion()) +
headerRequiredFieldDescriptors.map { fieldDescriptor ->
validateRequiredField(fieldDescriptor)
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/Router.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/Router.kt
index 2190eba3..c4e877bf 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/Router.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/Router.kt
@@ -35,7 +35,7 @@ import org.onap.dcae.collectors.veshv.utils.logging.Logger
import org.onap.ves.VesEventOuterClass.CommonEventHeader
import reactor.core.publisher.Flux
-class Router internal constructor(private val routing: Routing,
+internal class Router internal constructor(private val routing: Routing,
private val messageSinks: Map<String, Lazy<Sink>>,
private val ctx: ClientContext,
private val metrics: Metrics) {
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/ValidationError.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/ValidationError.kt
index 56a77f4f..5724fed7 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/ValidationError.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/ValidationError.kt
@@ -21,7 +21,7 @@ package org.onap.dcae.collectors.veshv.impl
import org.onap.dcae.collectors.veshv.domain.vesEventListenerVersionRegex
-sealed class ValidationError(val errorMessage: String) {
+internal sealed class ValidationError(val errorMessage: String) {
class MissingField<A>(field: A) : ValidationError(
"Invalid header - missing $field field"
)
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
index 8f66de2b..51eec024 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/HttpAdapter.kt
@@ -30,7 +30,7 @@ import java.util.*
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since May 2018
*/
-open class HttpAdapter(private val httpClient: HttpClient) {
+internal open class HttpAdapter(private val httpClient: HttpClient) {
open fun get(url: String, invocationId: UUID, queryParams: Map<String, Any> = emptyMap()): Mono<String> =
httpClient
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/ProtobufSerializer.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/ProtobufSerializer.kt
index 4e9932cc..8fc960d8 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/ProtobufSerializer.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/ProtobufSerializer.kt
@@ -26,7 +26,7 @@ import org.apache.kafka.common.serialization.Serializer
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since June 2018
*/
-class ProtobufSerializer : Serializer<MessageLite> {
+internal class ProtobufSerializer : Serializer<MessageLite> {
override fun configure(configs: MutableMap<String, *>?, isKey: Boolean) {
// no configuration
}
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/VesMessageSerializer.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/VesMessageSerializer.kt
index a5f80707..084b3376 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/VesMessageSerializer.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/kafka/VesMessageSerializer.kt
@@ -26,7 +26,7 @@ import org.onap.dcae.collectors.veshv.domain.VesMessage
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since June 2018
*/
-class VesMessageSerializer : Serializer<VesMessage> {
+internal class VesMessageSerializer : Serializer<VesMessage> {
override fun configure(configs: MutableMap<String, *>?, isKey: Boolean) {
// not needed
}
diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireFrameException.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireFrameException.kt
index 81845400..4dd26597 100644
--- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireFrameException.kt
+++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/wire/WireFrameException.kt
@@ -25,5 +25,5 @@ import org.onap.dcae.collectors.veshv.domain.WireFrameDecodingError
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since June 2018
*/
-class WireFrameException(val error: WireFrameDecodingError)
+internal class WireFrameException(val error: WireFrameDecodingError)
: Exception("${error::class.simpleName}: ${error.message}")
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/DcaeAppSimulator.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/DcaeAppSimulator.kt
index 33e9a37e..122d9bf0 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/DcaeAppSimulator.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/DcaeAppSimulator.kt
@@ -28,7 +28,7 @@ import java.util.Collections.synchronizedMap
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since August 2018
*/
-class DcaeAppSimulator(private val consumerFactory: ConsumerFactory,
+internal class DcaeAppSimulator(private val consumerFactory: ConsumerFactory,
private val messageStreamValidation: MessageStreamValidation) {
private val consumerState: MutableMap<String, ConsumerStateProvider> = synchronizedMap(mutableMapOf())
@@ -85,4 +85,4 @@ class DcaeAppSimulator(private val consumerFactory: ConsumerFactory,
}
}
-class MissingConsumerException(message: String) : Throwable(message)
+internal class MissingConsumerException(message: String) : Throwable(message)
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
index 144aab02..06a8d742 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/MessageStreamValidation.kt
@@ -31,7 +31,7 @@ import reactor.core.publisher.Mono
import java.io.InputStream
import javax.json.Json
-class MessageStreamValidation(
+internal class MessageStreamValidation(
private val messageGenerator: VesEventGenerator,
private val messageParametersParser: MessageParametersParser = MessageParametersParser.INSTANCE) {
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/DcaeAppApiServer.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/DcaeAppApiServer.kt
index 6a09be9f..2458b203 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/DcaeAppApiServer.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/DcaeAppApiServer.kt
@@ -41,7 +41,7 @@ import java.net.InetSocketAddress
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since May 2018
*/
-class DcaeAppApiServer(private val simulator: DcaeAppSimulator) {
+internal class DcaeAppApiServer(private val simulator: DcaeAppSimulator) {
fun start(socketAddress: InetSocketAddress, kafkaTopics: Set<String>): Mono<ServerHandle> =
Mono.defer {
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
index 0fd3bb10..b91e7a1c 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/adapters/KafkaSource.kt
@@ -31,7 +31,7 @@ import reactor.kafka.receiver.ReceiverRecord
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since May 2018
*/
-class KafkaSource(private val receiver: KafkaReceiver<ByteArray, ByteArray>) {
+internal class KafkaSource(private val receiver: KafkaReceiver<ByteArray, ByteArray>) {
fun start(): Flux<ReceiverRecord<ByteArray, ByteArray>> =
receiver.receive()
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/ArgDcaeAppSimConfiguration.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/ArgDcaeAppSimConfiguration.kt
index f6d1eab7..fb0e61f5 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/ArgDcaeAppSimConfiguration.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/ArgDcaeAppSimConfiguration.kt
@@ -34,7 +34,7 @@ import org.onap.dcae.collectors.veshv.domain.WireFrameMessage
import org.onap.dcae.collectors.veshv.utils.arrow.OptionUtils.binding
import java.net.InetSocketAddress
-class ArgDcaeAppSimConfiguration : ArgBasedConfiguration<DcaeAppSimConfiguration>(DefaultParser()) {
+internal class ArgDcaeAppSimConfiguration : ArgBasedConfiguration<DcaeAppSimConfiguration>(DefaultParser()) {
override val cmdLineOptionsList: List<CommandLineOption> = listOf(
LISTEN_PORT,
MAXIMUM_PAYLOAD_SIZE_BYTES,
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/DcaeAppSimConfiguration.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/DcaeAppSimConfiguration.kt
index 2b0382ac..a503e5b5 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/DcaeAppSimConfiguration.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/config/DcaeAppSimConfiguration.kt
@@ -21,7 +21,7 @@ package org.onap.dcae.collectors.veshv.simulators.dcaeapp.impl.config
import java.net.InetSocketAddress
-data class DcaeAppSimConfiguration(
+internal data class DcaeAppSimConfiguration(
val apiAddress: InetSocketAddress,
val maxPayloadSizeBytes: Int,
val kafkaBootstrapServers: String,
diff --git a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/consumer.kt b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/consumer.kt
index a6d1eddb..2de89aae 100644
--- a/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/consumer.kt
+++ b/sources/hv-collector-dcae-app-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/dcaeapp/impl/consumer.kt
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentLinkedQueue
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since June 2018
*/
-class ConsumerState(private val messages: ConcurrentLinkedQueue<ByteArray>) {
+internal class ConsumerState(private val messages: ConcurrentLinkedQueue<ByteArray>) {
val messagesCount: Int by lazy {
messages.size
}
@@ -38,12 +38,12 @@ class ConsumerState(private val messages: ConcurrentLinkedQueue<ByteArray>) {
}
}
-interface ConsumerStateProvider {
+internal interface ConsumerStateProvider {
fun currentState(): ConsumerState
fun reset()
}
-class Consumer : ConsumerStateProvider {
+internal class Consumer : ConsumerStateProvider {
private var consumedMessages: ConcurrentLinkedQueue<ByteArray> = ConcurrentLinkedQueue()
@@ -61,7 +61,7 @@ class Consumer : ConsumerStateProvider {
}
}
-class ConsumerFactory(private val kafkaBootstrapServers: String) {
+internal class ConsumerFactory(private val kafkaBootstrapServers: String) {
fun createConsumersForTopics(kafkaTopics: Set<String>): Map<String, Consumer> =
KafkaSource.create(kafkaBootstrapServers, kafkaTopics).let { kafkaSource ->
val topicToConsumer = kafkaTopics.associate { it to Consumer() }
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulator.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulator.kt
index 49d6a470..98f33b7f 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulator.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/XnfSimulator.kt
@@ -47,7 +47,7 @@ import javax.json.JsonArray
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since August 2018
*/
-class XnfSimulator(
+internal class XnfSimulator(
private val clientFactory: ClientFactory,
private val generatorFactory: MessageGeneratorFactory,
private val messageParametersParser: MessageParametersParser = MessageParametersParser.INSTANCE) {
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClient.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClient.kt
index e50f1e7a..63585c66 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClient.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/HvVesClient.kt
@@ -31,7 +31,7 @@ import java.nio.ByteBuffer
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since June 2018
*/
-class HvVesClient(private val producer: HvVesProducer) {
+internal class HvVesClient(private val producer: HvVesProducer) {
fun sendRawPayload(messages: Flux<ByteBuffer>, payloadType: PayloadType = PayloadType.UNDEFINED): Mono<Unit> =
producer.sendRaw(messages, payloadType)
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ClientConfiguration.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ClientConfiguration.kt
index 55a18310..a09a7c91 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ClientConfiguration.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/ClientConfiguration.kt
@@ -27,5 +27,5 @@ import java.net.InetSocketAddress
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since February 2019
*/
-data class ClientConfiguration(val collectorAddresses: Set<InetSocketAddress>,
+internal data class ClientConfiguration(val collectorAddresses: Set<InetSocketAddress>,
val securityProvider: () -> SecurityConfiguration)
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SimulatorConfiguration.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SimulatorConfiguration.kt
index 751985c6..46e1d295 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SimulatorConfiguration.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SimulatorConfiguration.kt
@@ -26,7 +26,7 @@ import java.net.InetSocketAddress
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since June 2018
*/
-data class SimulatorConfiguration(
+internal data class SimulatorConfiguration(
val listenAddress: InetSocketAddress,
val healthCheckApiListenAddress: InetSocketAddress,
val hvVesAddress: InetSocketAddress,
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt
index 7678fdbb..f440da62 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/config/SslUtils.kt
@@ -38,12 +38,12 @@ import java.nio.file.Paths
* @since September 2018
*/
-const val KEY_STORE_FILE = "/etc/ves-hv/server.p12"
-const val KEY_STORE_PASSWORD_FILE = "/etc/ves-hv/server.pass"
-const val TRUST_STORE_FILE = "/etc/ves-hv/trust.p12"
-const val TRUST_STORE_PASSWORD_FILE = "/etc/ves-hv/trust.pass"
+internal const val KEY_STORE_FILE = "/etc/ves-hv/server.p12"
+internal const val KEY_STORE_PASSWORD_FILE = "/etc/ves-hv/server.pass"
+internal const val TRUST_STORE_FILE = "/etc/ves-hv/trust.p12"
+internal const val TRUST_STORE_PASSWORD_FILE = "/etc/ves-hv/trust.pass"
-fun createSecurityConfigurationProvider(cmdLine: CommandLine): Try<() -> SecurityConfiguration> =
+internal fun createSecurityConfigurationProvider(cmdLine: CommandLine): Try<() -> SecurityConfiguration> =
if (shouldDisableSsl(cmdLine))
Try { { disabledSecurityConfiguration() } }
else
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/factory/ClientFactory.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/factory/ClientFactory.kt
index 72a1165e..94334c09 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/factory/ClientFactory.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/factory/ClientFactory.kt
@@ -29,7 +29,7 @@ import org.onap.dcaegen2.services.sdk.services.hvves.client.producer.api.options
* @author Jakub Dudycz <jakub.dudycz@nokia.com>
* @since February 2019
*/
-class ClientFactory(private val configuration: ClientConfiguration) {
+internal class ClientFactory(private val configuration: ClientConfiguration) {
fun create() = hvVesClient(partialConfiguration().build())
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
index 3f43ebe0..e36cfc8b 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
@@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap
* @author Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
* @since August 2018
*/
-class OngoingSimulations(private val scheduler: Scheduler = Schedulers.elastic(),
+internal class OngoingSimulations(private val scheduler: Scheduler = Schedulers.elastic(),
private val healthState: HealthState = HealthState.INSTANCE) {
private val simulations = ConcurrentHashMap<UUID, Status>()
@@ -76,11 +76,11 @@ class OngoingSimulations(private val scheduler: Scheduler = Schedulers.elastic()
}
}
-sealed class Status(val message: String) {
+internal sealed class Status(val message: String) {
override fun toString() = this::class.simpleName ?: "null"
}
-object StatusNotFound : Status("not found")
-object StatusOngoing : Status("ongoing")
-object StatusSuccess : Status("success")
-data class StatusFailure(val cause: Throwable) : Status("Error ${cause.message}")
+internal object StatusNotFound : Status("not found")
+internal object StatusOngoing : Status("ongoing")
+internal object StatusSuccess : Status("success")
+internal data class StatusFailure(val cause: Throwable) : Status("Error ${cause.message}")