diff --git a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/main/java/io/mosip/registration/processor/stages/biometric/extraction/stage/BiometricExtractionStage.java b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/main/java/io/mosip/registration/processor/stages/biometric/extraction/stage/BiometricExtractionStage.java index 80e050a7eae..2f7651b3ab4 100644 --- a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/main/java/io/mosip/registration/processor/stages/biometric/extraction/stage/BiometricExtractionStage.java +++ b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/main/java/io/mosip/registration/processor/stages/biometric/extraction/stage/BiometricExtractionStage.java @@ -359,12 +359,12 @@ private IdResponseDTO addBiometricExtractiontoIdRepository(ExtractorDto dto, List segments=List.of(registrationId); IdResponseDTO response= (IdResponseDTO) registrationProcessorRestClientService.putApi(ApiName.IDREPOEXTRACTBIOMETRICS, segments, extractionFormat, dto.getAttributeName(), null, IdResponseDTO.class, null); if (response.getErrors() != null && !response.getErrors().isEmpty()) { - idrepoDraftService.idrepodiscardDraft(registrationId); ErrorDTO error = response.getErrors().get(0); regProcLogger.error("Error occured while updating draft for id : " + registrationId, error.toString()); if (response.getErrors().get(0).getErrorCode().equalsIgnoreCase(ID_REPO_KEY_MANAGER_ERROR)) { throw new IdrepoDraftReprocessableException(error.getErrorCode(), error.getMessage()); } else { + idrepoDraftService.idrepoDiscardDraft(registrationId); throw new IdrepoDraftException(error.getErrorCode(), error.getMessage()); } } diff --git a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/test/java/io/mosip/registration/processor/stages/biometric/extraction/stages/test/BiometricExtractionStageTest.java b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/test/java/io/mosip/registration/processor/stages/biometric/extraction/stages/test/BiometricExtractionStageTest.java index 4f3f604eacc..cadca1ffe62 100644 --- a/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/test/java/io/mosip/registration/processor/stages/biometric/extraction/stages/test/BiometricExtractionStageTest.java +++ b/registration-processor/core-processor/registration-processor-biometric-extraction-stage/src/test/java/io/mosip/registration/processor/stages/biometric/extraction/stages/test/BiometricExtractionStageTest.java @@ -378,7 +378,7 @@ public void testBiometricExtractionDraftExceptionAndDiscardDreaft() throws Excep segment.add(messageDTO.getRid()); when(registrationProcessorRestClientService.putApi(Mockito.eq(ApiName.IDREPOEXTRACTBIOMETRICS), any(), anyString(), anyString(), Mockito.isNull(), Mockito.eq(IdResponseDTO.class), isNull())).thenReturn(idResponseDTO); MessageDTO result = biometricExtractionStage.process(messageDTO); - verify(idrepoDraftService,atLeastOnce()).idrepodiscardDraft(anyString()); + verify(idrepoDraftService,atLeastOnce()).idrepoDiscardDraft(anyString()); assertTrue(result.getInternalError()); assertFalse(result.getIsValid()); diff --git a/registration-processor/registration-processor-packet-manager/src/main/java/io/mosip/registration/processor/packet/manager/idreposervice/IdrepoDraftService.java b/registration-processor/registration-processor-packet-manager/src/main/java/io/mosip/registration/processor/packet/manager/idreposervice/IdrepoDraftService.java index b366d6d85d2..d192ecf12bf 100644 --- a/registration-processor/registration-processor-packet-manager/src/main/java/io/mosip/registration/processor/packet/manager/idreposervice/IdrepoDraftService.java +++ b/registration-processor/registration-processor-packet-manager/src/main/java/io/mosip/registration/processor/packet/manager/idreposervice/IdrepoDraftService.java @@ -115,7 +115,7 @@ public IdResponseDTO idrepoUpdateDraft(String id, String uin, IdRequestDto idReq ApiName.IDREPOUPDATEDRAFT, Lists.newArrayList(id), null, null, idRequestDto, IdResponseDTO.class); if (response.getErrors() != null && !response.getErrors().isEmpty()) { regProcLogger.info("Error while updating the drant " + id); - idrepodiscardDraft(id); + idrepoDiscardDraft(id); ErrorDTO error = response.getErrors().get(0); regProcLogger.error("Error occured while updating draft for id : " + id, error.toString()); if (response.getErrors().get(0).getErrorCode().equalsIgnoreCase(ID_REPO_KEY_MANAGER_ERROR)) { @@ -141,10 +141,10 @@ public IdResponseDTO idrepoPublishDraft(String id) { ErrorDTO error=response.getErrors().get(0); regProcLogger.error("Error occured while publishing the Draft : " + id, error.toString()); - idrepodiscardDraft(id); if (response.getErrors().get(0).getErrorCode().equalsIgnoreCase(ID_REPO_KEY_MANAGER_ERROR)) { throw new IdrepoDraftReprocessableException(error.getErrorCode(), error.getMessage()); } else { + idrepoDiscardDraft(id); throw new IdrepoDraftException(error.getErrorCode(), error.getMessage()); } } @@ -152,7 +152,7 @@ public IdResponseDTO idrepoPublishDraft(String id) return response; } - public Boolean idrepodiscardDraft(String id) throws ApisResourceAccessException, IdrepoDraftReprocessableException, IdrepoDraftException { + public Boolean idrepoDiscardDraft(String id) throws ApisResourceAccessException, IdrepoDraftReprocessableException, IdrepoDraftException { regProcLogger.debug("idrepoDiscardDraft entry " + id); List pathsegments = new ArrayList(); pathsegments.add(id); diff --git a/registration-processor/registration-processor-packet-manager/src/test/java/io/mosip/registration/processor/packet/manager/service/impl/test/IdrepoDraftServiceTest.java b/registration-processor/registration-processor-packet-manager/src/test/java/io/mosip/registration/processor/packet/manager/service/impl/test/IdrepoDraftServiceTest.java index fe6dab9cc6f..87adaf1902b 100644 --- a/registration-processor/registration-processor-packet-manager/src/test/java/io/mosip/registration/processor/packet/manager/service/impl/test/IdrepoDraftServiceTest.java +++ b/registration-processor/registration-processor-packet-manager/src/test/java/io/mosip/registration/processor/packet/manager/service/impl/test/IdrepoDraftServiceTest.java @@ -160,7 +160,7 @@ public void idrepoPublishDraftExceptionTest() deleteApi(ApiName.IDREPODISCARDDRAFT, Lists.newArrayList(ID), "", "", IdResponseDTO.class)).thenReturn(discardIdresponseDto); idrepoDraftService.idrepoPublishDraft(ID); - Mockito.verify(idrepoDraftService.idrepodiscardDraft(any()),times(1)); + Mockito.verify(idrepoDraftService.idrepoDiscardDraft(any()),times(1)); } @Test @@ -232,7 +232,7 @@ public void idrepoUpdateDraftExceptionTest() IdResponseDTO idResponseDTO2=idrepoDraftService.idrepoUpdateDraft(ID, null, idRequestDto); - verify(idrepoDraftService.idrepodiscardDraft(any()),times(1)); + verify(idrepoDraftService.idrepoDiscardDraft(any()),times(1)); } @@ -269,7 +269,7 @@ public void idrepoDraftReprocessableExceptionTest() deleteApi(ApiName.IDREPODISCARDDRAFT, Lists.newArrayList(ID), "", "", IdResponseDTO.class)).thenReturn(discardIdresponseDto); idrepoDraftService.idrepoUpdateDraft(ID, null, idRequestDto); - Mockito.verify(idrepoDraftService.idrepodiscardDraft(any()),times(1)); + Mockito.verify(idrepoDraftService.idrepoDiscardDraft(any()),times(1)); } @Test @@ -288,7 +288,7 @@ public void discardDraftSuccessTest() throws IdrepoDraftReprocessableException, when(registrationProcessorRestClientService. deleteApi(ApiName.IDREPODISCARDDRAFT, Lists.newArrayList(ID), "", "", IdResponseDTO.class)).thenReturn(discardIdresponseDto); - Boolean result= idrepoDraftService.idrepodiscardDraft(ID); + Boolean result= idrepoDraftService.idrepoDiscardDraft(ID); assertTrue(result); } }