Search in sources :

Example 26 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class QrdaControllerV1Test method uploadQrdaFile.

@Test
void uploadQrdaFile() {
    Metadata metadata = new Metadata();
    when(qrdaService.convertQrda3ToQpp(any(Source.class))).thenReturn(report);
    when(auditService.success(any(ConversionReport.class))).then(invocation -> CompletableFuture.completedFuture(metadata));
    ResponseEntity qppResponse = objectUnderTest.uploadQrdaFile(multipartFile, null);
    verify(qrdaService, atLeastOnce()).convertQrda3ToQpp(any(Source.class));
    assertThat(qppResponse.getBody()).isEqualTo(report.getEncoded().toString());
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Metadata(gov.cms.qpp.conversion.api.model.Metadata) ConversionReport(gov.cms.qpp.conversion.ConversionReport) Source(gov.cms.qpp.conversion.Source) Test(org.junit.jupiter.api.Test)

Example 27 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testExtractsCpcProgramTypeFromChild.

@Test
void testExtractsCpcProgramTypeFromChild() {
    Node node = new Node();
    Node child = new Node();
    child.setType(TemplateId.CLINICAL_DOCUMENT);
    child.putValue(ClinicalDocumentDecoder.RAW_PROGRAM_NAME, "CPCPLUS");
    node.addChildNode(child);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getCpc()).startsWith(Constants.CPC_DYNAMO_PARTITION_START);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 28 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testChildLacksApm.

@Test
void testChildLacksApm() {
    Node node = new Node();
    Node child = new Node();
    child.setType(TemplateId.CLINICAL_DOCUMENT);
    node.addChildNode(child);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getApm()).isNull();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 29 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testChildLacksNpi.

@Test
void testChildLacksNpi() {
    Node node = new Node();
    Node child = new Node();
    child.setType(TemplateId.CLINICAL_DOCUMENT);
    node.addChildNode(child);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getNpi()).isNull();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Example 30 with Metadata

use of gov.cms.qpp.conversion.api.model.Metadata in project qpp-conversion-tool by CMSgov.

the class MetadataHelperTest method testExtractsApmFromChild.

@Test
void testExtractsApmFromChild() {
    Node node = new Node();
    Node child = new Node();
    child.setType(TemplateId.CLINICAL_DOCUMENT);
    child.putValue(ClinicalDocumentDecoder.ENTITY_ID, MOCK_STRING);
    node.addChildNode(child);
    Metadata metadata = MetadataHelper.generateMetadata(node, MetadataHelper.Outcome.SUCCESS);
    assertThat(metadata.getApm()).isEqualTo(MOCK_STRING);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Metadata(gov.cms.qpp.conversion.api.model.Metadata) Test(org.junit.jupiter.api.Test)

Aggregations

Metadata (gov.cms.qpp.conversion.api.model.Metadata)40 Test (org.junit.jupiter.api.Test)24 Node (gov.cms.qpp.conversion.model.Node)16 Source (gov.cms.qpp.conversion.Source)5 ConversionReport (gov.cms.qpp.conversion.ConversionReport)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 ResponseEntity (org.springframework.http.ResponseEntity)3 InvalidFileTypeException (gov.cms.qpp.conversion.api.exceptions.InvalidFileTypeException)2 NoFileInDatabaseException (gov.cms.qpp.conversion.api.exceptions.NoFileInDatabaseException)2 Outcome (gov.cms.qpp.conversion.api.helper.MetadataHelper.Outcome)2 AcceptanceTest (gov.cms.qpp.test.annotations.AcceptanceTest)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)1 AuditException (gov.cms.qpp.conversion.api.exceptions.AuditException)1 InvalidPurposeException (gov.cms.qpp.conversion.api.exceptions.InvalidPurposeException)1 UncheckedInterruptedException (gov.cms.qpp.conversion.api.exceptions.UncheckedInterruptedException)1 MetadataHelper (gov.cms.qpp.conversion.api.helper.MetadataHelper)1 Constants (gov.cms.qpp.conversion.api.model.Constants)1 UnprocessedCpcFileData (gov.cms.qpp.conversion.api.model.UnprocessedCpcFileData)1 InputStream (java.io.InputStream)1