diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt index 8ce10af336c105977eeac2526b3487017cba369c..9e5b4456f24ac562259900a04ef7f0a6a3d32e21 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkYamlParser.kt @@ -1,15 +1,17 @@ package theodolite.benchmark import org.yaml.snakeyaml.Yaml +import org.yaml.snakeyaml.constructor.BaseConstructor +import org.yaml.snakeyaml.constructor.Constructor import java.io.File import java.io.FileInputStream import java.io.InputStream class BenchmarkYamlParser<T>: Parser<T> { - override fun parse(path: String): T { + override fun parse(path: String): KubernetesBenchmark? { val input: InputStream = FileInputStream(File(path)) - val parser = Yaml() - return parser.load<T>(input) + val parser = Yaml(Constructor(KubernetesBenchmark::class.java)) + return parser.loadAs(input, KubernetesBenchmark::class.java) } } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/Parser.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/Parser.kt index 1af3006a390def5d06d6cceb4c08deffa250992a..df6655b7e6c99d75541fc9d8559b432259dfd9b0 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/Parser.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/Parser.kt @@ -1,5 +1,5 @@ package theodolite.benchmark interface Parser<T> { - fun parse(path: String): T //Yaml + fun parse(path: String): KubernetesBenchmark? //Yaml } \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt index 66c3de474966d747ae769ad5bada9556d4361bc7..04d0bd306255ce0b98c8471844006cddd4158c93 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TheodoliteYamlExecutor.kt @@ -2,8 +2,8 @@ package theodolite.benchmark class TheodoliteYamlExecutor { fun run() { - val parser = BenchmarkYamlParser<KubernetesBenchmark>() + val parser = theodolite.benchmark.BenchmarkYamlParser<KubernetesBenchmark>() val benchmark= parser.parse("./../../../resources/main/yaml/test.yaml") - System.out.println(benchmark.name) + System.out.println(benchmark?.name) } } \ No newline at end of file