Search in sources :

Example 1 with AcceptanceTest

use of gov.cms.qpp.test.annotations.AcceptanceTest 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);
}
Also used : Response(io.restassured.response.Response) Assertions.fail(org.junit.jupiter.api.Assertions.fail) AcceptanceTest(gov.cms.qpp.test.annotations.AcceptanceTest) Filter(org.jdom2.filter.Filter) XPathFactory(org.jdom2.xpath.XPathFactory) XmlUtils(gov.cms.qpp.conversion.xml.XmlUtils) NioHelper(gov.cms.qpp.test.helper.NioHelper) Truth.assertThat(com.google.common.truth.Truth.assertThat) XPathExpression(org.jdom2.xpath.XPathExpression) ValidationServiceImpl(gov.cms.qpp.conversion.api.services.ValidationServiceImpl) Detail(gov.cms.qpp.conversion.model.error.Detail) Attribute(org.jdom2.Attribute) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Response(io.restassured.response.Response) Paths(java.nio.file.Paths) RestAssured.given(io.restassured.RestAssured.given) DataConversionException(org.jdom2.DataConversionException) XmlException(gov.cms.qpp.conversion.xml.XmlException) Filters(org.jdom2.filter.Filters) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) Path(java.nio.file.Path) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) AcceptanceTest(gov.cms.qpp.test.annotations.AcceptanceTest)

Example 2 with AcceptanceTest

use of gov.cms.qpp.test.annotations.AcceptanceTest in project qpp-conversion-tool by CMSgov.

the class CpcApiAcceptance method testMarkFileProcessedNotCPC.

@AcceptanceTest
void testMarkFileProcessedNotCPC() {
    Metadata metadata = createDatedCpcMetadata("2018-01-02T05:00:00.000Z");
    metadata.setCpc(null);
    mapper.save(metadata);
    String responseBody = markFileAsProcessed(metadata.getUuid(), 404);
    assertThat(responseBody).isEqualTo("The file was not a CPC+ file.");
}
Also used : Metadata(gov.cms.qpp.conversion.api.model.Metadata) AcceptanceTest(gov.cms.qpp.test.annotations.AcceptanceTest)

Example 3 with AcceptanceTest

use of gov.cms.qpp.test.annotations.AcceptanceTest in project qpp-conversion-tool by CMSgov.

the class CpcApiAcceptance method testUnprocessedFilesDates.

@AcceptanceTest
void testUnprocessedFilesDates() {
    Metadata afterJanuarySecondMetadata = createDatedCpcMetadata("2018-01-02T05:00:00.000Z");
    Metadata beforeJanuarySecondMetadata = createDatedCpcMetadata(DbServiceImpl.START_OF_UNALLOWED_CONVERSION_TIME);
    Metadata anotherAllowedMetadata = createDatedCpcMetadata("2018-02-26T14:36:43.723Z");
    Metadata anotherUnallowedMetadata = createDatedCpcMetadata("2017-12-25T00:00:00.000Z");
    mapper.batchSave(afterJanuarySecondMetadata, beforeJanuarySecondMetadata, anotherAllowedMetadata, anotherUnallowedMetadata);
    List<Map> responseBody = getUnprocessedFiles();
    responseBody.stream().forEach(map -> assertThat(Instant.parse((String) map.get("conversionDate"))).isGreaterThan(Instant.parse(DbServiceImpl.START_OF_UNALLOWED_CONVERSION_TIME)));
}
Also used : Metadata(gov.cms.qpp.conversion.api.model.Metadata) Map(java.util.Map) AcceptanceTest(gov.cms.qpp.test.annotations.AcceptanceTest)

Example 4 with AcceptanceTest

use of gov.cms.qpp.test.annotations.AcceptanceTest in project qpp-conversion-tool by CMSgov.

the class ValidationApiFailureAcceptance method testSuccess.

@AcceptanceTest
void testSuccess() {
    Response response = performRequest(getQrda(null));
    assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED.value());
}
Also used : Response(io.restassured.response.Response) AcceptanceTest(gov.cms.qpp.test.annotations.AcceptanceTest) ParameterizedAcceptanceTest(gov.cms.qpp.test.annotations.ParameterizedAcceptanceTest)

Aggregations

AcceptanceTest (gov.cms.qpp.test.annotations.AcceptanceTest)4 Metadata (gov.cms.qpp.conversion.api.model.Metadata)2 Response (io.restassured.response.Response)2 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 ValidationServiceImpl (gov.cms.qpp.conversion.api.services.ValidationServiceImpl)1 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)1 Detail (gov.cms.qpp.conversion.model.error.Detail)1 XmlException (gov.cms.qpp.conversion.xml.XmlException)1 XmlUtils (gov.cms.qpp.conversion.xml.XmlUtils)1 ParameterizedAcceptanceTest (gov.cms.qpp.test.annotations.ParameterizedAcceptanceTest)1 NioHelper (gov.cms.qpp.test.helper.NioHelper)1 RestAssured.given (io.restassured.RestAssured.given)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Map (java.util.Map)1 Attribute (org.jdom2.Attribute)1 DataConversionException (org.jdom2.DataConversionException)1 Filter (org.jdom2.filter.Filter)1 Filters (org.jdom2.filter.Filters)1 XPathExpression (org.jdom2.xpath.XPathExpression)1