This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new be06caebbd0f CAMEL-23912: Fix flaky ThemeTest by fully resetting
engine in resetForTesting
be06caebbd0f is described below
commit be06caebbd0fcceedbc0fb1a6895d01c9ed2381b
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jul 6 10:55:44 2026 +0200
CAMEL-23912: Fix flaky ThemeTest by fully resetting engine in
resetForTesting
CAMEL-23912: Parse Spring Boot parent version and fix flaky ThemeTest
Parse <parent> element in pom.xml to detect Spring Boot version from
spring-boot-starter-parent, enabling transitive dependency resolution
for Spring Boot dependencies. Also fix Theme to load only the active
stylesheet per engine instance, eliminating cross-theme contamination
that caused intermittent ThemeTest failures.
CAMEL-23912: Add VIA sort column and fix flaky ThemeTest with @Isolated
Add sort support on the VIA column so transitive dependencies can be
grouped by their parent. Fix ThemeTest flakiness caused by parallel
test execution — concurrent render tests resetting Theme static state
between setMode and assertions.
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../core/commands/tui/MavenDependenciesTab.java | 35 +++++++++++++++++++---
.../camel/dsl/jbang/core/commands/tui/Theme.java | 23 ++++----------
.../dsl/jbang/core/commands/tui/ThemeTest.java | 2 ++
3 files changed, 39 insertions(+), 21 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
index b1fb11836596..0ebf416a42b3 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/MavenDependenciesTab.java
@@ -90,7 +90,7 @@ class MavenDependenciesTab extends AbstractTableTab {
private List<DepEntry> transitiveEntries = Collections.emptyList();
MavenDependenciesTab(MonitorContext ctx) {
- super(ctx, "artifact", "version");
+ super(ctx, "artifact", "version", "via");
}
@Override
@@ -287,7 +287,7 @@ class MavenDependenciesTab extends AbstractTableTab {
.header(Row.from(
Cell.from(Span.styled(" " +
sortLabel("GROUP:ARTIFACT", "artifact"), sortStyle("artifact"))),
Cell.from(Span.styled(sortLabel("VERSION",
"version"), sortStyle("version"))),
- Cell.from(Span.styled("VIA", Style.EMPTY.bold()))))
+ Cell.from(Span.styled(sortLabel("VIA", "via"),
sortStyle("via")))))
.widths(
Constraint.fill(),
Constraint.length(20),
@@ -342,6 +342,11 @@ class MavenDependenciesTab extends AbstractTableTab {
String vb = b.version() != null ? b.version() : "";
yield va.compareToIgnoreCase(vb);
}
+ case "via" -> {
+ String pa = a.parent() != null ? shortArtifact(a.parent()) :
"";
+ String pb = b.parent() != null ? shortArtifact(b.parent()) :
"";
+ yield pa.compareToIgnoreCase(pb);
+ }
default -> { // "artifact"
yield a.display().compareToIgnoreCase(b.display());
}
@@ -503,12 +508,29 @@ class MavenDependenciesTab extends AbstractTableTab {
}
}
- NodeList nl = dom.getElementsByTagName("dependency");
- List<DepEntry> deps = new ArrayList<>();
String camelVersion = null;
String springBootVersion = null;
String quarkusVersion = null;
+ NodeList parentList = dom.getElementsByTagName("parent");
+ if (parentList.getLength() > 0) {
+ Element parentEl = (Element) parentList.item(0);
+ String pg = textContent(parentEl, "groupId");
+ String pa = textContent(parentEl, "artifactId");
+ String pv = textContent(parentEl, "version");
+ pv = resolveProperty(pv, properties);
+ if ("org.springframework.boot".equals(pg)
+ && ("spring-boot-starter-parent".equals(pa) ||
"spring-boot-dependencies".equals(pa))) {
+ springBootVersion = pv;
+ }
+ if ("org.apache.camel.springboot".equals(pg) &&
"camel-spring-boot-bom".equals(pa)) {
+ camelVersion = pv;
+ }
+ }
+
+ NodeList nl = dom.getElementsByTagName("dependency");
+ List<DepEntry> deps = new ArrayList<>();
+
for (int i = 0; i < nl.getLength(); i++) {
Element node = (Element) nl.item(i);
@@ -626,6 +648,11 @@ class MavenDependenciesTab extends AbstractTableTab {
}
}
+ private static String textContent(Element parent, String tag) {
+ NodeList nl = parent.getElementsByTagName(tag);
+ return nl.getLength() > 0 ? nl.item(0).getTextContent().trim() : null;
+ }
+
private static String resolveProperty(String value, Map<String, String>
properties) {
if (value != null && value.startsWith("${") && value.endsWith("}")) {
String key = value.substring(2, value.length() - 1);
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
index 70862c6e6dd4..1d549acaa65b 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/Theme.java
@@ -200,17 +200,12 @@ final class Theme {
/** Activate a specific mode without persisting. Unknown values fall back
to dark. */
static synchronized void setMode(String newMode) {
- engine();
String resolved = DARK.equals(newMode) || LIGHT.equals(newMode) ?
newMode : DARK;
- if (engine != null) {
- try {
- engine.setActiveStylesheet(resolved);
- } catch (RuntimeException ex) {
- logFallbackOnce(ex);
- }
- }
mode = resolved;
CACHE.clear();
+ engine = null;
+ initialized = false;
+ engine();
}
/** Test hook: enable in-memory-only mode so tests never touch user config
files. */
@@ -218,13 +213,8 @@ final class Theme {
testMode = true;
fallbackLogged = false;
CACHE.clear();
- if (engine != null) {
- try {
- engine.setActiveStylesheet(DARK);
- } catch (RuntimeException ex) {
- // ignore
- }
- }
+ engine = null;
+ initialized = false;
mode = DARK;
}
@@ -253,8 +243,7 @@ final class Theme {
}
try {
StyleEngine e = StyleEngine.create();
- e.loadStylesheet(DARK, "tui/themes/dark.tcss");
- e.loadStylesheet(LIGHT, "tui/themes/light.tcss");
+ e.loadStylesheet(mode, "tui/themes/" + mode + ".tcss");
e.setActiveStylesheet(mode);
engine = e;
} catch (Exception ex) {
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ThemeTest.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ThemeTest.java
index 35e92fec9122..2416608df439 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ThemeTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/ThemeTest.java
@@ -21,11 +21,13 @@ import dev.tamboui.style.Style;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Isolated;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+@Isolated
class ThemeTest {
@BeforeEach