Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

* Updated skeleton processing to recognise `RCMR_IN030000UK07` as a valid full-message skeleton type in addition to
`RCMR_IN030000UK06`, ensuring the service correctly replaces the inbound payload when a UK07 skeleton is received.

* Add Spring retry to MHS queue consumer to facilitate a more reasonable retry delay.

## [3.3.2] - 2026-08-19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class SkeletonProcessingService {


public InboundMessage updateInboundMessageWithSkeleton(PatientAttachmentLog skeletonLog,
InboundMessage inboundMessage, String conversationId)
throws SAXException, TransformerException {
InboundMessage inboundMessage,
String conversationId)
throws SAXException, TransformerException {

// merge skeleton message into original payload
var skeletonAttachment = attachmentHandlerService.getAttachment(
skeletonLog.getFilename(), conversationId);
var skeletonAttachment = attachmentHandlerService.getAttachment(skeletonLog.getFilename(), conversationId);
var skeletonFileAsString = new String(skeletonAttachment, StandardCharsets.UTF_8);

try {
Expand Down Expand Up @@ -72,7 +72,9 @@ private String normalizeSkeletonXml(String skeletonFileAsString) {
}

private boolean isEntireRcmrSkeleton(String normalizedSkeleton) {
return normalizedSkeleton != null && normalizedSkeleton.startsWith("<RCMR_IN030000UK06");
return normalizedSkeleton != null
&& (normalizedSkeleton.startsWith("<RCMR_IN030000UK06")
|| normalizedSkeleton.startsWith("<RCMR_IN030000UK07"));
}

private InboundMessage insertSkeletonIntoInboundMessagePayload(PatientAttachmentLog skeletonLog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ void When_UpdateInboundMessageAttachmentHandlerServiceThrowsIllegalArgumentExcep
inboundMessage, migrationRequest.getConversationId()));
}

@Test
void When_UpdateInboundMessageWithSkeleton_Expect_AttachmentIsFetchedByFilenameAndConversationId()
throws TransformerException, SAXException {
var inboundMessage = new InboundMessage();
var attachmentLog = createSkeletonPatientAttachmentLog();

inboundMessage.setPayload(readInboundMessagePayloadFromFile());
inboundMessage.setEbXML(readInboundMessageEbXmlFromFile());

prepareRCMRMocks(inboundMessage);

skeletonProcessingService.updateInboundMessageWithSkeleton(attachmentLog, inboundMessage, CONVERSATION_ID);

verify(attachmentHandlerService).getAttachment(FILENAME, CONVERSATION_ID);
}

@Test
void When_HappyPathWithSkeletonAsRCMRMessage_Expect_ThrowNoErrors() throws TransformerException,
SAXException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import uk.nhs.adaptors.pss.translator.service.SkeletonProcessingService;
import uk.nhs.adaptors.pss.translator.service.XPathService;
import uk.nhs.adaptors.pss.translator.storage.StorageException;
import uk.nhs.adaptors.pss.translator.util.XmlParseUtilService;

@ExtendWith(MockitoExtension.class)
public class EhrExtractMessageHandlerTest {
Expand Down Expand Up @@ -133,6 +134,22 @@ public class EhrExtractMessageHandlerTest {
@Captor
private ArgumentCaptor<PatientAttachmentLog> patientAttachmentLogCaptor;

@Test
public void When_SkeletonStartsWithEhrExtractVersion07_Expect_RecogniseAsWholeMessageSkeleton() throws Exception {
var service = new SkeletonProcessingService(
Mockito.mock(AttachmentHandlerService.class),
Mockito.mock(XmlParseUtilService.class),
Mockito.mock(XPathService.class)
);

var method = SkeletonProcessingService.class.getDeclaredMethod("isEntireRcmrSkeleton", String.class);
method.setAccessible(true);

var result = (boolean) method.invoke(service, "<RCMR_IN030000UK07");

assertTrue(result);
}

@Test
public void When_HandleMessageWithValidDataIsCalled_Expect_CallsMigrationStatusLogServiceAddMigrationStatusLog()
throws
Expand Down
Loading