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);
}
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());
}
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());
}
Aggregations