You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cd...@apache.org on 2024/12/12 10:04:08 UTC
(camel-jbang-examples) branch main updated: Add ftp test
This is an automated email from the ASF dual-hosted git repository.
cdeppisch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-jbang-examples.git
The following commit(s) were added to refs/heads/main by this push:
new d9584e8 Add ftp test
d9584e8 is described below
commit d9584e8a67ee20991e1eb7498fe2deb7f974c4ea
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Thu Dec 5 10:44:21 2024 +0100
Add ftp test
---
.github/workflows/build.yml | 18 +++++++++++++++---
ftp/README.adoc | 19 ++++++++++++++++---
ftp/compose.yaml | 2 --
ftp/ftp-kaoto.png | Bin 0 -> 76547 bytes
ftp/ftp.camel.yaml | 2 +-
ftp/jbang.properties | 3 +++
ftp/test/ftp.camel.it.yaml | 39 +++++++++++++++++++++++++++++++++++++++
ftp/test/jbang.properties | 7 +++++++
ftp/{ => test}/payload.xml | 0
mqtt/README.adoc | 2 +-
10 files changed, 82 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0ed9d0b..f87aadc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -36,10 +36,12 @@ jobs:
- name: Cache Maven cache
uses: actions/cache@v4
with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/*.camel.yaml') }}
+ restore-keys: ${{ runner.os }}-m2-
- name: Run Tests
+ env:
+ CITRUS_CAMEL_JBANG_DUMP_INTEGRATION_OUTPUT: "true"
run: |
echo "Install JBang via SDKMAN"
@@ -57,6 +59,16 @@ jobs:
echo "Running tests"
+ pushd ftp/test
+ jbang citrus@citrusframework/citrus run ftp.camel.it.yaml
+ popd
+
pushd mqtt/test
jbang citrus@citrusframework/citrus run mqtt.camel.it.yaml
popd
+ - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
+ if: failure()
+ with:
+ name: dumps
+ include-hidden-files: true
+ path: ${{ github.workspace }}/**/.citrus-jbang/*-output.txt
diff --git a/ftp/README.adoc b/ftp/README.adoc
index 34c7ce0..c5145f5 100644
--- a/ftp/README.adoc
+++ b/ftp/README.adoc
@@ -2,6 +2,8 @@
This example shows how to integrate ActiveMQ with FTP server.
+image::ftp-kaoto.png[Apache Camel Kaoto online designer]
+
=== Running ActiveMQ and FTP server
You need both an ActiveMQ Artemis broker, and FTP server up and running.
@@ -52,13 +54,13 @@ or by using Camel JBang:
[source,sh]
----
-$ camel cmd send --body=file:payload.xml
+$ camel cmd send --body=file:test/payload.xml
----
=== Browsing FTP server
-When you have send some messages to ActiveMQ then Camel will route these to the FTP server.
-To see which files has been uploaded, you can remote shell into Docker or use Camel JBang:
+When you have sent some messages to ActiveMQ Camel will route these to the FTP server.
+To see which files have been uploaded, you can start a remote shell into the Docker container or use Camel JBang:
[source,sh]
----
@@ -88,6 +90,17 @@ $ camel run * --console
Then you can browse: http://localhost:8080/q/dev to introspect the running Camel Application.
+=== Integration testing
+
+The example provides an automated integration test (`ftp.camel.it.yaml`) that you can run with the https://citrusframework.org/[Citrus] test framework.
+Please make sure to install Citrus as a JBang app, too.
+
+You may run the test with:
+
+[source,sh]
+----
+$ citrus run ftp.camel.it.yaml
+----
=== More Information
diff --git a/ftp/compose.yaml b/ftp/compose.yaml
index 2348bfb..45c7c47 100644
--- a/ftp/compose.yaml
+++ b/ftp/compose.yaml
@@ -1,7 +1,6 @@
services:
artemis:
- container_name: my-artemis
image: apache/activemq-artemis:2.37.0
ports:
- "8161:8161"
@@ -13,7 +12,6 @@ services:
ANONYMOUS_LOGIN: false
ftp-server:
- container_name: my-ftp-server
environment:
- FTP_PASS=mypassword
- FTP_USER=myuser
diff --git a/ftp/ftp-kaoto.png b/ftp/ftp-kaoto.png
new file mode 100644
index 0000000..1a59048
Binary files /dev/null and b/ftp/ftp-kaoto.png differ
diff --git a/ftp/ftp.camel.yaml b/ftp/ftp.camel.yaml
index cc083b3..81a02b6 100644
--- a/ftp/ftp.camel.yaml
+++ b/ftp/ftp.camel.yaml
@@ -9,4 +9,4 @@
port: 21
username: myuser
password: mypassword
- passiveMode: true
\ No newline at end of file
+ passiveMode: true
diff --git a/ftp/jbang.properties b/ftp/jbang.properties
new file mode 100644
index 0000000..a86794f
--- /dev/null
+++ b/ftp/jbang.properties
@@ -0,0 +1,3 @@
+# Declare required additional dependencies for testing
+run.deps=jakarta.inject:jakarta.inject-api:2.0.1,\
+jakarta.enterprise:jakarta.enterprise.cdi-api:4.1.0
diff --git a/ftp/test/ftp.camel.it.yaml b/ftp/test/ftp.camel.it.yaml
new file mode 100644
index 0000000..3a8741c
--- /dev/null
+++ b/ftp/test/ftp.camel.it.yaml
@@ -0,0 +1,39 @@
+name: ftp-camel-test
+description: Test verifying the ActiveMQ to Ftp Camel route
+variables:
+ - name: jms.queue
+ value: cheese
+actions:
+ - groovy:
+ beans:
+ script: |
+ beans {
+ connectionFactory(org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.class) {
+ brokerURL = "tcp://localhost:61616"
+ user = "artemis"
+ password = "artemis"
+ }
+ }
+ - testcontainers:
+ compose:
+ up:
+ file: "../compose.yaml"
+ - camel:
+ jbang:
+ run:
+ integration:
+ name: "ftp-camel"
+ file: "../ftp.camel.yaml"
+ systemProperties:
+ file: "../application.properties"
+ - send:
+ endpoint: jms:${jms.queue}
+ message:
+ body:
+ resource:
+ file: "payload.xml"
+ - camel:
+ jbang:
+ verify:
+ integration: "ftp-camel"
+ logMessage: "Camel in Action"
diff --git a/ftp/test/jbang.properties b/ftp/test/jbang.properties
new file mode 100644
index 0000000..a34dc2d
--- /dev/null
+++ b/ftp/test/jbang.properties
@@ -0,0 +1,7 @@
+# Declare required additional dependencies for testing
+run.deps=org.citrusframework:citrus-camel:4.5.0,\
+org.citrusframework:citrus-testcontainers:4.5.0,\
+org.citrusframework:citrus-jms:4.5.0,\
+org.apache.activemq:artemis-jakarta-client:2.37.0,\
+jakarta.inject:jakarta.inject-api:2.0.1,\
+jakarta.enterprise:jakarta.enterprise.cdi-api:4.1.0
diff --git a/ftp/payload.xml b/ftp/test/payload.xml
similarity index 100%
rename from ftp/payload.xml
rename to ftp/test/payload.xml
diff --git a/mqtt/README.adoc b/mqtt/README.adoc
index 103a20a..2d0ab4b 100644
--- a/mqtt/README.adoc
+++ b/mqtt/README.adoc
@@ -42,7 +42,7 @@ Or use
[source,sh]
----
-$ docker compose up
+$ docker compose up --detach
----
Then you can run the Camel integration using: