use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.
the class ExceptionHandlerControllerV1Test method testTransformExceptionBody.
@Test
void testTransformExceptionBody() {
TransformException exception = new TransformException("test transform exception", new NullPointerException(), report);
ResponseEntity<AllErrors> responseEntity = objectUnderTest.handleTransformException(exception);
assertThat(responseEntity.getBody()).isEqualTo(allErrors);
}
use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.
the class ExceptionHandlerControllerV1Test method testTransformExceptionHeaderContentType.
@Test
void testTransformExceptionHeaderContentType() {
TransformException exception = new TransformException("test transform exception", new NullPointerException(), report);
ResponseEntity<AllErrors> responseEntity = objectUnderTest.handleTransformException(exception);
assertThat(responseEntity.getHeaders().getContentType()).isEquivalentAccordingToCompareTo(MediaType.APPLICATION_JSON_UTF8);
}
use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.
the class ValidationApiAcceptance method testUnprocessedFiles.
@AcceptanceTest
void testUnprocessedFiles() {
Response response = given().multiPart("file", PATH.toFile()).when().post("/");
AllErrors blah = response.getBody().as(AllErrors.class);
blah.getErrors().stream().flatMap(error -> error.getDetails().stream()).forEach(this::verifyDetail);
}
use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.
the class ValidationApiFailureAcceptance method testBadPerformanceStart.
@ParameterizedAcceptanceTest
@MethodSource("getFailureScenarios")
void testBadPerformanceStart(String comparison, Map<String, String> override) {
String qrda = getQrda(override);
Response response = performRequest(qrda);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY.value());
AllErrors blah = response.getBody().as(AllErrors.class);
blah.getErrors().stream().flatMap(error -> error.getDetails().stream()).forEach(verifyDetail(comparison, qrda));
}
use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.
the class ValidationServiceImpl method validateQpp.
/**
* Validates that the given QPP is valid.
*
* @param conversionReport A report on the status of the conversion.
*/
@Override
public void validateQpp(final ConversionReport conversionReport) {
String validationUrl = environment.getProperty(Constants.VALIDATION_URL_ENV_VARIABLE);
if (StringUtils.isEmpty(validationUrl)) {
return;
}
conversionReport.getEncoded().stream().forEach(wrapper -> {
ResponseEntity<String> validationResponse = callValidationEndpoint(validationUrl, wrapper);
if (HttpStatus.UNPROCESSABLE_ENTITY == validationResponse.getStatusCode()) {
API_LOG.warn("Failed QPP validation");
AllErrors convertedErrors = convertQppValidationErrorsToQrda(validationResponse.getBody(), wrapper);
conversionReport.setRawValidationDetails(validationResponse.getBody());
conversionReport.setReportDetails(convertedErrors);
throw new QppValidationException("Converted QPP failed validation", null, conversionReport);
}
});
}
Aggregations