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 b9969d98cdfe chore: camel-jbang - the strips of What happened are in
the order of the routes, a called route after its caller (#29511)
b9969d98cdfe is described below
commit b9969d98cdfe06bf69b88076059ed870b132279d
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 9 22:52:49 2026 +0100
chore: camel-jbang - the strips of What happened are in the order of the
routes, a called route after its caller (#29511)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../dsl/jbang/core/commands/tui/AboutView.java | 23 ++++++++++--
.../dsl/jbang/core/commands/tui/AboutViewTest.java | 41 ++++++++++++++++++++++
2 files changed, 62 insertions(+), 2 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutView.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutView.java
index 09c7ccf48fa3..9d83e720e76d 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutView.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutView.java
@@ -448,8 +448,27 @@ final class AboutView {
return last;
}
- private static List<String> routeOrder(IntegrationInfo info) {
- return info.routes.stream().map(r -> r.routeId).filter(id -> id !=
null).toList();
+ /**
+ * The routes in the order of the Routes panel, where a route comes after
the one that calls it, then those it does
+ * not have; the integration lists its routes by id, which puts a called
route before its caller.
+ */
+ private List<String> routeOrder(IntegrationInfo info) {
+ List<String> running = info.routes.stream().map(r ->
r.routeId).filter(id -> id != null).toList();
+ List<String> order = new ArrayList<>();
+ About.Model m = model;
+ if (m != null) {
+ for (About.RouteLine r : m.routes()) {
+ if (running.contains(r.routeId()) &&
!order.contains(r.routeId())) {
+ order.add(r.routeId());
+ }
+ }
+ }
+ for (String id : running) {
+ if (!order.contains(id)) {
+ order.add(id);
+ }
+ }
+ return order;
}
/**
diff --git
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutViewTest.java
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutViewTest.java
index 1135cdbb9731..245204ed0ee2 100644
---
a/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutViewTest.java
+++
b/dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AboutViewTest.java
@@ -335,6 +335,47 @@ class AboutViewTest {
return List.of(TuiTestHelper.borderColor(buffer, " In "),
TuiTestHelper.borderColor(buffer, " Routes "));
}
+ @Test
+ void theStripsAreInTheOrderOfTheRoutesACalledRouteAfterItsCaller() throws
Exception {
+ Files.writeString(dir.resolve("orders.camel.yaml"), """
+ - route:
+ id: incoming
+ from:
+ uri: timer:orders
+ steps:
+ - wireTap: direct:audit
+ - route:
+ id: audit
+ from:
+ uri: direct:audit
+ steps:
+ - log: audited
+ """);
+ IntegrationInfo info = new IntegrationInfo();
+ info.pid = "1234";
+ info.name = "orders";
+ info.directory = dir.toString();
+ // the integration lists its routes by id: the called one first
+ for (String id : List.of("audit", "incoming")) {
+ RouteInfo r = new RouteInfo();
+ r.routeId = id;
+ r.state = "Started";
+ info.routes.add(r);
+ }
+ MonitorContext ctx = new MonitorContext(new
AtomicReference<>(List.of(info)), new AtomicReference<>(List.of()));
+ ctx.timeline.merge("1234", TimelineTabRenderTest.outage(T0 / 1000 +
59, 60, 0).json(), true);
+ AboutView about = new AboutView(ctx);
+
+ await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> {
+ List<String> strips = render(about, info).lines()
+ .dropWhile(l -> !l.contains("What happened"))
+ .filter(l -> l.contains(" incoming ") || l.contains("
audit ")).toList();
+ assertThat(strips).hasSize(2);
+ assertThat(strips.get(0)).contains("incoming");
+ assertThat(strips.get(1)).contains("audit");
+ });
+ }
+
@Test
void aboutAnIntegrationWithWhatHasHappened() throws Exception {
Files.writeString(dir.resolve("shop.camel.yaml"), """