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
* {{assertJBIRequestMultiPart}}: The result of the transformation from JBI to a HTTP request is expected as a given HTTP URI and a HTTP multi-part request similar to the given parts.

h3. Assertion 'assertJBIOutResponse'

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

The parameters of this assertion are:
* {{expectedXMLPayloadResourceName}}: Name of the resource containing the expected JBI OUT message payload,
* {{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,
* {{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 = EDM_NAMESPACE,
name = OP_NAME_GET_METADATA_BY_JSON))
public static ServiceOperationUnderTest OPERATION_UNDER_TEST;

@Test
public void nominal() throws Exception {
assertJBIOutResponse("get-metadata-expected-nominal-response.xml", OPERATION_UNDER_TEST,
HttpStatus.SC_OK, null, "get-metadata-nominal-http-body.json",
MediaType.APPLICATION_JSON_TYPE, null);
}
{code}

h3. Assertion 'assertJBIFault'

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

The parameters of this assertion are:
* {{expectedXMLPayloadResourceName}}: Name of the resource containing the expected JBI fault message payload,
* {{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,
* {{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 = EDM_NAMESPACE,
name = OP_NAME_GET_METADATA_BY_JSON))
public static ServiceOperationUnderTest OPERATION_UNDER_TEST;

@Test
public void unexistingDocument() throws Exception {

assertJBIFault("get-metadata-expected-fault-unexisting-document.xml", OPERATION_UNDER_TEST,
HttpStatus.SC_NOT_FOUND, null, null, null, "get-metadata-by-json-request.xml");
}
{code}

h3. Assertion 'assertJBIRequestJSON'

This assertion validates the transformation of the given JBI request into the given HTTP *JSON* request.

The parameters of this assertion are:
* {{expectedURI}}: The expected URI of the generated HTTP request,
* {{expectedJSONPayloadResourceName}}: Name of the resource containing the expected JSON of the HTTP request body,
* {{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 = EDM_NAMESPACE,
name = OP_NAME_RESET_METADATAS_BY_JSON))
public static ServiceOperationUnderTest OPERATION_UNDER_TEST;

@Test
public void requestWithMetadata() throws Exception {

assertJBIRequestJSON("reset-metadatas-by-json-with-metadatas-expected-request.json", OPERATION_UNDER_TEST,
MEPConstants.IN_OUT_PATTERN, "reset-metadatas-by-json-with-metadatas-request.xml");
}
{code}

h3. Assertion 'assertJBIRequestMultiPart'