This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 008950c8d chore: four descriptions that did not match what the
Kamelets do, and camel:kafka for the manual commit actions (#3310)
008950c8d is described below
commit 008950c8db76541e34273002f80f949376131b73
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 20 21:25:30 2026 +0100
chore: four descriptions that did not match what the Kamelets do, and
camel:kafka for the manual commit actions (#3310)
* chore: four descriptions that did not match what the Kamelets do, and
camel:kafka for the manual commit actions
- aws-cloudwatch-sink: the body is not always ignored. A MetricDatum body,
or
a List or an array of them, is sent as it is, and the metric headers and
options are then not used. A List or an array of anything else fails with
IllegalArgumentException. New Citrus test for the three cases.
- kafka-manual-commit-action and kafka-batch-manual-commit-action: add
camel:kafka to the dependencies. Without kafka-source in the same
integration, camel run failed at startup with "No bean could be found in
the registry for: org.apache.camel.component.kafka.ManualCommit" (or
BatchManualCommit). New Citrus tests run each action alone.
- json-serialize-action: text that is a JSON object or array is kept as it
is (CAMEL-25329), not quoted; only other text becomes a JSON string. The
Citrus test checks both.
- jolt-transformation-action: a Jackson JsonNode, such as the output of
json-deserialize-action, gives a null body without an error. The Citrus
test checks this, and that json-serialize-action before it works.
- tika-extract-text-action: outputFormat html fails (TIKA-237, invalid XML
character 0x0) for a document without a title, such as plain text; xml
works. This replaces the sentence about a NUL in the metadata failing html
and xml, which did not match what happens.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: tika-extract-text-action html works for a document without a title
(CAMEL-27304)
CAMEL-27304 fixes the html output of camel-tika for a document without a
title in Camel 4.24.0, so the outputFormat description says what it gives
now: an empty title element.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 4 +-
kamelets/aws-cloudwatch-sink.kamelet.yaml | 2 +-
kamelets/jolt-transformation-action.kamelet.yaml | 4 +-
kamelets/json-serialize-action.kamelet.yaml | 2 +-
.../kafka-batch-manual-commit-action.kamelet.yaml | 1 +
kamelets/kafka-manual-commit-action.kamelet.yaml | 1 +
kamelets/tika-extract-text-action.kamelet.yaml | 2 +-
.../main/resources/META-INF/kamelets-index.json | 6 +-
.../kamelets/aws-cloudwatch-sink.kamelet.yaml | 2 +-
.../jolt-transformation-action.kamelet.yaml | 4 +-
.../kamelets/json-serialize-action.kamelet.yaml | 2 +-
.../kafka-batch-manual-commit-action.kamelet.yaml | 1 +
.../kafka-manual-commit-action.kamelet.yaml | 1 +
.../kamelets/tika-extract-text-action.kamelet.yaml | 2 +-
.../aws-cloudwatch-sink-body-route.citrus.it.yaml | 170 +++++++++++++++++++++
.../cloudwatch/aws-cloudwatch-sink-body-route.yaml | 96 ++++++++++++
.../json-serialize-action-route.citrus.it.yaml | 34 +++++
.../json/json-serialize-action-route.yaml | 20 +++
...mit-action-without-source-route.citrus.it.yaml} | 18 +--
...manual-commit-action-without-source-route.yaml} | 12 +-
...mit-action-without-source-route.citrus.it.yaml} | 18 +--
...manual-commit-action-without-source-route.yaml} | 12 +-
...jolt-transformation-action-route.citrus.it.yaml | 39 +++++
.../jolt-transformation-action-route.yaml | 42 +++++
24 files changed, 446 insertions(+), 49 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index 9e09b8e3b..e0e0b5884 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -2690,13 +2690,13 @@
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:kafka-batch-manual-commit-action",
- "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]"
]
+ "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:kafka-batch-source",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:kafka-manual-commit-action",
- "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]"
]
+ "dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:kafka-sink",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
diff --git a/kamelets/aws-cloudwatch-sink.kamelet.yaml
b/kamelets/aws-cloudwatch-sink.kamelet.yaml
index 204c20c7e..e7fd86dab 100644
--- a/kamelets/aws-cloudwatch-sink.kamelet.yaml
+++ b/kamelets/aws-cloudwatch-sink.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Use it to record business or technical numbers from an integration, such
as orders processed, items in stock or processing time, and to graph them or
set alarms on them in CloudWatch.
- Input: the body is not used. The `metric-name` header (or
`ce-metricname`) is the name of the metric; it is required unless the
`metricName` option is set. The optional `metric-value` header (or
`ce-metricvalue`) is the value, a number; when it is not set, the value is
`metricValue`, or 1. The optional `metric-unit` header (or `ce-metricunit`) is
the unit, such as `Count`, `Seconds`, `Bytes` or `Percent`; when it is not set,
the unit is `metricUnit`, or `Count`. A header wins over [...]
+ Input: the data point comes from the headers and options, and the body,
such as text or a Map, is not used, unless it is a List, an array or a
`MetricDatum`. The `metric-name` header (or `ce-metricname`) is the name of the
metric; it is required unless the `metricName` option is set. The optional
`metric-value` header (or `ce-metricvalue`) is the value, a number; when it is
not set, the value is `metricValue`, or 1. The optional `metric-unit` header
(or `ce-metricunit`) is the unit [...]
Output: the message is unchanged.
diff --git a/kamelets/jolt-transformation-action.kamelet.yaml
b/kamelets/jolt-transformation-action.kamelet.yaml
index 6506e9f1e..bc74697cf 100644
--- a/kamelets/jolt-transformation-action.kamelet.yaml
+++ b/kamelets/jolt-transformation-action.kamelet.yaml
@@ -36,11 +36,11 @@ spec:
Use it to map the JSON of one system to the JSON another system expects,
for example to rename fields or move them into a nested object, when you
already have Jolt specifications. `jslt-action` does the same with a query
language, and is often easier to write.
- Input: parsed JSON, a Map (or a List). Since Camel 4.24, JSON text,
bytes and a stream work too. With older versions they do not fail but give an
empty body, and so does the parsed JSON of `json-deserialize-action`.
+ Input: parsed JSON as a Map (or a List), or a JSON object or array as
text, bytes or a stream. JSON text, bytes and a stream need Camel 4.24 or
later; with older versions they do not fail but give an empty body.
Output: the body is the result as parsed JSON, a Map (or a List), not
JSON text. Add `json-serialize-action` after it to get JSON text. The headers
are kept.
- Good to know: the specification cannot read headers, only the body. It
is loaded from a file, the classpath or a URL given by the `template` option;
it cannot come from the message. Headers that start with `CamelJolt` are
removed from the message first, so they cannot change what the Kamelet does.
+ Good to know: a Jackson `JsonNode`, such as the output of
`json-deserialize-action`, is not read: the body becomes empty (null), with no
error. Put `json-serialize-action` before it to give it JSON text. Text that is
not a JSON object or array, such as `hello`, also gives an empty body. The
specification cannot read headers, only the body. It is loaded from a file, the
classpath or a URL given by the `template` option; it cannot come from the
message. Headers that start with `Camel [...]
required:
- template
type: object
diff --git a/kamelets/json-serialize-action.kamelet.yaml
b/kamelets/json-serialize-action.kamelet.yaml
index 8210bcda2..50c3d12ea 100644
--- a/kamelets/json-serialize-action.kamelet.yaml
+++ b/kamelets/json-serialize-action.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: the body is JSON text, as bytes. The `Content-Type` header is
set to `application/json`.
- Good to know: a body that is already text becomes one JSON string, in
quotes: `hello` becomes `"hello"`, and JSON text is quoted the same way. Do not
use it on a body that is already JSON text.
+ Good to know: a body that is already JSON text is kept as it is, not
quoted: text, bytes or a stream that start with `{` and end with `}`, or start
with `[` and end with `]`, such as `{"id":1}`. It is not checked to be valid
JSON. Any other text becomes one JSON string, in quotes: `hello` becomes
`"hello"`, and the text `42` becomes `"42"`. Bytes or a stream that hold
another JSON value, such as `42`, are kept as well; other bytes become one JSON
string too.
type: object
dataTypes:
out:
diff --git a/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
b/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
index 451a4e256..c6995b32f 100644
--- a/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
+++ b/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
@@ -61,6 +61,7 @@ spec:
format: "application-x-unchanged"
description: "The body as it came in, of the same type."
dependencies:
+ - "camel:kafka"
- "camel:kamelet"
template:
from:
diff --git a/kamelets/kafka-manual-commit-action.kamelet.yaml
b/kamelets/kafka-manual-commit-action.kamelet.yaml
index 6dea79ae3..aa01e8cb6 100644
--- a/kamelets/kafka-manual-commit-action.kamelet.yaml
+++ b/kamelets/kafka-manual-commit-action.kamelet.yaml
@@ -61,6 +61,7 @@ spec:
format: "application-x-unchanged"
description: "The body as it came in, of the same type."
dependencies:
+ - "camel:kafka"
- "camel:kamelet"
template:
from:
diff --git a/kamelets/tika-extract-text-action.kamelet.yaml
b/kamelets/tika-extract-text-action.kamelet.yaml
index d89783d72..89da91654 100644
--- a/kamelets/tika-extract-text-action.kamelet.yaml
+++ b/kamelets/tika-extract-text-action.kamelet.yaml
@@ -52,7 +52,7 @@ spec:
example: CamelFileName
outputFormat:
title: Output Format
- description: What the body becomes. `text`, the default, is the plain
text of the document. `html` is the document as an XHTML page, with its
paragraphs, and for some formats its headings, lists and tables, as HTML
elements, and with the metadata Tika found, such as the title, as `meta`
elements in the `head`. `xml` is the same page with an XML declaration on top.
With `html` and `xml`, a document whose metadata holds a character that XML
does not allow, such as the NUL character [...]
+ description: What the body becomes. `text`, the default, is the plain
text of the document. `html` is the document as an XHTML page, with its
paragraphs, and for some formats its headings, lists and tables, as HTML
elements, and with the metadata Tika found, such as the title, as `meta`
elements in the `head`. `xml` is the same page with an XML declaration on top.
A document without a title, such as plain text or the text of an earlier
extraction, gets an empty `title` element.
type: string
enum: ["text", "html", "xml"]
default: text
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 230df704b..9b574c573 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -65,7 +65,7 @@
"supportLevel" : "Stable",
"title" : "AWS CloudWatch Metrics Sink",
"summary" : "Sends one data point of a custom metric to Amazon CloudWatch
for each message, with the name, the value and the unit of the metric taken
from headers or options.",
- "description" : "Sends one data point of a custom metric to Amazon
CloudWatch for each message, with the name, the value and the unit of the
metric taken from headers or options.\n\nUse it to record business or technical
numbers from an integration, such as orders processed, items in stock or
processing time, and to graph them or set alarms on them in
CloudWatch.\n\nInput: the body is not used. The `metric-name` header (or
`ce-metricname`) is the name of the metric; it is required un [...]
+ "description" : "Sends one data point of a custom metric to Amazon
CloudWatch for each message, with the name, the value and the unit of the
metric taken from headers or options.\n\nUse it to record business or technical
numbers from an integration, such as orders processed, items in stock or
processing time, and to graph them or set alarms on them in
CloudWatch.\n\nInput: the data point comes from the headers and options, and
the body, such as text or a Map, is not used, unless it i [...]
"group" : "AWS Cloudwatch",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
@@ -1245,7 +1245,7 @@
"supportLevel" : "Stable",
"title" : "Jolt Transformation Action",
"summary" : "Reshapes each JSON message into other JSON, as a Jolt
specification describes: moves, renames, removes fields or adds defaults.",
- "description" : "Reshapes each JSON message into other JSON, as a Jolt
specification describes: moves, renames, removes fields or adds
defaults.\n\nUse it to map the JSON of one system to the JSON another system
expects, for example to rename fields or move them into a nested object, when
you already have Jolt specifications. `jslt-action` does the same with a query
language, and is often easier to write.\n\nInput: parsed JSON, a Map (or a
List). Since Camel 4.24, JSON text, bytes an [...]
+ "description" : "Reshapes each JSON message into other JSON, as a Jolt
specification describes: moves, renames, removes fields or adds
defaults.\n\nUse it to map the JSON of one system to the JSON another system
expects, for example to rename fields or move them into a nested object, when
you already have Jolt specifications. `jslt-action` does the same with a query
language, and is often easier to write.\n\nInput: parsed JSON as a Map (or a
List), or a JSON object or array as text, [...]
"group" : "Actions",
"namespace" : "Transformation",
"provider" : "Apache Software Foundation"
@@ -1285,7 +1285,7 @@
"supportLevel" : "Stable",
"title" : "Json Serialize Action",
"summary" : "Turns a body of parsed data, such as a Map, a List or parsed
JSON, into JSON text.",
- "description" : "Turns a body of parsed data, such as a Map, a List or
parsed JSON, into JSON text.\n\nUse it to send parsed data to a sink that needs
JSON text, for example after `jsonata-action` or `json-deserialize-action`,
whose output is parsed JSON. To do the opposite, use
`json-deserialize-action`.\n\nInput: parsed data: a Map, a List, or parsed JSON
(a Jackson `JsonNode`).\n\nOutput: the body is JSON text, as bytes. The
`Content-Type` header is set to `application/json`.\n\nG [...]
+ "description" : "Turns a body of parsed data, such as a Map, a List or
parsed JSON, into JSON text.\n\nUse it to send parsed data to a sink that needs
JSON text, for example after `jsonata-action` or `json-deserialize-action`,
whose output is parsed JSON. To do the opposite, use
`json-deserialize-action`.\n\nInput: parsed data: a Map, a List, or parsed JSON
(a Jackson `JsonNode`).\n\nOutput: the body is JSON text, as bytes. The
`Content-Type` header is set to `application/json`.\n\nG [...]
"group" : "Actions",
"namespace" : "JSON",
"provider" : "Apache Software Foundation"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-cloudwatch-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-cloudwatch-sink.kamelet.yaml
index 204c20c7e..e7fd86dab 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/aws-cloudwatch-sink.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-cloudwatch-sink.kamelet.yaml
@@ -37,7 +37,7 @@ spec:
Use it to record business or technical numbers from an integration, such
as orders processed, items in stock or processing time, and to graph them or
set alarms on them in CloudWatch.
- Input: the body is not used. The `metric-name` header (or
`ce-metricname`) is the name of the metric; it is required unless the
`metricName` option is set. The optional `metric-value` header (or
`ce-metricvalue`) is the value, a number; when it is not set, the value is
`metricValue`, or 1. The optional `metric-unit` header (or `ce-metricunit`) is
the unit, such as `Count`, `Seconds`, `Bytes` or `Percent`; when it is not set,
the unit is `metricUnit`, or `Count`. A header wins over [...]
+ Input: the data point comes from the headers and options, and the body,
such as text or a Map, is not used, unless it is a List, an array or a
`MetricDatum`. The `metric-name` header (or `ce-metricname`) is the name of the
metric; it is required unless the `metricName` option is set. The optional
`metric-value` header (or `ce-metricvalue`) is the value, a number; when it is
not set, the value is `metricValue`, or 1. The optional `metric-unit` header
(or `ce-metricunit`) is the unit [...]
Output: the message is unchanged.
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
index 6506e9f1e..bc74697cf 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/jolt-transformation-action.kamelet.yaml
@@ -36,11 +36,11 @@ spec:
Use it to map the JSON of one system to the JSON another system expects,
for example to rename fields or move them into a nested object, when you
already have Jolt specifications. `jslt-action` does the same with a query
language, and is often easier to write.
- Input: parsed JSON, a Map (or a List). Since Camel 4.24, JSON text,
bytes and a stream work too. With older versions they do not fail but give an
empty body, and so does the parsed JSON of `json-deserialize-action`.
+ Input: parsed JSON as a Map (or a List), or a JSON object or array as
text, bytes or a stream. JSON text, bytes and a stream need Camel 4.24 or
later; with older versions they do not fail but give an empty body.
Output: the body is the result as parsed JSON, a Map (or a List), not
JSON text. Add `json-serialize-action` after it to get JSON text. The headers
are kept.
- Good to know: the specification cannot read headers, only the body. It
is loaded from a file, the classpath or a URL given by the `template` option;
it cannot come from the message. Headers that start with `CamelJolt` are
removed from the message first, so they cannot change what the Kamelet does.
+ Good to know: a Jackson `JsonNode`, such as the output of
`json-deserialize-action`, is not read: the body becomes empty (null), with no
error. Put `json-serialize-action` before it to give it JSON text. Text that is
not a JSON object or array, such as `hello`, also gives an empty body. The
specification cannot read headers, only the body. It is loaded from a file, the
classpath or a URL given by the `template` option; it cannot come from the
message. Headers that start with `Camel [...]
required:
- template
type: object
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
index 8210bcda2..50c3d12ea 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/json-serialize-action.kamelet.yaml
@@ -40,7 +40,7 @@ spec:
Output: the body is JSON text, as bytes. The `Content-Type` header is
set to `application/json`.
- Good to know: a body that is already text becomes one JSON string, in
quotes: `hello` becomes `"hello"`, and JSON text is quoted the same way. Do not
use it on a body that is already JSON text.
+ Good to know: a body that is already JSON text is kept as it is, not
quoted: text, bytes or a stream that start with `{` and end with `}`, or start
with `[` and end with `]`, such as `{"id":1}`. It is not checked to be valid
JSON. Any other text becomes one JSON string, in quotes: `hello` becomes
`"hello"`, and the text `42` becomes `"42"`. Bytes or a stream that hold
another JSON value, such as `42`, are kept as well; other bytes become one JSON
string too.
type: object
dataTypes:
out:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
index 451a4e256..c6995b32f 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/kafka-batch-manual-commit-action.kamelet.yaml
@@ -61,6 +61,7 @@ spec:
format: "application-x-unchanged"
description: "The body as it came in, of the same type."
dependencies:
+ - "camel:kafka"
- "camel:kamelet"
template:
from:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/kafka-manual-commit-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/kafka-manual-commit-action.kamelet.yaml
index 6dea79ae3..aa01e8cb6 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/kafka-manual-commit-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/kafka-manual-commit-action.kamelet.yaml
@@ -61,6 +61,7 @@ spec:
format: "application-x-unchanged"
description: "The body as it came in, of the same type."
dependencies:
+ - "camel:kafka"
- "camel:kamelet"
template:
from:
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/tika-extract-text-action.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/tika-extract-text-action.kamelet.yaml
index d89783d72..89da91654 100644
---
a/library/camel-kamelets/src/main/resources/kamelets/tika-extract-text-action.kamelet.yaml
+++
b/library/camel-kamelets/src/main/resources/kamelets/tika-extract-text-action.kamelet.yaml
@@ -52,7 +52,7 @@ spec:
example: CamelFileName
outputFormat:
title: Output Format
- description: What the body becomes. `text`, the default, is the plain
text of the document. `html` is the document as an XHTML page, with its
paragraphs, and for some formats its headings, lists and tables, as HTML
elements, and with the metadata Tika found, such as the title, as `meta`
elements in the `head`. `xml` is the same page with an XML declaration on top.
With `html` and `xml`, a document whose metadata holds a character that XML
does not allow, such as the NUL character [...]
+ description: What the body becomes. `text`, the default, is the plain
text of the document. `html` is the document as an XHTML page, with its
paragraphs, and for some formats its headings, lists and tables, as HTML
elements, and with the metadata Tika found, such as the title, as `meta`
elements in the `head`. `xml` is the same page with an XML declaration on top.
A document without a title, such as plain text or the text of an earlier
extraction, gets an empty `title` element.
type: string
enum: ["text", "html", "xml"]
default: text
diff --git
a/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.citrus.it.yaml
new file mode 100644
index 000000000..096c40aab
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.citrus.it.yaml
@@ -0,0 +1,170 @@
+# ---------------------------------------------------------------------------
+# 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: aws-cloudwatch-sink-body-route-test
+# A MetricDatum body, or a List of them, is sent as it is; a List of anything
else fails the message
+variables:
+ - name: "cw.start"
+ value: 'citrus:currentDate(''yyyy-MM-dd'', ''-1d'')'
+ - name: "cw.end"
+ value: 'citrus:currentDate(''yyyy-MM-dd'', ''+2d'')'
+actions:
+ # Create AWS infrastructure (Floci container)
+ - testcontainers:
+ start:
+ localstack:
+ services:
+ - "CLOUD_WATCH"
+ - waitFor:
+ http:
+ url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+
+ - camel:
+ cli:
+ run:
+ integration:
+ file: "aws/cloudwatch/aws-cloudwatch-sink-body-route.yaml"
+ systemProperties:
+ properties:
+ - name: "cw.endpoint"
+ value: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ - name: "cw.accessKey"
+ value: "${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}"
+ - name: "cw.secretKey"
+ value: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}"
+ - name: "cw.awsRegion"
+ value: "${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}"
+ - name: "http.sink.url"
+ value: "http://localhost:${aws.sink.server.port}"
+
+ # The MetricDatum body was sent, and the message is unchanged
+ - http:
+ server: "awsSinkServer"
+ receiveRequest:
+ POST:
+ path: "/datum"
+ type: "plaintext"
+ headers:
+ - name: "X-Body-Type"
+ value:
'software.amazon.awssdk.services.cloudwatch.model.MetricDatum'
+ body:
+ data: 'one'
+ - http:
+ server: "awsSinkServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ body:
+ data: "OK"
+
+ # The List of MetricDatum was sent
+ - http:
+ server: "awsSinkServer"
+ receiveRequest:
+ POST:
+ path: "/datums"
+ type: "plaintext"
+ body:
+ data: 'list'
+ - http:
+ server: "awsSinkServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ body:
+ data: "OK"
+
+ # The List of text failed the message
+ - http:
+ server: "awsSinkServer"
+ receiveRequest:
+ POST:
+ path: "/error"
+ type: "plaintext"
+ headers:
+ - name: "X-Error"
+ value: 'java.lang.IllegalArgumentException'
+ body:
+ data: 'failed'
+ - http:
+ server: "awsSinkServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ body:
+ data: "OK"
+
+ # The data point of the MetricDatum is in CloudWatch, with its value and unit
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ sendRequest:
+ POST:
+ path: "/"
+ contentType: "application/x-www-form-urlencoded"
+ body:
+ data:
'Action=GetMetricStatistics&Version=2010-08-01&Namespace=ShopBody&MetricName=FromBody&StartTime=${cw.start}&EndTime=${cw.end}&Period=259200&Statistics.member.1=Sum'
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data:
'@matches(''(?s).*<Label>FromBody</Label>.*<Sum>7.0</Sum><Unit>Seconds</Unit>.*'')@'
+
+ # The metric headers were not used
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ sendRequest:
+ POST:
+ path: "/"
+ contentType: "application/x-www-form-urlencoded"
+ body:
+ data:
'Action=GetMetricStatistics&Version=2010-08-01&Namespace=ShopBody&MetricName=FromHeader&StartTime=${cw.start}&EndTime=${cw.end}&Period=259200&Statistics.member.1=Sum'
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data: '@matches(''(?s).*<Datapoints(/>|>\s*</Datapoints>).*'')@'
+
+ # The second MetricDatum of the List is in CloudWatch
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ sendRequest:
+ POST:
+ path: "/"
+ contentType: "application/x-www-form-urlencoded"
+ body:
+ data:
'Action=GetMetricStatistics&Version=2010-08-01&Namespace=ShopBody&MetricName=ListB&StartTime=${cw.start}&EndTime=${cw.end}&Period=259200&Statistics.member.1=Sum'
+ - http:
+ client: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+ receiveResponse:
+ response:
+ status: 200
+ type: "plaintext"
+ body:
+ data: '@matches(''(?s).*<Label>ListB</Label>.*<Sum>2.0</Sum>.*'')@'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.yaml
new file mode 100644
index 000000000..51431646d
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/aws/cloudwatch/aws-cloudwatch-sink-body-route.yaml
@@ -0,0 +1,96 @@
+# ---------------------------------------------------------------------------
+# 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: "1000"
+ repeatCount: 1
+ steps:
+ # The metric headers are set, but a MetricDatum body is sent instead
of them
+ - setHeader:
+ name: metric-name
+ constant: 'FromHeader'
+ - setHeader:
+ name: metric-value
+ constant: '3'
+ - setBody:
+ groovy:
'software.amazon.awssdk.services.cloudwatch.model.MetricDatum.builder().metricName("FromBody").value(7d).unit("Seconds").build()'
+ - to:
+ uri: "kamelet:aws-cloudwatch-sink"
+ parameters:
+ cwNamespace: "ShopBody"
+ accessKey: "{{cw.accessKey}}"
+ secretKey: "{{cw.secretKey}}"
+ region: "{{cw.awsRegion}}"
+ overrideEndpoint: "true"
+ uriEndpointOverride: "{{cw.endpoint}}"
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setBody:
+ constant: 'one'
+ - to:
+ uri: "{{http.sink.url}}/datum"
+
+ # A List of MetricDatum: each one is a data point
+ - setBody:
+ groovy:
'[software.amazon.awssdk.services.cloudwatch.model.MetricDatum.builder().metricName("ListA").value(1d).build(),
software.amazon.awssdk.services.cloudwatch.model.MetricDatum.builder().metricName("ListB").value(2d).build()]'
+ - to:
+ uri: "kamelet:aws-cloudwatch-sink"
+ parameters:
+ cwNamespace: "ShopBody"
+ accessKey: "{{cw.accessKey}}"
+ secretKey: "{{cw.secretKey}}"
+ region: "{{cw.awsRegion}}"
+ overrideEndpoint: "true"
+ uriEndpointOverride: "{{cw.endpoint}}"
+ - setBody:
+ constant: 'list'
+ - to:
+ uri: "{{http.sink.url}}/datums"
+
+ # A List of anything else fails the message
+ - setBody:
+ groovy: '["order ORD-1", "order ORD-2"]'
+ - doTry:
+ steps:
+ - to:
+ uri: "kamelet:aws-cloudwatch-sink"
+ parameters:
+ cwNamespace: "ShopBody"
+ accessKey: "{{cw.accessKey}}"
+ secretKey: "{{cw.secretKey}}"
+ region: "{{cw.awsRegion}}"
+ overrideEndpoint: "true"
+ uriEndpointOverride: "{{cw.endpoint}}"
+ - setHeader:
+ name: X-Error
+ constant: 'none'
+ doCatch:
+ - exception:
+ - "java.lang.Exception"
+ steps:
+ - setHeader:
+ name: X-Error
+ simple: "${exception.class.name}"
+ - setBody:
+ constant: 'failed'
+ - to:
+ uri: "{{http.sink.url}}/error"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
index a2d28d703..476f5a75b 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
@@ -47,3 +47,37 @@ actions:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
+
+ # JSON text is kept as it is
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/json-text"
+ type: "plaintext"
+ body:
+ data: '{"id":1}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # Other text becomes one JSON string, in quotes
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/text"
+ type: "plaintext"
+ body:
+ data: '"hello"'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
index d238ecf2b..b37113e1f 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
@@ -37,3 +37,23 @@
simple: "ct=${header.Content-Type}"
- to:
uri: "{{http.sink.url}}/result"
+
+ # A body that is already JSON text is kept as it is, not quoted
+ - removeHeaders:
+ pattern: "*"
+ - setBody:
+ constant: '{"id":1}'
+ - to:
+ uri: "kamelet:json-serialize-action"
+ - to:
+ uri: "{{http.sink.url}}/json-text"
+
+ # Any other text becomes one JSON string, in quotes
+ - removeHeaders:
+ pattern: "*"
+ - setBody:
+ constant: 'hello'
+ - to:
+ uri: "kamelet:json-serialize-action"
+ - to:
+ uri: "{{http.sink.url}}/text"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.citrus.it.yaml
similarity index 75%
copy from
tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.citrus.it.yaml
index a2d28d703..50dba6c82 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.citrus.it.yaml
@@ -15,33 +15,33 @@
# limitations under the License.
# ---------------------------------------------------------------------------
-name: json-serialize-action-route-test
+name: kafka-batch-manual-commit-action-without-source-route-test
actions:
- camel:
cli:
run:
waitForRunningState: false
integration:
- file: "json/json-serialize-action-route.yaml"
+ file:
"kafka/kafka-batch-manual-commit-action-without-source-route.yaml"
systemProperties:
properties:
- name: "http.sink.url"
- value: "http://localhost:${http.server.port}"
+ value: "http://localhost:${kafka.sink.server.port}"
+ # the integration starts, and the action passes the message on unchanged
- http:
- server: "httpServer"
+ server: "kafkaSinkServer"
receiveRequest:
POST:
path: "/result"
+ type: "plaintext"
headers:
- name: "X-Body-Type"
- value: '[B'
- - name: "X-Content-Type"
- value: 'ct=application/json'
+ value: "java.lang.String"
body:
- data: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ data: "record-1"
- http:
- server: "httpServer"
+ server: "kafkaSinkServer"
sendResponse:
response:
status: 200
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.yaml
similarity index 77%
copy from
tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.yaml
index d238ecf2b..ffff5a3de 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-batch-manual-commit-action-without-source-route.yaml
@@ -15,6 +15,8 @@
# limitations under the License.
# ---------------------------------------------------------------------------
+# Without kafka-source in the integration, the Kamelet brings the Kafka
component itself; without the commit header it
+# does nothing
- route:
from:
uri: "timer:tick"
@@ -23,17 +25,11 @@
repeatCount: 1
steps:
- setBody:
- constant: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ constant: 'record-1'
- to:
- uri: "kamelet:json-deserialize-action"
- - to:
- uri: "kamelet:json-serialize-action"
- # what the Kamelet gives: the Java type of the body and the
Content-Type
+ uri: "kamelet:kafka-batch-manual-commit-action"
- setHeader:
name: X-Body-Type
simple: "${body.getClass().getName()}"
- - setHeader:
- name: X-Content-Type
- simple: "ct=${header.Content-Type}"
- to:
uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.citrus.it.yaml
similarity index 76%
copy from
tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.citrus.it.yaml
index a2d28d703..6905c9489 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.citrus.it.yaml
@@ -15,33 +15,33 @@
# limitations under the License.
# ---------------------------------------------------------------------------
-name: json-serialize-action-route-test
+name: kafka-manual-commit-action-without-source-route-test
actions:
- camel:
cli:
run:
waitForRunningState: false
integration:
- file: "json/json-serialize-action-route.yaml"
+ file: "kafka/kafka-manual-commit-action-without-source-route.yaml"
systemProperties:
properties:
- name: "http.sink.url"
- value: "http://localhost:${http.server.port}"
+ value: "http://localhost:${kafka.sink.server.port}"
+ # the integration starts, and the action passes the message on unchanged
- http:
- server: "httpServer"
+ server: "kafkaSinkServer"
receiveRequest:
POST:
path: "/result"
+ type: "plaintext"
headers:
- name: "X-Body-Type"
- value: '[B'
- - name: "X-Content-Type"
- value: 'ct=application/json'
+ value: "java.lang.String"
body:
- data: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ data: "record-1"
- http:
- server: "httpServer"
+ server: "kafkaSinkServer"
sendResponse:
response:
status: 200
diff --git
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.yaml
similarity index 77%
copy from
tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
copy to
tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.yaml
index d238ecf2b..4bf36df92 100644
---
a/tests/camel-kamelets-itest/src/test/resources/json/json-serialize-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-manual-commit-action-without-source-route.yaml
@@ -15,6 +15,8 @@
# limitations under the License.
# ---------------------------------------------------------------------------
+# Without kafka-source in the integration, the Kamelet brings the Kafka
component itself; without the commit header it
+# does nothing
- route:
from:
uri: "timer:tick"
@@ -23,17 +25,11 @@
repeatCount: 1
steps:
- setBody:
- constant: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ constant: 'record-1'
- to:
- uri: "kamelet:json-deserialize-action"
- - to:
- uri: "kamelet:json-serialize-action"
- # what the Kamelet gives: the Java type of the body and the
Content-Type
+ uri: "kamelet:kafka-manual-commit-action"
- setHeader:
name: X-Body-Type
simple: "${body.getClass().getName()}"
- - setHeader:
- name: X-Content-Type
- simple: "ct=${header.Content-Type}"
- to:
uri: "{{http.sink.url}}/result"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.citrus.it.yaml
index a79d116da..40c4877e2 100644
---
a/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.citrus.it.yaml
@@ -49,3 +49,42 @@ actions:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
+
+ # A JsonNode gives an empty body
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/json-node"
+ type: "plaintext"
+ headers:
+ - name: "X-Body-Null"
+ value: 'true'
+ body:
+ data: ''
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # The same JsonNode, turned into JSON text first, is transformed
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/json-node-serialized"
+ headers:
+ - name: "X-Body-Type"
+ value: 'java.util.LinkedHashMap'
+ body:
+ data: '{"customer":"Ann","prices":[2,3]}'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.yaml
index ad76f26cf..82db865fb 100644
---
a/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/transformation/jolt-transformation-action-route.yaml
@@ -39,3 +39,45 @@
uri: "kamelet:json-serialize-action"
- to:
uri: "{{http.sink.url}}/result"
+
+ # A Jackson JsonNode is not read: the body becomes empty (null), with
no error
+ - removeHeaders:
+ pattern: "*"
+ - setBody:
+ constant: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ - to:
+ uri: "kamelet:json-deserialize-action"
+ - to:
+ uri: "kamelet:jolt-transformation-action"
+ parameters:
+ template: 'classpath:order-jolt.json'
+ - setHeader:
+ name: X-Body-Null
+ groovy: "body == null"
+ # without a body the HTTP call would be a GET
+ - setHeader:
+ name: CamelHttpMethod
+ constant: POST
+ - to:
+ uri: "{{http.sink.url}}/json-node"
+
+ # With json-serialize-action before it, the JsonNode is read as JSON
text
+ - removeHeaders:
+ pattern: "*"
+ - setBody:
+ constant: '{"name":"Ann","items":[{"price":2},{"price":3}]}'
+ - to:
+ uri: "kamelet:json-deserialize-action"
+ - to:
+ uri: "kamelet:json-serialize-action"
+ - to:
+ uri: "kamelet:jolt-transformation-action"
+ parameters:
+ template: 'classpath:order-jolt.json'
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - to:
+ uri: "kamelet:json-serialize-action"
+ - to:
+ uri: "{{http.sink.url}}/json-node-serialized"