Petals-BC-REST 2.5.0+

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (1)

View Page History
{code}

h3. Assertion 'assertJBIStatus'

This assertion validates the transformation of the given HTTP response into the given JBI status.

The parameters of this assertion are:
* {{expectedStatus}}: The expected JBI status,
* {{opUnderTest}}: The service operation under test generating the JBI OUT message. The configuration of this service operation is given in the service unit JBI descriptor,
* {{mep}}: The message exchange pattern with which the JBI request was sent to the service operation under test. Must be InOnly or RobustInOnly.
* {{httpStatus}}: The HTTP status code of the HTTP response simulated,
* {{httpReason}}: The HTTP reason of the HTTP response simulated,
* {{httpBodyResourceName}}: Name of the resource containing the HTTP body of the HTTP response simulated,
* {{httpBodyContentType}}: The content type of the HTTP response simulated,
* {{inXMLPayloadResourceName}}: Name of the resource containing the XML payload of the JBI request sent to the service operation under test.

Example:
{code}
@ServiceOperationUnderTestExtension(
operation = @ServiceOperationName(namespace = NAMESPACE, name = "delete"),
placeholders = {
@Placeholder(name = "api-base.url", value = API_BASE_URL) },
suJbiDescriptorResourceName = RESOURCES_HOME + "jbi.xml"
)
public static ServiceOperationUnderTest OPERATION_DELETE_UNDER_TEST;

@Test
public void assertJBIResponse_ack() throws Exception {
assertJBIStatus(ExchangeStatus.DONE, OPERATION_DELETE_UNDER_TEST, MEPPatternConstants.IN_ONLY,
HttpStatus.ACCEPTED_202, HttpStatus.getMessage(HttpStatus.ACCEPTED_202), null, null);
}
{code}

h3. Assertion 'assertJBIRequestEmpty'

This assertion validates the transformation of the given JBI request into a HTTP request with an empty body.

The parameters of this assertion are:
* {{expectedURI}}: The expected URI of the generated HTTP request,
* {{opUnderTest}}: The service operation under test generating the HTTP request. The configuration of this service operation is given in the service unit JBI descriptor,
* {{mep}}: The message exchange pattern with which the JBI request send to the service operation under test,
* {{inXMLPayloadResourceName}}: Name of the resource containing the XML payload of the JBI request sent to the service operation under test.

Example:
{code}
@ServiceOperationUnderTestExtension(
operation = @ServiceOperationName(namespace = NAMESPACE, name = "delete"),
placeholders = {
@Placeholder(name = "api-base.url", value = API_BASE_URL) },
suJbiDescriptorResourceName = RESOURCES_HOME + "jbi.xml"
)
public static ServiceOperationUnderTest OPERATION_DELETE_UNDER_TEST;

@Test
public void assertJBIRequest_ack() throws Exception {
assertJBIRequestEmpty(URI.create(API_BASE_URL + "/item/" + ITEM_ID), OPERATION_DELETE_UNDER_TEST,
Message.MEPConstants.ROBUST_IN_ONLY_PATTERN, RESOURCES_HOME + "request.xml");
}
{code}

h3. Assertion 'assertJBIRequestJSON'