From 96e4d6a81868dbf0fa9adf34181a74d71ec16f7a Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Tue, 23 Jul 2024 17:00:21 +0530 Subject: [PATCH 1/6] [MOSIO-34112] Adding test cases Signed-off-by: khuddus shariff --- .../stage/BioDedupeProcessorTest.java | 284 +++++++++++++++++- 1 file changed, 283 insertions(+), 1 deletion(-) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java index 7efb2be83fd..e46a21ad4d1 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java @@ -25,12 +25,15 @@ import io.mosip.registration.processor.core.constant.ProviderStageName; import io.mosip.registration.processor.core.exception.PacketManagerException; import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; +import io.mosip.registration.processor.status.code.RegistrationStatusCode; import org.apache.commons.io.IOUtils; import org.json.simple.JSONObject; +import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; @@ -38,6 +41,7 @@ import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.dao.DataAccessException; import org.springframework.test.util.ReflectionTestUtils; @@ -77,6 +81,8 @@ import io.mosip.registration.processor.status.entity.RegistrationStatusEntity; import io.mosip.registration.processor.status.service.RegistrationStatusService; +import javax.validation.constraints.AssertTrue; + /** * The Class BioDedupeStageTest. */ @@ -450,11 +456,11 @@ public void testBioDeDupUpdatePacketHandlerProcessingSuccess() throws ApisResour * @throws RegistrationProcessorCheckedException */ @Test - @Ignore public void testBioDeDupUpdatePacketHandlerProcessingFailure() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("reg1234"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); @@ -728,4 +734,280 @@ public void testBioDeDupUpdatePacketHandlerProcessingFailWithAutoRejectEnable() assertFalse(messageDto.getIsValid()); assertFalse(messageDto.getInternalError()); } +// One match of RID/AID found at bio dedupe stage. +// UIN of the duplicate match is same as the update packet UIN + @Test + public void OneMatchFoundWithSameUin() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())).thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107396"); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + } + +// One match of RID/AID found at bio dedupe, +// but UIN of the duplicate match is different from update packet UIN + @Test + public void OneMatchFoundWithDiffrentUinWithMatchAutoRejecAsTrue() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())).thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107397"); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", true); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertFalse(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.REJECTED.name()); + } + + // One match of RID/AID found at bio dedupe, +// but UIN of the duplicate match is different from update packet UIN with auto rejection is false + @Test + public void OneMatchFoundWithDifferentUinWithSingleMatchAutoRejectAsFalse() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())).thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107397"); + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + } +// More than one match of RID/AID found at bio dedupe stage, +// all UIN of duplicate matches are same as update packet UIN + @Test + public void MoreThenOneMatchFoundWithSameUin() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396") + .thenReturn("9403107396") + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107396"); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", true); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + } + +// More than one match of RID/AID found at bio dedupe stage, +// all duplicate matches have the same UIN but, they does not matches with update packet UIN + @Test + public void MoreThenOneMatchFoundWithAllSameUinExceptUpdateUin() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())) + .thenReturn("9403107397") + .thenReturn("9403107397") + .thenReturn("9403107397"); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", true); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertFalse(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.REJECTED.name()); + } + +// More than one match of RID/AID found at bio dedupe stage, +// all duplicate matches possess different UINs. Among that one UIN matches with update packet UIN + @Test + public void MoreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())) + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) + .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())) + .thenReturn("9403107394") + .thenReturn("9403107395") + .thenReturn("9403107396"); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertFalse(messageDto.getIsValid()); + assertTrue(messageDto.getInternalError()); + } +// More than one match of RID/AID found at bio dedupe stage, +// all duplicate matches possess different UINs. Among that no UIN matches with update packet UIN + @Test + public void MoreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())) + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) + .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())) + .thenReturn("9403107397") + .thenReturn("9403107398") + .thenReturn("9403107399"); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertFalse(messageDto.getIsValid()); + assertTrue(messageDto.getInternalError()); + } + +// One match of RID/AID found at bio dedupe stage, +// found AID/RID is in progress status and RID & UIN mapping is not done + + @Test + public void OneMatchFoundWithStillInProgress () throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())) + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) + .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095011"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn(""); + + ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertFalse(messageDto.getIsValid()); + assertTrue(messageDto.getInternalError()); + } +// More than one match of RID/AID found at bio dedupe stage, +// Among them one of the RID is in progress state & mapping is not done in repo + @Test + public void MoreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())) + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) + .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())) + .thenReturn("9403107397") + .thenReturn("") + .thenReturn("9403107398"); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertFalse(messageDto.getIsValid()); + assertTrue(messageDto.getInternalError()); + } + +// More than one match of RID/AID found at bio dedupe stage, +// All RID is in progress state & mapping is not done in repo + @Test + public void MoreThenOneMatchFoundWithAllRidAreStillInProgress () throws ApisResourceAccessException, IOException, + PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { + registrationStatusDto.setRegistrationId("27847657360002520190320095011"); + registrationStatusDto.setRegistrationType("UPDATE"); + Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); + Mockito.when(abisHandlerUtil.getPacketStatus(any())) + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) + .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + + Set matchedRidList = new HashSet<>(); + matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); + matchedRidList.add("27847657360002520190320095013"); + matchedRidList.add("27847657360002520190320095014"); + Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); + Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + Mockito.when(idRepoService.getUinByRid(anyString(),any())) + .thenReturn("") + .thenReturn("") + .thenReturn(""); + MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + assertFalse(messageDto.getIsValid()); + assertTrue(messageDto.getInternalError()); + } } \ No newline at end of file From b0fb46636f11cec3735bcd9e044705dbc0164782 Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Thu, 25 Jul 2024 15:31:53 +0530 Subject: [PATCH 2/6] [Mosip-34112] resolving PR comment Signed-off-by: khuddus shariff --- .../constants/BioDedupeConstants.java | 6 +-- .../biodedupe/stage/BioDedupeProcessor.java | 10 ++--- .../stage/BioDedupeProcessorTest.java | 42 +++++++++++++------ .../core/status/util/StatusUtil.java | 4 +- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java index 6d1c65c5eee..2f2b5de45b5 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java @@ -43,7 +43,7 @@ public class BioDedupeConstants { /** The Constant INTERNAL_ERROR. */ private static final String INTERNAL_ERROR = "Internal error occurred in bio-dedupe stage while processing for registrationId "; - public static final String ABIS_RESPONSE_MATCHING = "ABIS response Details matching, destination stage is UIN"; + public static final String BIOMETRIC_MATCH_FOUND_WITH_SELF = "Biometric match found successfully, proceeding with UIN"; - public static final String NO_MATCH_FOUND_FOR_UPDATE = "No match found, rejecting the Update packet for "; -} + public static final String BIOMETRIC_MATCH_FOUND_WITH_OTHER = "Biometric match found with other user, rejecting packet for "; +} \ No newline at end of file diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java index 0b4598e23a3..e3c46a172d2 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java @@ -185,9 +185,7 @@ public MessageDTO process(MessageDTO object, String stageName) { newPacketPreAbisIdentification(registrationStatusDto, object); } else if (packetStatus.equalsIgnoreCase(AbisConstant.POST_ABIS_IDENTIFICATION)) { postAbisIdentification(registrationStatusDto, object, registrationType); - } - } else if (registrationType.equalsIgnoreCase(SyncTypeDto.UPDATE.toString()) || registrationType.equalsIgnoreCase(SyncTypeDto.RES_UPDATE.toString())) { String packetStatus = abisHandlerUtil.getPacketStatus(registrationStatusDto); @@ -489,7 +487,7 @@ private void updatePostAbisIdentification(InternalRegistrationStatusDto registra registrationStatusDto.setSubStatusCode(StatusUtil.BIO_DEDUPE_SUCCESS.getCode()); regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(), - BioDedupeConstants.ABIS_RESPONSE_MATCHING); + BioDedupeConstants.BIOMETRIC_MATCH_FOUND_WITH_SELF); } else { if (biometricsUpdateSingleMatchAutoReject) { registrationStatusDto.setLatestTransactionStatusCode( @@ -497,13 +495,13 @@ private void updatePostAbisIdentification(InternalRegistrationStatusDto registra object.setIsValid(Boolean.FALSE); registrationStatusDto.setStatusCode(RegistrationStatusCode.REJECTED.name()); registrationStatusDto - .setStatusComment(StatusUtil.UPDATE_PACKET_BIOMETRICS_NO_MATCH_FOUND.getMessage()); + .setStatusComment(StatusUtil. UPDATE_PACKET_BIOMETRICS_MATCHED_WITH_OTHER.getMessage()); registrationStatusDto - .setSubStatusCode(StatusUtil.UPDATE_PACKET_BIOMETRICS_NO_MATCH_FOUND.getCode()); + .setSubStatusCode(StatusUtil. UPDATE_PACKET_BIOMETRICS_MATCHED_WITH_OTHER.getCode()); regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(), - BioDedupeConstants.NO_MATCH_FOUND_FOR_UPDATE + BioDedupeConstants.BIOMETRIC_MATCH_FOUND_WITH_OTHER + registrationStatusDto.getRegistrationId()); } else { sendToManualAdjudicationStage(registrationStatusDto, object, registrationType, moduleName, diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java index e46a21ad4d1..fb6eb5a7579 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java @@ -737,10 +737,11 @@ public void testBioDeDupUpdatePacketHandlerProcessingFailWithAutoRejectEnable() // One match of RID/AID found at bio dedupe stage. // UIN of the duplicate match is same as the update packet UIN @Test - public void OneMatchFoundWithSameUin() throws ApisResourceAccessException, IOException, + public void oneMatchFoundWithSameUin() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); @@ -749,15 +750,18 @@ public void OneMatchFoundWithSameUin() throws ApisResourceAccessException, IOExc Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); Mockito.when(utility.getUIn(anyString(), anyString(), any())).thenReturn("9403107396"); Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107396"); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.PROCESSING.name()); assertTrue(messageDto.getIsValid()); assertFalse(messageDto.getInternalError()); } // One match of RID/AID found at bio dedupe, -// but UIN of the duplicate match is different from update packet UIN +// but UIN of the duplicate match is different from update packet UIN when AutoReject is True @Test - public void OneMatchFoundWithDiffrentUinWithMatchAutoRejecAsTrue() throws ApisResourceAccessException, IOException, + public void oneMatchFoundWithDiffrentUinWithMatchAutoRejecAsTrue() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -780,13 +784,14 @@ public void OneMatchFoundWithDiffrentUinWithMatchAutoRejecAsTrue() throws ApisRe Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.REJECTED.name()); } - // One match of RID/AID found at bio dedupe, +// One match of RID/AID found at bio dedupe, // but UIN of the duplicate match is different from update packet UIN with auto rejection is false @Test - public void OneMatchFoundWithDifferentUinWithSingleMatchAutoRejectAsFalse() throws ApisResourceAccessException, IOException, + public void oneMatchFoundWithDifferentUinWithSingleMatchAutoRejectAsFalse() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); @@ -797,9 +802,12 @@ public void OneMatchFoundWithDifferentUinWithSingleMatchAutoRejectAsFalse() thro Mockito.when(utility.getUIn(anyString(), anyString(), any())).thenReturn("9403107396"); Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107397"); ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); assertTrue(messageDto.getIsValid()); assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); } // More than one match of RID/AID found at bio dedupe stage, // all UIN of duplicate matches are same as update packet UIN @@ -819,21 +827,26 @@ public void MoreThenOneMatchFoundWithSameUin() throws ApisResourceAccessExceptio matchedRidList.add("27847657360002520190320095014"); Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); Mockito.when(utility.getUIn(anyString(), anyString(), any())) + .thenReturn("9403107396"); + + Mockito.when(idRepoService.getUinByRid(anyString(),any())) .thenReturn("9403107396") .thenReturn("9403107396") - .thenReturn("9403107396"); - Mockito.when(idRepoService.getUinByRid(anyString(),any())).thenReturn("9403107396"); + .thenReturn("9403107396");; ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", true); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); assertTrue(messageDto.getIsValid()); assertFalse(messageDto.getInternalError()); + Assert.assertEquals(RegistrationStatusCode.PROCESSING.name(),argumentCaptor.getValue().getStatusCode()); } // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches have the same UIN but, they does not matches with update packet UIN @Test - public void MoreThenOneMatchFoundWithAllSameUinExceptUpdateUin() throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithAllSameUinExceptUpdateUin() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -866,7 +879,7 @@ public void MoreThenOneMatchFoundWithAllSameUinExceptUpdateUin() throws ApisReso // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches possess different UINs. Among that one UIN matches with update packet UIN @Test - public void MoreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -897,7 +910,7 @@ public void MoreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisReso // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches possess different UINs. Among that no UIN matches with update packet UIN @Test - public void MoreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -931,10 +944,11 @@ public void MoreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessExce // found AID/RID is in progress status and RID & UIN mapping is not done @Test - public void OneMatchFoundWithStillInProgress () throws ApisResourceAccessException, IOException, + public void oneMatchFoundWithStillInProgress () throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) @@ -956,10 +970,11 @@ public void OneMatchFoundWithStillInProgress () throws ApisResourceAccessExcepti // More than one match of RID/AID found at bio dedupe stage, // Among them one of the RID is in progress state & mapping is not done in repo @Test - public void MoreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) @@ -985,10 +1000,11 @@ public void MoreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResource // More than one match of RID/AID found at bio dedupe stage, // All RID is in progress state & mapping is not done in repo @Test - public void MoreThenOneMatchFoundWithAllRidAreStillInProgress () throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithAllRidAreStillInProgress () throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java index 53b752f1e3b..00dbcc6cdb8 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusUtil.java @@ -200,8 +200,8 @@ public enum StatusUtil { LOST_PACKET_MULTIPLE_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "003", "Multiple Match was Found for the Biometrics Received"), - UPDATE_PACKET_BIOMETRICS_NO_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "004", - "No Match was Found for the Biometrics Received"), + UPDATE_PACKET_BIOMETRICS_MATCHED_WITH_OTHER(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "004", + "Biometric match found with another user"), // Biometric authentication stage BIOMETRIC_AUTHENTICATION_FAILED(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_FAILED + "001", From 56bacc32a8b243fd881417cd2d230670eb9d3749 Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Fri, 26 Jul 2024 18:03:29 +0530 Subject: [PATCH 3/6] [Mosip-34112] resolving PR comment-1 Signed-off-by: khuddus shariff --- .../biodedupe/stage/BioDedupeProcessor.java | 5 +- .../stage/BioDedupeProcessorTest.java | 63 +++++++++++-------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java index e3c46a172d2..6c130c2de08 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessor.java @@ -442,9 +442,8 @@ private void postAbisIdentification(InternalRegistrationStatusDto registrationSt updatePostAbisIdentification(registrationStatusDto, object, registrationType, moduleName, matchedRegIds); }else { - sendToManualAdjudicationStage(registrationStatusDto, object, registrationType, moduleName, matchedRegIds); - - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + sendToManualAdjudicationStage(registrationStatusDto, object, registrationType, moduleName, matchedRegIds); + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), registrationStatusDto.getRegistrationId(), BioDedupeConstants.ABIS_RESPONSE_NOT_NULL); } } diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java index fb6eb5a7579..e9a8acc40c0 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java @@ -456,6 +456,8 @@ public void testBioDeDupUpdatePacketHandlerProcessingSuccess() throws ApisResour * @throws RegistrationProcessorCheckedException */ @Test + @Ignore +// this test cases is being handeled in oneMatchFoundWithDifferentUinWithSingleMatchAutoRejectAsFalse() test Method. public void testBioDeDupUpdatePacketHandlerProcessingFailure() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("reg1234"); @@ -886,8 +888,7 @@ public void moreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisReso registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) - .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) - .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); matchedRidList.add("27847657360002520190320095011"); @@ -903,9 +904,12 @@ public void moreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisReso .thenReturn("9403107396"); ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); - assertFalse(messageDto.getIsValid()); - assertTrue(messageDto.getInternalError()); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); } // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches possess different UINs. Among that no UIN matches with update packet UIN @@ -917,8 +921,7 @@ public void moreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessExce registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) - .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) - .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); matchedRidList.add("27847657360002520190320095011"); @@ -935,9 +938,12 @@ public void moreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessExce ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); - assertFalse(messageDto.getIsValid()); - assertTrue(messageDto.getInternalError()); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); } // One match of RID/AID found at bio dedupe stage, @@ -951,21 +957,23 @@ public void oneMatchFoundWithStillInProgress () throws ApisResourceAccessExcepti registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) - .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) - .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); matchedRidList.add("27847657360002520190320095011"); - matchedRidList.add("27847657360002520190320095011"); + matchedRidList.add("27847657360002520190320095012"); Mockito.when(abisHandlerUtil.getUniqueRegIds(any(), any(), anyInt(), any(), any())).thenReturn(matchedRidList); Mockito.when(utility.getUIn(anyString(), anyString(), any())) - .thenReturn(""); + .thenReturn(null); ReflectionTestUtils.setField(bioDedupeProcessor, "biometricsUpdateSingleMatchAutoReject", false); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); - assertFalse(messageDto.getIsValid()); - assertTrue(messageDto.getInternalError()); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); } // More than one match of RID/AID found at bio dedupe stage, // Among them one of the RID is in progress state & mapping is not done in repo @@ -977,8 +985,7 @@ public void moreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResource registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) - .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) - .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); matchedRidList.add("27847657360002520190320095011"); @@ -990,11 +997,14 @@ public void moreThenOneMatchFoundWithOneIsStillInProgress () throws ApisResource .thenReturn("9403107396"); Mockito.when(idRepoService.getUinByRid(anyString(),any())) .thenReturn("9403107397") - .thenReturn("") + .thenReturn(null) .thenReturn("9403107398"); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); - assertFalse(messageDto.getIsValid()); - assertTrue(messageDto.getInternalError()); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); } // More than one match of RID/AID found at bio dedupe stage, @@ -1007,8 +1017,7 @@ public void moreThenOneMatchFoundWithAllRidAreStillInProgress () throws ApisReso registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())) - .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION) - .thenReturn(AbisConstant.DUPLICATE_FOR_SAME_TRANSACTION_ID); + .thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); Set matchedRidList = new HashSet<>(); matchedRidList.add("27847657360002520190320095011"); @@ -1019,11 +1028,13 @@ public void moreThenOneMatchFoundWithAllRidAreStillInProgress () throws ApisReso Mockito.when(utility.getUIn(anyString(), anyString(), any())) .thenReturn("9403107396"); Mockito.when(idRepoService.getUinByRid(anyString(),any())) - .thenReturn("") - .thenReturn("") - .thenReturn(""); + .thenReturn(null); + + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InternalRegistrationStatusDto.class); MessageDTO messageDto = bioDedupeProcessor.process(dto, stageName); - assertFalse(messageDto.getIsValid()); - assertTrue(messageDto.getInternalError()); + Mockito.verify(registrationStatusService).updateRegistrationStatus(argumentCaptor.capture(),anyString(),anyString()); + assertTrue(messageDto.getIsValid()); + assertFalse(messageDto.getInternalError()); + Assert.assertEquals(argumentCaptor.getValue().getStatusCode(), RegistrationStatusCode.FAILED.name()); } } \ No newline at end of file From 2f0aaee41ea81565f644bcd58d3f384deb9a5f09 Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Fri, 26 Jul 2024 18:21:54 +0530 Subject: [PATCH 4/6] [Mosip-34112] resolving PR comment Signed-off-by: khuddus shariff --- .../processor/biodedupe/stage/BioDedupeProcessorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java index e9a8acc40c0..2a54bc5c5a7 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java @@ -763,7 +763,7 @@ public void oneMatchFoundWithSameUin() throws ApisResourceAccessException, IOExc // One match of RID/AID found at bio dedupe, // but UIN of the duplicate match is different from update packet UIN when AutoReject is True @Test - public void oneMatchFoundWithDiffrentUinWithMatchAutoRejecAsTrue() throws ApisResourceAccessException, IOException, + public void oneMatchFoundWithDifferentUinWithMatchAutoRejecAsTrue() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -881,7 +881,7 @@ public void moreThenOneMatchFoundWithAllSameUinExceptUpdateUin() throws ApisReso // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches possess different UINs. Among that one UIN matches with update packet UIN @Test - public void moreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithDifferentUinOnlyOneMatches() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); @@ -914,7 +914,7 @@ public void moreThenOneMatchFoundWithDiffrentUinOnlyOneMatches() throws ApisReso // More than one match of RID/AID found at bio dedupe stage, // all duplicate matches possess different UINs. Among that no UIN matches with update packet UIN @Test - public void moreThenOneMatchFoundWithDiffrentUin() throws ApisResourceAccessException, IOException, + public void moreThenOneMatchFoundWithDifferentUin() throws ApisResourceAccessException, IOException, PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); From 57073a32f666a79fb5073376e6e1220d4cd46c87 Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Fri, 26 Jul 2024 18:53:39 +0530 Subject: [PATCH 5/6] [Mosip-34112] resolving PR comment Signed-off-by: khuddus shariff --- .../processor/biodedupe/stage/BioDedupeProcessorTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java index 2a54bc5c5a7..0ec8c184c8b 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/test/java/io/mosip/registration/processor/biodedupe/stage/BioDedupeProcessorTest.java @@ -767,6 +767,7 @@ public void oneMatchFoundWithDifferentUinWithMatchAutoRejecAsTrue() throws ApisR PacketDecryptionFailureException, io.mosip.kernel.core.exception.IOException, JsonProcessingException, PacketManagerException { registrationStatusDto.setRegistrationId("27847657360002520190320095011"); registrationStatusDto.setRegistrationType("UPDATE"); + registrationStatusDto.setStatusCode("PROCESSING"); Mockito.when(registrationStatusService.getRegistrationStatus(any(),any(),any(), any())).thenReturn(registrationStatusDto); Mockito.when(abisHandlerUtil.getPacketStatus(any())).thenReturn(AbisConstant.POST_ABIS_IDENTIFICATION); From bb99226db451dfd97cacd12bf1b92c192a06ef42 Mon Sep 17 00:00:00 2001 From: khuddus shariff Date: Fri, 26 Jul 2024 19:02:06 +0530 Subject: [PATCH 6/6] [Mosip-34112] resolving PR comment Signed-off-by: khuddus shariff --- .../processor/biodedupe/constants/BioDedupeConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java index 2f2b5de45b5..0a9faaeaf33 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/src/main/java/io/mosip/registration/processor/biodedupe/constants/BioDedupeConstants.java @@ -43,7 +43,7 @@ public class BioDedupeConstants { /** The Constant INTERNAL_ERROR. */ private static final String INTERNAL_ERROR = "Internal error occurred in bio-dedupe stage while processing for registrationId "; - public static final String BIOMETRIC_MATCH_FOUND_WITH_SELF = "Biometric match found successfully, proceeding with UIN"; + public static final String BIOMETRIC_MATCH_FOUND_WITH_SELF = "Biometric match found successfully, destination stage is UIN"; public static final String BIOMETRIC_MATCH_FOUND_WITH_OTHER = "Biometric match found with other user, rejecting packet for "; } \ No newline at end of file