Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/camel-kamelets-itest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@
<artifactId>camel-cassandraql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-paho-mqtt5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-nats</artifactId>
<scope>test</scope>
</dependency>

<!-- Citrus -->
<dependency>
Expand Down
33 changes: 33 additions & 0 deletions tests/camel-kamelets-itest/src/test/java/Mqtt5IT.java
Original file line number Diff line number Diff line change
@@ -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<DynamicTest> mqtt5() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("mqtt5");
}
}
33 changes: 33 additions & 0 deletions tests/camel-kamelets-itest/src/test/java/NatsIT.java
Original file line number Diff line number Diff line change
@@ -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<DynamicTest> nats() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("nats");
}
}
Original file line number Diff line number Diff line change
@@ -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}}"
Original file line number Diff line number Diff line change
@@ -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}"
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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}}"
Original file line number Diff line number Diff line change
@@ -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}"
Original file line number Diff line number Diff line change
@@ -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"
Loading