From c0877a5e58eaf4db03a7e1390d5f468694f49d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Sat, 17 Apr 2021 19:27:20 +0200 Subject: [PATCH] Minor code style fixes --- theodolite-quarkus/build.gradle | 6 +++--- .../main/kotlin/theodolite/k8s/TopicManager.kt | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/theodolite-quarkus/build.gradle b/theodolite-quarkus/build.gradle index 2f58f4c8a..8b61bf506 100644 --- a/theodolite-quarkus/build.gradle +++ b/theodolite-quarkus/build.gradle @@ -18,16 +18,16 @@ dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' implementation 'io.quarkus:quarkus-arc' implementation 'io.quarkus:quarkus-resteasy' - testImplementation 'io.quarkus:quarkus-junit5' - testImplementation 'io.rest-assured:rest-assured' implementation 'com.google.code.gson:gson:2.8.5' - implementation 'org.slf4j:slf4j-simple:1.7.29' implementation 'io.github.microutils:kotlin-logging:1.12.0' implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2' implementation 'io.quarkus:quarkus-kubernetes-client' implementation 'org.apache.kafka:kafka-clients:2.7.0' implementation 'khttp:khttp:1.0.0' + + testImplementation 'io.quarkus:quarkus-junit5' + testImplementation 'io.rest-assured:rest-assured' } group 'theodolite' diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index e82a133b3..1474040d3 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -11,13 +11,14 @@ private const val RETRY_TIME = 2000L /** * Manages the topics related tasks - * @param kafkaConfig Kafka Configuration as HashMap + * @param kafkaConfig Kafka configuration as a Map * @constructor Creates a KafkaAdminClient */ -class TopicManager(private val kafkaConfig: HashMap<String, Any>) { +class TopicManager(private val kafkaConfig: Map<String, Any>) { + /** - * Creates topics. - * @param newTopics List of all Topic that should be created + * Create topics. + * @param newTopics Collection of all topic that should be created */ fun createTopics(newTopics: Collection<NewTopic>) { val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) @@ -27,7 +28,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { var retryCreation = false try { result = kafkaAdmin.createTopics(newTopics) - result.all().get()// wait for the future object + result.all().get() // wait for the future to be completed } catch (e: Exception) { delete(newTopics.map { topic -> topic.name() }, kafkaAdmin) @@ -49,8 +50,8 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { } /** - * Removes topics. - * @param topics List of names with the topics to remove. + * Remove topics. + * @param topics Collection of names for the topics to remove. */ fun removeTopics(topics: List<String>) { val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) @@ -64,7 +65,7 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { while (!deleted) { try { val result = kafkaAdmin.deleteTopics(topics) - result.all().get() // wait for the future object + result.all().get() // wait for the future to be completed logger.info { "Topics deletion finished with result: ${ result.values().map { it -> it.key + ": " + it.value.isDone } -- GitLab