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 to be replaced with Citrus constant
- Invalid SOAP attachment encoding type
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@schema
andtest.*.message@schema-respository
tag 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
testcase.*.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@schema
andtest.*.message@schema-respository
tag 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@type
attribute - Spring XML DSL:
testcase.*.message@type
attribute - YAML DSL: lowercase values in
actions.soap.sendFault.message.type
,actions.send.message.type
andactions.receive.message.type
properties
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.type
actions.send.message.type
actions.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.header
tag - Spring XML DSL: the
testcase.*.send/receive.header.element
tag
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-type
attribute anywhere in Citrus XML filesheader@value
attribute when thename
attribute is set to Content-Typeheader.element@value
attribute when thename
attribute is set to Content-Type
Message header to be replaced 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 theSoapAttachment
class - XML and Spring XML DSLs: the
<ws:attachment encoding-type="...">
attribute value