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 30b22861c9cf CAMEL-26929: camel-jbang - the JSON of the listings: a 
pid is a number, the rows say their integration, and get about is a list 
(#29937)
30b22861c9cf is described below

commit 30b22861c9cf9652bac65f71c5f80abbeea1edab
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 15 09:59:23 2026 +0100

    CAMEL-26929: camel-jbang - the JSON of the listings: a pid is a number, the 
rows say their integration, and get about is a list (#29937)
    
    Item 5 of [CAMEL-26929](https://issues.apache.org/jira/browse/CAMEL-26929) 
(JSON and output), the parts about the shape of the JSON. The ANSI codes in 
piped output are in #29924 (no ANSI codes when stdout is not a terminal).
    
    ## Problems and changes
    
    - **`pid` was text** in the JSON of `camel cmd trace` (status), `camel cmd 
browse` and `camel cmd logger`, and a number elsewhere. It is a number, with 
`JsonValues.pid` as in the other listings (now public, for the action 
commands). The JSON of these three commands is new in 4.24, so no released 
output changes. `camel cmd stub` had a number already.
    - **The rows of `camel get error --json`, `camel get history --json` and 
`camel top source --json` did not say which integration they are of.** They 
start with `pid` and `name` now, as the other listings; the rest of the row is 
as before.
    - **`camel get about --json` was an object for one integration and a list 
for more.** It is a list, also for one. Its JSON is new in 4.24.
    - **`--sort=age` of `camel get route` and `camel get route-group` sorted 
the youngest first**, the opposite of the listings of the integrations: those 
sort by when the integration started, and the uptime of a route is how long it 
runs. The routes now sort the oldest first too. The Javadoc of 
`RowSort.integration` said "how long the integration runs" while its callers 
pass the start time, and now says so.
    
    The JSON section of the exit codes page (`camel-jbang-exit-codes.adoc`) 
says that a list is a list also for one integration, and that a row of a 
listing has `pid` (a number) and `name`.
    
    Not in this PR: `uptime` stays a duration in the JSON of `get route` and 
`get route-group` (it is so since 4.23, and the TUI reads it), and "`name` is 
the file name in the action commands and the short name in the listings" needs 
its own look; `cmd send` and the trace dump have no `--json` yet.
    
    ## Tests
    
    - `ListErrorTest.testJsonOutput`, 
`CamelHistoryActionTest.testJsonOutputIsTheRecordedHistory`, 
`CamelSourceTopTest.jsonHasTheNumbersAndTheCode`: the rows have the `pid` and 
the `name`.
    - `CamelTraceActionTest.statusAsJson`: the `pid` is a number.
    - `ListAboutTest.asJson`: a list of one.
    - `CamelRouteStatusTest.sortByAgeIsTheOldestFirst` (new): a route that runs 
for 2 hours comes before one that runs for 5 seconds.
    - All six fail without the change.
    - camel-jbang-run: 303 pass. camel-jbang-core: 3003 + 259 pass (5 cases of 
`ExportTest` failed once and passed on the rerun, as on other branches).
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../modules/ROOT/pages/camel-jbang-exit-codes.adoc   |  2 ++
 .../core/commands/action/CamelBrowseAction.java      |  3 ++-
 .../core/commands/action/CamelHistoryAction.java     | 20 ++++++++++++++++++--
 .../jbang/core/commands/action/CamelSourceTop.java   |  3 +++
 .../jbang/core/commands/action/CamelTraceAction.java |  3 ++-
 .../dsl/jbang/core/commands/action/LoggerAction.java |  3 ++-
 .../core/commands/process/CamelRouteGroupStatus.java |  3 ++-
 .../core/commands/process/CamelRouteStatus.java      |  4 +++-
 .../dsl/jbang/core/commands/process/JsonValues.java  |  4 ++--
 .../dsl/jbang/core/commands/process/ListAbout.java   |  3 ++-
 .../dsl/jbang/core/commands/process/ListError.java   |  9 ++++++++-
 .../apache/camel/dsl/jbang/core/common/RowSort.java  |  2 +-
 .../core/commands/action/CamelHistoryActionTest.java |  5 +++++
 .../core/commands/action/CamelSourceTopTest.java     |  3 +++
 .../core/commands/action/CamelTraceActionTest.java   |  3 +++
 .../core/commands/process/CamelRouteStatusTest.java  | 15 +++++++++++++++
 .../jbang/core/commands/process/ListAboutTest.java   |  6 +++++-
 .../jbang/core/commands/process/ListErrorTest.java   |  3 +++
 18 files changed, 81 insertions(+), 13 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-exit-codes.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-jbang-exit-codes.adoc
index 05b3306131cc..bab9b984768a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang-exit-codes.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-exit-codes.adoc
@@ -119,6 +119,8 @@ With it, stdout is exactly one JSON document, also when the 
command fails:
 
 * A list is a JSON array, and `[]` when there is nothing to list, such as 
`camel ps --json` when no integration
   is running.
+* A list is a list also for one integration, such as `camel get about --json`.
+* A row of a listing of running integrations says which integration it is of: 
`pid`, a number, and `name`.
 * An error is a JSON object, with the exit code of the command in `code`:
 +
 [source,json]
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelBrowseAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelBrowseAction.java
index 14d656a95501..3c653b06e48d 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelBrowseAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelBrowseAction.java
@@ -31,6 +31,7 @@ import org.aesh.command.option.Argument;
 import org.aesh.command.option.Mixin;
 import org.aesh.command.option.Option;
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.process.JsonValues;
 import org.apache.camel.dsl.jbang.core.common.CliException;
 import org.apache.camel.dsl.jbang.core.common.CompletionCandidates;
 import org.apache.camel.dsl.jbang.core.common.CopyableRow;
@@ -189,7 +190,7 @@ public class CamelBrowseAction extends ActionBaseCommand {
         if (jsonOutput) {
             JsonOutput.printList(printer(), rows.stream().map(r -> {
                 JsonObject jo2 = new JsonObject();
-                jo2.put("pid", r.pid);
+                jo2.put("pid", JsonValues.pid(r.pid));
                 jo2.put("name", r.name);
                 jo2.put("age", r.ago);
                 jo2.put("endpointUri", r.uri);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
index b865d644b289..dd95480b5854 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryAction.java
@@ -171,6 +171,20 @@ public class CamelHistoryAction extends ActionWatchCommand 
{
         return super.doCall();
     }
 
+    /**
+     * The entry with the pid and the name of its integration first, as the 
other listings have them (CAMEL-26929).
+     */
+    private static Object withIntegration(Object entry, CamelProcess process) {
+        if (entry instanceof JsonObject jo) {
+            JsonObject answer = new JsonObject();
+            answer.put("pid", process.pid());
+            answer.put("name", process.name());
+            answer.putAll(jo);
+            return answer;
+        }
+        return entry;
+    }
+
     @Override
     public Integer doWatchCall() throws Exception {
         if (name == null) {
@@ -190,9 +204,11 @@ public class CamelHistoryAction extends ActionWatchCommand 
{
                                 entry = Jsoner.deserialize(line, (JsonArray) 
null);
                             }
                             if (entry instanceof JsonArray array) {
-                                entries.addAll(array);
+                                for (Object e : array) {
+                                    entries.add(withIntegration(e, process));
+                                }
                             } else if (entry != null) {
-                                entries.add(entry);
+                                entries.add(withIntegration(entry, process));
                             }
                         }
                     }
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTop.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTop.java
index e2c1266e47ae..db39d988c2fd 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTop.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTop.java
@@ -130,6 +130,9 @@ public class CamelSourceTop extends ActionWatchCommand {
         if (jsonOutput) {
             JsonOutput.printList(printer(), rows.stream().map(r -> {
                 JsonObject row = new JsonObject();
+                // which integration, as the other listings say (CAMEL-26929)
+                row.put("pid", process.pid());
+                row.put("name", process.name());
                 row.put("id", r.id);
                 row.put("routeId", r.routeId);
                 row.put("location", r.location);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java
index 712bab723f8d..dba7946f1f0b 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceAction.java
@@ -48,6 +48,7 @@ import org.aesh.command.option.OptionList;
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
 import org.apache.camel.dsl.jbang.core.commands.CommandHelper;
 import org.apache.camel.dsl.jbang.core.commands.DurationMixin;
+import org.apache.camel.dsl.jbang.core.commands.process.JsonValues;
 import org.apache.camel.dsl.jbang.core.common.CliException;
 import org.apache.camel.dsl.jbang.core.common.CompletionCandidates;
 import org.apache.camel.dsl.jbang.core.common.JsonOutput;
@@ -268,7 +269,7 @@ public class CamelTraceAction extends ActionBaseCommand {
         if (jsonOutput) {
             JsonOutput.printList(printer(), rows.stream().map(r -> {
                 JsonObject jo = new JsonObject();
-                jo.put("pid", r.pid);
+                jo.put("pid", JsonValues.pid(r.pid));
                 jo.put("name", r.name);
                 jo.put("age", r.age);
                 jo.put("status", getTraceStatus(r));
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/LoggerAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/LoggerAction.java
index 388140fa8185..e5df2654ded4 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/LoggerAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/LoggerAction.java
@@ -30,6 +30,7 @@ import org.aesh.command.option.Argument;
 import org.aesh.command.option.Mixin;
 import org.aesh.command.option.Option;
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.process.JsonValues;
 import org.apache.camel.dsl.jbang.core.common.CliException;
 import org.apache.camel.dsl.jbang.core.common.CopyableRow;
 import org.apache.camel.dsl.jbang.core.common.JsonOutput;
@@ -130,7 +131,7 @@ public class LoggerAction extends ActionBaseCommand {
         if (jsonOutput) {
             JsonOutput.printList(printer(), rows.stream().map(r -> {
                 JsonObject jo = new JsonObject();
-                jo.put("pid", r.pid);
+                jo.put("pid", JsonValues.pid(r.pid));
                 jo.put("name", r.name);
                 jo.put("age", r.ago);
                 jo.put("logger", r.logger);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteGroupStatus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteGroupStatus.java
index da4209278230..78f7f43e54eb 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteGroupStatus.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteGroupStatus.java
@@ -54,7 +54,8 @@ public class CamelRouteGroupStatus extends 
ProcessWatchCommand {
             .number("pid", r -> r.pid)
             .text("name", r -> r.name)
             .text("group", r -> r.group)
-            .numeric("age", r -> r.uptime);
+            // the uptime of a route group is how long it runs: the oldest 
first, as the other listings (CAMEL-26929)
+            .numeric("age", r -> -r.uptime);
 
     public static class PidNameAgeGroupCompletionCandidates extends 
CompletionCandidates {
 
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
index 4c37d49db931..c5fbe2771ecd 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
@@ -54,7 +54,9 @@ import org.apache.camel.util.json.Jsoner;
                            "  camel get route --watch" })
 public class CamelRouteStatus extends ProcessWatchCommand {
 
-    private static final RowSort<Row> ORDER = RowSort.<Row> integration(r -> 
r.pid, r -> r.name, r -> r.uptime);
+    // the uptime of a route is how long it runs: the oldest first, as the 
listings of the integrations sort by when
+    // they started (CAMEL-26929)
+    private static final RowSort<Row> ORDER = RowSort.<Row> integration(r -> 
r.pid, r -> r.name, r -> -r.uptime);
 
     @Argument(description = "Name or pid of running Camel integration")
     String name = "*";
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/JsonValues.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/JsonValues.java
index cb484278889b..407063ed853d 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/JsonValues.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/JsonValues.java
@@ -20,7 +20,7 @@ package org.apache.camel.dsl.jbang.core.commands.process;
  * The values of a listing in JSON mode: a number is a JSON number, also when 
the listing keeps it as text for its
  * table, and a value that is not there is <tt>null</tt> (the table shows it 
as {@code -} or blank).
  */
-final class JsonValues {
+public final class JsonValues {
 
     private JsonValues() {
     }
@@ -28,7 +28,7 @@ final class JsonValues {
     /**
      * A pid, which the listings keep as text.
      */
-    static Long pid(String pid) {
+    public static Long pid(String pid) {
         return number(pid);
     }
 
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListAbout.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListAbout.java
index 53b4fa124209..9192cd99e0ea 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListAbout.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListAbout.java
@@ -92,7 +92,8 @@ public class ListAbout extends ProcessWatchCommand {
             text.append(AboutReport.text(title, about));
         });
         if (jsonOutput) {
-            printer().println(all.size() == 1 ? ((JsonObject) 
all.get(0)).toJson() : all.toJson());
+            // a list, also for one integration, as the other listings 
(CAMEL-26929)
+            printer().println(all.toJson());
         } else if (!text.isEmpty()) {
             printer().print(text.toString());
         }
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListError.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListError.java
index 529590b3a4d1..34362e4f509a 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListError.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListError.java
@@ -238,7 +238,14 @@ public class ListError extends ProcessWatchCommand {
 
             if (jsonOutput) {
                 // dump the raw JSON from the error entries
-                printer().println(Jsoner.serialize(display.stream().map(r -> 
r.rawJson).collect(Collectors.toList())));
+                printer().println(Jsoner.serialize(display.stream().map(r -> {
+                    // which integration the error is of, as in the table 
(CAMEL-26929)
+                    JsonObject jo = new JsonObject();
+                    jo.put("pid", JsonValues.pid(r.pid));
+                    jo.put("name", r.name);
+                    jo.putAll(r.rawJson);
+                    return jo;
+                }).collect(Collectors.toList())));
             } else {
                 printer().println(AsciiTable.getTable(AsciiTable.NO_BORDERS, 
display, Arrays.asList(
                         new 
Column().header("PID").headerAlign(HorizontalAlign.CENTER).with(r -> r.pid),
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RowSort.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RowSort.java
index c60655cc0099..a63fe1b9dd36 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RowSort.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RowSort.java
@@ -38,7 +38,7 @@ public final class RowSort<R> {
      *
      * @param pid    the pid of the row, as text
      * @param name   the name of the integration
-     * @param uptime how long the integration runs, in millis
+     * @param uptime when the integration started, in epoch millis, so {@code 
age} sorts the oldest first
      */
     public static <R> RowSort<R> integration(Function<R, String> pid, 
Function<R, String> name, ToLongFunction<R> uptime) {
         return new RowSort<R>().number("pid", pid).text("name", 
name).by("age", Comparator.comparingLong(uptime));
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryActionTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryActionTest.java
index 79392ffdd2e9..12fe1be3fd31 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryActionTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelHistoryActionTest.java
@@ -30,6 +30,7 @@ import 
org.apache.camel.dsl.jbang.core.common.CommandLineHelper;
 import org.apache.camel.dsl.jbang.core.common.CommandLineTestHelper;
 import org.apache.camel.util.json.JsonArray;
 import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.MockedStatic;
@@ -68,6 +69,10 @@ class CamelHistoryActionTest extends 
ActionCommandTestSupport {
 
         assertThat(printer.getOutput()).contains("\"traces\"", "ABCDEFGH-0001")
                 .doesNotContain("Message History of last completed");
+        // which integration, as the other listings say (CAMEL-26929)
+        JsonObject entry = Jsoner.deserialize(printer.getOutput(), (JsonArray) 
null).getMap(0);
+        assertThat(entry.getLong("pid")).isEqualTo(TEST_PID);
+        assertThat(entry.getString("name")).isEqualTo("myApp");
     }
 
     @Test
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTopTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTopTest.java
index f9a7bd6b41a0..2b663298bf76 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTopTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSourceTopTest.java
@@ -103,6 +103,9 @@ class CamelSourceTopTest extends ActionCommandTestSupport {
         JsonArray rows = Jsoner.deserialize(printer.getOutput(), (JsonArray) 
null);
         assertThat(rows).hasSize(2);
         JsonObject to = rows.getMap(0);
+        // which integration, as the other listings say (CAMEL-26929)
+        assertThat(to.getLong("pid")).isEqualTo(TEST_PID);
+        assertThat(to.getString("name")).isEqualTo("myApp");
         assertThat(to.getString("id")).isEqualTo("to1");
         assertThat(to.getString("routeId")).isEqualTo("orders");
         assertThat(to.getString("location")).isEqualTo("file:orders.yaml:14");
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceActionTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceActionTest.java
index 75eae0167617..208fc12d8ccb 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceActionTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelTraceActionTest.java
@@ -52,6 +52,9 @@ class CamelTraceActionTest extends ActionCommandTestSupport {
 
         JsonArray rows = Jsoner.deserialize(printer.getStdout(), (JsonArray) 
null);
         JsonObject row = rows.getMap(0);
+        // a number, as in the other listings: it was text (CAMEL-26929)
+        assertThat(row.get("pid")).isInstanceOf(Number.class);
+        assertThat(row.getLong("pid")).isEqualTo(TEST_PID);
         assertThat(row.getString("name")).isEqualTo("orders");
         assertThat(row.getString("status")).isEqualTo("Started");
         assertThat(row.getLong("total")).isEqualTo(7L);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatusTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatusTest.java
index 1448b8a505d5..9583a5bdfe09 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatusTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatusTest.java
@@ -338,6 +338,21 @@ class CamelRouteStatusTest extends 
ProcessCommandTestSupport {
         assertThat(output.indexOf("zeta")).isLessThan(output.indexOf("alpha"));
     }
 
+    @Test
+    void sortByAgeIsTheOldestFirst() throws Exception {
+        // the uptime of a route is how long it runs, and age sorted the 
youngest first, the opposite of the listings
+        // of the integrations (CAMEL-26929)
+        JsonObject young = route("route-newest", "timer:y", "Started", 
stats(0, 0, 0, -1));
+        young.put("uptime", "5s");
+        JsonObject old = route("route-oldest", "timer:o", "Started", stats(0, 
0, 0, -1));
+        old.put("uptime", "2h");
+        writeStatusFile(TEST_PID, integration("myApp", young, old));
+
+        assertThat(call(command("--sort=age"))).isZero();
+        String output = printer.getOutput();
+        
assertThat(output.indexOf("route-oldest")).isLessThan(output.indexOf("route-newest"));
+    }
+
     @Test
     void testLimitReducesRows() throws Exception {
         JsonObject[] routes = new JsonObject[5];
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListAboutTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListAboutTest.java
index 2148ddece69a..4da7dfd5bc41 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListAboutTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListAboutTest.java
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.stream.Stream;
 
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.util.json.JsonArray;
 import org.apache.camel.util.json.JsonObject;
 import org.apache.camel.util.json.Jsoner;
 import org.junit.jupiter.api.Test;
@@ -51,7 +52,10 @@ class ListAboutTest extends ProcessCommandTestSupport {
 
     @Test
     void asJson() throws Exception {
-        JsonObject about = (JsonObject) Jsoner.deserialize(run(command(null), 
true));
+        // a list, also for one integration, as the other listings 
(CAMEL-26929)
+        JsonArray all = (JsonArray) Jsoner.deserialize(run(command(null), 
true));
+        assertThat(all).hasSize(1);
+        JsonObject about = (JsonObject) all.get(0);
         assertThat(about.getString("name")).isEqualTo("myApp");
         assertThat(about.getString("purpose")).isEqualTo("Every order is 
checked against the stock.");
         assertThat((List<?>) about.get("routes")).hasSize(2);
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListErrorTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListErrorTest.java
index c7be4762e21a..84e17a255626 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListErrorTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/process/ListErrorTest.java
@@ -79,6 +79,9 @@ class ListErrorTest extends ProcessCommandTestSupport {
         assertThat(errors).hasSize(1);
         JsonObject error = errors.getMap(0);
         assertThat(error.getString("routeId")).isEqualTo("myRoute");
+        // which integration, as in the table (CAMEL-26929)
+        assertThat(error.getLong("pid")).isEqualTo(TEST_PID);
+        assertThat(error.getString("name")).isEqualTo("myApp");
     }
 
     @Test

Reply via email to