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 a07b4862d5a CAMEL-20367: Adds stub test (#17261)
a07b4862d5a is described below
commit a07b4862d5ac992c26e97fc104a8c9e34f85ed47
Author: Jakub Vrubel <[email protected]>
AuthorDate: Tue Feb 25 12:20:14 2025 +0100
CAMEL-20367: Adds stub test (#17261)
Co-authored-by: Jakub Vrubel <[email protected]>
---
.../camel/dsl/jbang/it/RunCommandOnMqttITCase.java | 10 ++++++++
.../dsl/jbang/it/ScriptingWithPipesITCase.java | 2 +-
.../dsl/jbang/it/support/JBangTestSupport.java | 1 +
.../src/test/resources/jbang/it/StubRoute.java | 28 ++++++++++++++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RunCommandOnMqttITCase.java
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RunCommandOnMqttITCase.java
index 38a3d0d8b4d..8d1729ea0e8 100644
---
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RunCommandOnMqttITCase.java
+++
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/RunCommandOnMqttITCase.java
@@ -58,6 +58,16 @@ public class RunCommandOnMqttITCase extends JBangTestSupport
{
checkLogContains("The temperature is 21");
}
+ @Test
+ public void testStub() throws IOException {
+ copyResourceInDataFolder(TestResources.STUB_ROUTE);
+ final String ipAddr = getIpAddr(service.getContainer());
+ final String pid = executeBackground(String.format("run %s/%s
--stub=jms",
+ mountPoint(), TestResources.STUB_ROUTE.getName()));
+ checkCommandOutputs("cmd send --body=\"Hello camel from stubbed jms\""
+ pid, "jms://inbox : Sent (success)");
+ checkCommandOutputs("cmd stub --browse", "Hello camel from stubbed
jms");
+ }
+
private String getIpAddr(final GenericContainer container) {
return
container.getCurrentContainerInfo().getNetworkSettings().getNetworks().entrySet()
.stream().filter(entry -> "127.0.0.1" !=
entry.getValue().getIpAddress())
diff --git
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ScriptingWithPipesITCase.java
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ScriptingWithPipesITCase.java
index cd6e7a88ea4..6915b4c3c87 100644
---
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ScriptingWithPipesITCase.java
+++
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/ScriptingWithPipesITCase.java
@@ -37,7 +37,7 @@ public class ScriptingWithPipesITCase extends
JBangTestSupport {
"
.to(\"stream:out\");\n" +
" }\n" +
"}");
- execInHost(String.format("chmod +x %s/UpperCase.java",
getDataFolder()));
+ execInContainer(String.format("chmod +x %s/UpperCase.java",
mountPoint()));
execInContainer(String.format("echo \"hello camel\" |
%s/UpperCase.java > %s/hello.txt", mountPoint(), mountPoint()));
assertFileInDataFolderContains("hello.txt", "HELLO CAMEL");
}
diff --git
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
index 1903d728002..a9e54b55445 100644
---
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
+++
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
@@ -106,6 +106,7 @@ public abstract class JBangTestSupport {
COMP_MAPPING_DATA("data.xml",
"/jbang/it/data-mapping/components/data.xml"),
COMP_MAPPING_TEMPLATE("transform.xml",
"/jbang/it/data-mapping/components/transform.xml"),
FORMATS_MAPPING_DATA("data.csv",
"/jbang/it/data-mapping/data-formats/data.csv"),
+ STUB_ROUTE("StubRoute.java", "/jbang/it/StubRoute.java"),
USER_SOURCE_KAMELET("user-source.kamelet.yaml",
"/jbang/it/user-source.kamelet.yaml");
private String name;
diff --git
a/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/StubRoute.java
b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/StubRoute.java
new file mode 100644
index 00000000000..cbf2547e319
--- /dev/null
+++ b/dsl/camel-jbang/camel-jbang-it/src/test/resources/jbang/it/StubRoute.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.apache.camel.builder.RouteBuilder;
+
+public class StubRoute extends RouteBuilder {
+
+ @Override
+ public void configure() {
+ from("jms:inbox")
+ .log("Incoming order")
+ .log("After transformation")
+ .to("jms:process");
+ }
+}