diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/Benchmark.kt b/theodolite/src/main/kotlin/theodolite/benchmark/Benchmark.kt index cf2fac7337d79c1c5daf2b0fac070200cf27f9a5..6f07c7a3bd210f52fff77fcc806d2517743e5887 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/Benchmark.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/Benchmark.kt @@ -3,11 +3,11 @@ package theodolite.benchmark import io.quarkus.runtime.annotations.RegisterForReflection import theodolite.util.ConfigurationOverride import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources /** * A Benchmark contains: - * - The [Resource]s that can be scaled for the benchmark. + * - The [Resources]s that can be scaled for the benchmark. * - The [LoadDimension]s that can be scaled the benchmark. * - additional [ConfigurationOverride]s. */ @@ -22,10 +22,10 @@ interface Benchmark { * @return a BenchmarkDeployment. */ fun buildDeployment( - load: LoadDimension, - res: Resource, - configurationOverrides: List<ConfigurationOverride?>, - loadGenerationDelay: Long, - afterTeardownDelay: Long + load: LoadDimension, + res: Resources, + configurationOverrides: List<ConfigurationOverride?>, + loadGenerationDelay: Long, + afterTeardownDelay: Long ): BenchmarkDeployment } diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt index 0b81f8701f92a95662efef6e0d58839c9a2f6f3b..d41618cbc546327457e89aadc417f2fcac49b7c2 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt @@ -1,6 +1,5 @@ package theodolite.benchmark -import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.client.DefaultKubernetesClient @@ -82,11 +81,11 @@ class KubernetesBenchmark : KubernetesResource, Benchmark { * @return a [BenchmarkDeployment] */ override fun buildDeployment( - load: LoadDimension, - res: Resource, - configurationOverrides: List<ConfigurationOverride?>, - loadGenerationDelay: Long, - afterTeardownDelay: Long + load: LoadDimension, + res: theodolite.util.Resources, + configurationOverrides: List<ConfigurationOverride?>, + loadGenerationDelay: Long, + afterTeardownDelay: Long ): BenchmarkDeployment { logger.info { "Using $namespace as namespace." } diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt index 281c68e318784ee8206473cd014f814b3f5152a9..6ae360e0de455837610d2436be0bf64171125d05 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt @@ -5,7 +5,7 @@ import theodolite.benchmark.BenchmarkExecution import theodolite.util.EvaluationFailedException import theodolite.util.IOHandler import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import java.text.Normalizer import java.time.Duration import java.time.Instant @@ -36,14 +36,14 @@ class AnalysisExecutor( * @param executionIntervals list of start and end points of experiments * @return true if the experiment succeeded. */ - fun analyze(load: LoadDimension, res: Resource, executionIntervals: List<Pair<Instant, Instant>>): Boolean { + fun analyze(load: LoadDimension, res: Int, executionIntervals: List<Pair<Instant, Instant>>): Boolean { var result: Boolean var repetitionCounter = 1 try { val ioHandler = IOHandler() val resultsFolder: String = ioHandler.getResultFolderURL() - val fileURL = "${resultsFolder}exp${executionId}_${load.get()}_${res.get()}_${slo.sloType.toSlug()}" + val fileURL = "${resultsFolder}exp${executionId}_${load.get()}_${res}_${slo.sloType.toSlug()}" val prometheusData = executionIntervals .map { interval -> @@ -71,7 +71,7 @@ class AnalysisExecutor( result = sloChecker.evaluate(prometheusData) } catch (e: Exception) { - throw EvaluationFailedException("Evaluation failed for resource '${res.get()}' and load '${load.get()} ", e) + throw EvaluationFailedException("Evaluation failed for resource '${res}' and load '${load.get()} ", e) } return result } diff --git a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt index 3238f447be06ce6486bb7f6ca1758700f36ba558..fb6c7201910cb23f054fc42a254e36dff6886421 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutor.kt @@ -5,7 +5,7 @@ import theodolite.benchmark.Benchmark import theodolite.benchmark.BenchmarkExecution import theodolite.util.ConfigurationOverride import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results import java.time.Duration import java.util.concurrent.atomic.AtomicBoolean @@ -44,7 +44,7 @@ abstract class BenchmarkExecutor( * @return True, if the number of resources are suitable for the * given load, false otherwise. */ - abstract fun runExperiment(load: LoadDimension, res: Resource): Boolean + abstract fun runExperiment(load: LoadDimension, res: Int): Boolean /** * Wait while the benchmark is running and log the number of minutes executed every 1 minute. diff --git a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index 2e938be3a6e503a5e7e3f94c18a9454e173db5b0..f51a4a8420eaf833339d51a2d4810ef6094cb2ce 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -39,7 +39,7 @@ class BenchmarkExecutorImpl( private val eventCreator = EventCreator() private val mode = Configuration.EXECUTION_MODE - override fun runExperiment(load: LoadDimension, res: Resource): Boolean { + override fun runExperiment(load: LoadDimension, res: Int): Boolean { var result = false val executionIntervals: MutableList<Pair<Instant, Instant>> = ArrayList() @@ -76,7 +76,8 @@ class BenchmarkExecutorImpl( return result } - private fun runSingleExperiment(load: LoadDimension, res: Resource): Pair<Instant, Instant> { + private fun runSingleExperiment(load: LoadDimension, res: Int): Pair<Instant, Instant> { + // TODO res muss eigentlich eine Resource (Int) + Patcher sein val benchmarkDeployment = benchmark.buildDeployment( load, res, @@ -94,7 +95,7 @@ class BenchmarkExecutorImpl( executionName = executionName, type = "NORMAL", reason = "Start experiment", - message = "load: ${load.get()}, resources: ${res.get()}") + message = "load: ${load.get()}, resources: $res") } } catch (e: Exception) { this.run.set(false) @@ -104,7 +105,7 @@ class BenchmarkExecutorImpl( executionName = executionName, type = "WARNING", reason = "Start experiment failed", - message = "load: ${load.get()}, resources: ${res.get()}") + message = "load: ${load.get()}, resources: $res") } throw ExecutionFailedException("Error during setup the experiment", e) } diff --git a/theodolite/src/main/kotlin/theodolite/execution/Shutdown.kt b/theodolite/src/main/kotlin/theodolite/execution/Shutdown.kt index 6dedc94af864269d7d15929c69ec54aa384fc8e3..a8a5a43bed375c1e322ab5ccb414c842487e0597 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/Shutdown.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/Shutdown.kt @@ -4,7 +4,7 @@ import mu.KotlinLogging import theodolite.benchmark.BenchmarkExecution import theodolite.benchmark.KubernetesBenchmark import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources private val logger = KotlinLogging.logger {} @@ -28,7 +28,7 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, private val b val deployment = benchmark.buildDeployment( load = LoadDimension(0, emptyList()), - res = Resource(0, emptyList()), + res = Resources(listOf(0), emptyList()), configurationOverrides = benchmarkExecution.configOverrides, loadGenerationDelay = 0L, afterTeardownDelay = 5L diff --git a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index becac28494a34afee4ae37f207ade16e74cdaf9d..4be0d94cb6670f49fdb4aed0aa934043f67b8e0c 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -86,12 +86,7 @@ class TheodoliteExecutor( return Config( loads = config.load.loadValues.map { load -> LoadDimension(load, loadDimensionPatcherDefinition) }, - resources = config.resources.resourceValues.map { resource -> - Resource( - resource, - resourcePatcherDefinition - ) - }, + resources = Resources(config.resources.resourceValues, resourcePatcherDefinition), searchStrategy = strategyFactory.createSearchStrategy(executor, config.execution.strategy, results), metric = config.execution.metric ) @@ -125,12 +120,12 @@ class TheodoliteExecutor( //demand metric for (load in config.loads) { if (executor.run.get()) { - config.searchStrategy.findSuitableResource(load, config.resources) + config.searchStrategy.findSuitableResource(load, config.resources.get()) } } } else { //capacity metric - for (resource in config.resources) { + for (resource in config.resources.get()) { if (executor.run.get()) { config.searchStrategy.findSuitableLoad(resource, config.loads) } diff --git a/theodolite/src/main/kotlin/theodolite/strategies/StrategyFactory.kt b/theodolite/src/main/kotlin/theodolite/strategies/StrategyFactory.kt index a4c51bc0cae28ae968fc519741e7a3f62f427d9e..875e3e57f4720b84962454ff68f81bc84d7b8b14 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/StrategyFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/StrategyFactory.kt @@ -50,7 +50,7 @@ class StrategyFactory { * * @param results The [Results] saves the state of the Theodolite benchmark run. * @param restrictionStrings Specifies the list of [RestrictionStrategy] that are used to restrict the amount - * of [theodolite.util.Resource] for a fixed LoadDimension. Must equal the string + * of [theodolite.util.Resources] for a fixed LoadDimension. Must equal the string * 'LowerBound'. * * @throws IllegalArgumentException if param searchStrategyString was not one of the allowed options. diff --git a/theodolite/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt b/theodolite/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt index 13bfedfe055f2bd428137f89b2986f3967ec797c..02ffea74ead668e97b718609bfec1145606a85d3 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/restriction/LowerBoundRestriction.kt @@ -1,7 +1,6 @@ package theodolite.strategies.restriction import theodolite.util.LoadDimension -import theodolite.util.Resource import theodolite.util.Results /** @@ -12,13 +11,13 @@ import theodolite.util.Results */ class LowerBoundRestriction(results: Results) : RestrictionStrategy(results) { - override fun apply(load: LoadDimension, resources: List<Resource>): List<Resource> { + override fun apply(load: LoadDimension, resources: List<Int>): List<Int> { val maxLoad: LoadDimension? = this.results.getMaxBenchmarkedLoad(load) - var lowerBound: Resource? = this.results.getMinRequiredInstances(maxLoad) + var lowerBound: Int? = this.results.getMinRequiredInstances(maxLoad) if (lowerBound == null) { lowerBound = resources[0] } - return resources.filter { x -> x.get() >= lowerBound.get() } + return resources.filter { x -> x >= lowerBound } } } diff --git a/theodolite/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt b/theodolite/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt index 1ab7302d7898daad729b1c94c32d97138b5cdcf4..a1fe97a1e8523ef3fbf6a9d1212535d470fb7401 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/restriction/RestrictionStrategy.kt @@ -2,7 +2,7 @@ package theodolite.strategies.restriction import io.quarkus.runtime.annotations.RegisterForReflection import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results /** @@ -17,9 +17,9 @@ abstract class RestrictionStrategy(val results: Results) { * Apply the restriction of the given resource list for the given load based on the results object. * * @param load [LoadDimension] for which a subset of resources are required. - * @param resources List of [Resource]s to be restricted. + * @param resources List of [Resources]s to be restricted. * @return Returns a list containing only elements that have not been filtered out by the * restriction (possibly empty). */ - abstract fun apply(load: LoadDimension, resources: List<Resource>): List<Resource> + abstract fun apply(load: LoadDimension, resources: List<Int>): List<Int> } diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt index eaa5c0cd573bf1901241d336bf1ad2d05e0b575a..62bf12e2d795edd645cfaa55014af4cb1126ab69 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/BinarySearch.kt @@ -1,9 +1,10 @@ package theodolite.strategies.searchstrategy import mu.KotlinLogging +import org.apache.kafka.common.protocol.types.Field import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources private val logger = KotlinLogging.logger {} @@ -13,16 +14,17 @@ private val logger = KotlinLogging.logger {} * @param benchmarkExecutor Benchmark executor which runs the individual benchmarks. */ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { - override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { - val result = binarySearch(load, resources, 0, resources.size - 1) + override fun findSuitableResource(load: LoadDimension, resources: List<Int>): Int? { + val result = binarySearch(load, resources, 0, resources.size - 1, true) if (result == -1) { return null } return resources[result] } - override fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>): LoadDimension? { - TODO("Not yet implemented") + override fun findSuitableLoad(resource: Int, loads: List<LoadDimension>): LoadDimension? { + // TODO + return null } /** @@ -33,14 +35,15 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm * @param lower lower bound for binary search (inclusive) * @param upper upper bound for binary search (inclusive) */ - private fun binarySearch(load: LoadDimension, resources: List<Resource>, lower: Int, upper: Int): Int { + private fun binarySearch(load: LoadDimension, resources: List<Int>, lower: Int, upper: Int, + demand: Boolean): Int { if (lower > upper) { throw IllegalArgumentException() } // special case: length == 1 or 2 if (lower == upper) { val res = resources[lower] - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } if (this.benchmarkExecutor.runExperiment(load, resources[lower])) return lower else { if (lower + 1 == resources.size) return -1 @@ -51,14 +54,14 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm // length > 2 and adjust upper and lower depending on the result for `resources[mid]` val mid = (upper + lower) / 2 val res = resources[mid] - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } if (this.benchmarkExecutor.runExperiment(load, resources[mid])) { if (mid == lower) { return lower } - return binarySearch(load, resources, lower, mid - 1) + return binarySearch(load, resources, lower, mid - 1, demand) } else { - return binarySearch(load, resources, mid + 1, upper) + return binarySearch(load, resources, mid + 1, upper, demand) } } } diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/FullSearch.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/FullSearch.kt index 237124b8f930d375e0bc2e88743c4b274123d015..304297147e463f3a431b9c0da826fa45350f99ff 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/FullSearch.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/FullSearch.kt @@ -3,7 +3,7 @@ package theodolite.strategies.searchstrategy import mu.KotlinLogging import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources private val logger = KotlinLogging.logger {} @@ -17,23 +17,23 @@ private val logger = KotlinLogging.logger {} */ class FullSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { - override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { - var minimalSuitableResources: Resource? = null + override fun findSuitableResource(load: LoadDimension, resources: List<Int>): Int? { + var minimalSuitableResources: Int? = null for (res in resources) { - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } val result = this.benchmarkExecutor.runExperiment(load, res) //TODO: that actually doesnt make sense no? Shouldnt it be == null? - if (result && minimalSuitableResources != null) { + if (result && minimalSuitableResources == null) { minimalSuitableResources = res } } return minimalSuitableResources } - override fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>): LoadDimension? { + override fun findSuitableLoad(resource: Int, loads: List<LoadDimension>): LoadDimension? { var maxSuitableLoad: LoadDimension? = null for (load in loads) { - logger.info { "Running experiment with resources '${resource.get()}' and load '${load.get()}'" } + logger.info { "Running experiment with resources '$resource' and load '${load.get()}'" } if (this.benchmarkExecutor.runExperiment(load, resource)) maxSuitableLoad = load } return maxSuitableLoad diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/GuessStrategy.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/GuessStrategy.kt index 786a3baf159e94841c1f76c696f030718e8f768f..68d42714a1f2e9cf1a8f95c49d55b5b80fef2c21 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/GuessStrategy.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/GuessStrategy.kt @@ -1,7 +1,7 @@ package theodolite.strategies.searchstrategy import io.quarkus.runtime.annotations.RegisterForReflection -import theodolite.util.Resource +import theodolite.util.Resources /** * Base class for the implementation of Guess strategies. Guess strategies are strategies to determine the resource @@ -13,10 +13,10 @@ abstract class GuessStrategy { /** * Computing the resource demand for the initial guess search strategy to start with. * - * @param resources List of all possible [Resource]s. + * @param resources List of all possible [Resources]s. * @param lastLowestResource Previous resource demand needed for the given load. * * @return Returns the resource demand to start the initial guess search strategy with or null */ - abstract fun firstGuess(resources: List<Resource>, lastLowestResource: Resource?): Resource? + abstract fun firstGuess(resources: List<Int>, lastLowestResource: Int?): Int? } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/InitialGuessSearchStrategy.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/InitialGuessSearchStrategy.kt index 61c42ba7815a5045aaf36575e7cae0ea31e945e4..56e57dde856a572ed800eeea7e49a1029eccaf60 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/InitialGuessSearchStrategy.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/InitialGuessSearchStrategy.kt @@ -3,7 +3,7 @@ package theodolite.strategies.searchstrategy import mu.KotlinLogging import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results private val logger = KotlinLogging.logger {} @@ -19,7 +19,7 @@ private val logger = KotlinLogging.logger {} class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStrategy: GuessStrategy, results: Results) : SearchStrategy(benchmarkExecutor, guessStrategy, results) { - override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { + override fun findSuitableResource(load: LoadDimension, resources: List<Int>): Int? { if(resources.isEmpty()) { logger.info { "You need to specify resources to be checked for the InitialGuessSearchStrategy to work." } @@ -37,21 +37,21 @@ class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStra } - var lastLowestResource : Resource? = null + var lastLowestResource : Int? = null // Getting the lastLowestResource from results and calling firstGuess() with it if (!results.isEmpty()) { val maxLoad: LoadDimension? = this.results.getMaxBenchmarkedLoad(load) lastLowestResource = this.results.getMinRequiredInstances(maxLoad) - if (lastLowestResource.get() == Int.MAX_VALUE) lastLowestResource = null + if (lastLowestResource == Int.MAX_VALUE) lastLowestResource = null } lastLowestResource = this.guessStrategy.firstGuess(resources, lastLowestResource) if (lastLowestResource != null) { - val resourcesToCheck: List<Resource> + val resourcesToCheck: List<Int> val startIndex: Int = resources.indexOf(lastLowestResource) - logger.info { "Running experiment with load '${load.get()}' and resources '${lastLowestResource.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$lastLowestResource'" } // If the first experiment passes, starting downward linear search // otherwise starting upward linear search @@ -60,10 +60,10 @@ class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStra resourcesToCheck = resources.subList(0, startIndex).reversed() if (resourcesToCheck.isEmpty()) return lastLowestResource - var currentMin: Resource = lastLowestResource + var currentMin: Int = lastLowestResource for (res in resourcesToCheck) { - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } if (this.benchmarkExecutor.runExperiment(load, res)) { currentMin = res } @@ -79,7 +79,7 @@ class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStra for (res in resourcesToCheck) { - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } if (this.benchmarkExecutor.runExperiment(load, res)) return res } } @@ -91,7 +91,7 @@ class InitialGuessSearchStrategy(benchmarkExecutor: BenchmarkExecutor, guessStra return null } - override fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>): LoadDimension? { + override fun findSuitableLoad(resource: Int, loads: List<LoadDimension>): LoadDimension? { TODO("Not yet implemented") } } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt index 752b3301fb985af103d8fd50a0d75b11f74aaa49..0e8aaf6ddb05ca171f8d2da157b5bd1010159449 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/LinearSearch.kt @@ -3,7 +3,7 @@ package theodolite.strategies.searchstrategy import mu.KotlinLogging import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources private val logger = KotlinLogging.logger {} @@ -14,9 +14,9 @@ private val logger = KotlinLogging.logger {} */ class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchmarkExecutor) { - override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { + override fun findSuitableResource(load: LoadDimension, resources: List<Int>): Int? { for (res in resources) { - logger.info { "Running experiment with load '${load.get()}' and resources '${res.get()}'" } + logger.info { "Running experiment with load '${load.get()}' and resources '$res'" } if (this.benchmarkExecutor.runExperiment(load, res)) return res } return null @@ -24,10 +24,10 @@ class LinearSearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm // Stops after having the first load which is not possible anymore with the current resource, maybe some later load still possible tho // kinda like GuessSearchStrat case -> differentiate or is it fine like that? - override fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>): LoadDimension? { + override fun findSuitableLoad(resource: Int, loads: List<LoadDimension>): LoadDimension? { var maxSuitableLoad: LoadDimension? = null for (load in loads) { - logger.info { "Running experiment with resources '${resource.get()}' and load '${load.get()}'" } + logger.info { "Running experiment with resources '$resource' and load '${load.get()}'" } if (this.benchmarkExecutor.runExperiment(load, resource)) { maxSuitableLoad = load } else break diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/PrevResourceMinGuess.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/PrevResourceMinGuess.kt index 413eecea27279cd79bad155fbb7d5d18b674a12e..250f25b1e77d6667eb0b1de4ae55c2f6a30ee69a 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/PrevResourceMinGuess.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/PrevResourceMinGuess.kt @@ -1,6 +1,6 @@ package theodolite.strategies.searchstrategy -import theodolite.util.Resource +import theodolite.util.Resources /** * This Guess strategy takes the minimal resource demand of the previous load, which is given as an argument for the @@ -10,12 +10,12 @@ import theodolite.util.Resource class PrevResourceMinGuess() : GuessStrategy(){ /** - * @param resources List of all possible [Resource]s. + * @param resources List of all possible [Resources]s. * @param lastLowestResource Previous resource demand needed for the given load. * * @return the value of lastLowestResource if given otherwise the first element of the resource list or null */ - override fun firstGuess(resources: List<Resource>, lastLowestResource: Resource?): Resource? { + override fun firstGuess(resources: List<Int>, lastLowestResource: Int?): Int? { if (lastLowestResource != null) return lastLowestResource else if(resources.isNotEmpty()) return resources[0] diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/RestrictionSearch.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/RestrictionSearch.kt index f09371cb43a0b5f6a7435709ea2880e2b0706653..fa18785f92e63efcc172977ee321aef6c90a05ad 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/RestrictionSearch.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/RestrictionSearch.kt @@ -4,13 +4,13 @@ import io.quarkus.runtime.annotations.RegisterForReflection import theodolite.execution.BenchmarkExecutor import theodolite.strategies.restriction.RestrictionStrategy import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources /** * Strategy that combines a SearchStrategy and a set of RestrictionStrategy. * * @param searchStrategy the [SearchStrategy] that is executed as part of this [RestrictionSearch]. - * @param restrictionStrategies the set of [RestrictionStrategy] that are connected conjunctive to restrict the [Resource] + * @param restrictionStrategies the set of [RestrictionStrategy] that are connected conjunctive to restrict the [Resources] * @param benchmarkExecutor Benchmark executor which runs the individual benchmarks. */ @RegisterForReflection @@ -20,8 +20,8 @@ class RestrictionSearch( val restrictionStrategies: Set<RestrictionStrategy> ) : SearchStrategy(benchmarkExecutor) { - override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? { - var restrictedResources = resources.toList() + override fun findSuitableResource(load: LoadDimension, resources: List<Int>): Int? { + var restrictedResources = resources for (strategy in this.restrictionStrategies) { restrictedResources = restrictedResources.intersect(strategy.apply(load, resources)).toList() } @@ -29,7 +29,7 @@ class RestrictionSearch( } //TODO: not sure if it makes sense but actually doing the same as for finding suitable resource with the restrictions - override fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>): LoadDimension? { + override fun findSuitableLoad(resource: Int, loads: List<LoadDimension>): LoadDimension? { //erste Zeile komisch, wird auch bei resource so gemacht aber warum? das ist doch ne liste warum also toList? TODO("Not yet implemented") } diff --git a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt index ef366a1b282eaf0ea3dcdaf4a5ce792d0acc1a1b..961c71d0edcc3885eb9dae2d308cfce4cee9dc75 100644 --- a/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt +++ b/theodolite/src/main/kotlin/theodolite/strategies/searchstrategy/SearchStrategy.kt @@ -3,7 +3,7 @@ package theodolite.strategies.searchstrategy import io.quarkus.runtime.annotations.RegisterForReflection import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results /** @@ -24,7 +24,7 @@ abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val gues * * @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<Int>): Int? /** * Find biggest suitable load from the specified load list for the given resource amount. @@ -34,5 +34,5 @@ abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor, val gues * * @return suitable load for the specified resource amount, or null if no suitable load exists. */ - abstract fun findSuitableLoad(resource: Resource, loads: List<LoadDimension>) : LoadDimension? + abstract fun findSuitableLoad(resource: Int, loads: List<LoadDimension>) : LoadDimension? } diff --git a/theodolite/src/main/kotlin/theodolite/util/Config.kt b/theodolite/src/main/kotlin/theodolite/util/Config.kt index fb4c0b641bb19f5892d0efcb8273acd62914cfa7..9b9cd81a8352a0843b5ee8c7dba770df750a054f 100644 --- a/theodolite/src/main/kotlin/theodolite/util/Config.kt +++ b/theodolite/src/main/kotlin/theodolite/util/Config.kt @@ -1,21 +1,20 @@ package theodolite.util import io.quarkus.runtime.annotations.RegisterForReflection -import theodolite.strategies.searchstrategy.RestrictionSearch import theodolite.strategies.searchstrategy.SearchStrategy /** * Config class that represents a configuration of a theodolite run. * * @param loads the [LoadDimension] of the execution - * @param resources the [Resource] of the execution + * @param resources the [Resources] of the execution * @param searchStrategy the [SearchStrategy] of the execution * @param metric the Metric of the execution */ @RegisterForReflection data class Config( - val loads: List<LoadDimension>, - val resources: List<Resource>, - val searchStrategy: SearchStrategy, - val metric: String + val loads: List<LoadDimension>, + val resources: Resources, + val searchStrategy: SearchStrategy, + val metric: String ) diff --git a/theodolite/src/main/kotlin/theodolite/util/Resource.kt b/theodolite/src/main/kotlin/theodolite/util/Resources.kt similarity index 50% rename from theodolite/src/main/kotlin/theodolite/util/Resource.kt rename to theodolite/src/main/kotlin/theodolite/util/Resources.kt index 1d6410aa4288e19817e3ba48bfd1bc0d85d006a2..6315913a489113e059646fb98d119dda023df92f 100644 --- a/theodolite/src/main/kotlin/theodolite/util/Resource.kt +++ b/theodolite/src/main/kotlin/theodolite/util/Resources.kt @@ -6,13 +6,20 @@ import io.quarkus.runtime.annotations.RegisterForReflection * Representation of the resources for an execution of Theodolite. */ @RegisterForReflection -data class Resource(private val number: Int, private val type: List<PatcherDefinition>) { +data class Resources(private val resourceList: List<Int>, private val type: List<PatcherDefinition>) { /** - * @return the value of this resource. + * @return the list of resources. */ - fun get(): Int { - return this.number + fun get(): List<Int> { + return this.resourceList + } + + /** + * @return the resource at a given Index. + */ + fun getIndex(i: Int): Int { + return this.resourceList[i] } /** diff --git a/theodolite/src/main/kotlin/theodolite/util/Results.kt b/theodolite/src/main/kotlin/theodolite/util/Results.kt index 2221c2e64f6dbc1776122f20793aa8d04d621d9d..8ed951b2b7e5bea225be165c0c810880e32b355d 100644 --- a/theodolite/src/main/kotlin/theodolite/util/Results.kt +++ b/theodolite/src/main/kotlin/theodolite/util/Results.kt @@ -9,28 +9,28 @@ import io.quarkus.runtime.annotations.RegisterForReflection */ @RegisterForReflection class Results { - private val results: MutableMap<Pair<LoadDimension, Resource>, Boolean> = mutableMapOf() + private val results: MutableMap<Pair<LoadDimension, Int>, Boolean> = mutableMapOf() /** * Set the result for an experiment. * - * @param experiment A pair that identifies the experiment by the [LoadDimension] and [Resource]. + * @param experiment A pair that identifies the experiment by the [LoadDimension] and [Resources]. * @param successful the result of the experiment. Successful == true and Unsuccessful == false. */ - fun setResult(experiment: Pair<LoadDimension, Resource>, successful: Boolean) { + fun setResult(experiment: Pair<LoadDimension, Int>, successful: Boolean) { this.results[experiment] = successful } /** * Get the result for an experiment. * - * @param experiment A pair that identifies the experiment by the [LoadDimension] and [Resource]. + * @param experiment A pair that identifies the experiment by the [LoadDimension] and [Resources]. * @return true if the experiment was successful and false otherwise. If the result has not been reported so far, * null is returned. * - * @see Resource + * @see Resources */ - fun getResult(experiment: Pair<LoadDimension, Resource>): Boolean? { + fun getResult(experiment: Pair<LoadDimension, Int>): Boolean? { return this.results[experiment] } @@ -44,16 +44,16 @@ class Results { * If no experiments have been marked as either successful or unsuccessful * yet, a Resource with the constant value Int.MIN_VALUE is returned. */ - fun getMinRequiredInstances(load: LoadDimension?): Resource { + fun getMinRequiredInstances(load: LoadDimension?): Int { if (this.results.isEmpty()) { - return Resource(Int.MIN_VALUE, emptyList()) + return Int.MIN_VALUE } - var minRequiredInstances = Resource(Int.MAX_VALUE, emptyList()) + var minRequiredInstances = Int.MAX_VALUE for (experiment in results) { // Get all successful experiments for requested load if (experiment.key.first == load && experiment.value) { - if (experiment.key.second.get() < minRequiredInstances.get()) { + if (experiment.key.second < minRequiredInstances) { // Found new smallest resources minRequiredInstances = experiment.key.second } diff --git a/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt b/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt index 1af6f548b219697009c688ace712a9f7f5620bd0..93816132a7e52ee266c3bd473b861aa89964c4e1 100644 --- a/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt +++ b/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt @@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test import theodolite.benchmark.BenchmarkExecution import theodolite.strategies.searchstrategy.InitialGuessSearchStrategy import theodolite.util.LoadDimension -import theodolite.util.Resource import theodolite.util.Results import mu.KotlinLogging import theodolite.strategies.searchstrategy.PrevResourceMinGuess @@ -28,7 +27,7 @@ class InitialGuessSearchStrategyTest { arrayOf(false, false, false, false, false, false, false) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..6).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..6).toList() val results = Results() val benchmark = TestBenchmark() val guessStrategy = PrevResourceMinGuess() @@ -36,14 +35,14 @@ class InitialGuessSearchStrategyTest { val benchmarkExecutor = TestBenchmarkExecutorImpl(mockResults, benchmark, results, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor,guessStrategy, results) - val actual: ArrayList<Resource?> = ArrayList() - val expected: ArrayList<Resource?> = ArrayList(listOf(0, 2, 2, 3, 4, 6).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + val expected: ArrayList<Int?> = ArrayList(listOf(0, 2, 2, 3, 4, 6)) expected.add(null) for (load in mockLoads) { - val returnVal : Resource? = strategy.findSuitableResource(load, mockResources) + val returnVal : Int? = strategy.findSuitableResource(load, mockResources) if(returnVal != null) { - logger.info { "returnVal '${returnVal.get()}'" } + logger.info { "returnVal '${returnVal}'" } } else { logger.info { "returnVal is null." } @@ -66,7 +65,7 @@ class InitialGuessSearchStrategyTest { arrayOf(false, false, false, false, false, false, false) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..6).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..6).toList() val results = Results() val benchmark = TestBenchmark() val guessStrategy = PrevResourceMinGuess() @@ -74,14 +73,14 @@ class InitialGuessSearchStrategyTest { val benchmarkExecutor = TestBenchmarkExecutorImpl(mockResults, benchmark, results, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor,guessStrategy, results) - val actual: ArrayList<Resource?> = ArrayList() - val expected: ArrayList<Resource?> = ArrayList(listOf(0, 2, 2, 1, 4, 6).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + val expected: ArrayList<Int?> = ArrayList(listOf(0, 2, 2, 1, 4, 6)) expected.add(null) for (load in mockLoads) { - val returnVal : Resource? = strategy.findSuitableResource(load, mockResources) + val returnVal : Int? = strategy.findSuitableResource(load, mockResources) if(returnVal != null) { - logger.info { "returnVal '${returnVal.get()}'" } + logger.info { "returnVal '${returnVal}'" } } else { logger.info { "returnVal is null." } @@ -104,7 +103,7 @@ class InitialGuessSearchStrategyTest { arrayOf(false, false, false, false, false, false, false) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..6).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..6).toList() val results = Results() val benchmark = TestBenchmark() val guessStrategy = PrevResourceMinGuess() @@ -112,15 +111,15 @@ class InitialGuessSearchStrategyTest { val benchmarkExecutor = TestBenchmarkExecutorImpl(mockResults, benchmark, results, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor, guessStrategy, results) - val actual: ArrayList<Resource?> = ArrayList() - var expected: ArrayList<Resource?> = ArrayList(listOf(2, 3, 0, 4, 6).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + var expected: ArrayList<Int?> = ArrayList(listOf(2, 3, 0, 4, 6)) expected.add(null) expected = ArrayList(listOf(null) + expected) for (load in mockLoads) { - val returnVal : Resource? = strategy.findSuitableResource(load, mockResources) + val returnVal : Int? = strategy.findSuitableResource(load, mockResources) if(returnVal != null) { - logger.info { "returnVal '${returnVal.get()}'" } + logger.info { "returnVal '${returnVal}'" } } else { logger.info { "returnVal is null." } diff --git a/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt b/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt index 965040e06467ae627842ba86991aadd7ba1fb2a5..aeeaa19a11c856b8310c435b301af4f79f8f3ade 100644 --- a/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt +++ b/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt @@ -9,7 +9,6 @@ import theodolite.strategies.searchstrategy.BinarySearch import theodolite.strategies.searchstrategy.RestrictionSearch import theodolite.strategies.searchstrategy.LinearSearch import theodolite.util.LoadDimension -import theodolite.util.Resource import theodolite.util.Results @QuarkusTest @@ -28,7 +27,7 @@ class RestrictionSearchTest { arrayOf(false, false, false, false, false, false, false) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..6).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..6).toList() val results = Results() val benchmark = TestBenchmark() val sloChecker: BenchmarkExecution.Slo = BenchmarkExecution.Slo() @@ -38,8 +37,8 @@ class RestrictionSearchTest { val strategy = RestrictionSearch(benchmarkExecutor, linearSearch, setOf(lowerBoundRestriction)) - val actual: ArrayList<Resource?> = ArrayList() - val expected: ArrayList<Resource?> = ArrayList(listOf(0, 2, 2, 3, 4, 6).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + val expected: ArrayList<Int?> = ArrayList(listOf(0, 2, 2, 3, 4, 6)) expected.add(null) for (load in mockLoads) { @@ -61,7 +60,7 @@ class RestrictionSearchTest { arrayOf(false, false, false, false, false, false, false) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..6).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..6).toList() val results = Results() val benchmark = TestBenchmark() val sloChecker: BenchmarkExecution.Slo = BenchmarkExecution.Slo() @@ -71,8 +70,8 @@ class RestrictionSearchTest { val lowerBoundRestriction = LowerBoundRestriction(results) val strategy = RestrictionSearch(benchmarkExecutorImpl, binarySearch, setOf(lowerBoundRestriction)) - val actual: ArrayList<Resource?> = ArrayList() - val expected: ArrayList<Resource?> = ArrayList(listOf(0, 2, 2, 3, 4, 6).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + val expected: ArrayList<Int?> = ArrayList(listOf(0, 2, 2, 3, 4, 6)) expected.add(null) for (load in mockLoads) { @@ -94,7 +93,7 @@ class RestrictionSearchTest { arrayOf(false, false, false, false, false, false, false, true) ) val mockLoads: List<LoadDimension> = (0..6).map { number -> LoadDimension(number, emptyList()) } - val mockResources: List<Resource> = (0..7).map { number -> Resource(number, emptyList()) } + val mockResources: List<Int> = (0..7).toList() val results = Results() val benchmark = TestBenchmark() val sloChecker: BenchmarkExecution.Slo = BenchmarkExecution.Slo() @@ -104,9 +103,9 @@ class RestrictionSearchTest { val strategy = RestrictionSearch(benchmarkExecutor, binarySearch, setOf(lowerBoundRestriction)) - val actual: ArrayList<Resource?> = ArrayList() - val expected: ArrayList<Resource?> = - ArrayList(listOf(0, 2, 2, 3, 4, 6, 7).map { x -> Resource(x, emptyList()) }) + val actual: ArrayList<Int?> = ArrayList() + val expected: ArrayList<Int?> = + ArrayList(listOf(0, 2, 2, 3, 4, 6, 7)) for (load in mockLoads) { actual.add(strategy.findSuitableResource(load, mockResources)) diff --git a/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt b/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt index b08c1a18a3013e1573e4892f01698b5e509f9609..16e3293ab17a4cf6c05ddb740c1cf0a1173752fe 100644 --- a/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt +++ b/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt @@ -4,7 +4,7 @@ import theodolite.benchmark.Benchmark import theodolite.benchmark.BenchmarkDeployment import theodolite.util.ConfigurationOverride import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources class TestBenchmark : Benchmark { @@ -15,11 +15,11 @@ class TestBenchmark : Benchmark { } override fun buildDeployment( - load: LoadDimension, - res: Resource, - configurationOverrides: List<ConfigurationOverride?>, - loadGenerationDelay: Long, - afterTeardownDelay: Long + load: LoadDimension, + res: Resources, + configurationOverrides: List<ConfigurationOverride?>, + loadGenerationDelay: Long, + afterTeardownDelay: Long ): BenchmarkDeployment { return TestBenchmarkDeployment() } diff --git a/theodolite/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt b/theodolite/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt index 2efddc48cb93a0870d1716c58a7018145c16e2ff..e7e943efbbbe75f58eab04f865b415a35bac16d0 100644 --- a/theodolite/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt +++ b/theodolite/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt @@ -4,7 +4,7 @@ import theodolite.benchmark.Benchmark import theodolite.benchmark.BenchmarkExecution import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results import java.time.Duration @@ -30,7 +30,7 @@ class TestBenchmarkExecutorImpl( executionName = "test-execution" ) { - override fun runExperiment(load: LoadDimension, res: Resource): Boolean { + override fun runExperiment(load: LoadDimension, res: Resources): Boolean { val result = this.mockResults[load.get()][res.get()] this.results.setResult(Pair(load, res), result) return result diff --git a/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt b/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt index b368647e314a4d803b444268c8218aefbee00ad4..0ee4eab2891599403017437b9e7aa3a66052b5f4 100644 --- a/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt +++ b/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import theodolite.util.LoadDimension -import theodolite.util.Resource +import theodolite.util.Resources import theodolite.util.Results internal class LowerBoundRestrictionTest { @@ -64,7 +64,7 @@ internal class LowerBoundRestrictionTest { val restriction = strategy.apply(load, resources) assertEquals(0, restriction.size) - assertEquals(emptyList<Resource>(), restriction) + assertEquals(emptyList<Resources>(), restriction) } @@ -79,7 +79,7 @@ internal class LowerBoundRestrictionTest { val minRequiredInstances = results.getMinRequiredInstances(LoadDimension(20000, emptyList())) assertNotNull(minRequiredInstances) - assertEquals(2, minRequiredInstances!!.get()) + assertEquals(2, minRequiredInstances!!) } @Test @@ -95,15 +95,15 @@ internal class LowerBoundRestrictionTest { val minRequiredInstances = results.getMinRequiredInstances(LoadDimension(20000, emptyList())) assertNotNull(minRequiredInstances) - assertEquals(2, minRequiredInstances!!.get()) + assertEquals(2, minRequiredInstances!!) } private fun buildLoadDimension(load: Int): LoadDimension { return LoadDimension(load, emptyList()) } - private fun buildResourcesDimension(resources: Int): Resource { - return Resource(resources, emptyList()) + private fun buildResourcesDimension(resources: Int): Int { + return resources } private fun Results.setResult(load: Int, resources: Int, successful: Boolean) { diff --git a/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt b/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt index 6b8aa1d567fd2c93c1301fe3f953273e0f5d5420..3960e52dd842f978114c841d60a816576f2e802d 100644 --- a/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt +++ b/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt @@ -69,7 +69,7 @@ internal class IOHandlerTest { fun testWriteToJSONFile() { temporaryFolder.create() val folder = temporaryFolder.newFolder(FOLDER_URL) - val testContent = Resource(0, emptyList()) + val testContent = Resources(0, emptyList()) IOHandler().writeToJSONFile( fileURL = "${folder.absolutePath}/test-file.json", diff --git a/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt b/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt index 9cfc2ae78e7a8846e3f0fa136699509145e5de22..0cdcf8631052fde8bcfd2c36a416632fea6510a6 100644 --- a/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt +++ b/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt @@ -43,7 +43,7 @@ internal class ResultsTest { this.setResult( Pair( LoadDimension(load, emptyList()), - Resource(resources, emptyList()) + Resources(resources, emptyList()) ), successful )