You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/01/30 16:13:39 UTC

(camel) branch main updated: CAMEL-20367: Reflect syntax changes in camel cmd command + cover more use cases (#16990)

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 f6f4809d6ae CAMEL-20367: Reflect syntax changes in camel cmd command + cover more use cases (#16990)
f6f4809d6ae is described below

commit f6f4809d6ae988006ce5bb30ccbdc676916f535c
Author: Jakub Vrubel <52...@users.noreply.github.com>
AuthorDate: Thu Jan 30 17:13:33 2025 +0100

    CAMEL-20367: Reflect syntax changes in camel cmd command + cover more use cases (#16990)
---
 .../camel/dsl/jbang/it/CmdStartStopITCase.java     | 61 ++++++++++++++++++++--
 1 file changed, 58 insertions(+), 3 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CmdStartStopITCase.java b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CmdStartStopITCase.java
index b5ae16a6a9c..f0bb62c2fc8 100644
--- a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CmdStartStopITCase.java
+++ b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/CmdStartStopITCase.java
@@ -24,18 +24,73 @@ import org.junit.jupiter.api.Test;
 public class CmdStartStopITCase extends JBangTestSupport {
 
     @Test
-    public void testCmdStop() throws IOException {
+    public void testCmdStopByRouteID() throws IOException {
         copyResourceInDataFolder(TestResources.DIR_ROUTE);
         copyResourceInDataFolder(TestResources.ROUTE2);
         executeBackground(String.format("run --source-dir=%s", mountPoint()));
         checkLogContains("Hello world!");
+        execute("cmd stop-route --id=route1");
         checkCommandOutputsPattern("get route",
-                "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started.*\\n.*route2\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started");
-        execute("cmd stop-route route2");
+                "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped.*\\n.*route2\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started");
+    }
+
+    @Test
+    public void testCmdStopByPID() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        copyResourceInDataFolder(TestResources.ROUTE2);
+        String PID = executeBackground(String.format("run %s/FromDirectoryRoute.java", mountPoint()));
+        executeBackground(String.format("run %s/route2.yaml", mountPoint()));
+        checkLogContains("Hello world!");
+        execute("cmd stop-route " + PID);
+        checkCommandOutputsPattern("get route",
+                "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped.*\\n.*route2.*timer:\\/\\/(yaml|java)\\?period=1000\\s+Started");
+    }
+
+    @Test
+    public void testCmdStopAll() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        copyResourceInDataFolder(TestResources.ROUTE2);
+        executeBackground(String.format("run --source-dir=%s", mountPoint()));
+        checkLogContains("Hello world!");
+        execute("cmd stop-route");
         checkCommandOutputsPattern("get route",
                 "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped.*\\n.*route2\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped");
+    }
+
+    @Test
+    public void testCmdStartByRouteID() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        copyResourceInDataFolder(TestResources.ROUTE2);
+        executeBackground(String.format("run --source-dir=%s", mountPoint()));
+        checkLogContains("Hello world!");
+        execute("cmd stop-route");
         execute("cmd start-route --id=route1");
         checkCommandOutputsPattern("get route",
                 "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started.*\\n.*route2\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped");
     }
+
+    @Test
+    public void testCmdStartByPID() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        copyResourceInDataFolder(TestResources.ROUTE2);
+        String PID = executeBackground(String.format("run %s/FromDirectoryRoute.java", mountPoint()));
+        executeBackground(String.format("run %s/route2.yaml", mountPoint()));
+        checkLogContains("Hello world!");
+        execute("cmd stop-route");
+        execute("cmd start-route " + PID);
+        checkCommandOutputsPattern("get route",
+                "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started.*\\n.*route2.*timer:\\/\\/(yaml|java)\\?period=1000\\s+Stopped");
+    }
+
+    @Test
+    public void testCmdStartAll() throws IOException {
+        copyResourceInDataFolder(TestResources.DIR_ROUTE);
+        copyResourceInDataFolder(TestResources.ROUTE2);
+        executeBackground(String.format("run --source-dir=%s", mountPoint()));
+        checkLogContains("Hello world!");
+        execute("cmd stop-route");
+        execute("cmd start-route");
+        checkCommandOutputsPattern("get route",
+                "route1\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started.*\\n.*route2\\s+timer:\\/\\/(yaml|java)\\?period=1000\\s+Started");
+    }
 }