diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt index 4fba0d3623f4fa59bf112830e19a01a8f03d5719..bb816fb1d268d67a19e82f61dfb61154f77017e1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt @@ -4,7 +4,7 @@ import theodolite.util.ConfigurationOverride import kotlin.properties.Delegates -class BenchmarkExecution() { +class BenchmarkExecution { lateinit var name: String lateinit var benchmark: String lateinit var load: LoadDefinition @@ -13,24 +13,24 @@ class BenchmarkExecution() { lateinit var execution: Execution lateinit var configOverrides: List<ConfigurationOverride> - class Execution() { + class Execution { lateinit var strategy: String var duration by Delegates.notNull<Long>() - var repititions by Delegates.notNull<Int>() + var repetitions by Delegates.notNull<Int>() lateinit var restrictions: List<String> } - class Slo(){ + class Slo{ lateinit var sloType: String var threshold by Delegates.notNull<Int>() } - class LoadDefinition() { + class LoadDefinition { lateinit var loadType: String lateinit var loadValues: List<Int> } - class ResourceDefinition() { + class ResourceDefinition { lateinit var resourceType: String lateinit var resourceValues: List<Int> } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index cef47a556bfb29060f1698101f76329175dcdc4e..69e45e46ab37b1b32ae4a1178ee35abe12b4582d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -7,20 +7,20 @@ import theodolite.patcher.PatcherManager import theodolite.util.* import java.util.* -class KubernetesBenchmark(): Benchmark { +class KubernetesBenchmark: Benchmark { lateinit var name: String - lateinit var appResource: List<String> - lateinit var loadGenResource: List<String> - lateinit var resourceTypes: List<TypeName> - lateinit var loadTypes: List<TypeName> - lateinit var kafkaConfig: KafkaConfig - lateinit var zookeeperConfig: HashMap<String,String> + private lateinit var appResource: List<String> + private lateinit var loadGenResource: List<String> + private lateinit var resourceTypes: List<TypeName> + private lateinit var loadTypes: List<TypeName> + private lateinit var kafkaConfig: KafkaConfig + private lateinit var zookeeperConfig: HashMap<String,String> private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> { val basePath = "./../../../resources/main/yaml/" - var parser = YamlParser() + val parser = YamlParser() val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace("theodolite-she")) return resources .map { resource -> diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index ee7273c028020e9c9b6f42fa5eaec5c799d3f68b..1c286b7f2ce956165eb5285a48f86ace15e8bbbe 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -13,6 +13,6 @@ class BenchmarkExecutorImpl(benchmark: Benchmark, results: Results, executionDur // todo evaluate val result = false // if success else false this.results.setResult(Pair(load, res), result) - return result; + return result } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt index c297894f85844301a61ebd0679d55b54d148b579..8ae567f97e34667240adbc69c7048c5eed1c2779 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt @@ -7,7 +7,7 @@ import theodolite.benchmark.KubernetesBenchmark class TheodoliteYamlExecutor { fun run() { // load the BenchmarkExecution and the BenchmarkType - var parser = YamlParser() + val parser = YamlParser() val benchmarkExecution = parser.parse("./../../../resources/main/yaml/testBenchmarkExecution.yaml", BenchmarkExecution::class.java) !! val benchmark = parser.parse("./../../../resources/main/yaml/testBenchmarkType.yaml", KubernetesBenchmark::class.java) !! diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt index ef0c522070c954b7f3d386cb76a2a99e4bc48c60..8a7a9304b82f74c17de004856e5e7a5324257a06 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt @@ -3,8 +3,6 @@ package theodolite.k8s import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.Service -import io.fabric8.kubernetes.api.model.Volume -import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.api.model.apps.StatefulSet import io.fabric8.kubernetes.client.NamespacedKubernetesClient diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index 08a4d19ffe39ecf1b613163373ce02c31090fb4f..1336f57517ef74d8c781cc3b51bf130dbf8d99c5 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -2,7 +2,6 @@ package theodolite.k8s import mu.KotlinLogging import org.apache.kafka.clients.admin.AdminClient -import org.apache.kafka.clients.admin.AdminClientConfig import org.apache.kafka.clients.admin.ListTopicsResult import org.apache.kafka.clients.admin.NewTopic import java.util.* @@ -11,10 +10,10 @@ private val logger = KotlinLogging.logger {} /** * Manages the topics related tasks - * @param bootstrapServers Ip of the kafka server + * @param kafkaConfig Kafka Configuration as HashMap */ class TopicManager(kafkaConfig: HashMap<String, Any>) { - lateinit var kafkaAdmin: AdminClient + private lateinit var kafkaAdmin: AdminClient init { try { @@ -26,8 +25,7 @@ class TopicManager(kafkaConfig: HashMap<String, Any>) { /** * Creates topics. - * @param topics Map that holds a numPartition for each topic it should create - * @param replicationFactor + * @param newTopics List of all Topic which should be created */ fun createTopics(newTopics: Collection<NewTopic>) { kafkaAdmin.createTopics(newTopics) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt index 9fd386ba96c7c088119fc3ba56c499746d118a82..46194c411bb21e52257c3337db389de2db6e7ea5 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt @@ -10,14 +10,14 @@ import java.time.Duration private val logger = KotlinLogging.logger {} /** - * Resets the Workloadgenerator states in Zookeeper (and potentially watches for Zookeeper events) + * Resets the WorkloadGenerator states in Zookeeper (and potentially watches for Zookeeper events) * * @param connectionString of zookeeper */ class WorkloadGeneratorStateCleaner(connectionString: String) { private val timeout: Duration = Duration.ofMillis(500) private val retryAfter: Duration = Duration.ofSeconds(5) - lateinit var zookeeperClient: ZooKeeper + private lateinit var zookeeperClient: ZooKeeper private val path = "/workload-generation" init { @@ -44,7 +44,7 @@ class WorkloadGeneratorStateCleaner(connectionString: String) { try { children = zookeeperClient.getChildren(nodePath, true) } catch (e: KeeperException.NoNodeException) { - break; + break } // recursively delete all children nodes for (s: String in children) { @@ -58,11 +58,11 @@ class WorkloadGeneratorStateCleaner(connectionString: String) { // delete main node try { zookeeperClient.delete(nodePath, -1) - break; + break } catch (ex: Exception) { // no instance of node found if (ex is KeeperException.NoNodeException) { - break; + break } else { logger.error { ex.toString() } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/AbstractPatcher.kt b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/AbstractPatcher.kt index 9435a8d27a327692fee14795706a5b89fab0c263..7ee31881e0f23127f0323219094590c17044eb1d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/AbstractPatcher.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/AbstractPatcher.kt @@ -2,5 +2,4 @@ package theodolite.patcher import io.fabric8.kubernetes.api.model.KubernetesResource -abstract class AbstractPatcher(k8sResource: KubernetesResource, container: String? = null, variableName: String? = null): Patcher { -} +abstract class AbstractPatcher(k8sResource: KubernetesResource, container: String? = null, variableName: String? = null): Patcher diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/EnvVarPatcher.kt b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/EnvVarPatcher.kt index 941890ca36d339f61b3e9a52d32b7cc0c6f6deeb..a9eafb93e5b58115d652e0ebac2a38cb166a7f5e 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/EnvVarPatcher.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/EnvVarPatcher.kt @@ -41,9 +41,7 @@ class EnvVarPatcher(private val k8sResource: KubernetesResource, private val con */ private fun setEnv(workloadDeployment: Deployment, containerName: String, map: Map<String, String>) { workloadDeployment.spec.template.spec.containers.filter { it.name == containerName } - .forEach { it: Container -> - setContainerEnv(it, map) - } + .forEach { setContainerEnv(it, map) } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/NodeSelectorPatcher.kt b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/NodeSelectorPatcher.kt index b6d75eb801e12a0be07254f0578c9ca6b0463061..d588e7daed70a2c7b66d15c931f3c8a2867b91f8 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/NodeSelectorPatcher.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/NodeSelectorPatcher.kt @@ -1,7 +1,6 @@ package theodolite.patcher import io.fabric8.kubernetes.api.model.KubernetesResource -import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.api.model.apps.Deployment class NodeSelectorPatcher(private val k8sResource: KubernetesResource, private val variableName: String): AbstractPatcher(k8sResource, variableName){ diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt index 2479e9429ba2f82522a28f24ce1aba76816063ec..6cca627e6a2359fccf4781510960e82869e8d017 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt @@ -16,5 +16,5 @@ abstract class RestrictionStrategy(val results: Results) { * @param resources List of resources to be restricted. * @return Returns a list containing only elements that have not been filtered out by the restriction (possibly empty). */ - public abstract fun next(load: LoadDimension, resources: List<Resource>): List<Resource> + abstract fun next(load: LoadDimension, resources: List<Resource>): List<Resource> } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt index 474389c9283b08c672186fe11504351db88995c6..88972ffdba8021d3bca7bd69140f9749b6747b4a 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt @@ -14,7 +14,7 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { val result = binarySearch(load, resources, 0, resources.size - 1) if( result == -1 ) { - return null; + return null } return resources[result] } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt index 67a254989a9e56775787bf395934a3d5b299d694..c2d6c0933e7c4c6136fce6e83087b760cb957f61 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt @@ -3,7 +3,6 @@ package theodolite.strategies.searchstrategy import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension import theodolite.util.Resource -import theodolite.util.Results class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { @@ -11,6 +10,6 @@ class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm for (res in resources) { if (this.benchmarkExecutor.runExperiment(load, res)) return res } - return null; + return null } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt index 118d2f1625f704f4967a66e6c27a0a3fdaeb2895..2c03d1eeb27874028a7492f126f4c6103747eace 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt @@ -3,7 +3,6 @@ package theodolite.strategies.searchstrategy import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension import theodolite.util.Resource -import theodolite.util.Results abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor) { /** @@ -13,5 +12,5 @@ abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor) { * @param resources List of all possible resources. * @return suitable resource for the specified load, or null if no suitable resource exists. */ - abstract fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource?; + abstract fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? } \ No newline at end of file