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
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,7 @@ private void lostPacketPostAbisIdentification(InternalRegistrationStatusDto regi
regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(),
registrationStatusDto.getRegistrationId(),
BioDedupeConstants.NO_MATCH_FOUND_FOR_LOST + registrationId);
// Discard the draft since this LOST packet has no biometric match.
try {
idrepoDraftService.idrepoDiscardDraft(registrationId);
} catch (IdrepoDraftException | IdrepoDraftReprocessableException | ApisResourceAccessException e) {
regProcLogger.warn(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(),
registrationId, "Failed to discard draft on LOST no-match (non-fatal): " + e.getMessage());
}
// Draft discard is handled by WorkflowInternalActionVerticle.processCompleteAsRejected()

} else if (matchedRegIds.size() == 1) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,27 +524,8 @@ public void testLostPacketValidationMatchedIdEmpty() throws ApisResourceAccessEx
MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName);
assertFalse(messageDto.getIsValid());
assertFalse(messageDto.getInternalError());
Mockito.verify(idrepoDraftService, Mockito.times(1)).idrepoDiscardDraft("reg1234");
}

@Test
public void testLostPacketNoMatch_DiscardThrows_StillRejectsWithoutInternalError() throws Exception {
registrationStatusDto.setRegistrationId("reg1234");
registrationStatusDto.setRegistrationType("LOST");
Mockito.when(registrationStatusService.getRegistrationStatus(any(), any(), any(), any())).thenReturn(registrationStatusDto);
Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION);
ProcessedMatchedResult processedMatchedResult = new ProcessedMatchedResult();
processedMatchedResult.setMatchedResults(new HashSet<>());
Mockito.when(abisHandlerUtil.getProcessedMatchedResult(any(), any(), anyInt(), any(), any()))
.thenReturn(processedMatchedResult);
Mockito.when(idrepoDraftService.idrepoDiscardDraft(anyString()))
.thenThrow(new IdrepoDraftException("IDR-IDC-005", "discard failed"));

MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName);

assertFalse(messageDto.getIsValid());
assertFalse(messageDto.getInternalError());
Mockito.verify(idrepoDraftService, Mockito.times(1)).idrepoDiscardDraft("reg1234");
// Draft discard is handled by WorkflowInternalActionVerticle.processCompleteAsRejected()
Mockito.verify(idrepoDraftService, Mockito.never()).idrepoDiscardDraft(anyString());
}

@Test
Expand Down
Loading