Search in sources :

Example 11 with RCMRIN030000UK06Message

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

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithAttachmentsNotReceived_Expect_ShouldHaveCorrectNackCode.

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

Example 12 with RCMRIN030000UK06Message

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

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithUnexpectedCondition_Expect_ShouldHaveCorrectNackCode.

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

Example 13 with RCMRIN030000UK06Message

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

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithClinicalSysIntegrationFailure_Expect_ShouldHaveCorrectNackCode.

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

Example 14 with RCMRIN030000UK06Message

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

the class NackAckPreparationServiceTest method When_SendNackMessageRCMR_WithValidParameters_Expect_ShouldParseMessageDataCorrectly.

@Test
public void When_SendNackMessageRCMR_WithValidParameters_Expect_ShouldParseMessageDataCorrectly() throws JAXBException {
    NACKMessageData expectedMessageData = NACKMessageData.builder().nackCode(TEST_NACK_CODE).toOdsCode(TEST_TO_ODS).toAsid(TEST_TO_ASID).fromAsid(TEST_FROM_ASID).conversationId(CONVERSATION_ID).messageRef(TEST_MESSAGE_REF).build();
    RCMRIN030000UK06Message payload = unmarshallString(readInboundMessagePayloadFromFile(), RCMRIN030000UK06Message.class);
    nackAckPreparationService.sendNackMessage(NACKReason.LARGE_MESSAGE_GENERAL_FAILURE, payload, CONVERSATION_ID);
    verify(sendNACKMessageHandler).prepareAndSendMessage(ackMessageDataCaptor.capture());
    assertEquals(expectedMessageData, ackMessageDataCaptor.getValue());
}
Also used : NACKMessageData(uk.nhs.adaptors.pss.translator.model.NACKMessageData) RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message) Test(org.junit.jupiter.api.Test)

Example 15 with RCMRIN030000UK06Message

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

the class JaxbTest method testUnmarshal.

@Test
public void testUnmarshal() throws JAXBException {
    JAXBContext jaxbContext = JAXBContext.newInstance(RCMRIN030000UK06Message.class);
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
    JAXBElement<RCMRIN030000UK06Message> unmarshalledMessage = (JAXBElement) unmarshaller.unmarshal(TEST_FILE);
    var ehrFolder = unmarshalledMessage.getValue().getControlActEvent().getSubject().getEhrExtract().getComponent().get(0).getEhrFolder();
    var person = ehrFolder.getResponsibleParty().getAgentDirectory().getPart().get(2).getAgent().getAgentPerson();
    var place = ehrFolder.getComponent().get(0).getEhrComposition().getLocation().getLocatedEntity().getLocatedPlace();
    assertThat(person.getName().getFamily()).isEqualTo("Whitcombe");
    assertThat(person.getName().getGiven()).isEqualTo("Peter");
    assertThat(person.getName().getPrefix()).isEqualTo("Dr");
    assertThat(person.getName().getValidTime().getCenter().getValue()).isEqualTo("20100114");
    assertThat(place.getName()).isEqualTo("EMIS Test Practice Location");
}
Also used : JAXBContext(javax.xml.bind.JAXBContext) JAXBElement(javax.xml.bind.JAXBElement) Unmarshaller(javax.xml.bind.Unmarshaller) 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