Skip to content

Commit

Permalink
fix: message to be validated is logged
Browse files Browse the repository at this point in the history
  • Loading branch information
phos-web committed Oct 24, 2024
1 parent d512416 commit 26dbaa9
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.Map.Entry;

import static org.citrusframework.util.StringUtils.hasText;
import static org.citrusframework.util.XMLUtils.prettyPrint;

/**
* Default message validator implementation. Working on XML messages
Expand Down Expand Up @@ -77,8 +78,7 @@ public DomXmlMessageValidator(XmlSchemaValidation schemaValidator) {
@Override
public void validateMessage(Message receivedMessage, Message controlMessage,
TestContext context, XmlMessageValidationContext validationContext) throws ValidationException {
logger.debug("Start XML message validation ...");

logger.debug("Start XML message validation: {}", prettyPrint(receivedMessage.getPayload(String.class)));
try {
if (validationContext.isSchemaValidationEnabled()) {
schemaValidator.validate(receivedMessage, context, validationContext);
Expand All @@ -103,9 +103,6 @@ public void validateMessage(Message receivedMessage, Message controlMessage,
logger.debug("XML message validation successful: All values OK");
} catch (ClassCastException | DOMException | LSException e) {
throw new CitrusRuntimeException(e);
} catch (ValidationException ex) {
logger.error("Failed to validate:\n{}", XMLUtils.prettyPrint(receivedMessage.getPayload(String.class)));
throw ex;
}
}

Expand Down

0 comments on commit 26dbaa9

Please sign in to comment.