Search in sources :

Example 1 with RCMRIN030000UK06Message

use of org.hl7.v3.RCMRIN030000UK06Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class BundleMapperServiceTest method testAllMappersHaveBeenUsed.

@Test
public void testAllMappersHaveBeenUsed() throws BundleMappingException {
    final RCMRIN030000UK06Message xml = unmarshallCodeElement(STRUCTURED_RECORD_XML);
    Bundle bundle = bundleMapperService.mapToBundle(xml, LOSING_ODS_CODE);
    verify(patientMapper).mapToPatient(any(RCMRMT030101UK04Patient.class), any(Organization.class));
    verify(organizationMapper).mapAuthorOrganization(anyString());
    verify(agentDirectoryMapper).mapAgentDirectory(any(RCMRMT030101UK04AgentDirectory.class));
    verify(locationMapper, atLeast(1)).mapToLocation(any(RCMRMT030101UK04Location.class), anyString(), anyString());
    verify(encounterMapper).mapEncounters(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyString());
    verify(procedureRequestMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(referralRequestMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(bloodPressureMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), any(String.class));
    verify(observationMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(conditionMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(immunizationMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), any(String.class));
    verify(observationCommentMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(medicationRequestMapper, atLeast(1)).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(unknownPractitionerHandler).updateUnknownPractitionersRefs(bundle);
    verify(documentReferenceMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), any(Organization.class));
    verify(templateMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(allergyIntoleranceMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), anyString());
    verify(diagnosticReportMapper).mapResources(any(RCMRMT030101UK04EhrExtract.class), any(Patient.class), anyList(), any(String.class));
    verify(specimenMapper).mapSpecimen(any(RCMRMT030101UK04EhrExtract.class), anyList(), any(Patient.class), anyString());
    verify(diagnosticReportMapper).handleChildObservationComments(any(RCMRMT030101UK04EhrExtract.class), anyList());
    verify(specimenCompoundsMapper).handleSpecimenChildComponents(any(RCMRMT030101UK04EhrExtract.class), anyList(), anyList(), anyList(), any(Patient.class), anyList(), anyString());
}
Also used : Organization(org.hl7.fhir.dstu3.model.Organization) RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) RCMRMT030101UK04EhrExtract(org.hl7.v3.RCMRMT030101UK04EhrExtract) Bundle(org.hl7.fhir.dstu3.model.Bundle) RCMRMT030101UK04AgentDirectory(org.hl7.v3.RCMRMT030101UK04AgentDirectory) RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) Patient(org.hl7.fhir.dstu3.model.Patient) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) RCMRMT030101UK04Location(org.hl7.v3.RCMRMT030101UK04Location) Test(org.junit.jupiter.api.Test)

Example 2 with RCMRIN030000UK06Message

use of org.hl7.v3.RCMRIN030000UK06Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithErrors_Expect_ShouldUpdateLog.

@Test
public void When_SendNackMessageRCMR_WithErrors_Expect_ShouldUpdateLog() throws JAXBException {
    RCMRIN030000UK06Message payload = unmarshallString(readInboundMessagePayloadFromFile(), RCMRIN030000UK06Message.class);
    when(sendNACKMessageHandler.prepareAndSendMessage(any(NACKMessageData.class))).thenReturn(false);
    assertFalse(nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_GENERAL_FAILURE, payload, CONVERSATION_ID));
    verify(migrationStatusLogService).addMigrationStatusLog(ERROR_LRG_MSG_GENERAL_FAILURE, CONVERSATION_ID);
}
Also used : NACKMessageData(uk.nhs.adaptors.pss.translator.model.NACKMessageData) RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) Test(org.junit.jupiter.api.Test)

Example 3 with RCMRIN030000UK06Message

use of org.hl7.v3.RCMRIN030000UK06Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithTimeoutFailure_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageRCMR_WithTimeoutFailure_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    RCMRIN030000UK06Message payload = unmarshallString(readInboundMessagePayloadFromFile(), RCMRIN030000UK06Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_TIMEOUT, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("25", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) Test(org.junit.jupiter.api.Test)

Example 4 with RCMRIN030000UK06Message

use of org.hl7.v3.RCMRIN030000UK06Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithReAssemblyFailure_Expect_ShouldHaveCorrectNackCode.

@Test
public void When_SendNackMessageRCMR_WithReAssemblyFailure_Expect_ShouldHaveCorrectNackCode() throws JAXBException {
    RCMRIN030000UK06Message payload = unmarshallString(readInboundMessagePayloadFromFile(), RCMRIN030000UK06Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_REASSEMBLY_FAILURE, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals("29", ackMessageDataCaptor.getValue().getNackCode());
}
Also used : RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) Test(org.junit.jupiter.api.Test)

Example 5 with RCMRIN030000UK06Message

use of org.hl7.v3.RCMRIN030000UK06Message in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithEHRExtractCannotBeProcessed_Expect_AddMigrationStatusLogCalledWithGeneralProcessingError.

@Test
public void When_SendNackMessageRCMR_WithEHRExtractCannotBeProcessed_Expect_AddMigrationStatusLogCalledWithGeneralProcessingError() throws JAXBException {
    RCMRIN030000UK06Message payload = unmarshallString(readInboundMessagePayloadFromFile(), RCMRIN030000UK06Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.EHR_EXTRACT_CANNOT_BE_PROCESSED, payload, CONVERSATION_ID);
    verify(migrationStatusLogService).addMigrationStatusLog(migrationStatusCaptor.capture(), any());
    assertEquals(MigrationStatus.EHR_GENERAL_PROCESSING_ERROR, migrationStatusCaptor.getValue());
}
Also used : RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) Test(org.junit.jupiter.api.Test)

Aggregations

RCMRIN030000UK06Message (org.hl7.v3.RCMRIN030000UK06Message)16 Test (org.junit.jupiter.api.Test)13 NACKMessageData (uk.nhs.adaptors.pss.translator.model.NACKMessageData)4 BundleMappingException (uk.nhs.adaptors.pss.translator.exception.BundleMappingException)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 Bundle (org.hl7.fhir.dstu3.model.Bundle)2 Organization (org.hl7.fhir.dstu3.model.Organization)2 RCMRMT030101UK04EhrExtract (org.hl7.v3.RCMRMT030101UK04EhrExtract)2 SAXException (org.xml.sax.SAXException)2 PatientMigrationRequest (uk.nhs.adaptors.connector.model.PatientMigrationRequest)2 AttachmentNotFoundException (uk.nhs.adaptors.pss.translator.exception.AttachmentNotFoundException)2 InlineAttachmentProcessingException (uk.nhs.adaptors.pss.translator.exception.InlineAttachmentProcessingException)2 XmlUnmarshallUtil.unmarshallString (uk.nhs.adaptors.pss.translator.util.XmlUnmarshallUtil.unmarshallString)2 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 ParseException (java.text.ParseException)1 JAXBContext (javax.xml.bind.JAXBContext)1 JAXBElement (javax.xml.bind.JAXBElement)1 JAXBException (javax.xml.bind.JAXBException)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 ValidationException (javax.xml.bind.ValidationException)1