From 694cacec4656428af3617b4bfb6de89ef999a41f Mon Sep 17 00:00:00 2001 From: Andrea Cosentino Date: Tue, 19 May 2026 12:13:11 +0200 Subject: [PATCH] Add integration tests for transformation, header, filter, http, and log kamelets Add 10 new Citrus integration tests covering actions, sources, and sinks: Transformation actions: drop-field, mask-field, replace-field, hoist-field Header actions: insert-header Filter actions: predicate-filter, has-header-filter Source kamelets: http-source Sink kamelets: http-sink, log-sink Also fix YAML folded block scalar (message: >) to quoted string in existing pipe definitions (extract-field, insert-field, data-type) to avoid trailing newline in property resolution. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/test/java/CommonIT.java | 20 +++++ ...s-header-filter-action-pipe.citrus.it.yaml | 68 ++++++++++++++++ .../filter/has-header-filter-action-pipe.yaml | 46 +++++++++++ ...redicate-filter-action-pipe.citrus.it.yaml | 62 +++++++++++++++ .../filter/predicate-filter-action-pipe.yaml | 40 ++++++++++ .../insert-header-action-pipe.citrus.it.yaml | 68 ++++++++++++++++ .../header/insert-header-action-pipe.yaml | 40 ++++++++++ .../http/http-sink-pipe.citrus.it.yaml | 60 ++++++++++++++ .../test/resources/http/http-sink-pipe.yaml | 38 +++++++++ .../http/http-source-to-http.citrus.it.yaml | 78 +++++++++++++++++++ .../resources/http/http-source-to-http.yaml | 33 ++++++++ .../log/log-sink-pipe.citrus.it.yaml | 40 ++++++++++ .../src/test/resources/log/log-sink-pipe.yaml | 38 +++++++++ .../transformation/data-type-action-pipe.yaml | 3 +- .../drop-field-action-pipe.citrus.it.yaml | 64 +++++++++++++++ .../drop-field-action-pipe.yaml | 40 ++++++++++ .../extract-field-action-pipe.yaml | 3 +- .../hoist-field-action-pipe.citrus.it.yaml | 64 +++++++++++++++ .../hoist-field-action-pipe.yaml | 40 ++++++++++ .../insert-field-action-pipe.yaml | 3 +- .../mask-field-action-pipe.citrus.it.yaml | 68 ++++++++++++++++ .../mask-field-action-pipe.yaml | 41 ++++++++++ .../replace-field-action-pipe.citrus.it.yaml | 62 +++++++++++++++ .../replace-field-action-pipe.yaml | 40 ++++++++++ 24 files changed, 1053 insertions(+), 6 deletions(-) create mode 100644 tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.citrus.it.yaml create mode 100644 tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml diff --git a/tests/camel-kamelets-itest/src/test/java/CommonIT.java b/tests/camel-kamelets-itest/src/test/java/CommonIT.java index b01527187..27a1af47c 100644 --- a/tests/camel-kamelets-itest/src/test/java/CommonIT.java +++ b/tests/camel-kamelets-itest/src/test/java/CommonIT.java @@ -78,4 +78,24 @@ public Stream transformation() { public Stream crypto() { return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("crypto"); } + + @CitrusTestFactory + public Stream header() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("header"); + } + + @CitrusTestFactory + public Stream filter() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("filter"); + } + + @CitrusTestFactory + public Stream httpTests() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("http"); + } + + @CitrusTestFactory + public Stream log() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("log"); + } } diff --git a/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..b120a1401 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.citrus.it.yaml @@ -0,0 +1,68 @@ +# --------------------------------------------------------------------------- +# 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: has-header-filter-action-pipe-test +variables: + - name: "id" + value: "citrus:randomUUID()" + - name: "header.name" + value: "myTestHeader" + - name: "header.value" + value: "myTestValue" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "filter/has-header-filter-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "header.name" + value: "${header.name}" + - name: "header.value" + value: "${header.value}" + - name: "input" + value: | + { \"id\": \"${id}\" } + + # Verify Http request - message should pass through because header exists + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + headers: + - name: "${header.name}" + value: "${header.value}" + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml new file mode 100644 index 000000000..4a432399d --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml @@ -0,0 +1,46 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: has-header-filter-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: insert-header-action + properties: + name: "{{header.name}}" + value: "{{header.value}}" + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: has-header-filter-action + properties: + name: "{{header.name}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..69c7602f6 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.citrus.it.yaml @@ -0,0 +1,62 @@ +# --------------------------------------------------------------------------- +# 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: predicate-filter-action-pipe-test +variables: + - name: "name.value" + value: "Camel" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "filter/predicate-filter-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "filter.expression" + value: "@.name =~ /.*Camel.*/" + - name: "input" + value: | + { \"name\": \"${name.value}\" } + + # Verify Http request - message should pass through because expression matches + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + { "name": "${name.value}" } + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml new file mode 100644 index 000000000..52c38ff6a --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: predicate-filter-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + contentType: application/json + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: predicate-filter-action + properties: + expression: "{{filter.expression}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..3fb8096c4 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.citrus.it.yaml @@ -0,0 +1,68 @@ +# --------------------------------------------------------------------------- +# 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: insert-header-action-pipe-test +variables: + - name: "id" + value: "citrus:randomUUID()" + - name: "header.name" + value: "myTestHeader" + - name: "header.value" + value: "myTestValue" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "header/insert-header-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "header.name" + value: "${header.name}" + - name: "header.value" + value: "${header.value}" + - name: "input" + value: | + { \"id\": \"${id}\" } + + # Verify Http request with the inserted header + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + headers: + - name: "${header.name}" + value: "${header.value}" + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml new file mode 100644 index 000000000..7805bc999 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: insert-header-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: insert-header-action + properties: + name: "{{header.name}}" + value: "{{header.value}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.citrus.it.yaml new file mode 100644 index 000000000..50a7ef16b --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.citrus.it.yaml @@ -0,0 +1,60 @@ +# --------------------------------------------------------------------------- +# 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: http-sink-pipe-test +variables: + - name: "id" + value: "citrus:randomUUID()" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "http/http-sink-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "input" + value: | + { \"id\": \"${id}\", \"message\": \"Hello from http-sink\" } + + # Verify Http request received by the mock server + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + { "id": "${id}", "message": "Hello from http-sink" } + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml new file mode 100644 index 000000000..e3bd348df --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml @@ -0,0 +1,38 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: http-sink-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + message: "{{input}}" + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: http-sink + properties: + url: "{{http.sink.url}}/result" + method: "POST" diff --git a/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.citrus.it.yaml new file mode 100644 index 000000000..1cf3ba809 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.citrus.it.yaml @@ -0,0 +1,78 @@ +# --------------------------------------------------------------------------- +# 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: http-source-to-http-test +variables: + - name: "id" + value: "citrus:randomUUID()" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "http/http-source-to-http.yaml" + systemProperties: + properties: + - name: "http.source.url" + value: "${http.server.url}" + - name: "http.sink.url" + value: "${http.server.url}" + + # The http-source will poll GET /data - respond with test data + - http: + server: "httpServer" + receiveRequest: + GET: + path: "/data" + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + contentType: "application/json" + body: + data: | + { "id": "${id}", "message": "Hello from http-source" } + + # Verify the data arrives at the sink endpoint + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + { "id": "${id}", "message": "Hello from http-source" } + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml new file mode 100644 index 000000000..22c984459 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml @@ -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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: http-source-to-http +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: http-source + properties: + url: "{{http.source.url}}/data" + period: 10000 + contentType: application/json + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml new file mode 100644 index 000000000..01f9a98d7 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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: log-sink-pipe-test +variables: + - name: "log.message" + value: "Hello from log-sink test!" +actions: + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "log/log-sink-pipe.yaml" + systemProperties: + properties: + - name: "message" + value: "${log.message}" + + # Verify the log output contains the message + - camel: + jbang: + verify: + integration: "log-sink-pipe" + logMessage: "${log.message}" diff --git a/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml new file mode 100644 index 000000000..8dd027b95 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml @@ -0,0 +1,38 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: log-sink-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + message: "{{message}}" + sink: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: log-sink + properties: + loggerName: "test-log-sink" + showHeaders: false diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml index 71f4a19b9..cbfd8a00b 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml @@ -31,8 +31,7 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..699f0521a --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.citrus.it.yaml @@ -0,0 +1,64 @@ +# --------------------------------------------------------------------------- +# 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: drop-field-action-pipe-test +variables: + - name: "field.name" + value: "subject" + - name: "id" + value: "citrus:randomUUID()" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "transformation/drop-field-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "field.name" + value: "${field.name}" + - name: "input" + value: | + { \"id\": \"${id}\", \"${field.name}\": \"Camel rocks!\" } + + # Verify Http request + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + {"id":"${id}"} + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml new file mode 100644 index 000000000..4e06f342c --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: drop-field-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + contentType: application/json + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: drop-field-action + properties: + field: "{{field.name}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml index 9e994901d..947867457 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml @@ -28,8 +28,7 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..675e9fbdf --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.citrus.it.yaml @@ -0,0 +1,64 @@ +# --------------------------------------------------------------------------- +# 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: hoist-field-action-pipe-test +variables: + - name: "id" + value: "citrus:randomUUID()" + - name: "hoist.field" + value: "wrapped" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "transformation/hoist-field-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "hoist.field" + value: "${hoist.field}" + - name: "input" + value: | + { \"id\": \"${id}\" } + + # Verify Http request + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + {"${hoist.field}":{"id":"${id}"}} + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml new file mode 100644 index 000000000..0a2ee004e --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: hoist-field-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + contentType: application/json + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: hoist-field-action + properties: + field: "{{hoist.field}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.yaml index a52700de6..f4149fe82 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.yaml @@ -28,8 +28,7 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..f8608ac2e --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.citrus.it.yaml @@ -0,0 +1,68 @@ +# --------------------------------------------------------------------------- +# 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: mask-field-action-pipe-test +variables: + - name: "id" + value: "citrus:randomUUID()" + - name: "mask.fields" + value: "password" + - name: "mask.replacement" + value: "***" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "transformation/mask-field-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "mask.fields" + value: "${mask.fields}" + - name: "mask.replacement" + value: "${mask.replacement}" + - name: "input" + value: | + { \"id\": \"${id}\", \"password\": \"secret123\" } + + # Verify Http request + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + {"id":"${id}","password":"${mask.replacement}"} + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml new file mode 100644 index 000000000..29002d893 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml @@ -0,0 +1,41 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: mask-field-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + contentType: application/json + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: mask-field-action + properties: + fields: "{{mask.fields}}" + replacement: "{{mask.replacement}}" + sink: + uri: "{{http.sink.url}}/result" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.citrus.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.citrus.it.yaml new file mode 100644 index 000000000..1ac084660 --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.citrus.it.yaml @@ -0,0 +1,62 @@ +# --------------------------------------------------------------------------- +# 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: replace-field-action-pipe-test +variables: + - name: "field.value" + value: "Camel rocks!" +actions: + - createVariables: + variables: + - name: "http.server.url" + value: "http://localhost:${http.server.port}" + # Create Camel JBang integration + - camel: + jbang: + run: + waitForRunningState: false + integration: + file: "transformation/replace-field-action-pipe.yaml" + systemProperties: + properties: + - name: "http.sink.url" + value: "${http.server.url}" + - name: "renames" + value: "oldName:newName" + - name: "input" + value: | + { \"oldName\": \"${field.value}\" } + + # Verify Http request + - http: + server: "httpServer" + receiveRequest: + POST: + path: "/result" + body: + data: | + {"newName":"${field.value}"} + + - http: + server: "httpServer" + sendResponse: + response: + status: 200 + reasonPhrase: "OK" + version: "HTTP/1.1" + body: + data: "Thank You!" diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml new file mode 100644 index 000000000..70dcabfda --- /dev/null +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml @@ -0,0 +1,40 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +apiVersion: camel.apache.org/v1 +kind: Pipe +metadata: + name: replace-field-action-pipe +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: timer-source + properties: + period: 10000 + contentType: application/json + message: "{{input}}" + steps: + - ref: + kind: Kamelet + apiVersion: camel.apache.org/v1 + name: replace-field-action + properties: + renames: "{{renames}}" + sink: + uri: "{{http.sink.url}}/result"