diff --git a/tests/camel-kamelets-itest/pom.xml b/tests/camel-kamelets-itest/pom.xml index 912dbd9ff..ffbd1b0d2 100644 --- a/tests/camel-kamelets-itest/pom.xml +++ b/tests/camel-kamelets-itest/pom.xml @@ -141,6 +141,16 @@ camel-cassandraql test + + org.apache.camel + camel-paho-mqtt5 + test + + + org.apache.camel + camel-nats + test + diff --git a/tests/camel-kamelets-itest/src/test/java/Mqtt5IT.java b/tests/camel-kamelets-itest/src/test/java/Mqtt5IT.java new file mode 100644 index 000000000..19e137cb9 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/java/Mqtt5IT.java @@ -0,0 +1,33 @@ +/* + * 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 java.util.stream.Stream; + +import org.citrusframework.common.TestLoader; +import org.citrusframework.junit.jupiter.CitrusSupport; +import org.citrusframework.junit.jupiter.CitrusTestFactory; +import org.citrusframework.junit.jupiter.CitrusTestFactorySupport; +import org.junit.jupiter.api.DynamicTest; + +@CitrusSupport +public class Mqtt5IT { + + @CitrusTestFactory + public Stream mqtt5() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("mqtt5"); + } +} diff --git a/tests/camel-kamelets-itest/src/test/java/NatsIT.java b/tests/camel-kamelets-itest/src/test/java/NatsIT.java new file mode 100644 index 000000000..a7c768685 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/java/NatsIT.java @@ -0,0 +1,33 @@ +/* + * 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 java.util.stream.Stream; + +import org.citrusframework.common.TestLoader; +import org.citrusframework.junit.jupiter.CitrusSupport; +import org.citrusframework.junit.jupiter.CitrusTestFactory; +import org.citrusframework.junit.jupiter.CitrusTestFactorySupport; +import org.junit.jupiter.api.DynamicTest; + +@CitrusSupport +public class NatsIT { + + @CitrusTestFactory + public Stream nats() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("nats"); + } +} diff --git a/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-route.yaml b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-route.yaml new file mode 100644 index 000000000..4b99efbb7 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-route.yaml @@ -0,0 +1,32 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +- route: + from: + uri: "timer:tick" + parameters: + period: "10000" + repeatCount: 1 + steps: + - setBody: + constant: "{{test.message}}" + - log: "${body}" + - to: + uri: "kamelet:mqtt5-sink" + parameters: + topic: "{{mqtt.topic}}" + brokerUrl: "{{mqtt.brokerUrl}}" diff --git a/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-to-source-route.citrus.it.yaml.disabled b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-to-source-route.citrus.it.yaml.disabled new file mode 100644 index 000000000..6f55c29ed --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-sink-to-source-route.citrus.it.yaml.disabled @@ -0,0 +1,77 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +name: mqtt5-sink-to-source-route-test +variables: + - name: "test.message" + value: "hello-mqtt5-test" + - name: "mqtt.topic" + value: "test/topic" +actions: + # Start EMQX MQTT broker (allows anonymous by default) + - testcontainers: + start: + container: + name: "mqtt" + image: "emqx/emqx:5" + exposedPorts: + - 1883 + env: + - name: "EMQX_LISTENERS__TCP__DEFAULT__ENABLE" + value: "true" + waitFor: + disabled: true + + # Wait for EMQX to be ready + - sleep: + milliseconds: 10000 + + # Start source (subscriber) first + - camel: + jbang: + run: + integration: + file: "mqtt5/mqtt5-source-route.yaml" + systemProperties: + properties: + - name: "mqtt.topic" + value: "${mqtt.topic}" + - name: "mqtt.brokerUrl" + value: "tcp://${CITRUS_TESTCONTAINERS_MQTT_HOST}:${CITRUS_TESTCONTAINERS_MQTT_PORT}" + + # Start sink (publisher) + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "mqtt5/mqtt5-sink-route.yaml" + systemProperties: + properties: + - name: "test.message" + value: "${test.message}" + - name: "mqtt.topic" + value: "${mqtt.topic}" + - name: "mqtt.brokerUrl" + value: "tcp://${CITRUS_TESTCONTAINERS_MQTT_HOST}:${CITRUS_TESTCONTAINERS_MQTT_PORT}" + + # Verify source received the message + - camel: + jbang: + verify: + integration: "mqtt5-source-route" + logMessage: "${test.message}" diff --git a/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-source-route.yaml b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-source-route.yaml new file mode 100644 index 000000000..6519ba526 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/mqtt5/mqtt5-source-route.yaml @@ -0,0 +1,27 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +- route: + from: + uri: "kamelet:mqtt5-source" + parameters: + topic: "{{mqtt.topic}}" + brokerUrl: "{{mqtt.brokerUrl}}" + clientId: "mqtt5-source-test" + steps: + - to: + uri: "kamelet:log-sink" diff --git a/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-route.yaml b/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-route.yaml new file mode 100644 index 000000000..04d4fa2eb --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-route.yaml @@ -0,0 +1,32 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +- route: + from: + uri: "timer:tick" + parameters: + period: "10000" + repeatCount: 1 + steps: + - setBody: + constant: "{{test.message}}" + - log: "${body}" + - to: + uri: "kamelet:nats-sink" + parameters: + topic: "{{nats.topic}}" + servers: "{{nats.servers}}" diff --git a/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-to-source-route.citrus.it.yaml.disabled b/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-to-source-route.citrus.it.yaml.disabled new file mode 100644 index 000000000..5a42605e0 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/nats/nats-sink-to-source-route.citrus.it.yaml.disabled @@ -0,0 +1,74 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +name: nats-sink-to-source-route-test +variables: + - name: "test.message" + value: "hello-nats-test" + - name: "nats.topic" + value: "test-topic" +actions: + # Start NATS container + - testcontainers: + start: + container: + name: "nats" + image: "nats:2" + exposedPorts: + - 4222 + waitFor: + disabled: true + + # Wait for NATS to be ready + - sleep: + milliseconds: 5000 + + # Start source (subscriber) first + - camel: + jbang: + run: + integration: + file: "nats/nats-source-route.yaml" + systemProperties: + properties: + - name: "nats.topic" + value: "${nats.topic}" + - name: "nats.servers" + value: "nats://${CITRUS_TESTCONTAINERS_NATS_HOST}:${CITRUS_TESTCONTAINERS_NATS_PORT}" + + # Start sink (publisher) + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "nats/nats-sink-route.yaml" + systemProperties: + properties: + - name: "test.message" + value: "${test.message}" + - name: "nats.topic" + value: "${nats.topic}" + - name: "nats.servers" + value: "nats://${CITRUS_TESTCONTAINERS_NATS_HOST}:${CITRUS_TESTCONTAINERS_NATS_PORT}" + + # Verify source received the message + - camel: + jbang: + verify: + integration: "nats-source-route" + logMessage: "${test.message}" diff --git a/tests/camel-kamelets-itest/src/test/resources/nats/nats-source-route.yaml b/tests/camel-kamelets-itest/src/test/resources/nats/nats-source-route.yaml new file mode 100644 index 000000000..531c6269c --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/nats/nats-source-route.yaml @@ -0,0 +1,26 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +- route: + from: + uri: "kamelet:nats-source" + parameters: + topic: "{{nats.topic}}" + servers: "{{nats.servers}}" + steps: + - to: + uri: "kamelet:log-sink"