This is an automated email from the ASF dual-hosted git repository.
martinweiler pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie.git
The following commit(s) were added to refs/heads/main by this push:
new 7cf67a4497e add unit tests for KieFlywayQuarkusRuntimeConfig to verify
correct property key binding after @WithParentName removal (#7171)
7cf67a4497e is described below
commit 7cf67a4497e2b104696f1aaf7edf31852ce07272
Author: Soniya Abraham <[email protected]>
AuthorDate: Wed Oct 7 19:00:25 2026 +0530
add unit tests for KieFlywayQuarkusRuntimeConfig to verify correct property
key binding after @WithParentName removal (#7171)
---
kogito-quarkus/addons/flyway/runtime/pom.xml | 17 +++++
.../quarkus/KieFlywayQuarkusRuntimeConfigTest.java | 75 ++++++++++++++++++++++
2 files changed, 92 insertions(+)
diff --git a/kogito-quarkus/addons/flyway/runtime/pom.xml
b/kogito-quarkus/addons/flyway/runtime/pom.xml
index ceac5d73012..711e208bf2e 100644
--- a/kogito-quarkus/addons/flyway/runtime/pom.xml
+++ b/kogito-quarkus/addons/flyway/runtime/pom.xml
@@ -57,6 +57,23 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-flyway</artifactId>
</dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/kogito-quarkus/addons/flyway/runtime/src/test/java/org/kie/flyway/quarkus/KieFlywayQuarkusRuntimeConfigTest.java
b/kogito-quarkus/addons/flyway/runtime/src/test/java/org/kie/flyway/quarkus/KieFlywayQuarkusRuntimeConfigTest.java
new file mode 100644
index 00000000000..9507778207c
--- /dev/null
+++
b/kogito-quarkus/addons/flyway/runtime/src/test/java/org/kie/flyway/quarkus/KieFlywayQuarkusRuntimeConfigTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.flyway.quarkus;
+
+import java.util.Map;
+
+import org.junit.jupiter.api.Test;
+
+import io.smallrye.config.PropertiesConfigSource;
+import io.smallrye.config.SmallRyeConfig;
+import io.smallrye.config.SmallRyeConfigBuilder;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class KieFlywayQuarkusRuntimeConfigTest {
+
+ private static SmallRyeConfig buildConfig(String... keyValuePairs) {
+ Map<String, String> props = new java.util.LinkedHashMap<>();
+ for (int i = 0; i < keyValuePairs.length; i += 2) {
+ props.put(keyValuePairs[i], keyValuePairs[i + 1]);
+ }
+ return new SmallRyeConfigBuilder()
+ .withMapping(KieFlywayQuarkusRuntimeConfig.class, "kie.flyway")
+ .withSources(new PropertiesConfigSource(props, "test"))
+ .build();
+ }
+
+ @Test
+ void globalEnabledDefaultsToFalse() {
+ KieFlywayQuarkusRuntimeConfig runtimeConfig = buildConfig()
+ .getConfigMapping(KieFlywayQuarkusRuntimeConfig.class);
+
+ assertThat(runtimeConfig.enabled()).isFalse();
+ }
+
+ @Test
+ void globalEnabledCanBeSetToTrue() {
+ KieFlywayQuarkusRuntimeConfig runtimeConfig =
buildConfig("kie.flyway.enabled", "true")
+ .getConfigMapping(KieFlywayQuarkusRuntimeConfig.class);
+
+ assertThat(runtimeConfig.enabled()).isTrue();
+ }
+
+ @Test
+ void moduleEnabledTrue() {
+ KieFlywayQuarkusRuntimeConfig runtimeConfig =
buildConfig("kie.flyway.modules.\"test-module\".enabled", "true")
+ .getConfigMapping(KieFlywayQuarkusRuntimeConfig.class);
+
+
assertThat(runtimeConfig.modules().get("test-module").enabled()).isTrue();
+ }
+
+ @Test
+ void moduleEnabledFalse() {
+ KieFlywayQuarkusRuntimeConfig runtimeConfig =
buildConfig("kie.flyway.modules.\"test-module\".enabled", "false")
+ .getConfigMapping(KieFlywayQuarkusRuntimeConfig.class);
+
+
assertThat(runtimeConfig.modules().get("test-module").enabled()).isFalse();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]