From 1e0811c38d0adf46233112f97da0fb15ecfa51bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Sat, 26 Nov 2022 20:28:49 +0100
Subject: [PATCH] Clean up code

---
 .../commons/hazelcastjet/HazelcastJetService.java  | 10 ++++------
 .../uc2/hazelcastjet/HistoryService.java           |  4 +---
 .../uc3/hazelcastjet/HistoryService.java           | 14 +++++++-------
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/theodolite-benchmarks/hazelcastjet-commons/src/main/java/rocks/theodolite/benchmarks/commons/hazelcastjet/HazelcastJetService.java b/theodolite-benchmarks/hazelcastjet-commons/src/main/java/rocks/theodolite/benchmarks/commons/hazelcastjet/HazelcastJetService.java
index 6c9beb671..34378c427 100644
--- a/theodolite-benchmarks/hazelcastjet-commons/src/main/java/rocks/theodolite/benchmarks/commons/hazelcastjet/HazelcastJetService.java
+++ b/theodolite-benchmarks/hazelcastjet-commons/src/main/java/rocks/theodolite/benchmarks/commons/hazelcastjet/HazelcastJetService.java
@@ -36,16 +36,14 @@ public abstract class HazelcastJetService {
    * build a new jet instance.
    */
   public HazelcastJetService(final Logger logger) {
-    this.jobName = this.config.getProperty(ConfigurationKeys.APPLICATION_NAME).toString();
+    this.jobName = this.config.getString(ConfigurationKeys.APPLICATION_NAME);
 
-    this.kafkaBootstrapServer = this.config.getProperty(
-        ConfigurationKeys.KAFKA_BOOTSTRAP_SERVERS).toString();
-    this.schemaRegistryUrl =
-        this.config.getProperty(ConfigurationKeys.SCHEMA_REGISTRY_URL).toString();
+    this.kafkaBootstrapServer = this.config.getString(ConfigurationKeys.KAFKA_BOOTSTRAP_SERVERS);
+    this.schemaRegistryUrl = this.config.getString(ConfigurationKeys.SCHEMA_REGISTRY_URL);
     this.propsBuilder =
         new KafkaPropertiesBuilder(this.kafkaBootstrapServer, this.schemaRegistryUrl, this.jobName);
 
-    this.kafkaInputTopic = this.config.getProperty(ConfigurationKeys.KAFKA_INPUT_TOPIC).toString();
+    this.kafkaInputTopic = this.config.getString(ConfigurationKeys.KAFKA_INPUT_TOPIC);
 
     final JetInstanceBuilder jetInstance = new JetInstanceBuilder()
         .setConfigFromEnv(logger, this.kafkaBootstrapServer, HZ_KUBERNETES_SERVICE_DNS_KEY);
diff --git a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java
index 6104b8a70..06785b583 100644
--- a/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java
+++ b/theodolite-benchmarks/uc2-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc2/hazelcastjet/HistoryService.java
@@ -19,7 +19,6 @@ public class HistoryService extends HazelcastJetService {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(HistoryService.class);
 
-
   /**
    * Constructs the use case logic for UC2. Retrieves the needed values and instantiates a pipeline
    * factory.
@@ -36,8 +35,7 @@ public class HistoryService extends HazelcastJetService {
             StringSerializer.class.getCanonicalName(),
             StringSerializer.class.getCanonicalName());
 
-    final String kafkaOutputTopic =
-        this.config.getProperty(ConfigurationKeys.KAFKA_OUTPUT_TOPIC).toString();
+    final String kafkaOutputTopic = this.config.getString(ConfigurationKeys.KAFKA_OUTPUT_TOPIC);
 
     final Duration downsampleInterval = Duration.ofMinutes(
         this.config.getInt(ConfigurationKeys.DOWNSAMPLE_INTERVAL_MINUTES));
diff --git a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/HistoryService.java b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/HistoryService.java
index df3f85a42..9732db7c2 100644
--- a/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/HistoryService.java
+++ b/theodolite-benchmarks/uc3-hazelcastjet/src/main/java/rocks/theodolite/benchmarks/uc3/hazelcastjet/HistoryService.java
@@ -35,16 +35,16 @@ public class HistoryService extends HazelcastJetService {
             StringSerializer.class.getCanonicalName());
 
     final String kafkaOutputTopic =
-        this.config.getProperty(ConfigurationKeys.KAFKA_OUTPUT_TOPIC).toString();
+        this.config.getString(ConfigurationKeys.KAFKA_OUTPUT_TOPIC);
 
-    final Duration windowSize = Duration.ofDays(Integer.parseInt(
-        this.config.getProperty(ConfigurationKeys.AGGREGATION_DURATION_DAYS).toString()));
+    final Duration windowSize = Duration.ofDays(
+        this.config.getInt(ConfigurationKeys.AGGREGATION_DURATION_DAYS));
 
-    final Duration hoppingSize = Duration.ofDays(Integer.parseInt(
-        this.config.getProperty(ConfigurationKeys.AGGREGATION_ADVANCE_DAYS).toString()));
+    final Duration hoppingSize = Duration.ofDays(
+        this.config.getInt(ConfigurationKeys.AGGREGATION_ADVANCE_DAYS));
 
-    final Duration emitPeriod = Duration.ofSeconds(Integer.parseInt(
-        this.config.getProperty(ConfigurationKeys.AGGREGATION_EMIT_PERIOD_SECONDS).toString()));
+    final Duration emitPeriod = Duration.ofSeconds(
+        this.config.getInt(ConfigurationKeys.AGGREGATION_EMIT_PERIOD_SECONDS));
 
     this.pipelineFactory = new Uc3PipelineFactory(
         kafkaProps,
-- 
GitLab