davsclaus commented on code in PR #27252:
URL: https://github.com/apache/camel/pull/27252#discussion_r4163372576


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreview.java:
##########
@@ -36,6 +37,8 @@ class RouteTreePreview {
             "throttle", "threads", "onException", "onCompletion",
             "intercept", "interceptFrom", "interceptSendToEndpoint");
 
+    private static final Pattern SELF_NAMED = 
Pattern.compile("[A-Za-z]+[\\[(]");

Review Comment:
   Kept as is, agreeing with the YAGNI: the codes of this tree are endpoint 
URIs (with a colon, `direct:foo`) or names that label themselves 
(`otherwise[..]`, `case[..]`), so the broader pattern matches what the tree 
model has without a list of names to keep in sync.
   
   _Claude Code on behalf of davsclaus_



##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/RouteTreePreviewTest.java:
##########
@@ -154,6 +154,30 @@ private LayoutRoute buildContentBasedRouterLayout() {
         return layout;
     }
 
+    @Test
+    void theOtherwiseOfASwitchIsLabelledAsItself() {
+        LayoutRoute layout = new LayoutRoute();
+        TreeNode root = node("from", "kafka:orders");
+        TreeNode sw = node("switch", null);
+        TreeNode case1 = node("case", "case[direct:gold]");
+        // the otherwise of a Switch is a node of type to whose code names it
+        TreeNode otherwise = node("to", "otherwise[direct:normal]");
+        TreeNode out = node("to", "kafka:out");
+        addChild(root, sw);
+        addChild(sw, case1);
+        addChild(sw, otherwise);
+        addChild(root, out);
+        for (TreeNode n : List.of(root, sw, case1, otherwise, out)) {
+            addLayoutNode(layout, n);
+        }
+
+        String tree = lineToPlainText(RouteTreePreview.buildTree(layout, 20, 
60, null));
+        assertTrue(tree.contains("otherwise[direct:normal]"), tree);
+        assertTrue(!tree.contains("to: otherwise"), tree);

Review Comment:
   Done in 736b73aec9dd: `assertFalse`.
   
   _Claude Code on behalf of davsclaus_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to