From e7f239d435bfe4c05d49f642691946d540cc089b Mon Sep 17 00:00:00 2001 From: lorenz <stu203404@mail.uni-kiel.de> Date: Fri, 29 Jan 2021 16:19:24 +0100 Subject: [PATCH] Restructuring --- .../kotlin/theodolite/BenchmarkExecutor.kt | 17 ----------------- .../main/kotlin/theodolite/GreetingResource.kt | 14 -------------- .../src/main/kotlin/theodolite/Main.kt | 1 + .../theodolite/{ => execution}/Benchmark.kt | 4 ++-- .../theodolite/execution/BenchmarkExecutor.kt | 18 ++++++++++++++++++ .../{ => execution}/ConfigMapManager.kt | 2 +- .../{ => execution}/DeploymentManager.kt | 2 +- .../{ => execution}/ServiceManager.kt | 2 +- .../theodolite/{ => execution}/YamlLoader.kt | 2 +- .../theodolite/{ => k8s}/TopicManager.kt | 6 +++--- .../{ => k8s}/WorkloadGeneratorStateCleaner.kt | 10 ++++++---- .../theodolite/NativeGreetingResourceIT.kt | 6 ------ 12 files changed, 34 insertions(+), 50 deletions(-) delete mode 100644 theodolite-quarkus/src/main/kotlin/theodolite/BenchmarkExecutor.kt delete mode 100644 theodolite-quarkus/src/main/kotlin/theodolite/GreetingResource.kt rename theodolite-quarkus/src/main/kotlin/theodolite/{ => execution}/Benchmark.kt (75%) create mode 100644 theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt rename theodolite-quarkus/src/main/kotlin/theodolite/{ => execution}/ConfigMapManager.kt (93%) rename theodolite-quarkus/src/main/kotlin/theodolite/{ => execution}/DeploymentManager.kt (98%) rename theodolite-quarkus/src/main/kotlin/theodolite/{ => execution}/ServiceManager.kt (95%) rename theodolite-quarkus/src/main/kotlin/theodolite/{ => execution}/YamlLoader.kt (98%) rename theodolite-quarkus/src/main/kotlin/theodolite/{ => k8s}/TopicManager.kt (94%) rename theodolite-quarkus/src/main/kotlin/theodolite/{ => k8s}/WorkloadGeneratorStateCleaner.kt (88%) delete mode 100644 theodolite-quarkus/src/native-test/kotlin/theodolite/NativeGreetingResourceIT.kt diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/BenchmarkExecutor.kt deleted file mode 100644 index 1790cfe81..000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/BenchmarkExecutor.kt +++ /dev/null @@ -1,17 +0,0 @@ -package theodolite - -class BenchmarkExecutor(benchmark: Benchmark) { - val benchmark: Benchmark = benchmark - - fun waitExecution(executionMinutes: Int) { - val milliToMinutes = 60000 - System.out.println("Wait while executing") - for (i in 1.rangeTo(executionMinutes)) { - Thread.sleep((milliToMinutes * i).toLong()) - System.out.println("Executed: $i minutes") - } - - System.out.println("Execution finished") - } - fun runExperiment() {} -} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/GreetingResource.kt b/theodolite-quarkus/src/main/kotlin/theodolite/GreetingResource.kt deleted file mode 100644 index 2cf79f2d8..000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/GreetingResource.kt +++ /dev/null @@ -1,14 +0,0 @@ -package theodolite - -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.Produces -import javax.ws.rs.core.MediaType - -@Path("/hello-resteasy") -class GreetingResource { - - @GET - @Produces(MediaType.TEXT_PLAIN) - fun hello() = "Hello RESTEasy" -} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt index 57031509d..694bd60fd 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt @@ -2,6 +2,7 @@ package theodolite import io.quarkus.runtime.annotations.QuarkusMain import mu.KotlinLogging +import theodolite.execution.DeploymentManager private val logger = KotlinLogging.logger {} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/Benchmark.kt similarity index 75% rename from theodolite-quarkus/src/main/kotlin/theodolite/Benchmark.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/Benchmark.kt index b68007278..77112a652 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/Benchmark.kt @@ -1,9 +1,9 @@ -package theodolite +package theodolite.execution class Benchmark { fun start() {} fun stop() {} - fun startWorkloadGenerator(wg: String, dimValue: Int, ucId: String) { } + fun startWorkloadGenerator(wg: String, dimValue: Int, ucId: String) {} } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt new file mode 100644 index 000000000..94b4df4dd --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -0,0 +1,18 @@ +package theodolite.execution + +class BenchmarkExecutor(benchmark: Benchmark) { + val benchmark: Benchmark = benchmark + + fun waitExecution(executionMinutes: Int) { + val milliToMinutes = 60000 + System.out.println("Wait while executing") + for (i in 1.rangeTo(executionMinutes)) { + Thread.sleep((milliToMinutes * i).toLong()) + System.out.println("Executed: $i minutes") + } + + System.out.println("Execution finished") + } + + fun runExperiment() {} +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/ConfigMapManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/ConfigMapManager.kt similarity index 93% rename from theodolite-quarkus/src/main/kotlin/theodolite/ConfigMapManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/ConfigMapManager.kt index 92dd638cd..43daddc5d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/ConfigMapManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/ConfigMapManager.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.execution import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.client.NamespacedKubernetesClient diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/DeploymentManager.kt similarity index 98% rename from theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/DeploymentManager.kt index 0dc4c356b..12eeb73b6 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/DeploymentManager.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.execution import io.fabric8.kubernetes.api.model.Container import io.fabric8.kubernetes.api.model.EnvVar diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/ServiceManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/ServiceManager.kt similarity index 95% rename from theodolite-quarkus/src/main/kotlin/theodolite/ServiceManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/ServiceManager.kt index 1e8f627f2..d0e21ab5a 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/ServiceManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/ServiceManager.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.execution import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.client.NamespacedKubernetesClient diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/YamlLoader.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/YamlLoader.kt similarity index 98% rename from theodolite-quarkus/src/main/kotlin/theodolite/YamlLoader.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/YamlLoader.kt index 1a7e36dab..acdb75bfe 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/YamlLoader.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/YamlLoader.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.execution import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.api.model.Service diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt similarity index 94% rename from theodolite-quarkus/src/main/kotlin/theodolite/TopicManager.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index a62a8d825..23954d198 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.k8s import org.apache.kafka.clients.admin.AdminClient import org.apache.kafka.clients.admin.AdminClientConfig @@ -12,7 +12,7 @@ class TopicManager(boostrapIp: String) { init { try { kafkaAdmin = AdminClient.create(props) - } catch (e : Exception) { + } catch (e: Exception) { System.out.println(e.toString()) } } @@ -45,7 +45,7 @@ class TopicManager(boostrapIp: String) { try { result.all().get() - } catch (ex:Exception) { + } catch (ex: Exception) { System.out.println(ex.toString()) } System.out.println("Topics deleted") diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/WorkloadGeneratorStateCleaner.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt similarity index 88% rename from theodolite-quarkus/src/main/kotlin/theodolite/WorkloadGeneratorStateCleaner.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt index c519b0c84..f58478222 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/WorkloadGeneratorStateCleaner.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/WorkloadGeneratorStateCleaner.kt @@ -1,4 +1,4 @@ -package theodolite +package theodolite.k8s import org.apache.zookeeper.KeeperException import org.apache.zookeeper.WatchedEvent @@ -15,7 +15,7 @@ class WorkloadGeneratorStateCleaner(ip: String) { try { val watcher: Watcher = ZookeperWatcher() // defined below zookeeperClient = ZooKeeper(ip, sessionTimeout, watcher) - } catch (e:Exception) { + } catch (e: Exception) { System.out.println(e.toString()) } } @@ -33,12 +33,14 @@ class WorkloadGeneratorStateCleaner(ip: String) { try { val clients = zookeeperClient.getChildren(path, true) - if (clients.isEmpty()){ + if (clients.isEmpty()) { break; } } catch (ex: Exception) { when (ex) { - is KeeperException -> { deleted = true } + is KeeperException -> { + deleted = true + } is InterruptedException -> { System.out.println(ex.toString()) } diff --git a/theodolite-quarkus/src/native-test/kotlin/theodolite/NativeGreetingResourceIT.kt b/theodolite-quarkus/src/native-test/kotlin/theodolite/NativeGreetingResourceIT.kt deleted file mode 100644 index 26e8900ff..000000000 --- a/theodolite-quarkus/src/native-test/kotlin/theodolite/NativeGreetingResourceIT.kt +++ /dev/null @@ -1,6 +0,0 @@ -package theodolite - -import io.quarkus.test.junit.NativeImageTest - -@NativeImageTest -class NativeGreetingResourceIT : GreetingResourceTest() \ No newline at end of file -- GitLab