Search in sources :

Example 1 with NACKMessageData

use of uk.nhs.adaptors.pss.translator.model.NACKMessageData in project nia-patient-switching-standard-adaptor by NHSDigital.

the class EHRTimeoutHandler method sendNackMessage.

private void sendNackMessage(InboundMessage inboundMessage, String conversationId) throws JAXBException {
    RCMRIN030000UK06Message payload = unmarshallString(inboundMessage.getPayload(), RCMRIN030000UK06Message.class);
    NACKMessageData messageData = NACKMessageData.builder().nackCode(LARGE_MESSAGE_TIMEOUT.getCode()).fromAsid(outboundMessageUtil.parseFromAsid(payload)).toAsid(outboundMessageUtil.parseToAsid(payload)).toOdsCode(outboundMessageUtil.parseToOdsCode(payload)).messageRef(outboundMessageUtil.parseMessageRef(payload)).conversationId(conversationId).build();
    LOGGER.debug("EHR Extract message timed out: sending NACK message");
    migrationStatusLogService.addMigrationStatusLog(LARGE_MESSAGE_TIMEOUT.getMigrationStatus(), conversationId);
    sendNACKMessageHandler.prepareAndSendMessage(messageData);
}
Also used : NACKMessageData(uk.nhs.adaptors.pss.translator.model.NACKMessageData) RCMRIN030000UK06Message(org.hl7.v3.RCMRIN030000UK06Message)

Example 2 with NACKMessageData

use of uk.nhs.adaptors.pss.translator.model.NACKMessageData 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 3 with NACKMessageData

use of uk.nhs.adaptors.pss.translator.model.NACKMessageData in project nia-patient-switching-standard-adaptor by NHSDigital.

the class NackAckPreparationServiceTest method When_SendNackMessageCOPC_WithValidParameters_Expect_ShouldParseMessageDataCorrectly.

@Test
public void When_SendNackMessageCOPC_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();
    COPCIN000001UK01Message payload = unmarshallString(readSubsequentInboundMessagePayloadFromFile(), COPCIN000001UK01Message.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) COPCIN000001UK01Message(org.hl7.v3.COPCIN000001UK01Message) Test(org.junit.jupiter.api.Test)

Aggregations

NACKMessageData (uk.nhs.adaptors.pss.translator.model.NACKMessageData)3 RCMRIN030000UK06Message (org.hl7.v3.RCMRIN030000UK06Message)2 Test (org.junit.jupiter.api.Test)2 COPCIN000001UK01Message (org.hl7.v3.COPCIN000001UK01Message)1