Skip to content
Snippets Groups Projects
Commit 6447f736 authored by Sören Henning's avatar Sören Henning
Browse files

Fix some code style issues

parent 86f311b0
No related branches found
No related tags found
No related merge requests found
Pipeline #2778 failed
...@@ -18,16 +18,16 @@ dependencies { ...@@ -18,16 +18,16 @@ dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'io.quarkus:quarkus-arc' implementation 'io.quarkus:quarkus-arc'
implementation 'io.quarkus:quarkus-resteasy' 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 'com.google.code.gson:gson:2.8.5'
implementation 'org.slf4j:slf4j-simple:1.7.29' implementation 'org.slf4j:slf4j-simple:1.7.29'
implementation 'io.github.microutils:kotlin-logging:1.12.0' implementation 'io.github.microutils:kotlin-logging:1.12.0'
implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2' implementation 'io.fabric8:kubernetes-client:5.0.0-alpha-2'
implementation 'io.quarkus:quarkus-kubernetes-client' implementation 'io.quarkus:quarkus-kubernetes-client'
implementation 'org.apache.kafka:kafka-clients:2.7.0' implementation 'org.apache.kafka:kafka-clients:2.7.0'
implementation 'khttp:khttp:1.0.0' implementation 'khttp:khttp:1.0.0'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
} }
group 'theodolite' group 'theodolite'
......
...@@ -8,21 +8,21 @@ private val logger = KotlinLogging.logger {} ...@@ -8,21 +8,21 @@ private val logger = KotlinLogging.logger {}
/** /**
* Manages the topics related tasks * Manages the topics related tasks
* @param kafkaConfig Kafka Configuration as HashMap * @param kafkaConfig Kafka configuration as a Map
* @constructor Creates a KafkaAdminClient * @constructor Creates a KafkaAdminClient
*/ */
class TopicManager(private val kafkaConfig: HashMap<String, Any>) { class TopicManager(private val kafkaConfig: Map<String, Any>) {
/** /**
* Creates topics. * Create topics.
* @param newTopics List of all Topic that should be created * @param newTopics Collection of all topic that should be created
*/ */
fun createTopics(newTopics: Collection<NewTopic>) { fun createTopics(newTopics: Collection<NewTopic>) {
var kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
val result = kafkaAdmin.createTopics(newTopics) val result = kafkaAdmin.createTopics(newTopics)
result.all().get()// wait for the future object result.all().get() // wait for the future to be completed
logger.info { logger.info {
"Topics created finished with result: ${ "Topic creation finished with result: ${
result.values().map { it -> it.key + ": " + it.value.isDone } result.values().map { it -> it.key + ": " + it.value.isDone }
.joinToString(separator = ",") .joinToString(separator = ",")
} " } "
...@@ -31,14 +31,14 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) { ...@@ -31,14 +31,14 @@ class TopicManager(private val kafkaConfig: HashMap<String, Any>) {
} }
/** /**
* Removes topics. * Remove topics.
* @param topics List of names with the topics to remove. * @param topics Collection of names for the topics to remove.
*/ */
fun removeTopics(topics: List<String>) { fun removeTopics(topics: Collection<String>) {
var kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig) val kafkaAdmin: AdminClient = AdminClient.create(this.kafkaConfig)
try { try {
val result = kafkaAdmin.deleteTopics(topics) 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 { logger.info {
"Topics deletion finished with result: ${ "Topics deletion finished with result: ${
result.values().map { it -> it.key + ": " + it.value.isDone } result.values().map { it -> it.key + ": " + it.value.isDone }
......
package theodolite.k8s
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Assertions.*
internal class TopicManagerTest {
@BeforeEach
fun setUp() {
}
@AfterEach
fun tearDown() {
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment