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.git
The following commit(s) were added to refs/heads/main by this push:
new d779e2dd02c5 CAMEL-27869: camel-test-citrus: the component log and
reportGroup options do nothing, a missing validation module is never reported
(#31156)
d779e2dd02c5 is described below
commit d779e2dd02c5a8c991e39c606e31fb9cf4fa97c3
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Dec 1 14:27:13 2026 +0100
CAMEL-27869: camel-test-citrus: the component log and reportGroup options
do nothing, a missing validation module is never reported (#31156)
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../apache/camel/catalog/components/citrus.json | 2 +-
.../camel/catalog/docs/citrus-component.adoc | 4 +-
.../org/apache/camel/component/citrus/citrus.json | 2 +-
.../src/main/docs/citrus-component.adoc | 4 +-
.../camel/component/citrus/CitrusComponent.java | 12 +++
.../camel/component/citrus/CitrusEndpoint.java | 14 +--
.../citrus/CitrusValidationProcessor.java | 22 ++--
.../citrus/CitrusComponentOptionsTest.java | 111 +++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc | 23 +++++
.../endpoint/dsl/CitrusEndpointBuilderFactory.java | 19 ++--
10 files changed, 185 insertions(+), 28 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/citrus.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/citrus.json
index 3bce65db0331..9d58244324e1 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/citrus.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/citrus.json
@@ -38,7 +38,7 @@
"name": { "index": 1, "kind": "path", "displayName": "Name", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "An optional name that makes this a separate endpoint with its
own specs and message count, so a test can use several Citrus endpoints of the
same operation, such as citrus:receive\/orders and citrus:receive\/payments." },
"assertPeriod": { "index": 2, "kind": "parameter", "displayName": "Assert
Period", "group": "producer", "label": "producer", "required": false, "type":
"duration", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds that
assertIsSatisfied() waits after the expectations are met, before it checks them
all again. The first check passes as soon as the expected number of messages
arrived, so a period is needed to detect me [...]
"expectedCount": { "index": 3, "kind": "parameter", "displayName":
"Expected Count", "group": "producer", "label": "producer", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": -1, "description": "The number of messages
that this endpoint must receive. assertIsSatisfied() waits up to resultWaitTime
for them, and then checks that exactly this number arrived; a message that
arrives after the check is not s [...]
- "messageType": { "index": 4, "kind": "parameter", "displayName": "Message
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The Citrus message type of the body, which
selects the Citrus message validators: json, xml, yaml, plaintext, binary,
binary_base64, gzip or gzip_base64 (case-insensitive). The binary and gzip
types read the body as bytes, the oth [...]
+ "messageType": { "index": 4, "kind": "parameter", "displayName": "Message
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The Citrus message type of the body, which
selects the Citrus message validators: json, xml, yaml, plaintext, binary,
binary_base64 or gzip_base64 (case-insensitive). The binary and binary_base64
types read the body as bytes; gzip [...]
"copyOnExchange": { "index": 5, "kind": "parameter", "displayName": "Copy
On Exchange", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to keep a copy of each received Exchange, instead of
the Exchange itself. The copy has its own message, headers and exchange
properties (the body object is shared), so chang [...]
"failFast": { "index": 6, "kind": "parameter", "displayName": "Fail Fast",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to check the expectations on each message as it arrives (the
expectations that check each message, such as on bodies and headers), so that
assertIsSatisfied() fails at the first failed e [...]
"lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/citrus-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/citrus-component.adoc
index 80d431c5edf6..875d84d976f0 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/citrus-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/citrus-component.adoc
@@ -222,7 +222,7 @@ Plain text validation performs exact string comparison with
support for:
* **`@variable('name')@`** to extract values at specific positions into test
variables.
* **Whitespace normalization** (configurable) to ignore line separator
differences (CR, LF, CRLF)
or all whitespace.
-* **Gzip** and **binary/base64** content comparison via the respective message
types.
+* **Gzip-base64** and **binary/base64** content comparison via the respective
message types.
==== YAML validation
@@ -236,7 +236,7 @@ YAML validation compares YAML documents structurally,
similar to JSON validation
The endpoint reads the message body as text before it validates it: a
`String`, a `byte[]`, a file
(`java.io.File`, `java.nio.file.Path` or the file of a file consumer) or a
stream. For the
-`binary`, `binary_base64`, `gzip` and `gzip_base64` message types it reads the
body as bytes instead.
+`binary`, `binary_base64` and `gzip_base64` message types it reads the body as
bytes instead.
A stream body (an `InputStream` or a `Reader`) is cached first when stream
caching is turned off, so the
next step in the route can still read it. Any other body (such as a `Map`) is
handed to Citrus as is, and
diff --git
a/components/camel-test/camel-test-citrus/src/generated/resources/META-INF/org/apache/camel/component/citrus/citrus.json
b/components/camel-test/camel-test-citrus/src/generated/resources/META-INF/org/apache/camel/component/citrus/citrus.json
index 3bce65db0331..9d58244324e1 100644
---
a/components/camel-test/camel-test-citrus/src/generated/resources/META-INF/org/apache/camel/component/citrus/citrus.json
+++
b/components/camel-test/camel-test-citrus/src/generated/resources/META-INF/org/apache/camel/component/citrus/citrus.json
@@ -38,7 +38,7 @@
"name": { "index": 1, "kind": "path", "displayName": "Name", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "An optional name that makes this a separate endpoint with its
own specs and message count, so a test can use several Citrus endpoints of the
same operation, such as citrus:receive\/orders and citrus:receive\/payments." },
"assertPeriod": { "index": 2, "kind": "parameter", "displayName": "Assert
Period", "group": "producer", "label": "producer", "required": false, "type":
"duration", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "description": "The time in milliseconds that
assertIsSatisfied() waits after the expectations are met, before it checks them
all again. The first check passes as soon as the expected number of messages
arrived, so a period is needed to detect me [...]
"expectedCount": { "index": 3, "kind": "parameter", "displayName":
"Expected Count", "group": "producer", "label": "producer", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": -1, "description": "The number of messages
that this endpoint must receive. assertIsSatisfied() waits up to resultWaitTime
for them, and then checks that exactly this number arrived; a message that
arrives after the check is not s [...]
- "messageType": { "index": 4, "kind": "parameter", "displayName": "Message
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The Citrus message type of the body, which
selects the Citrus message validators: json, xml, yaml, plaintext, binary,
binary_base64, gzip or gzip_base64 (case-insensitive). The binary and gzip
types read the body as bytes, the oth [...]
+ "messageType": { "index": 4, "kind": "parameter", "displayName": "Message
Type", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The Citrus message type of the body, which
selects the Citrus message validators: json, xml, yaml, plaintext, binary,
binary_base64 or gzip_base64 (case-insensitive). The binary and binary_base64
types read the body as bytes; gzip [...]
"copyOnExchange": { "index": 5, "kind": "parameter", "displayName": "Copy
On Exchange", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to keep a copy of each received Exchange, instead of
the Exchange itself. The copy has its own message, headers and exchange
properties (the body object is shared), so chang [...]
"failFast": { "index": 6, "kind": "parameter", "displayName": "Fail Fast",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether to check the expectations on each message as it arrives (the
expectations that check each message, such as on bodies and headers), so that
assertIsSatisfied() fails at the first failed e [...]
"lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
diff --git
a/components/camel-test/camel-test-citrus/src/main/docs/citrus-component.adoc
b/components/camel-test/camel-test-citrus/src/main/docs/citrus-component.adoc
index 80d431c5edf6..875d84d976f0 100644
---
a/components/camel-test/camel-test-citrus/src/main/docs/citrus-component.adoc
+++
b/components/camel-test/camel-test-citrus/src/main/docs/citrus-component.adoc
@@ -222,7 +222,7 @@ Plain text validation performs exact string comparison with
support for:
* **`@variable('name')@`** to extract values at specific positions into test
variables.
* **Whitespace normalization** (configurable) to ignore line separator
differences (CR, LF, CRLF)
or all whitespace.
-* **Gzip** and **binary/base64** content comparison via the respective message
types.
+* **Gzip-base64** and **binary/base64** content comparison via the respective
message types.
==== YAML validation
@@ -236,7 +236,7 @@ YAML validation compares YAML documents structurally,
similar to JSON validation
The endpoint reads the message body as text before it validates it: a
`String`, a `byte[]`, a file
(`java.io.File`, `java.nio.file.Path` or the file of a file consumer) or a
stream. For the
-`binary`, `binary_base64`, `gzip` and `gzip_base64` message types it reads the
body as bytes instead.
+`binary`, `binary_base64` and `gzip_base64` message types it reads the body as
bytes instead.
A stream body (an `InputStream` or a `Reader`) is cached first when stream
caching is turned off, so the
next step in the route can still read it. Any other body (such as a `Map`) is
handed to Citrus as is, and
diff --git
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusComponent.java
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusComponent.java
index f41e7e400a83..0f175dc5cdf6 100644
---
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusComponent.java
+++
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusComponent.java
@@ -19,8 +19,11 @@ package org.apache.camel.component.citrus;
import java.util.Map;
import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
import org.apache.camel.component.mock.MockComponent;
+import org.apache.camel.spi.CamelLogger;
import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.processor.ThroughputLogger;
@Component("citrus")
public class CitrusComponent extends MockComponent {
@@ -45,6 +48,15 @@ public class CitrusComponent extends MockComponent {
}
endpoint.setOperation(operation);
endpoint.setName(name);
+ // propagate log and reportGroup from component to endpoint (mirrors
MockComponent behaviour)
+ endpoint.setLog(isLog());
+ Integer reportGroup = getAndRemoveParameter(parameters, "reportGroup",
Integer.class);
+ if (reportGroup != null) {
+ Processor reporter = new ThroughputLogger(
+ new CamelLogger("org.apache.camel.component.citrus:" +
remaining), reportGroup);
+ endpoint.setReporter(reporter);
+ endpoint.setReportGroup(reportGroup);
+ }
setProperties(endpoint, parameters);
return endpoint;
}
diff --git
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusEndpoint.java
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusEndpoint.java
index 4d1c95dc12fd..4707e80b7012 100644
---
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusEndpoint.java
+++
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusEndpoint.java
@@ -71,12 +71,14 @@ public class CitrusEndpoint extends MockEndpoint {
private String name;
@UriParam(description = "The Citrus message type of the body, which
selects the Citrus message validators: json, xml,"
- + " yaml, plaintext, binary, binary_base64, gzip
or gzip_base64 (case-insensitive). The binary and"
- + " gzip types read the body as bytes, the others
as text. When not set, the type is detected from"
- + " the expected body of the spec (JSON, XML or
YAML, else plaintext, also for a body set with a"
- + " MessagePayloadBuilder). The Citrus validation
module of the type, such as"
- + " citrus-validation-json, must be on the
classpath, otherwise Citrus logs a warning and compares"
- + " the bodies as plain text.")
+ + " yaml, plaintext, binary, binary_base64 or
gzip_base64 (case-insensitive). The binary and"
+ + " binary_base64 types read the body as bytes;
gzip_base64 reads it as bytes and expects"
+ + " gzip-compressed, base64-encoded content; the
others read it as text. When not set, the type is"
+ + " detected from the expected body of the spec
(JSON, XML or YAML, else plaintext, also for a body"
+ + " set with a MessagePayloadBuilder). The binary
and binary_base64 types require"
+ + " citrus-validation-binary; gzip_base64 requires
citrus-validation-text."
+ + " Text types (json, xml, yaml) fall back to
plain-text comparison when citrus-validation-text is"
+ + " present but their type-specific module is
absent.")
private String messageType;
private volatile CitrusContext citrusContext;
diff --git
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusValidationProcessor.java
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusValidationProcessor.java
index 46f98f27bb72..77d42b3ac4dd 100644
---
a/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusValidationProcessor.java
+++
b/components/camel-test/camel-test-citrus/src/main/java/org/apache/camel/component/citrus/CitrusValidationProcessor.java
@@ -36,6 +36,7 @@ import org.apache.camel.Processor;
import org.apache.camel.StreamCache;
import org.apache.camel.WrappedFile;
import org.citrusframework.context.TestContext;
+import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.message.DefaultMessage;
import org.citrusframework.message.MessagePayloadBuilder;
import org.citrusframework.message.MessagePayloadUtils;
@@ -183,15 +184,20 @@ class CitrusValidationProcessor implements Processor {
String resolvedType) {
MessageValidatorRegistry registry =
testContext.getMessageValidatorRegistry();
- List<MessageValidator<? extends ValidationContext>> validators
- = registry.findMessageValidators(resolvedType,
receivedMessage);
-
- if (validators.isEmpty()) {
- throw new IllegalStateException(
+ List<MessageValidator<? extends ValidationContext>> validators;
+ try {
+ // mustFindValidator=true: Citrus throws CitrusRuntimeException
when no type-specific
+ // validator is registered, which surfaces missing validation
modules instead of
+ // silently falling back to plain-text comparison.
+ validators = registry.findMessageValidators(resolvedType,
receivedMessage, true);
+ } catch (CitrusRuntimeException e) {
+ throw new CitrusRuntimeException(
"No Citrus message validator found for message type '" +
resolvedType
- + "'. Make sure to add the
required Citrus validation module "
- + "to the test classpath (e.g.
citrus-validation-json, "
- + "citrus-validation-xml,
citrus-validation-text).");
+ + "'. Make sure to add the
required Citrus validation module "
+ + "to the test classpath (e.g.
citrus-validation-json, "
+ + "citrus-validation-xml,
citrus-validation-text, "
+ + "citrus-validation-binary).",
+ e);
}
LOG.debug("Validating exchange with {} Citrus validator(s) for message
type '{}'",
diff --git
a/components/camel-test/camel-test-citrus/src/test/java/org/apache/camel/component/citrus/CitrusComponentOptionsTest.java
b/components/camel-test/camel-test-citrus/src/test/java/org/apache/camel/component/citrus/CitrusComponentOptionsTest.java
new file mode 100644
index 000000000000..3a65190f46d1
--- /dev/null
+++
b/components/camel-test/camel-test-citrus/src/test/java/org/apache/camel/component/citrus/CitrusComponentOptionsTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+package org.apache.camel.component.citrus;
+
+import java.nio.charset.StandardCharsets;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/**
+ * Regression test for CAMEL-27869: the {@code log} and {@code reportGroup}
component-level options were not propagated
+ * to the endpoint, and a missing validation module was silently ignored
instead of reported.
+ */
+class CitrusComponentOptionsTest extends CamelTestSupport {
+
+ // --- log option ---
+
+ @Test
+ void componentLogOptionPropagatesToEndpoint() {
+ // Set log=true on the component; createEndpoint() must propagate it
to the CitrusEndpoint.
+ // (URI-level log=true already worked pre-fix via setProperties; this
tests the component path.)
+ CitrusComponent component = context.getComponent("citrus",
CitrusComponent.class);
+ component.setLog(true);
+
+ CitrusEndpoint citrus =
context.getEndpoint("citrus:validate/log-component", CitrusEndpoint.class);
+ assertThat(citrus.isLog())
+ .as("component-level log option must be propagated to the
CitrusEndpoint")
+ .isTrue();
+ }
+
+ @Test
+ void logOptionDefaultIsFalse() {
+ CitrusEndpoint citrus =
context.getEndpoint("citrus:validate/log-default", CitrusEndpoint.class);
+ assertThat(citrus.isLog())
+ .as("log option must default to false when not set")
+ .isFalse();
+ }
+
+ // --- reportGroup option ---
+
+ @Test
+ void reportGroupOptionPropagatesToEndpoint() {
+ // reportGroup=10 set via URI query parameter
+ CitrusEndpoint citrus =
context.getEndpoint("citrus:validate/rg-test?reportGroup=10",
CitrusEndpoint.class);
+ assertThat(citrus.getReportGroup())
+ .as("reportGroup option must be propagated to the
CitrusEndpoint")
+ .isEqualTo(10);
+ assertThat(citrus.getReporter())
+ .as("a ThroughputLogger reporter must be registered when
reportGroup is set")
+ .isNotNull();
+ }
+
+ @Test
+ void reporterIsNullByDefault() {
+ CitrusEndpoint citrus =
context.getEndpoint("citrus:validate/rg-default", CitrusEndpoint.class);
+ assertThat(citrus.getReporter())
+ .as("reporter must be null when reportGroup is not set")
+ .isNull();
+ }
+
+ // --- missing validation module ---
+
+ @Test
+ void unknownMessageTypeShouldBeReported() throws Exception {
+ // messageType=BINARY requires citrus-validation-binary (not on the
test classpath).
+ // Send a body that the old text-fallback would have accepted
("ignored" as bytes), so
+ // the test only passes when the new code path fires and surfaces the
missing module.
+ CitrusEndpoint citrus = context.getEndpoint(
+ "citrus:validate/missing-module?messageType=BINARY",
CitrusEndpoint.class);
+ citrus.validateAll().body("ignored");
+ citrus.expectedMessageCount(1);
+
+ template.sendBody("direct:missing-module",
"ignored".getBytes(StandardCharsets.UTF_8));
+
+ // Before the fix the 2-arg findMessageValidators returned the
text-fallback and body
+ // comparison succeeded silently. After the fix the 3-arg overload
throws, and we rethrow
+ // with the module-hint message.
+ assertThatThrownBy(citrus::assertIsSatisfied)
+ .isInstanceOf(AssertionError.class)
+ .hasMessageContaining("No Citrus message validator found for
message type 'BINARY'");
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+
from("direct:missing-module").to("citrus:validate/missing-module?messageType=BINARY");
+ }
+ };
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index 34200b07b0c9..213b38a3a54d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -189,6 +189,29 @@ starts, the same error that was already raised when the
endpoint was still activ
queue was silently replaced with a fresh one,
which caused the buffered messages to be discarded.
+=== camel-test-citrus - missing binary validation module now fails instead of
silently falling back
+
+When a `citrus:validate/...?messageType=BINARY` (or `BINARY_BASE64`,
`GZIP_BASE64`) endpoint
+cannot find a Citrus message validator and no other validator matches,
validation now fails with a
+`CitrusRuntimeException` naming the type and listing the modules to add (for
example
+`citrus-validation-binary` for `binary` and `binary_base64`, or
`citrus-validation-text` for `gzip_base64`
+and for the `plaintext` type).
+
+Previously, `MessageValidatorRegistry.findMessageValidators` silently fell
back to
+`DefaultTextEqualsMessageValidator` when no type-specific validator was
registered, so a missing binary
+validation module caused plain-text body comparison (which always fails for
byte payloads, but without a
+meaningful error message).
+
+For text message types (json, xml, yaml, plaintext),
`MessageValidatorRegistry` still retries with the
+XML, JSON and finally PLAINTEXT fallback validators before it declares a
validator missing, so a text body
+with `messageType=JSON` and no `citrus-validation-json` on the classpath
continues to be compared as plain
+text when `citrus-validation-text` is present. Add the required validation
module to get type-specific
+validation. This also affects header-only validation specs, whose type is
auto-detected as `plaintext`;
+these now require `citrus-validation-text` to be on the classpath to avoid
falling back silently.
+
+Note: the `gzip` message type (without base64 encoding) has been removed from
the documented types.
+Use `gzip_base64` instead (requires `citrus-validation-text`).
+
=== camel-aws2-translate - a String CamelAwsTranslateTerminologyNames header
is used, and other types fail
The `CamelAwsTranslateTerminologyNames` header can now be a `String` with one
terminology name or names separated by
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CitrusEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CitrusEndpointBuilderFactory.java
index 0c4eb485df69..afdd80b181fe 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CitrusEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CitrusEndpointBuilderFactory.java
@@ -131,14 +131,17 @@ public interface CitrusEndpointBuilderFactory {
}
/**
* The Citrus message type of the body, which selects the Citrus
message
- * validators: json, xml, yaml, plaintext, binary, binary_base64, gzip
- * or gzip_base64 (case-insensitive). The binary and gzip types read
the
- * body as bytes, the others as text. When not set, the type is
detected
- * from the expected body of the spec (JSON, XML or YAML, else
- * plaintext, also for a body set with a MessagePayloadBuilder). The
- * Citrus validation module of the type, such as
citrus-validation-json,
- * must be on the classpath, otherwise Citrus logs a warning and
- * compares the bodies as plain text.
+ * validators: json, xml, yaml, plaintext, binary, binary_base64 or
+ * gzip_base64 (case-insensitive). The binary and binary_base64 types
+ * read the body as bytes; gzip_base64 reads it as bytes and expects
+ * gzip-compressed, base64-encoded content; the others read it as text.
+ * When not set, the type is detected from the expected body of the
spec
+ * (JSON, XML or YAML, else plaintext, also for a body set with a
+ * MessagePayloadBuilder). The binary and binary_base64 types require
+ * citrus-validation-binary; gzip_base64 requires
+ * citrus-validation-text. Text types (json, xml, yaml) fall back to
+ * plain-text comparison when citrus-validation-text is present but
+ * their type-specific module is absent.
*
* The option is a: <code>java.lang.String</code> type.
*