This is an automated email from the ASF dual-hosted git repository. oscerd pushed a commit to branch add-integration-tests in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit 694cacec4656428af3617b4bfb6de89ef999a41f Author: Andrea Cosentino <[email protected]> AuthorDate: Tue May 19 12:13:11 2026 +0200 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) <[email protected]> --- .../src/test/java/CommonIT.java | 20 ++++++ .../has-header-filter-action-pipe.citrus.it.yaml | 68 +++++++++++++++++++ .../has-header-filter-action-pipe.yaml} | 19 ++---- .../predicate-filter-action-pipe.citrus.it.yaml | 62 +++++++++++++++++ .../predicate-filter-action-pipe.yaml} | 9 ++- .../insert-header-action-pipe.citrus.it.yaml | 68 +++++++++++++++++++ .../insert-header-action-pipe.yaml} | 11 ++- .../resources/http/http-sink-pipe.citrus.it.yaml | 60 +++++++++++++++++ .../http-sink-pipe.yaml} | 21 +++--- .../http/http-source-to-http.citrus.it.yaml | 78 ++++++++++++++++++++++ .../http-source-to-http.yaml} | 14 +--- .../log-sink-pipe.citrus.it.yaml} | 47 +++++++------ .../log-sink-pipe.yaml} | 21 +++--- .../transformation/data-type-action-pipe.yaml | 3 +- .../drop-field-action-pipe.citrus.it.yaml | 64 ++++++++++++++++++ ...ction-pipe.yaml => drop-field-action-pipe.yaml} | 7 +- .../transformation/extract-field-action-pipe.yaml | 3 +- .../hoist-field-action-pipe.citrus.it.yaml | 64 ++++++++++++++++++ ...tion-pipe.yaml => hoist-field-action-pipe.yaml} | 9 ++- .../transformation/insert-field-action-pipe.yaml | 3 +- .../mask-field-action-pipe.citrus.it.yaml | 68 +++++++++++++++++++ ...ction-pipe.yaml => mask-field-action-pipe.yaml} | 10 +-- .../replace-field-action-pipe.citrus.it.yaml | 62 +++++++++++++++++ ...on-pipe.yaml => replace-field-action-pipe.yaml} | 9 ++- 24 files changed, 693 insertions(+), 107 deletions(-) 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 class CommonIT { public Stream<DynamicTest> crypto() { return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("crypto"); } + + @CitrusTestFactory + public Stream<DynamicTest> header() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("header"); + } + + @CitrusTestFactory + public Stream<DynamicTest> filter() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("filter"); + } + + @CitrusTestFactory + public Stream<DynamicTest> httpTests() { + return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("http"); + } + + @CitrusTestFactory + public Stream<DynamicTest> 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/transformation/data-type-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml similarity index 81% copy from tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml index 71f4a19b9..4a432399d 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/filter/has-header-filter-action-pipe.yaml @@ -18,11 +18,8 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: data-type-action-pipe + name: has-header-filter-action-pipe spec: - integration: - dependencies: - - "camel:cloudevents" source: ref: kind: Kamelet @@ -30,22 +27,20 @@ spec: name: timer-source properties: period: 10000 - contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: data-type-action + name: insert-header-action properties: - scheme: "http" - format: "application-cloudevents" + name: "{{header.name}}" + value: "{{header.value}}" - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: log-action + name: has-header-filter-action properties: - showHeaders: true + 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/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml similarity index 90% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml index 9e994901d..52c38ff6a 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/filter/predicate-filter-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: predicate-filter-action-pipe spec: source: ref: @@ -28,14 +28,13 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: predicate-filter-action properties: - field: "{{field.name}}" + 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/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml similarity index 88% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml index 9e994901d..7805bc999 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/header/insert-header-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: insert-header-action-pipe spec: source: ref: @@ -27,15 +27,14 @@ spec: name: timer-source properties: period: 10000 - contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: insert-header-action properties: - field: "{{field.name}}" + 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/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml similarity index 78% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml index 9e994901d..e3bd348df 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-sink-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: http-sink-pipe spec: source: ref: @@ -27,15 +27,12 @@ spec: name: timer-source properties: period: 10000 - contentType: application/json - message: > - {{input}} - steps: - - ref: - kind: Kamelet - apiVersion: camel.apache.org/v1 - name: extract-field-action - properties: - field: "{{field.name}}" + message: "{{input}}" sink: - uri: "{{http.sink.url}}/result" + 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/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml similarity index 82% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml index 9e994901d..22c984459 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/http/http-source-to-http.yaml @@ -18,24 +18,16 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: http-source-to-http spec: source: ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: timer-source + name: http-source properties: + url: "{{http.source.url}}/data" period: 10000 contentType: application/json - message: > - {{input}} - steps: - - ref: - kind: Kamelet - apiVersion: camel.apache.org/v1 - name: extract-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/log/log-sink-pipe.citrus.it.yaml similarity index 61% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml index 9e994901d..01f9a98d7 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.citrus.it.yaml @@ -15,27 +15,26 @@ # limitations under the License. # --------------------------------------------------------------------------- -apiVersion: camel.apache.org/v1 -kind: Pipe -metadata: - name: extract-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: extract-field-action - properties: - field: "{{field.name}}" - sink: - uri: "{{http.sink.url}}/result" +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/transformation/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml similarity index 78% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml index 9e994901d..8dd027b95 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/log/log-sink-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: log-sink-pipe spec: source: ref: @@ -27,15 +27,12 @@ spec: name: timer-source properties: period: 10000 - contentType: application/json - message: > - {{input}} - steps: - - ref: - kind: Kamelet - apiVersion: camel.apache.org/v1 - name: extract-field-action - properties: - field: "{{field.name}}" + message: "{{message}}" sink: - uri: "{{http.sink.url}}/result" + 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/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml similarity index 92% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml index 9e994901d..4e06f342c 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/drop-field-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: drop-field-action-pipe spec: source: ref: @@ -28,13 +28,12 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: drop-field-action properties: field: "{{field.name}}" sink: 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/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml similarity index 90% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml index 9e994901d..0a2ee004e 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/hoist-field-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: hoist-field-action-pipe spec: source: ref: @@ -28,14 +28,13 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: hoist-field-action properties: - field: "{{field.name}}" + 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/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml similarity index 88% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml index 9e994901d..29002d893 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/mask-field-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: mask-field-action-pipe spec: source: ref: @@ -28,14 +28,14 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: mask-field-action properties: - field: "{{field.name}}" + 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/extract-field-action-pipe.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml similarity index 90% copy from tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml copy to tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml index 9e994901d..70dcabfda 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/replace-field-action-pipe.yaml @@ -18,7 +18,7 @@ apiVersion: camel.apache.org/v1 kind: Pipe metadata: - name: extract-field-action-pipe + name: replace-field-action-pipe spec: source: ref: @@ -28,14 +28,13 @@ spec: properties: period: 10000 contentType: application/json - message: > - {{input}} + message: "{{input}}" steps: - ref: kind: Kamelet apiVersion: camel.apache.org/v1 - name: extract-field-action + name: replace-field-action properties: - field: "{{field.name}}" + renames: "{{renames}}" sink: uri: "{{http.sink.url}}/result"
