Messaging
- Code completion of XsdSchema and XsdSchemaRepository Spring beans
- Code completion of SimpleJsonSchema and JsonSchemaRepository Spring beans
- MessageType code completion
- MessageType validation
- Message header code completion
- Content type code completion
- Message header is replaceable with Citrus constant
- Invalid SOAP attachment encoding type
- Kafka message selector and filter keys
- Inspection
NOTE: action specific language injections can be found in the language injections document.
Code completion of XsdSchema and XsdSchemaRepository Spring beans
To make the discovery of XsdSchema and XsdSchemaRepository-type beans easier in test code, the following methods’ arguments are extended with code completion:
- Java and Groovy DSLs:
XmlValidationContextBuilder#schema(): for exampleXmlMessageValidationContext.Builder.xml().schema("")XmlValidationContextBuilder#schemaRepository(): for exampleXmlMessageValidationContext.Builder.xml().schemaRepository("")
- XML DSL:
test.*.message@schemaandtest.*.message@schema-respositorytag attribute - Spring XML DSL: tag attributes of
testcase.*.message@schema,testcase.*.message@schema-repository,testcase.*.[send-response,receive-response,GET,POST,...].http:body@schema,testcase.*.[send-response,receive-response,GET,POST,...].http:body@schema-repositorytestcase.*.ws:fault-detail@schema,testcase.*.ws:fault-detail@schema-repository
The type text on the right hand side of each completion item shows the Spring configuration class the bean is defined in. Also, while the completion list is displayed, one can also navigate to the bean definition via Ctrl+B and similar shortcuts.

Code completion of SimpleJsonSchema and JsonSchemaRepository Spring beans
To make the discovery of SimpleJsonSchema and JsonSchemaRepository-type beans easier in test code, the following locations are extended with code completion:
- Java and Groovy DSLs:
JsonMessageValidationContext.Builder#schema(): for exampleJsonMessageValidationContext.Builder.json().schema("")JsonMessageValidationContext.Builder#schemaRepository(): for exampleJsonMessageValidationContext.Builder.json().schemaRepository("")
- XML DSL:
test.*.message@schemaandtest.*.message@schema-respositorytag attribute - Spring XML DSL: tag attributes of
testcase.*.message@schema,testcase.*.message@schema-repository,testcase.*.[send-response,receive-response,GET,POST,...].http:body@schema,testcase.*.[send-response,receive-response,GET,POST,...].http:body@schema-repository
The type text on the right hand side of each completion item shows the Spring class/file the bean is defined in. Also, while the completion list is displayed, one can also navigate to the bean definition via Ctrl+B and similar shortcuts.

MessageType code completion
To simplify the insertion of MessageType values when configuring a message’s type in send and receive actions, this code completion provides the possible values at:
- Java and Groovy DSLs:
type(String)insend()andreceive()call chains - XML DSL:
test.*.message@typeattribute - Spring XML DSL:
testcase.*.message@typeattribute - YAML DSL: lowercase values in
actions.soap.sendFault.message.type,actions.send.message.typeandactions.receive.message.typeproperties

MessageType validation
Since MessageType values may be specified in a case-insensitive way in the YAML DSL, Citric incorporates an inspection to validate those value, instead of using the Citrus YAML DSL schema for that, in the following properties:
actions.soap.sendFault.message.typeactions.send.message.typeactions.receive.message.type
Message header code completion
JMS, Kafka and other messaging types have message headers specific to them. With this code completion, it is easier to discover them.
The corresponding header names are suggested when their Citrus packages are used in the project. The header names are collected from the following utility classes from the aforementioned citrus packages:
- JMS:
JmsMessageHeaders - Kafka:
KafkaMessageHeaders - HTTP:
HttpMessageHeaders - SOAP:
SoapMessageHeaders - WS-Addressing:
WsAddressingMessageHeaders - Apache Camel:
CamelMessageHeaders
This is currently supported in *Header() methods of the Message class, as well as in header() calls in send(Endpoint) and receive(Endpoint) call chains. In case the concrete Endpoint type used in the call chain can be evaluated, only the message headers for that endpoint type are suggested.
The type text on the right side of each item shows the aforementioned utility classes’ names.
XML and Spring XML DSLs
This completion is available in the name attribute of:
- XML DSL: the
test.*.message.headers.headertag - Spring XML DSL: the
testcase.*.send/receive.header.elementtag

Content type code completion
HTTP media types are used at various places, for one, in the citrus-http package. At those places, a list of media types is suggested:
- Java DSL:
HttpClientBuilder.contentType()in for examplenew HttpClientBuilder().contentType("...").build();call chainsHttpMessageBuilderSupport.contentType()/.accept()in for exampleHttpActionBuilder.http().client("client").send().post().message()...call chains.ReceiveSoapMessageAction.SoapMessageBuilderSupport.attachment()in for exampleSoapActionBuilder.soap().server("server").receive().message().attachment("", "...", "")SoapAttachment.setContentType()
- XML and Spring XML DSLs:
content-typeattribute anywhere in Citrus XML filesheader@valueattribute when thenameattribute is set to Content-Typeheader.element@valueattribute when thenameattribute is set to Content-Type

Message header is replaceable with Citrus constant
JMS, Kafka and other library-specific message headers are also stored in dedicated Citrus utility classes, so this inspection reports header name literals, and provides a quick fix to replace them with their corresponding constant references.
The Java and Groovy DSLs are supported.
The following Citrus utilities are supported now:
- JMS:
JmsMessageHeaders - Kafka:
KafkaMessageHeaders - HTTP:
HttpMessageHeaders - SOAP:
SoapMessageHeaders - WS-Addressing:
WsAddressingMessageHeaders - Apache Camel:
CamelMessageHeaders

Invalid SOAP attachment encoding type
The SoapAttachment type can be configured with an encoding type for which only base64Binary and hexBinary are valid values.
This inspection reports invalid values in:
- Java and Groovy DSLs: the
setEncodingType()method of theSoapAttachmentclass - XML and Spring XML DSLs: the
<ws:attachment encoding-type="...">attribute value

Kafka message selector and filter keys
Code completion
This code completion suggests the available message header selector and message filter keys for Kafka message configurations.
Java and Groovy DSLs
The message header selectors (header-filter-key, header-filter-value, header-filter-comparator) are completed in the following method calls:
KafkaMessageByHeaderSelector.KafkaMessageByHeaderSelectorBuilder#key(...)KafkaMessageByHeaderSelector#kafkaHeaderContains(...)KafkaMessageByHeaderSelector#kafkaHeaderEquals(...)

XML and Spring XML DSLs
The message header selectors and filters (header-filter-key, header-filter-value, header-filter-comparator, event-lookback-window, poll-timeout) are completed in the following XML attributes:
- XML DSL:
test.*.receive.selector.element@name - Spring XML DSL:
testcase.*.receive.selector.element@name
Value matching strategies (EQUALS, CONTAINS, STARTS_WITH, ENDS_WITH) are also completed when the selector is set to header-filter-comparator.

Inspection
An inspection reports invalid value matching strategy values specified in the value attribute of receive.selector.element tags when the key is header-filter-comparator.
Valid values are the entries defined in the KafkaMessageByHeaderSelector.ValueMatchingStrategy enum.
