From 5f5b1623e0678b548a898384c8b6d1e72a001fe4 Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Thu, 10 Aug 2023 10:53:12 +0530 Subject: [PATCH 1/6] MOSIP-23147 code fix --- .../BiometricRecordValidationException.java | 15 + .../abis/handler/stage/AbisHandlerStage.java | 1278 +++++++++-------- .../stage/test/AbisHandlerStageTest.java | 1148 ++++++++------- .../exception/util/PlatformErrorMessages.java | 17 + .../core/status/util/StatusConstants.java | 6 +- .../core/status/util/StatusUtil.java | 487 +++---- 6 files changed, 1617 insertions(+), 1334 deletions(-) create mode 100644 registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/exception/BiometricRecordValidationException.java diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/exception/BiometricRecordValidationException.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/exception/BiometricRecordValidationException.java new file mode 100644 index 00000000000..41ff609995d --- /dev/null +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/exception/BiometricRecordValidationException.java @@ -0,0 +1,15 @@ +package io.mosip.registration.processor.abis.handler.exception; + +import io.mosip.kernel.core.exception.BaseCheckedException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; + +public class BiometricRecordValidationException extends BaseCheckedException { + + public BiometricRecordValidationException(String message) { + super(PlatformErrorMessages.RPR_BIOMETRIC_RECORD_VALIDATION_FAILED.getCode(), message); + } + + public BiometricRecordValidationException(String code, String message) { + super(code, message); + } +} diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java index 6f8b51d87c7..b1621ed9cc4 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java @@ -1,598 +1,680 @@ -package io.mosip.registration.processor.abis.handler.stage; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import io.mosip.registration.processor.core.constant.PolicyConstant; -import io.mosip.registration.processor.core.constant.ProviderStageName; -import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.json.simple.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ByteArrayResource; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.collect.Lists; - -import io.mosip.kernel.biometrics.entities.BiometricRecord; -import io.mosip.kernel.core.cbeffutil.spi.CbeffUtil; -import io.mosip.kernel.core.logger.spi.Logger; -import io.mosip.kernel.core.util.DateUtils; -import io.mosip.kernel.core.util.JsonUtils; -import io.mosip.kernel.core.util.exception.JsonProcessingException; -import io.mosip.registration.processor.abis.handler.constant.AbisHandlerStageConstant; -import io.mosip.registration.processor.abis.handler.dto.DataShareResponseDto; -import io.mosip.registration.processor.abis.handler.dto.Filter; -import io.mosip.registration.processor.abis.handler.dto.ShareableAttributes; -import io.mosip.registration.processor.abis.handler.dto.Source; -import io.mosip.registration.processor.abis.handler.exception.AbisHandlerException; -import io.mosip.registration.processor.abis.handler.exception.DataShareException; -import io.mosip.registration.processor.abis.queue.dto.AbisQueueDetails; -import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress; -import io.mosip.registration.processor.core.abstractverticle.MessageDTO; -import io.mosip.registration.processor.core.abstractverticle.MosipEventBus; -import io.mosip.registration.processor.core.abstractverticle.MosipRouter; -import io.mosip.registration.processor.core.abstractverticle.MosipVerticleAPIManager; -import io.mosip.registration.processor.core.code.AbisStatusCode; -import io.mosip.registration.processor.core.code.ApiName; -import io.mosip.registration.processor.core.code.EventId; -import io.mosip.registration.processor.core.code.EventName; -import io.mosip.registration.processor.core.code.EventType; -import io.mosip.registration.processor.core.code.ModuleName; -import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; -import io.mosip.registration.processor.core.constant.LoggerFileConstant; -import io.mosip.registration.processor.core.constant.MappingJsonConstants; -import io.mosip.registration.processor.core.exception.ApisResourceAccessException; -import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; -import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; -import io.mosip.registration.processor.core.http.ResponseWrapper; -import io.mosip.registration.processor.core.logger.LogDescription; -import io.mosip.registration.processor.core.logger.RegProcessorLogger; -import io.mosip.registration.processor.core.packet.dto.Identity; -import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestGalleryDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisInsertRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.Flag; -import io.mosip.registration.processor.core.packet.dto.abis.ReferenceIdDto; -import io.mosip.registration.processor.core.packet.dto.abis.RegBioRefDto; -import io.mosip.registration.processor.core.packet.dto.abis.RegDemoDedupeListDto; -import io.mosip.registration.processor.core.spi.packetmanager.PacketInfoManager; -import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; -import io.mosip.registration.processor.core.status.util.StatusUtil; -import io.mosip.registration.processor.core.status.util.TrimExceptionMessage; -import io.mosip.registration.processor.core.util.JsonUtil; -import io.mosip.registration.processor.packet.storage.dto.ApplicantInfoDto; -import io.mosip.registration.processor.packet.storage.utils.BIRConverter; -import io.mosip.registration.processor.packet.storage.utils.Utilities; -import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; -import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; -import io.mosip.registration.processor.status.dto.RegistrationStatusDto; -import io.mosip.registration.processor.status.service.RegistrationStatusService; - -/** - * The Class AbisHandlerStage. - * - * @author M1048358 Alok - */ -@Service -public class AbisHandlerStage extends MosipVerticleAPIManager { - - /** The cluster manager url. */ - @Value("${vertx.cluster.configuration}") - private String clusterManagerUrl; - - /** The max results. */ - @Value("${registration.processor.abis.maxResults}") - private String maxResults; - - /** The target FPIR. */ - @Value("${registration.processor.abis.targetFPIR}") - private String targetFPIR; - - /** server port number. */ - @Value("${server.port}") - private String port; - - /** worker pool size. */ - @Value("${worker.pool.size}") - private Integer workerPoolSize; - - /** After this time intervel, message should be considered as expired (In seconds). */ - @Value("${mosip.regproc.abis.handler.message.expiry-time-limit}") - private Long messageExpiryTimeLimit; - - @Value("${registration.processor.policy.id}") - private String policyId; - - @Value("${registration.processor.subscriber.id}") - private String subscriberId; - - @Autowired - private RegistrationProcessorRestClientService registrationProcessorRestClientService; - - /** The reg proc logger. */ - private static Logger regProcLogger = RegProcessorLogger.getLogger(AbisHandlerStage.class); - - /** The core audit request builder. */ - @Autowired - private AuditLogRequestBuilder auditLogRequestBuilder; - - /** The registration status service. */ - @Autowired - private RegistrationStatusService registrationStatusService; - - /** The packet info manager. */ - @Autowired - private PacketInfoManager packetInfoManager; - - @Autowired - private Utilities utility; - - /** The mosip event bus. */ - MosipEventBus mosipEventBus = null; - - /** Mosip router for APIs */ - @Autowired - MosipRouter router; - - @Autowired - private CbeffUtil cbeffutil; - - @Autowired - private Environment env; - - @Autowired - private PriorityBasedPacketManagerService priorityBasedPacketManagerService; - - private static final String DATASHARECREATEURL = "DATASHARECREATEURL"; - - private static final String DATETIME_PATTERN = "mosip.registration.processor.datetime.pattern"; - /** - * Deploy verticle. - */ - public void deployVerticle() { - mosipEventBus = this.getEventBus(this, clusterManagerUrl, workerPoolSize); - this.consumeAndSend(mosipEventBus, MessageBusAddress.ABIS_HANDLER_BUS_IN, - MessageBusAddress.ABIS_HANDLER_BUS_OUT, messageExpiryTimeLimit); - } - - @Override - public void start() { - router.setRoute(this.postUrl(getVertx(), MessageBusAddress.ABIS_HANDLER_BUS_IN, - MessageBusAddress.ABIS_HANDLER_BUS_OUT)); - this.createServer(router.getRouter(), Integer.parseInt(port)); - } - - /* - * (non-Javadoc) - * - * @see - * io.mosip.registration.processor.core.spi.eventbus.EventBusManager#process( - * java.lang.Object) - */ - @Override - public MessageDTO process(MessageDTO object) { - TrimExceptionMessage trimExceptionMessage = new TrimExceptionMessage(); - LogDescription description = new LogDescription(); - object.setMessageBusAddress(MessageBusAddress.ABIS_HANDLER_BUS_IN); - Boolean isTransactionSuccessful = false; - String regId = object.getRid(); - InternalRegistrationStatusDto registrationStatusDto = null; - String transactionTypeCode = null; - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - regId, "AbisHandlerStage::process()::entry"); - try { - registrationStatusDto = registrationStatusService.getRegistrationStatus(regId); - transactionTypeCode = registrationStatusDto.getLatestTransactionTypeCode(); - String transactionId = registrationStatusDto.getLatestRegistrationTransactionId(); - - Boolean isIdentifyRequestPresent = packetInfoManager.getIdentifyByTransactionId(transactionId, - AbisHandlerStageConstant.IDENTIFY); - - if (!isIdentifyRequestPresent) { - List abisQueueDetails = utility.getAbisQueueDetails(); - if (abisQueueDetails.isEmpty()) { - description.setStatusComment(AbisHandlerStageConstant.DETAILS_NOT_FOUND); - description.setMessage(PlatformErrorMessages.RPR_DETAILS_NOT_FOUND.getMessage()); - description.setCode(PlatformErrorMessages.RPR_DETAILS_NOT_FOUND.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), "", - AbisHandlerStageConstant.DETAILS_NOT_FOUND); - throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode()); - } - createRequest(regId, abisQueueDetails, transactionId, registrationStatusDto.getRegistrationType(), description, transactionTypeCode); - object.setMessageBusAddress(MessageBusAddress.ABIS_MIDDLEWARE_BUS_IN); - } else { - if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { - object.setMessageBusAddress(MessageBusAddress.DEMO_DEDUPE_BUS_IN); - } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { - object.setMessageBusAddress(MessageBusAddress.BIO_DEDUPE_BUS_IN); - } - } - description.setStatusComment(AbisHandlerStageConstant.ABIS_HANDLER_SUCCESS); - description.setMessage(PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getMessage()); - description.setCode(PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode()); - isTransactionSuccessful = true; - regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - regId, description.getMessage()); - } catch (Exception e) { - description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER); - description.setMessage(PlatformErrorMessages.RPR_MESSAGE_SENDER_STAGE_FAILED.getMessage()); - description.setCode(PlatformErrorMessages.RPR_MESSAGE_SENDER_STAGE_FAILED.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - regId, ExceptionUtils.getStackTrace(e)); - object.setInternalError(Boolean.TRUE); - registrationStatusDto - .setLatestTransactionStatusCode(RegistrationTransactionStatusCode.REPROCESS.toString()); - registrationStatusDto.setSubStatusCode(StatusUtil.SYSTEM_EXCEPTION_OCCURED.getCode()); - if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { - registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.DEMO_DEDUPE_STAGE); - } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { - registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.BIO_DEDUPE_STAGE); - } - registrationStatusDto.setStatusComment(trimExceptionMessage - .trimExceptionMessage(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getMessage() + e.getMessage())); - String moduleId = description.getCode(); - String moduleName = ModuleName.ABIS_HANDLER.toString(); - registrationStatusService.updateRegistrationStatus(registrationStatusDto, moduleId, moduleName); - } finally { - String eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); - String eventName = isTransactionSuccessful ? EventName.UPDATE.toString() : EventName.EXCEPTION.toString(); - String eventType = isTransactionSuccessful ? EventType.BUSINESS.toString() : EventType.SYSTEM.toString(); - - /** Module-Id can be Both Success/Error code */ - String moduleId = isTransactionSuccessful ? PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode() - : description.getCode(); - String moduleName = ModuleName.ABIS_HANDLER.toString(); - - auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, - moduleId, moduleName, regId); - - } - - return object; - } - - private void createRequest(String regId, List abisQueueDetails, String transactionId, String process, - LogDescription description, String transactionTypeCode) throws Exception { - List bioRefDtos = packetInfoManager.getBioRefIdByRegId(regId); - String bioRefId; - if (bioRefDtos.isEmpty()) { - bioRefId = getUUID(); - insertInBioRef(regId, bioRefId); - } else { - bioRefId = bioRefDtos.get(0).getBioRefId(); - } - createInsertRequest(abisQueueDetails, transactionId, bioRefId, regId, process, description); - createIdentifyRequest(abisQueueDetails, transactionId, bioRefId, transactionTypeCode, description); - - } - - /** - * Creates the identify request. - * - * @param abisQueueDetails - * the abis application dto list - * @param transactionId - * the transaction id - * @param bioRefId - * the bio ref id - * @param transactionTypeCode - * the transaction type code - * @param description - */ - private void createIdentifyRequest(List abisQueueDetails, String transactionId, String bioRefId, - String transactionTypeCode, LogDescription description) { - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", - "AbisHandlerStage::createIdentifyRequest()::entry"); - String batchId = getUUID(); - for (AbisQueueDetails abisQueue : abisQueueDetails) { - AbisRequestDto abisRequestDto = new AbisRequestDto(); - String id = getUUID(); - abisRequestDto.setId(id); - abisRequestDto.setAbisAppCode(abisQueue.getName()); - abisRequestDto.setBioRefId(bioRefId); - abisRequestDto.setRequestType(AbisHandlerStageConstant.IDENTIFY); - abisRequestDto.setReqBatchId(batchId); - abisRequestDto.setRefRegtrnId(transactionId); - - byte[] abisIdentifyRequestBytes = getIdentifyRequestBytes(transactionId, bioRefId, transactionTypeCode, id, - description); - abisRequestDto.setReqText(abisIdentifyRequestBytes); - - abisRequestDto.setStatusCode(RegistrationTransactionStatusCode.IN_PROGRESS.toString()); - abisRequestDto.setStatusComment(null); - abisRequestDto.setLangCode(AbisHandlerStageConstant.ENG); - abisRequestDto.setCrBy(AbisHandlerStageConstant.USER); - abisRequestDto.setUpdBy(null); - abisRequestDto.setIsDeleted(Boolean.FALSE); - - String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); - String moduleName = ModuleName.ABIS_HANDLER.toString(); - packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); - } - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", - "AbisHandlerStage::createIdentifyRequest()::exit"); - } - - /** - * Gets the identify request bytes. - * - * @param transactionId - * the transaction id - * @param bioRefId - * the bio ref id - * @param transactionTypeCode - * the transaction type code - * @param id - * the id - * @param description - * @return the identify request bytes - */ - private byte[] getIdentifyRequestBytes(String transactionId, String bioRefId, String transactionTypeCode, String id, - LogDescription description) { - AbisIdentifyRequestDto abisIdentifyRequestDto = new AbisIdentifyRequestDto(); - Flag flag = new Flag(); - abisIdentifyRequestDto.setId(AbisHandlerStageConstant.MOSIP_ABIS_IDENTIFY); - abisIdentifyRequestDto.setVersion(AbisHandlerStageConstant.VERSION); - abisIdentifyRequestDto.setRequestId(id); - abisIdentifyRequestDto.setReferenceId(bioRefId); - abisIdentifyRequestDto.setReferenceUrl(""); - abisIdentifyRequestDto.setRequesttime(DateUtils.getUTCCurrentDateTimeString(env.getProperty(DATETIME_PATTERN))); - flag.setMaxResults(maxResults); - flag.setTargetFPIR(targetFPIR); - abisIdentifyRequestDto.setFlags(flag); - - // Added Gallery data for demo dedupe - if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { - List regDemoDedupeListDtoList = packetInfoManager - .getDemoListByTransactionId(transactionId); - if (regDemoDedupeListDtoList.isEmpty()) { - description.setStatusComment(AbisHandlerStageConstant.NO_RECORD_FOUND); - description.setMessage(PlatformErrorMessages.RPR_NO_RECORD_FOUND.getMessage()); - description.setCode(PlatformErrorMessages.RPR_NO_RECORD_FOUND.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), - LoggerFileConstant.REGISTRATIONID.toString(), "", - "Potential Match Records are Not Found for Demo Dedupe Potential Match"); - throw new AbisHandlerException(description.getMessage()); - } - List referenceIdDtos = new ArrayList<>(); - - for (RegDemoDedupeListDto dedupeListDto : regDemoDedupeListDtoList) { - ReferenceIdDto dto = new ReferenceIdDto(); - List regBioRefDto = packetInfoManager.getBioRefIdByRegId(dedupeListDto.getMatchedRegId()); - if (!CollectionUtils.isEmpty(regBioRefDto)) { - dto.setReferenceId(regBioRefDto.get(0).getBioRefId()); - } - - referenceIdDtos.add(dto); - } - AbisIdentifyRequestGalleryDto galleryDto = new AbisIdentifyRequestGalleryDto(); - galleryDto.setReferenceIds(referenceIdDtos); - abisIdentifyRequestDto.setGallery(galleryDto); - } - - try { - String jsonString = JsonUtils.javaObjectToJsonString(abisIdentifyRequestDto); - return jsonString.getBytes(); - } catch (JsonProcessingException e) { - description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); - description.setMessage(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getMessage()); - description.setCode(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - "", AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); - throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode(), e); - } - } - - /** - * Insert in bio ref. - * - * @param regId - * the reg id - * @param bioRefId - * the bio ref id - */ - private void insertInBioRef(String regId, String bioRefId) { - RegBioRefDto regBioRefDto = new RegBioRefDto(); - regBioRefDto.setBioRefId(bioRefId); - regBioRefDto.setCrBy(AbisHandlerStageConstant.USER); - regBioRefDto.setIsActive(Boolean.TRUE); - regBioRefDto.setIsDeleted(Boolean.FALSE); - regBioRefDto.setRegId(regId); - regBioRefDto.setUpdBy(null); - String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); - String moduleName = ModuleName.ABIS_HANDLER.toString(); - packetInfoManager.saveBioRef(regBioRefDto, moduleId, moduleName); - } - - /** - * Creates the insert request. - * - * @param abisQueueDetails - * the abis application dto list - * @param transactionId - * the transaction id - * @param bioRefId - * the bio ref id - * @param regId - * the reg id - * @param description - */ - private void createInsertRequest(List abisQueueDetails, String transactionId, String bioRefId, - String regId, String process, LogDescription description) throws Exception { - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - regId, "AbisHandlerStage::createInsertRequest()::entry"); - String batchId = getUUID(); - List abisProcessedInsertAppCodeList = packetInfoManager.getAbisProcessedRequestsAppCodeByBioRefId( - bioRefId, AbisStatusCode.INSERT.toString(), AbisStatusCode.PROCESSED.toString()); - List abisAppCodeList = new ArrayList<>(); - for (AbisQueueDetails abisQueue : abisQueueDetails) { - abisAppCodeList.add(abisQueue.getName()); - } - - for (String appCode : abisAppCodeList) { - - AbisRequestDto abisRequestDto = new AbisRequestDto(); - String id = getUUID(); - abisRequestDto.setId(id); - abisRequestDto.setAbisAppCode(appCode); - abisRequestDto.setBioRefId(bioRefId); - abisRequestDto.setRequestType(AbisHandlerStageConstant.INSERT); - abisRequestDto.setReqBatchId(batchId); - abisRequestDto.setRefRegtrnId(transactionId); - - byte[] abisInsertRequestBytes = getInsertRequestBytes(regId, id, process, bioRefId, description); - abisRequestDto.setReqText(abisInsertRequestBytes); - - abisRequestDto.setStatusCode(AbisStatusCode.IN_PROGRESS.toString()); - abisRequestDto.setStatusComment(null); - abisRequestDto.setLangCode(AbisHandlerStageConstant.ENG); - abisRequestDto.setCrBy(AbisHandlerStageConstant.USER); - abisRequestDto.setUpdBy(null); - abisRequestDto.setIsDeleted(Boolean.FALSE); - String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); - String moduleName = ModuleName.ABIS_HANDLER.toString(); - if (abisProcessedInsertAppCodeList != null && abisProcessedInsertAppCodeList.contains(appCode)) { - abisRequestDto.setStatusCode(AbisStatusCode.ALREADY_PROCESSED.toString()); - packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); - } else { - abisRequestDto.setStatusCode(AbisStatusCode.IN_PROGRESS.toString()); - packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); - } - - } - - regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", - "AbisHandlerStage::createInsertRequest()::exit"); - } - - /** - * Gets the insert request bytes. - * - * @param regId - * the reg id - * @param id - * the id - * @param bioRefId - * the bio ref id - * @param description - * @return the insert request bytes - */ - private byte[] getInsertRequestBytes(String regId, String id, String process, String bioRefId, LogDescription description) throws Exception { - AbisInsertRequestDto abisInsertRequestDto = new AbisInsertRequestDto(); - abisInsertRequestDto.setId(AbisHandlerStageConstant.MOSIP_ABIS_INSERT); - abisInsertRequestDto.setReferenceId(bioRefId); - abisInsertRequestDto.setReferenceURL(getDataShareUrl(regId, process)); - abisInsertRequestDto.setRequestId(id); - abisInsertRequestDto.setRequesttime(DateUtils.getUTCCurrentDateTimeString(env.getProperty(DATETIME_PATTERN))); - abisInsertRequestDto.setVersion(AbisHandlerStageConstant.VERSION); - try { - String jsonString = JsonUtils.javaObjectToJsonString(abisInsertRequestDto); - return jsonString.getBytes(); - } catch (JsonProcessingException e) { - description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); - description.setMessage(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getMessage()); - description.setCode(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getCode()); - regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), - "", AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); - throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode(), e); - } - } - - /** - * Gets the uuid. - * - * @return the uuid - */ - private String getUUID() { - return UUID.randomUUID().toString(); - } - - private String getDataShareUrl(String id, String process) throws Exception { - Map> typeAndSubtypMap=createTypeSubtypeMapping(); - List modalities=new ArrayList<>(); - for(Map.Entry> entry:typeAndSubtypMap.entrySet()) { - if(entry.getValue()==null) { - modalities.add(entry.getKey()); - } else { - modalities.addAll(entry.getValue()); - } - } - JSONObject regProcessorIdentityJson = utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY); - String individualBiometricsLabel = JsonUtil.getJSONValue( - JsonUtil.getJSONObject(regProcessorIdentityJson, MappingJsonConstants.INDIVIDUAL_BIOMETRICS), - MappingJsonConstants.VALUE); - BiometricRecord biometricRecord = priorityBasedPacketManagerService.getBiometrics( - id, individualBiometricsLabel, modalities, process, ProviderStageName.BIO_DEDUPE); - byte[] content = cbeffutil.createXML(BIRConverter.convertSegmentsToBIRList(biometricRecord.getSegments())); - - MultiValueMap map = new LinkedMultiValueMap<>(); - map.add("name", individualBiometricsLabel); - map.add("filename", individualBiometricsLabel); - - ByteArrayResource contentsAsResource = new ByteArrayResource(content) { - @Override - public String getFilename() { - return individualBiometricsLabel; - } - }; - map.add("file", contentsAsResource); - - List pathSegments = new ArrayList<>(); - pathSegments.add(policyId); - pathSegments.add(subscriberId); - - DataShareResponseDto response = (DataShareResponseDto) registrationProcessorRestClientService.postApi(ApiName.DATASHARECREATEURL, MediaType.MULTIPART_FORM_DATA, pathSegments, null, null, map, DataShareResponseDto.class); - if (response == null || (response.getErrors() != null && response.getErrors().size() >0)) - throw new DataShareException(response == null ? "Datashare response is null" : response.getErrors().get(0).getMessage()); - - return response.getDataShare().getUrl(); - } - public Map> createTypeSubtypeMapping() throws ApisResourceAccessException, DataShareException, JsonParseException, JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException, IOException{ - Map> typeAndSubTypeMap = new HashMap<>(); - ResponseWrapper policyResponse = (ResponseWrapper) registrationProcessorRestClientService.getApi( - ApiName.PMS, Lists.newArrayList(policyId, PolicyConstant.PARTNER_ID, subscriberId), "", "", ResponseWrapper.class); - if (policyResponse == null || (policyResponse.getErrors() != null && policyResponse.getErrors().size() >0)) { - throw new DataShareException(policyResponse == null ? "Policy Response response is null" : policyResponse.getErrors().get(0).getMessage()); - - } else { - LinkedHashMap responseMap = (LinkedHashMap) policyResponse.getResponse(); - LinkedHashMap policies = (LinkedHashMap) responseMap.get(PolicyConstant.POLICIES); - List attributes = (List) policies.get(PolicyConstant.SHAREABLE_ATTRIBUTES); - ObjectMapper mapper = new ObjectMapper(); - ShareableAttributes shareableAttributes = mapper.readValue(mapper.writeValueAsString(attributes.get(0)), - ShareableAttributes.class); - for (Source source : shareableAttributes.getSource()) { - List filterList = source.getFilter(); - if (filterList != null && !filterList.isEmpty()) { - - filterList.forEach(filter -> { - if (filter.getSubType() != null && !filter.getSubType().isEmpty()) { - typeAndSubTypeMap.put(filter.getType(), filter.getSubType()); - } else { - typeAndSubTypeMap.put(filter.getType(), null); - } - }); - } - } - } - return typeAndSubTypeMap; - - } -} +package io.mosip.registration.processor.abis.handler.stage; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.json.simple.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.Lists; + +import io.mosip.kernel.biometrics.constant.BiometricType; +import io.mosip.kernel.biometrics.entities.BIR; +import io.mosip.kernel.biometrics.entities.BiometricRecord; +import io.mosip.kernel.core.cbeffutil.spi.CbeffUtil; +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.util.DateUtils; +import io.mosip.kernel.core.util.JsonUtils; +import io.mosip.kernel.core.util.exception.JsonProcessingException; +import io.mosip.registration.processor.abis.handler.constant.AbisHandlerStageConstant; +import io.mosip.registration.processor.abis.handler.dto.DataShareResponseDto; +import io.mosip.registration.processor.abis.handler.dto.Filter; +import io.mosip.registration.processor.abis.handler.dto.ShareableAttributes; +import io.mosip.registration.processor.abis.handler.dto.Source; +import io.mosip.registration.processor.abis.handler.exception.AbisHandlerException; +import io.mosip.registration.processor.abis.handler.exception.BiometricRecordValidationException; +import io.mosip.registration.processor.abis.handler.exception.DataShareException; +import io.mosip.registration.processor.abis.queue.dto.AbisQueueDetails; +import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress; +import io.mosip.registration.processor.core.abstractverticle.MessageDTO; +import io.mosip.registration.processor.core.abstractverticle.MosipEventBus; +import io.mosip.registration.processor.core.abstractverticle.MosipRouter; +import io.mosip.registration.processor.core.abstractverticle.MosipVerticleAPIManager; +import io.mosip.registration.processor.core.code.AbisStatusCode; +import io.mosip.registration.processor.core.code.ApiName; +import io.mosip.registration.processor.core.code.EventId; +import io.mosip.registration.processor.core.code.EventName; +import io.mosip.registration.processor.core.code.EventType; +import io.mosip.registration.processor.core.code.ModuleName; +import io.mosip.registration.processor.core.code.RegistrationTransactionStatusCode; +import io.mosip.registration.processor.core.constant.LoggerFileConstant; +import io.mosip.registration.processor.core.constant.MappingJsonConstants; +import io.mosip.registration.processor.core.constant.PolicyConstant; +import io.mosip.registration.processor.core.constant.ProviderStageName; +import io.mosip.registration.processor.core.exception.ApisResourceAccessException; +import io.mosip.registration.processor.core.exception.util.PlatformErrorMessages; +import io.mosip.registration.processor.core.exception.util.PlatformSuccessMessages; +import io.mosip.registration.processor.core.http.ResponseWrapper; +import io.mosip.registration.processor.core.logger.LogDescription; +import io.mosip.registration.processor.core.logger.RegProcessorLogger; +import io.mosip.registration.processor.core.packet.dto.Identity; +import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestGalleryDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisInsertRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.Flag; +import io.mosip.registration.processor.core.packet.dto.abis.ReferenceIdDto; +import io.mosip.registration.processor.core.packet.dto.abis.RegBioRefDto; +import io.mosip.registration.processor.core.packet.dto.abis.RegDemoDedupeListDto; +import io.mosip.registration.processor.core.spi.packetmanager.PacketInfoManager; +import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; +import io.mosip.registration.processor.core.status.util.StatusUtil; +import io.mosip.registration.processor.core.status.util.TrimExceptionMessage; +import io.mosip.registration.processor.core.util.JsonUtil; +import io.mosip.registration.processor.packet.storage.dto.ApplicantInfoDto; +import io.mosip.registration.processor.packet.storage.utils.BIRConverter; +import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; +import io.mosip.registration.processor.packet.storage.utils.Utilities; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.service.RegistrationStatusService; + +/** + * The Class AbisHandlerStage. + * + * @author M1048358 Alok + */ +@Service +public class AbisHandlerStage extends MosipVerticleAPIManager { + + /** The cluster manager url. */ + @Value("${vertx.cluster.configuration}") + private String clusterManagerUrl; + + /** The max results. */ + @Value("${registration.processor.abis.maxResults}") + private String maxResults; + + /** The target FPIR. */ + @Value("${registration.processor.abis.targetFPIR}") + private String targetFPIR; + + /** server port number. */ + @Value("${server.port}") + private String port; + + /** worker pool size. */ + @Value("${worker.pool.size}") + private Integer workerPoolSize; + + /** After this time intervel, message should be considered as expired (In seconds). */ + @Value("${mosip.regproc.abis.handler.message.expiry-time-limit}") + private Long messageExpiryTimeLimit; + + @Value("${registration.processor.policy.id}") + private String policyId; + + @Value("${registration.processor.subscriber.id}") + private String subscriberId; + + @Value("#{${mosip.regproc.abis.handler.biometric-modalities-segments-mapping}}") + private Map> biometricModalitySegmentsMap; + + @Value("${mosip.regproc.abis.handler.status.code:REJECTED}") + private String statusCode; + @Autowired + private RegistrationProcessorRestClientService registrationProcessorRestClientService; + + /** The reg proc logger. */ + private static Logger regProcLogger = RegProcessorLogger.getLogger(AbisHandlerStage.class); + + /** The core audit request builder. */ + @Autowired + private AuditLogRequestBuilder auditLogRequestBuilder; + + /** The registration status service. */ + @Autowired + private RegistrationStatusService registrationStatusService; + + /** The packet info manager. */ + @Autowired + private PacketInfoManager packetInfoManager; + + @Autowired + private Utilities utility; + + /** The mosip event bus. */ + MosipEventBus mosipEventBus = null; + + /** Mosip router for APIs */ + @Autowired + MosipRouter router; + + @Autowired + private CbeffUtil cbeffutil; + + @Autowired + private Environment env; + + @Autowired + private PriorityBasedPacketManagerService priorityBasedPacketManagerService; + + private static final String DATASHARECREATEURL = "DATASHARECREATEURL"; + + private static final String DATETIME_PATTERN = "mosip.registration.processor.datetime.pattern"; + /** + * Deploy verticle. + */ + public void deployVerticle() { + mosipEventBus = this.getEventBus(this, clusterManagerUrl, workerPoolSize); + this.consumeAndSend(mosipEventBus, MessageBusAddress.ABIS_HANDLER_BUS_IN, + MessageBusAddress.ABIS_HANDLER_BUS_OUT, messageExpiryTimeLimit); + } + + @Override + public void start() { + router.setRoute(this.postUrl(getVertx(), MessageBusAddress.ABIS_HANDLER_BUS_IN, + MessageBusAddress.ABIS_HANDLER_BUS_OUT)); + this.createServer(router.getRouter(), Integer.parseInt(port)); + } + + /* + * (non-Javadoc) + * + * @see + * io.mosip.registration.processor.core.spi.eventbus.EventBusManager#process( + * java.lang.Object) + */ + @Override + public MessageDTO process(MessageDTO object) { + TrimExceptionMessage trimExceptionMessage = new TrimExceptionMessage(); + LogDescription description = new LogDescription(); + object.setMessageBusAddress(MessageBusAddress.ABIS_HANDLER_BUS_IN); + Boolean isTransactionSuccessful = false; + String regId = object.getRid(); + InternalRegistrationStatusDto registrationStatusDto = null; + String transactionTypeCode = null; + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + regId, "AbisHandlerStage::process()::entry"); + try { + registrationStatusDto = registrationStatusService.getRegistrationStatus(regId); + transactionTypeCode = registrationStatusDto.getLatestTransactionTypeCode(); + String transactionId = registrationStatusDto.getLatestRegistrationTransactionId(); + + Boolean isIdentifyRequestPresent = packetInfoManager.getIdentifyByTransactionId(transactionId, + AbisHandlerStageConstant.IDENTIFY); + + if (!isIdentifyRequestPresent) { + List abisQueueDetails = utility.getAbisQueueDetails(); + if (abisQueueDetails.isEmpty()) { + description.setStatusComment(AbisHandlerStageConstant.DETAILS_NOT_FOUND); + description.setMessage(PlatformErrorMessages.RPR_DETAILS_NOT_FOUND.getMessage()); + description.setCode(PlatformErrorMessages.RPR_DETAILS_NOT_FOUND.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), "", + AbisHandlerStageConstant.DETAILS_NOT_FOUND); + throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode()); + } + createRequest(regId, abisQueueDetails, transactionId, registrationStatusDto.getRegistrationType(), description, transactionTypeCode); + object.setMessageBusAddress(MessageBusAddress.ABIS_MIDDLEWARE_BUS_IN); + } else { + if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { + object.setMessageBusAddress(MessageBusAddress.DEMO_DEDUPE_BUS_IN); + } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { + object.setMessageBusAddress(MessageBusAddress.BIO_DEDUPE_BUS_IN); + } + } + description.setStatusComment(AbisHandlerStageConstant.ABIS_HANDLER_SUCCESS); + description.setMessage(PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getMessage()); + description.setCode(PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode()); + isTransactionSuccessful = true; + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + regId, description.getMessage()); + } catch (BiometricRecordValidationException e) { + description.setStatusComment(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage()); + description.setMessage(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage()); + description.setCode(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + regId, ExceptionUtils.getStackTrace(e)); + object.setIsValid(false); + object.setInternalError(true); + registrationStatusDto + .setLatestTransactionStatusCode(RegistrationTransactionStatusCode.ERROR.toString()); + registrationStatusDto.setSubStatusCode(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getCode()); + if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { + registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.DEMO_DEDUPE_STAGE); + } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { + registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.BIO_DEDUPE_STAGE); + } + registrationStatusDto.setStatusCode(statusCode); + registrationStatusDto.setStatusComment(trimExceptionMessage + .trimExceptionMessage(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + e.getMessage())); + String moduleId = description.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + registrationStatusService.updateRegistrationStatus(registrationStatusDto, moduleId, moduleName); + } + catch (Exception e) { + description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER); + description.setMessage(PlatformErrorMessages.RPR_ABIS_HANDLER_STAGE_FAILED.getMessage()); + description.setCode(PlatformErrorMessages.RPR_ABIS_HANDLER_STAGE_FAILED.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + regId, ExceptionUtils.getStackTrace(e)); + object.setInternalError(Boolean.TRUE); + registrationStatusDto + .setLatestTransactionStatusCode(RegistrationTransactionStatusCode.REPROCESS.toString()); + registrationStatusDto.setSubStatusCode(StatusUtil.SYSTEM_EXCEPTION_OCCURED.getCode()); + if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { + registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.DEMO_DEDUPE_STAGE); + } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { + registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.BIO_DEDUPE_STAGE); + } + registrationStatusDto.setStatusComment(trimExceptionMessage + .trimExceptionMessage(StatusUtil.UNKNOWN_EXCEPTION_OCCURED.getMessage() + e.getMessage())); + String moduleId = description.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + + registrationStatusService.updateRegistrationStatus(registrationStatusDto, moduleId, moduleName); + } finally { + String eventId = isTransactionSuccessful ? EventId.RPR_402.toString() : EventId.RPR_405.toString(); + String eventName = isTransactionSuccessful ? EventName.UPDATE.toString() : EventName.EXCEPTION.toString(); + String eventType = isTransactionSuccessful ? EventType.BUSINESS.toString() : EventType.SYSTEM.toString(); + + /** Module-Id can be Both Success/Error code */ + String moduleId = isTransactionSuccessful ? PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode() + : description.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + + auditLogRequestBuilder.createAuditRequestBuilder(description.getMessage(), eventId, eventName, eventType, + moduleId, moduleName, regId); + + } + + return object; + } + + private void createRequest(String regId, List abisQueueDetails, String transactionId, String process, + LogDescription description, String transactionTypeCode) throws Exception { + List bioRefDtos = packetInfoManager.getBioRefIdByRegId(regId); + String bioRefId; + if (bioRefDtos.isEmpty()) { + bioRefId = getUUID(); + insertInBioRef(regId, bioRefId); + } else { + bioRefId = bioRefDtos.get(0).getBioRefId(); + } + createInsertRequest(abisQueueDetails, transactionId, bioRefId, regId, process, description); + createIdentifyRequest(abisQueueDetails, transactionId, bioRefId, transactionTypeCode, description); + + } + + /** + * Creates the identify request. + * + * @param abisQueueDetails + * the abis application dto list + * @param transactionId + * the transaction id + * @param bioRefId + * the bio ref id + * @param transactionTypeCode + * the transaction type code + * @param description + */ + private void createIdentifyRequest(List abisQueueDetails, String transactionId, String bioRefId, + String transactionTypeCode, LogDescription description) { + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", + "AbisHandlerStage::createIdentifyRequest()::entry"); + String batchId = getUUID(); + for (AbisQueueDetails abisQueue : abisQueueDetails) { + AbisRequestDto abisRequestDto = new AbisRequestDto(); + String id = getUUID(); + abisRequestDto.setId(id); + abisRequestDto.setAbisAppCode(abisQueue.getName()); + abisRequestDto.setBioRefId(bioRefId); + abisRequestDto.setRequestType(AbisHandlerStageConstant.IDENTIFY); + abisRequestDto.setReqBatchId(batchId); + abisRequestDto.setRefRegtrnId(transactionId); + + byte[] abisIdentifyRequestBytes = getIdentifyRequestBytes(transactionId, bioRefId, transactionTypeCode, id, + description); + abisRequestDto.setReqText(abisIdentifyRequestBytes); + + abisRequestDto.setStatusCode(RegistrationTransactionStatusCode.IN_PROGRESS.toString()); + abisRequestDto.setStatusComment(null); + abisRequestDto.setLangCode(AbisHandlerStageConstant.ENG); + abisRequestDto.setCrBy(AbisHandlerStageConstant.USER); + abisRequestDto.setUpdBy(null); + abisRequestDto.setIsDeleted(Boolean.FALSE); + + String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); + } + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", + "AbisHandlerStage::createIdentifyRequest()::exit"); + } + + /** + * Gets the identify request bytes. + * + * @param transactionId + * the transaction id + * @param bioRefId + * the bio ref id + * @param transactionTypeCode + * the transaction type code + * @param id + * the id + * @param description + * @return the identify request bytes + */ + private byte[] getIdentifyRequestBytes(String transactionId, String bioRefId, String transactionTypeCode, String id, + LogDescription description) { + AbisIdentifyRequestDto abisIdentifyRequestDto = new AbisIdentifyRequestDto(); + Flag flag = new Flag(); + abisIdentifyRequestDto.setId(AbisHandlerStageConstant.MOSIP_ABIS_IDENTIFY); + abisIdentifyRequestDto.setVersion(AbisHandlerStageConstant.VERSION); + abisIdentifyRequestDto.setRequestId(id); + abisIdentifyRequestDto.setReferenceId(bioRefId); + abisIdentifyRequestDto.setReferenceUrl(""); + abisIdentifyRequestDto.setRequesttime(DateUtils.getUTCCurrentDateTimeString(env.getProperty(DATETIME_PATTERN))); + flag.setMaxResults(maxResults); + flag.setTargetFPIR(targetFPIR); + abisIdentifyRequestDto.setFlags(flag); + + // Added Gallery data for demo dedupe + if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.DEMOGRAPHIC_VERIFICATION)) { + List regDemoDedupeListDtoList = packetInfoManager + .getDemoListByTransactionId(transactionId); + if (regDemoDedupeListDtoList.isEmpty()) { + description.setStatusComment(AbisHandlerStageConstant.NO_RECORD_FOUND); + description.setMessage(PlatformErrorMessages.RPR_NO_RECORD_FOUND.getMessage()); + description.setCode(PlatformErrorMessages.RPR_NO_RECORD_FOUND.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), "", + "Potential Match Records are Not Found for Demo Dedupe Potential Match"); + throw new AbisHandlerException(description.getMessage()); + } + List referenceIdDtos = new ArrayList<>(); + + for (RegDemoDedupeListDto dedupeListDto : regDemoDedupeListDtoList) { + ReferenceIdDto dto = new ReferenceIdDto(); + List regBioRefDto = packetInfoManager.getBioRefIdByRegId(dedupeListDto.getMatchedRegId()); + if (!CollectionUtils.isEmpty(regBioRefDto)) { + dto.setReferenceId(regBioRefDto.get(0).getBioRefId()); + } + + referenceIdDtos.add(dto); + } + AbisIdentifyRequestGalleryDto galleryDto = new AbisIdentifyRequestGalleryDto(); + galleryDto.setReferenceIds(referenceIdDtos); + abisIdentifyRequestDto.setGallery(galleryDto); + } + + try { + String jsonString = JsonUtils.javaObjectToJsonString(abisIdentifyRequestDto); + return jsonString.getBytes(); + } catch (JsonProcessingException e) { + description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); + description.setMessage(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getMessage()); + description.setCode(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + "", AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); + throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode(), e); + } + } + + /** + * Insert in bio ref. + * + * @param regId + * the reg id + * @param bioRefId + * the bio ref id + */ + private void insertInBioRef(String regId, String bioRefId) { + RegBioRefDto regBioRefDto = new RegBioRefDto(); + regBioRefDto.setBioRefId(bioRefId); + regBioRefDto.setCrBy(AbisHandlerStageConstant.USER); + regBioRefDto.setIsActive(Boolean.TRUE); + regBioRefDto.setIsDeleted(Boolean.FALSE); + regBioRefDto.setRegId(regId); + regBioRefDto.setUpdBy(null); + String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + packetInfoManager.saveBioRef(regBioRefDto, moduleId, moduleName); + } + + /** + * Creates the insert request. + * + * @param abisQueueDetails + * the abis application dto list + * @param transactionId + * the transaction id + * @param bioRefId + * the bio ref id + * @param regId + * the reg id + * @param description + */ + private void createInsertRequest(List abisQueueDetails, String transactionId, String bioRefId, + String regId, String process, LogDescription description) throws Exception { + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + regId, "AbisHandlerStage::createInsertRequest()::entry"); + String batchId = getUUID(); + List abisProcessedInsertAppCodeList = packetInfoManager.getAbisProcessedRequestsAppCodeByBioRefId( + bioRefId, AbisStatusCode.INSERT.toString(), AbisStatusCode.PROCESSED.toString()); + List abisAppCodeList = new ArrayList<>(); + for (AbisQueueDetails abisQueue : abisQueueDetails) { + abisAppCodeList.add(abisQueue.getName()); + } + + for (String appCode : abisAppCodeList) { + + AbisRequestDto abisRequestDto = new AbisRequestDto(); + String id = getUUID(); + abisRequestDto.setId(id); + abisRequestDto.setAbisAppCode(appCode); + abisRequestDto.setBioRefId(bioRefId); + abisRequestDto.setRequestType(AbisHandlerStageConstant.INSERT); + abisRequestDto.setReqBatchId(batchId); + abisRequestDto.setRefRegtrnId(transactionId); + + byte[] abisInsertRequestBytes = getInsertRequestBytes(regId, id, process, bioRefId, description); + abisRequestDto.setReqText(abisInsertRequestBytes); + + abisRequestDto.setStatusCode(AbisStatusCode.IN_PROGRESS.toString()); + abisRequestDto.setStatusComment(null); + abisRequestDto.setLangCode(AbisHandlerStageConstant.ENG); + abisRequestDto.setCrBy(AbisHandlerStageConstant.USER); + abisRequestDto.setUpdBy(null); + abisRequestDto.setIsDeleted(Boolean.FALSE); + String moduleId = PlatformSuccessMessages.RPR_ABIS_HANDLER_STAGE_SUCCESS.getCode(); + String moduleName = ModuleName.ABIS_HANDLER.toString(); + if (abisProcessedInsertAppCodeList != null && abisProcessedInsertAppCodeList.contains(appCode)) { + abisRequestDto.setStatusCode(AbisStatusCode.ALREADY_PROCESSED.toString()); + packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); + } else { + abisRequestDto.setStatusCode(AbisStatusCode.IN_PROGRESS.toString()); + packetInfoManager.saveAbisRequest(abisRequestDto, moduleId, moduleName); + } + + } + + regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.USERID.toString(), "", + "AbisHandlerStage::createInsertRequest()::exit"); + } + + /** + * Gets the insert request bytes. + * + * @param regId + * the reg id + * @param id + * the id + * @param bioRefId + * the bio ref id + * @param description + * @return the insert request bytes + */ + private byte[] getInsertRequestBytes(String regId, String id, String process, String bioRefId, LogDescription description) throws Exception { + AbisInsertRequestDto abisInsertRequestDto = new AbisInsertRequestDto(); + abisInsertRequestDto.setId(AbisHandlerStageConstant.MOSIP_ABIS_INSERT); + abisInsertRequestDto.setReferenceId(bioRefId); + abisInsertRequestDto.setReferenceURL(getDataShareUrl(regId, process)); + abisInsertRequestDto.setRequestId(id); + abisInsertRequestDto.setRequesttime(DateUtils.getUTCCurrentDateTimeString(env.getProperty(DATETIME_PATTERN))); + abisInsertRequestDto.setVersion(AbisHandlerStageConstant.VERSION); + try { + String jsonString = JsonUtils.javaObjectToJsonString(abisInsertRequestDto); + return jsonString.getBytes(); + } catch (JsonProcessingException e) { + description.setStatusComment(AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); + description.setMessage(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getMessage()); + description.setCode(PlatformErrorMessages.RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST.getCode()); + regProcLogger.error(LoggerFileConstant.SESSIONID.toString(), LoggerFileConstant.REGISTRATIONID.toString(), + "", AbisHandlerStageConstant.ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST); + throw new AbisHandlerException(PlatformErrorMessages.RPR_ABIS_INTERNAL_ERROR.getCode(), e); + } + } + + /** + * Gets the uuid. + * + * @return the uuid + */ + private String getUUID() { + return UUID.randomUUID().toString(); + } + + private String getDataShareUrl(String id, String process) throws Exception { + Map> typeAndSubtypMap=createTypeSubtypeMapping(); + List modalities=new ArrayList<>(); + for(Map.Entry> entry:typeAndSubtypMap.entrySet()) { + if(entry.getValue()==null) { + modalities.add(entry.getKey()); + } else { + modalities.addAll(entry.getValue()); + } + } + JSONObject regProcessorIdentityJson = utility.getRegistrationProcessorMappingJson(MappingJsonConstants.IDENTITY); + String individualBiometricsLabel = JsonUtil.getJSONValue( + JsonUtil.getJSONObject(regProcessorIdentityJson, MappingJsonConstants.INDIVIDUAL_BIOMETRICS), + MappingJsonConstants.VALUE); + BiometricRecord biometricRecord = priorityBasedPacketManagerService.getBiometrics( + id, individualBiometricsLabel, modalities, process, ProviderStageName.BIO_DEDUPE); + validateBiometricRecord(biometricRecord, modalities, biometricModalitySegmentsMap); + byte[] content = cbeffutil.createXML(BIRConverter.convertSegmentsToBIRList(biometricRecord.getSegments())); + + MultiValueMap map = new LinkedMultiValueMap<>(); + map.add("name", individualBiometricsLabel); + map.add("filename", individualBiometricsLabel); + + ByteArrayResource contentsAsResource = new ByteArrayResource(content) { + @Override + public String getFilename() { + return individualBiometricsLabel; + } + }; + map.add("file", contentsAsResource); + + List pathSegments = new ArrayList<>(); + pathSegments.add(policyId); + pathSegments.add(subscriberId); + + DataShareResponseDto response = (DataShareResponseDto) registrationProcessorRestClientService.postApi(ApiName.DATASHARECREATEURL, MediaType.MULTIPART_FORM_DATA, pathSegments, null, null, map, DataShareResponseDto.class); + if (response == null || (response.getErrors() != null && response.getErrors().size() >0)) + throw new DataShareException(response == null ? "Datashare response is null" : response.getErrors().get(0).getMessage()); + + return response.getDataShare().getUrl(); + } + public Map> createTypeSubtypeMapping() throws ApisResourceAccessException, DataShareException, JsonParseException, JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException, IOException{ + Map> typeAndSubTypeMap = new HashMap<>(); + ResponseWrapper policyResponse = (ResponseWrapper) registrationProcessorRestClientService.getApi( + ApiName.PMS, Lists.newArrayList(policyId, PolicyConstant.PARTNER_ID, subscriberId), "", "", ResponseWrapper.class); + if (policyResponse == null || (policyResponse.getErrors() != null && policyResponse.getErrors().size() >0)) { + throw new DataShareException(policyResponse == null ? "Policy Response response is null" : policyResponse.getErrors().get(0).getMessage()); + + } else { + LinkedHashMap responseMap = (LinkedHashMap) policyResponse.getResponse(); + LinkedHashMap policies = (LinkedHashMap) responseMap.get(PolicyConstant.POLICIES); + List attributes = (List) policies.get(PolicyConstant.SHAREABLE_ATTRIBUTES); + ObjectMapper mapper = new ObjectMapper(); + ShareableAttributes shareableAttributes = mapper.readValue(mapper.writeValueAsString(attributes.get(0)), + ShareableAttributes.class); + for (Source source : shareableAttributes.getSource()) { + List filterList = source.getFilter(); + if (filterList != null && !filterList.isEmpty()) { + + filterList.forEach(filter -> { + if (filter.getSubType() != null && !filter.getSubType().isEmpty()) { + typeAndSubTypeMap.put(filter.getType(), filter.getSubType()); + } else { + typeAndSubTypeMap.put(filter.getType(), null); + } + }); + } + } + } + return typeAndSubTypeMap; + + } + + private void validateBiometricRecord(BiometricRecord biometricRecord, List modalities, + Map> biometricModalitySegmentsMap) + throws BiometricRecordValidationException, JsonParseException, JsonMappingException, IOException { + if (modalities == null || modalities.isEmpty()) { + throw new BiometricRecordValidationException(PlatformErrorMessages.RPR_DATASHARE_MODALITIES_EMPTY.getCode(),PlatformErrorMessages.RPR_DATASHARE_MODALITIES_EMPTY.getMessage()); + } + if (biometricRecord == null || biometricRecord.getSegments() == null + || biometricRecord.getSegments().isEmpty()) { + throw new BiometricRecordValidationException(PlatformErrorMessages.RPR_NO_BIOMETRICS_FOUND_WITH_DATASHARE.getCode(),PlatformErrorMessages.RPR_NO_BIOMETRICS_FOUND_WITH_DATASHARE.getMessage()); + } + + boolean isBioFound = false; + for (String biometricSegment : biometricModalitySegmentsMap.keySet()) { + if (!modalities.contains(biometricSegment)) { + throw new BiometricRecordValidationException(PlatformErrorMessages.RPR_BIOMETRIC_SEGMENT_NOT_CONFIGURED_FOR_MODALITY.getCode(),String.format(PlatformErrorMessages.RPR_BIOMETRIC_SEGMENT_NOT_CONFIGURED_FOR_MODALITY.getMessage(),biometricSegment)); + } + for (String segment : biometricModalitySegmentsMap.get(biometricSegment)) { + Optional optionalBIR = Optional.empty(); + if (segment.equalsIgnoreCase("Face")) { + optionalBIR = biometricRecord.getSegments().stream() + .filter(bir -> bir.getBdbInfo().getType() != null + && bir.getBdbInfo().getType().get(0).equals(BiometricType.FACE)) + .findFirst(); + } else { + String[] segmentArray = segment.split(" "); + optionalBIR = biometricRecord.getSegments().stream().filter(bir -> bir.getBdbInfo() + .getSubtype() != null && bir.getBdbInfo().getSubtype().size() == segmentArray.length + ? (bir.getBdbInfo().getSubtype().get(0).equalsIgnoreCase(segmentArray[0]) + && (segmentArray.length == 2 + ? bir.getBdbInfo().getSubtype().get(1) + .equalsIgnoreCase(segmentArray[1]) + : true)) + : false) + .findFirst(); + } + if (optionalBIR.isPresent()) { + BIR bir = optionalBIR.get(); + if (bir.getBdb() != null) { + isBioFound = true; + } + } + } + } + if (!isBioFound) { + throw new BiometricRecordValidationException(PlatformErrorMessages.RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE.getCode(),PlatformErrorMessages.RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE.getMessage()); + } + } +} diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java index b53b20d557b..dc3b7575a7c 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java @@ -1,493 +1,655 @@ -package io.mosip.registration.processor.abis.handler.stage.test; - -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.List; - -import com.fasterxml.jackson.databind.ObjectMapper; -import io.mosip.kernel.biometrics.constant.BiometricType; -import io.mosip.kernel.biometrics.constant.QualityType; -import io.mosip.kernel.biometrics.entities.BDBInfo; -import io.mosip.kernel.biometrics.entities.RegistryIDType; -import io.mosip.registration.processor.abis.handler.dto.Filter; -import io.mosip.registration.processor.abis.handler.dto.ShareableAttributes; -import io.mosip.registration.processor.abis.handler.dto.Source; -import io.mosip.registration.processor.core.constant.PolicyConstant; -import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; -import org.assertj.core.util.Lists; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.springframework.core.env.Environment; -import org.springframework.http.MediaType; -import org.springframework.test.util.ReflectionTestUtils; - -import io.mosip.kernel.biometrics.entities.BiometricRecord; -import io.mosip.kernel.biometrics.entities.BIR; -import io.mosip.kernel.core.cbeffutil.spi.CbeffUtil; -import io.mosip.kernel.core.util.JsonUtils; -import io.mosip.kernel.core.util.exception.JsonProcessingException; -import io.mosip.registration.processor.abis.handler.dto.DataShare; -import io.mosip.registration.processor.abis.handler.dto.DataShareResponseDto; -import io.mosip.registration.processor.abis.handler.stage.AbisHandlerStage; -import io.mosip.registration.processor.abis.queue.dto.AbisQueueDetails; -import io.mosip.registration.processor.core.abstractverticle.EventDTO; -import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress; -import io.mosip.registration.processor.core.abstractverticle.MessageDTO; -import io.mosip.registration.processor.core.abstractverticle.MosipEventBus; -import io.mosip.registration.processor.core.code.ApiName; -import io.mosip.registration.processor.core.exception.RegistrationProcessorCheckedException; -import io.mosip.registration.processor.core.http.ResponseWrapper; -import io.mosip.registration.processor.core.logger.LogDescription; -import io.mosip.registration.processor.core.packet.dto.Identity; -import io.mosip.registration.processor.core.packet.dto.abis.AbisApplicationDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisInsertRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.AbisRequestDto; -import io.mosip.registration.processor.core.packet.dto.abis.RegBioRefDto; -import io.mosip.registration.processor.core.packet.dto.abis.RegDemoDedupeListDto; -import io.mosip.registration.processor.core.spi.eventbus.EventHandler; -import io.mosip.registration.processor.core.spi.packetmanager.PacketInfoManager; -import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; -import io.mosip.registration.processor.packet.storage.dto.ApplicantInfoDto; -import io.mosip.registration.processor.packet.storage.utils.Utilities; -import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; -import io.mosip.registration.processor.rest.client.audit.dto.AuditResponseDto; -import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; -import io.mosip.registration.processor.status.dto.RegistrationStatusDto; -import io.mosip.registration.processor.status.service.RegistrationStatusService; -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; -import io.vertx.core.Vertx; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ JsonUtils.class }) -@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*","javax.management.*", "javax.net.ssl.*" }) -public class AbisHandlerStageTest { - - @Mock - private AuditLogRequestBuilder auditLogRequestBuilder; - - @Mock - private RegistrationStatusService registrationStatusService; - - @Mock - private PacketInfoManager packetInfoManager; - - @Mock - private InternalRegistrationStatusDto registrationStatusDto; - - @Mock - private Utilities utility; - - @Mock - private PriorityBasedPacketManagerService packetManagerService; - - @Mock - private LogDescription description; - - List abisApplicationDtos = new ArrayList<>(); - - List bioRefDtos = new ArrayList<>(); - - List regDemoDedupeListDtoList = new ArrayList<>(); - - List abisRequestDtoList = new ArrayList<>(); - - @Mock - private Environment env; - - @Mock - private RegistrationProcessorRestClientService registrationProcessorRestClientService; - - @Mock - private CbeffUtil cbeffutil; - - @InjectMocks - private AbisHandlerStage abisHandlerStage = new AbisHandlerStage() { - @Override - public MosipEventBus getEventBus(Object verticleName, String url, int instanceNumber) { - vertx = Vertx.vertx(); - - return new MosipEventBus() { - - @Override - public Vertx getEventbus() { - return vertx; - } - - @Override - public void consume(MessageBusAddress fromAddress, - EventHandler>> eventHandler) { - - } - - @Override - public void consumeAndSend(MessageBusAddress fromAddress, MessageBusAddress toAddress, - EventHandler>> eventHandler) { - - } - - @Override - public void send(MessageBusAddress toAddress, MessageDTO message) { - - } - }; - } - - @Override - public void consumeAndSend(MosipEventBus mosipEventBus, MessageBusAddress fromAddress, - MessageBusAddress toAddress, long messageExpiryTimeLimit) { - } - }; - - @Before - public void setUp() throws Exception { - ReflectionTestUtils.setField(abisHandlerStage, "maxResults", "30"); - ReflectionTestUtils.setField(abisHandlerStage, "targetFPIR", "30"); - ReflectionTestUtils.setField(abisHandlerStage, "workerPoolSize", 10); - ReflectionTestUtils.setField(abisHandlerStage, "messageExpiryTimeLimit", Long.valueOf(0)); - ReflectionTestUtils.setField(abisHandlerStage, "clusterManagerUrl", "/dummyPath"); - Mockito.when(env.getProperty("mosip.registration.processor.datetime.pattern")) - .thenReturn("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - AbisApplicationDto dto = new AbisApplicationDto(); - dto.setCode("ABIS1"); - abisApplicationDtos.add(dto); - - Mockito.doNothing().when(description).setMessage(any()); - Mockito.when(description.getMessage()).thenReturn("description"); - - List birTypeList = new ArrayList<>(); - BIR birType1 = new BIR.BIRBuilder().build(); - BDBInfo bdbInfoType1 = new BDBInfo.BDBInfoBuilder().build(); - io.mosip.kernel.biometrics.entities.RegistryIDType registryIDType = new RegistryIDType(); - registryIDType.setOrganization("Mosip"); - registryIDType.setType("257"); - io.mosip.kernel.biometrics.constant.QualityType quality = new QualityType(); - quality.setAlgorithm(registryIDType); - quality.setScore(90l); - bdbInfoType1.setQuality(quality); - BiometricType singleType1 = BiometricType.FINGER; - List singleTypeList1 = new ArrayList<>(); - singleTypeList1.add(singleType1); - List subtype1 = new ArrayList<>(Arrays.asList("Left", "RingFinger")); - bdbInfoType1.setSubtype(subtype1); - bdbInfoType1.setType(singleTypeList1); - birType1.setBdbInfo(bdbInfoType1); - birTypeList.add(birType1); - - BiometricRecord biometricRecord = new BiometricRecord(); - biometricRecord.setSegments(birTypeList); - when(utility.getDefaultSource(any(), any())).thenReturn("reg-client"); - when(cbeffutil.createXML(any())).thenReturn("abishandlerstage".getBytes()); - - Mockito.when(packetManagerService.getBiometrics(any(),any(),any(), any())).thenReturn(biometricRecord); - - Mockito.doNothing().when(registrationStatusDto).setLatestTransactionStatusCode(any()); - Mockito.doNothing().when(registrationStatusService).updateRegistrationStatus(any(), any(), any()); - - Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); - - AbisQueueDetails abisQueueDetails = new AbisQueueDetails(); - abisQueueDetails.setName("ABIS1"); - List abisQueueDetailsList = new ArrayList<>(); - abisQueueDetailsList.add(abisQueueDetails); - Mockito.when(utility.getAbisQueueDetails()).thenReturn(abisQueueDetailsList); - - AuditResponseDto auditResponseDto = new AuditResponseDto(); - ResponseWrapper responseWrapper = new ResponseWrapper<>(); - responseWrapper.setResponse(auditResponseDto); - Mockito.when(auditLogRequestBuilder.createAuditRequestBuilder(any(), any(), any(), any(), any(), any(), any())) - .thenReturn(responseWrapper); - - DataShareResponseDto dataShareResponseDto = new DataShareResponseDto(); - DataShare dataShare = new DataShare(); - dataShare.setUrl("http://localhost"); - dataShareResponseDto.setDataShare(dataShare); - - ShareableAttributes shareableAttributes = new ShareableAttributes(); - List source = new ArrayList<>(); - Filter filter = new Filter(); - filter.setType("face"); - Source src = new Source(); - src.setFilter(Lists.newArrayList(filter)); - source.add(src); - shareableAttributes.setSource(source); - - ObjectMapper mapper = new ObjectMapper(); - - List attr = Lists.newArrayList(shareableAttributes); - - ResponseWrapper> policy = new ResponseWrapper<>(); - LinkedHashMap policies = new LinkedHashMap<>(); - LinkedHashMap sharableAttributes = new LinkedHashMap<>(); - sharableAttributes.put(PolicyConstant.SHAREABLE_ATTRIBUTES, attr); - policies.put(PolicyConstant.POLICIES, sharableAttributes); - policy.setResponse(policies); - - when(registrationProcessorRestClientService.getApi(any(),any(),anyString(),anyString(),any())).thenReturn(policy); - - Mockito.when(registrationProcessorRestClientService.postApi(any(ApiName.class), any(MediaType.class), any(),any(),any(), any(), any())).thenReturn(dataShareResponseDto); - } - - @Test - public void testDeployVerticle() { - abisHandlerStage.deployVerticle(); - } - - @Ignore - @Test - public void testDemoToAbisHandlerTOMiddlewareSuccess() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto(); - regDemoDedupeListDto.setMatchedRegId("10003100030001520190422074511"); - regDemoDedupeListDtoList.add(regDemoDedupeListDto); - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); - } - - @Ignore - @Test - public void testBioToAbisHandlerToMiddlewareSuccess() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - RegBioRefDto regBioRefDto = new RegBioRefDto(); - regBioRefDto.setBioRefId("1234567890"); - bioRefDtos.add(regBioRefDto); - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto(); - regDemoDedupeListDto.setMatchedRegId("10003100030001520190422074511"); - regDemoDedupeListDtoList.add(regDemoDedupeListDto); - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); - } - - @Test - public void testMiddlewareToAbisHandlerToDemoSuccess() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.TRUE); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("demo-dedupe-bus-in")); - } - - @Test - public void testMiddlewareToAbisHandlerToBioSuccess() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.TRUE); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("bio-dedupe-bus-in")); - } - - @Test - public void testDemoDedupeDataNotFound() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getInternalError()); - - } - - @Ignore - @Test - public void testReprocessInsert() { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - List appCodeList = new ArrayList<>(); - appCodeList.add("ABIS1"); - Mockito.when(packetInfoManager.getAbisProcessedRequestsAppCodeByBioRefId(any(), any(), any())).thenReturn(appCodeList); - - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - RegBioRefDto bioRefDto = new RegBioRefDto(); - bioRefDtos.add(bioRefDto); - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - - AbisRequestDto abisRequestDto = new AbisRequestDto(); - abisRequestDto.setAbisAppCode("ABIS1"); - abisRequestDto.setStatusCode("IN-PROGRESS"); - abisRequestDtoList.add(abisRequestDto); - Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); - - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); - } - - @Test - public void testAbisDetailsNotFound() throws RegistrationProcessorCheckedException { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - - List abisQueueDetails = new ArrayList<>(); - Mockito.when(utility.getAbisQueueDetails()).thenReturn(abisQueueDetails); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getInternalError()); - } - - @Test - public void testCreateRequestException() throws JsonProcessingException { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - RegBioRefDto bioRefDto = new RegBioRefDto(); - bioRefDtos.add(bioRefDto); - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - - AbisRequestDto abisRequestDto = new AbisRequestDto(); - abisRequestDto.setAbisAppCode("ABIS1"); - abisRequestDto.setStatusCode("IN-PROGRESS"); - abisRequestDtoList.add(abisRequestDto); - Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); - - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - PowerMockito.mockStatic(JsonUtils.class); - PowerMockito.when(JsonUtils.javaObjectToJsonString(any(AbisInsertRequestDto.class))).thenThrow(JsonProcessingException.class); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getInternalError()); - } - - @Test - public void testIdentifyRequestException() throws JsonProcessingException { - Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); - Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); - Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) - .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); - Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); - - Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); - - RegBioRefDto bioRefDto = new RegBioRefDto(); - bioRefDtos.add(bioRefDto); - Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); - - Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); - - AbisRequestDto abisRequestDto = new AbisRequestDto(); - abisRequestDto.setAbisAppCode("ABIS1"); - abisRequestDto.setStatusCode("IN-PROGRESS"); - abisRequestDtoList.add(abisRequestDto); - Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); - - Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); - - Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); - - PowerMockito.mockStatic(JsonUtils.class); - PowerMockito.when(JsonUtils.javaObjectToJsonString(any(AbisInsertRequestDto.class))).thenReturn("AbisInsertRequestDto"); - PowerMockito.when(JsonUtils.javaObjectToJsonString(ArgumentMatchers.any(AbisIdentifyRequestDto.class))).thenThrow(JsonProcessingException.class); - - MessageDTO dto = new MessageDTO(); - dto.setRid("10003100030001520190422074511"); - MessageDTO result = abisHandlerStage.process(dto); - - assertTrue(result.getInternalError()); - } - - -} +package io.mosip.registration.processor.abis.handler.stage.test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.assertj.core.util.Lists; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.test.util.ReflectionTestUtils; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.kernel.biometrics.constant.BiometricType; +import io.mosip.kernel.biometrics.constant.QualityType; +import io.mosip.kernel.biometrics.entities.BDBInfo; +import io.mosip.kernel.biometrics.entities.BIR; +import io.mosip.kernel.biometrics.entities.BiometricRecord; +import io.mosip.kernel.biometrics.entities.RegistryIDType; +import io.mosip.kernel.core.cbeffutil.spi.CbeffUtil; +import io.mosip.kernel.core.util.JsonUtils; +import io.mosip.kernel.core.util.exception.JsonProcessingException; +import io.mosip.registration.processor.abis.handler.dto.DataShare; +import io.mosip.registration.processor.abis.handler.dto.DataShareResponseDto; +import io.mosip.registration.processor.abis.handler.dto.Filter; +import io.mosip.registration.processor.abis.handler.dto.ShareableAttributes; +import io.mosip.registration.processor.abis.handler.dto.Source; +import io.mosip.registration.processor.abis.handler.stage.AbisHandlerStage; +import io.mosip.registration.processor.abis.queue.dto.AbisQueueDetails; +import io.mosip.registration.processor.core.abstractverticle.EventDTO; +import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress; +import io.mosip.registration.processor.core.abstractverticle.MessageDTO; +import io.mosip.registration.processor.core.abstractverticle.MosipEventBus; +import io.mosip.registration.processor.core.code.ApiName; +import io.mosip.registration.processor.core.constant.PolicyConstant; +import io.mosip.registration.processor.core.exception.ApisResourceAccessException; +import io.mosip.registration.processor.core.exception.PacketManagerException; +import io.mosip.registration.processor.core.exception.RegistrationProcessorCheckedException; +import io.mosip.registration.processor.core.http.ResponseWrapper; +import io.mosip.registration.processor.core.logger.LogDescription; +import io.mosip.registration.processor.core.packet.dto.Identity; +import io.mosip.registration.processor.core.packet.dto.abis.AbisApplicationDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisIdentifyRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisInsertRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.AbisRequestDto; +import io.mosip.registration.processor.core.packet.dto.abis.RegBioRefDto; +import io.mosip.registration.processor.core.packet.dto.abis.RegDemoDedupeListDto; +import io.mosip.registration.processor.core.spi.eventbus.EventHandler; +import io.mosip.registration.processor.core.spi.packetmanager.PacketInfoManager; +import io.mosip.registration.processor.core.spi.restclient.RegistrationProcessorRestClientService; +import io.mosip.registration.processor.packet.storage.dto.ApplicantInfoDto; +import io.mosip.registration.processor.packet.storage.utils.PriorityBasedPacketManagerService; +import io.mosip.registration.processor.packet.storage.utils.Utilities; +import io.mosip.registration.processor.rest.client.audit.builder.AuditLogRequestBuilder; +import io.mosip.registration.processor.rest.client.audit.dto.AuditResponseDto; +import io.mosip.registration.processor.status.dto.InternalRegistrationStatusDto; +import io.mosip.registration.processor.status.dto.RegistrationStatusDto; +import io.mosip.registration.processor.status.service.RegistrationStatusService; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.Vertx; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ JsonUtils.class }) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*","javax.management.*", "javax.net.ssl.*" }) +public class AbisHandlerStageTest { + + @Mock + private AuditLogRequestBuilder auditLogRequestBuilder; + + @Mock + private RegistrationStatusService registrationStatusService; + + @Mock + private PacketInfoManager packetInfoManager; + + @Mock + private InternalRegistrationStatusDto registrationStatusDto; + + @Mock + private Utilities utility; + + @Mock + private PriorityBasedPacketManagerService packetManagerService; + + @Mock + private LogDescription description; + + List abisApplicationDtos = new ArrayList<>(); + + List bioRefDtos = new ArrayList<>(); + + List regDemoDedupeListDtoList = new ArrayList<>(); + + List abisRequestDtoList = new ArrayList<>(); + + @Mock + private Environment env; + + @Mock + private RegistrationProcessorRestClientService registrationProcessorRestClientService; + + @Mock + private CbeffUtil cbeffutil; + + @InjectMocks + private AbisHandlerStage abisHandlerStage = new AbisHandlerStage() { + @Override + public MosipEventBus getEventBus(Object verticleName, String url, int instanceNumber) { + vertx = Vertx.vertx(); + + return new MosipEventBus() { + + @Override + public Vertx getEventbus() { + return vertx; + } + + @Override + public void consume(MessageBusAddress fromAddress, + EventHandler>> eventHandler) { + + } + + @Override + public void consumeAndSend(MessageBusAddress fromAddress, MessageBusAddress toAddress, + EventHandler>> eventHandler) { + + } + + @Override + public void send(MessageBusAddress toAddress, MessageDTO message) { + + } + }; + } + + @Override + public void consumeAndSend(MosipEventBus mosipEventBus, MessageBusAddress fromAddress, + MessageBusAddress toAddress, long messageExpiryTimeLimit) { + } + }; + + @Before + public void setUp() throws Exception { + ReflectionTestUtils.setField(abisHandlerStage, "maxResults", "30"); + ReflectionTestUtils.setField(abisHandlerStage, "targetFPIR", "30"); + ReflectionTestUtils.setField(abisHandlerStage, "workerPoolSize", 10); + ReflectionTestUtils.setField(abisHandlerStage, "messageExpiryTimeLimit", Long.valueOf(0)); + ReflectionTestUtils.setField(abisHandlerStage, "clusterManagerUrl", "/dummyPath"); + Map> biometricModalitySegmentsMap = new HashMap(); + biometricModalitySegmentsMap.put("Finger", getFingerList()); + biometricModalitySegmentsMap.put("Iris", getIrisList()); + biometricModalitySegmentsMap.put("Face", getFaceList()); + ReflectionTestUtils.setField(abisHandlerStage, "biometricModalitySegmentsMap", biometricModalitySegmentsMap); + ReflectionTestUtils.setField(abisHandlerStage, "statusCode", "REJECTED"); + Mockito.when(env.getProperty("mosip.registration.processor.datetime.pattern")) + .thenReturn("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + AbisApplicationDto dto = new AbisApplicationDto(); + dto.setCode("ABIS1"); + abisApplicationDtos.add(dto); + + Mockito.doNothing().when(description).setMessage(any()); + Mockito.when(description.getMessage()).thenReturn("description"); + + when(utility.getDefaultSource(any(), any())).thenReturn("reg-client"); + when(cbeffutil.createXML(any())).thenReturn("abishandlerstage".getBytes()); + + + Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())) + .thenReturn(getBiometricRecord(Arrays.asList("Left Thumb", "Right Thumb", "Left MiddleFinger", + "Left RingFinger", "Left LittleFinger", "Left IndexFinger", "Right MiddleFinger", + "Right RingFinger", "Right LittleFinger", "Right IndexFinger", "Left", "Right", "Face"), + false)); + + Mockito.doNothing().when(registrationStatusDto).setLatestTransactionStatusCode(any()); + Mockito.doNothing().when(registrationStatusService).updateRegistrationStatus(any(), any(), any()); + + Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); + + AbisQueueDetails abisQueueDetails = new AbisQueueDetails(); + abisQueueDetails.setName("ABIS1"); + List abisQueueDetailsList = new ArrayList<>(); + abisQueueDetailsList.add(abisQueueDetails); + Mockito.when(utility.getAbisQueueDetails()).thenReturn(abisQueueDetailsList); + + AuditResponseDto auditResponseDto = new AuditResponseDto(); + ResponseWrapper responseWrapper = new ResponseWrapper<>(); + responseWrapper.setResponse(auditResponseDto); + Mockito.when(auditLogRequestBuilder.createAuditRequestBuilder(any(), any(), any(), any(), any(), any(), any())) + .thenReturn(responseWrapper); + + DataShareResponseDto dataShareResponseDto = new DataShareResponseDto(); + DataShare dataShare = new DataShare(); + dataShare.setUrl("http://localhost"); + dataShareResponseDto.setDataShare(dataShare); + + mockDataSharePolicy(Lists.newArrayList(BiometricType.FACE, BiometricType.FINGER, BiometricType.IRIS)); + Mockito.doNothing().when(description).setMessage(any()); + Mockito.when(description.getMessage()).thenReturn("description"); + Mockito.when(registrationProcessorRestClientService.postApi(any(ApiName.class), any(MediaType.class), any(),any(),any(), any(), any())).thenReturn(dataShareResponseDto); + } + + @Test + public void testDeployVerticle() { + abisHandlerStage.deployVerticle(); + } + + @Ignore + @Test + public void testDemoToAbisHandlerTOMiddlewareSuccess() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto(); + regDemoDedupeListDto.setMatchedRegId("10003100030001520190422074511"); + regDemoDedupeListDtoList.add(regDemoDedupeListDto); + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); + } + + @Ignore + @Test + public void testBioToAbisHandlerToMiddlewareSuccess() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + RegBioRefDto regBioRefDto = new RegBioRefDto(); + regBioRefDto.setBioRefId("1234567890"); + bioRefDtos.add(regBioRefDto); + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto(); + regDemoDedupeListDto.setMatchedRegId("10003100030001520190422074511"); + regDemoDedupeListDtoList.add(regDemoDedupeListDto); + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); + } + + @Test + public void testMiddlewareToAbisHandlerToDemoSuccess() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.TRUE); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("demo-dedupe-bus-in")); + } + + @Test + public void testMiddlewareToAbisHandlerToBioSuccess() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.TRUE); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("bio-dedupe-bus-in")); + } + + @Test + public void testDemoDedupeDataNotFound() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("DEMOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getInternalError()); + + } + + @Ignore + @Test + public void testReprocessInsert() { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + List appCodeList = new ArrayList<>(); + appCodeList.add("ABIS1"); + Mockito.when(packetInfoManager.getAbisProcessedRequestsAppCodeByBioRefId(any(), any(), any())).thenReturn(appCodeList); + + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + RegBioRefDto bioRefDto = new RegBioRefDto(); + bioRefDtos.add(bioRefDto); + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + + AbisRequestDto abisRequestDto = new AbisRequestDto(); + abisRequestDto.setAbisAppCode("ABIS1"); + abisRequestDto.setStatusCode("IN-PROGRESS"); + abisRequestDtoList.add(abisRequestDto); + Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); + + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getMessageBusAddress().getAddress().equalsIgnoreCase("abis-middle-ware-bus-in")); + } + + @Test + public void testAbisDetailsNotFound() throws RegistrationProcessorCheckedException { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + + List abisQueueDetails = new ArrayList<>(); + Mockito.when(utility.getAbisQueueDetails()).thenReturn(abisQueueDetails); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getInternalError()); + } + + @Test + public void testCreateRequestException() throws JsonProcessingException { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + RegBioRefDto bioRefDto = new RegBioRefDto(); + bioRefDtos.add(bioRefDto); + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + + AbisRequestDto abisRequestDto = new AbisRequestDto(); + abisRequestDto.setAbisAppCode("ABIS1"); + abisRequestDto.setStatusCode("IN-PROGRESS"); + abisRequestDtoList.add(abisRequestDto); + Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); + + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + PowerMockito.mockStatic(JsonUtils.class); + PowerMockito.when(JsonUtils.javaObjectToJsonString(any(AbisInsertRequestDto.class))).thenThrow(JsonProcessingException.class); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getInternalError()); + } + + @Test + public void testIdentifyRequestException() throws JsonProcessingException { + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + RegBioRefDto bioRefDto = new RegBioRefDto(); + bioRefDtos.add(bioRefDto); + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + + AbisRequestDto abisRequestDto = new AbisRequestDto(); + abisRequestDto.setAbisAppCode("ABIS1"); + abisRequestDto.setStatusCode("IN-PROGRESS"); + abisRequestDtoList.add(abisRequestDto); + Mockito.when(packetInfoManager.getAbisRequestsByBioRefId(any())).thenReturn(abisRequestDtoList); + + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + PowerMockito.mockStatic(JsonUtils.class); + PowerMockito.when(JsonUtils.javaObjectToJsonString(any(AbisInsertRequestDto.class))).thenReturn("AbisInsertRequestDto"); + PowerMockito.when(JsonUtils.javaObjectToJsonString(ArgumentMatchers.any(AbisIdentifyRequestDto.class))).thenThrow(JsonProcessingException.class); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertTrue(result.getInternalError()); + } + + private List getIrisList() { + return Arrays.asList("Left", "Right"); + + } + + private List getFingerList() { + return Arrays.asList("Left Thumb", "Left LittleFinger", "Left IndexFinger", "Left MiddleFinger", + "Left RingFinger", "Right Thumb", "Right LittleFinger", "Right IndexFinger", "Right MiddleFinger", + "Right RingFinger"); + } + + private List getFaceList() { + return Arrays.asList("Face"); + } + + private BiometricRecord getBiometricRecord(List bioAttributes, boolean isBdbEmpty) { + BiometricRecord biometricRecord = new BiometricRecord(); + + byte[] bdb = isBdbEmpty ? null : new byte[2048]; + for (String bioAttribute : bioAttributes) { + BIR birType1 = new BIR.BIRBuilder().build(); + BDBInfo bdbInfoType1 = new BDBInfo.BDBInfoBuilder().build(); + io.mosip.kernel.biometrics.entities.RegistryIDType registryIDType = new RegistryIDType(); + registryIDType.setOrganization("Mosip"); + registryIDType.setType("257"); + io.mosip.kernel.biometrics.constant.QualityType quality = new QualityType(); + quality.setAlgorithm(registryIDType); + quality.setScore(90l); + bdbInfoType1.setQuality(quality); + + BiometricType singleType1 = bioAttribute.equalsIgnoreCase("face") ? BiometricType.FACE + : bioAttribute.equalsIgnoreCase("left") || bioAttribute.equalsIgnoreCase("right") + ? BiometricType.IRIS + : BiometricType.FINGER; + List singleTypeList1 = new ArrayList<>(); + singleTypeList1.add(singleType1); + bdbInfoType1.setType(singleTypeList1); + + String[] bioAttributeArray = bioAttribute.split(" "); + + List subtype = new ArrayList<>(); + for (String attribute : bioAttributeArray) { + subtype.add(attribute); + } + bdbInfoType1.setSubtype(subtype); + + birType1.setBdbInfo(bdbInfoType1); + birType1.setBdb(bdb); + + biometricRecord.getSegments().add(birType1); + } + + return biometricRecord; + } + + private void mockDataSharePolicy(List sherableBiometricList) throws ApisResourceAccessException { + when(registrationProcessorRestClientService.getApi(any(), any(), anyString(), anyString(), any())) + .thenReturn(getMockDataSharePolicy(sherableBiometricList)); + } + + private ResponseWrapper> getMockDataSharePolicy( + List sherableBiometricList) { + + ObjectMapper mapper = new ObjectMapper(); + + List attr = new LinkedList<>(); + if (sherableBiometricList != null && !sherableBiometricList.isEmpty()) { + + ShareableAttributes shareableAttributes = new ShareableAttributes(); + List sourceList = new ArrayList<>(); + + for (BiometricType bioType : sherableBiometricList) { + Filter filter = new Filter(); + filter.setType(bioType.value()); + Source src = new Source(); + src.setFilter(Lists.newArrayList(filter)); + sourceList.add(src); + } + + shareableAttributes.setSource(sourceList); + attr = Lists.newArrayList(shareableAttributes); + } + + ResponseWrapper> policy = new ResponseWrapper<>(); + LinkedHashMap policies = new LinkedHashMap<>(); + LinkedHashMap sharableAttributes = new LinkedHashMap<>(); + sharableAttributes.put(PolicyConstant.SHAREABLE_ATTRIBUTES, attr); + policies.put(PolicyConstant.POLICIES, sharableAttributes); + policy.setResponse(policies); + + return policy; + } + + @Test + public void noBdbInAnyBiometric() + throws ApisResourceAccessException, PacketManagerException, JsonProcessingException, IOException { + defaultMockToProcess(); + Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())) + .thenReturn(getBiometricRecord(Arrays.asList("Left Thumb", "Right Thumb", "Left MiddleFinger", + "Left RingFinger", "Left LittleFinger", "Left IndexFinger", "Right MiddleFinger", + "Right RingFinger", "Right LittleFinger", "Right IndexFinger", "Left", "Right", "Face"), true)); + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + assertFalse(result.getIsValid()); + assertTrue(result.getInternalError()); + } + + private void defaultMockToProcess() { + Mockito.when(registrationStatusDto.getLatestTransactionTypeCode()).thenReturn("BIOGRAPHIC_VERIFICATION"); + Mockito.when(registrationStatusDto.getLatestRegistrationTransactionId()) + .thenReturn("dd7b7d20-910a-4b84-be21-c9f211318563"); + Mockito.when(registrationStatusService.getRegistrationStatus(any())).thenReturn(registrationStatusDto); + Mockito.when(packetInfoManager.getIdentifyByTransactionId(any(), any())).thenReturn(Boolean.FALSE); + Mockito.when(packetInfoManager.getAllAbisDetails()).thenReturn(abisApplicationDtos); + + RegBioRefDto regBioRefDto = new RegBioRefDto(); + regBioRefDto.setBioRefId("1234567890"); + bioRefDtos.add(regBioRefDto); + Mockito.when(packetInfoManager.getBioRefIdByRegId(any())).thenReturn(bioRefDtos); + + Mockito.doNothing().when(packetInfoManager).saveBioRef(any(), any(), any()); + Mockito.doNothing().when(packetInfoManager).saveAbisRequest(any(), any(), any()); + + RegDemoDedupeListDto regDemoDedupeListDto = new RegDemoDedupeListDto(); + regDemoDedupeListDto.setMatchedRegId("10003100030001520190422074511"); + regDemoDedupeListDtoList.add(regDemoDedupeListDto); + Mockito.when(packetInfoManager.getDemoListByTransactionId(any())).thenReturn(regDemoDedupeListDtoList); + + } + + @Test + public void emptyBdbFound() + throws ApisResourceAccessException, PacketManagerException, JsonProcessingException, IOException { + + defaultMockToProcess(); + + Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())) + .thenReturn(getBiometricRecord(Arrays.asList("Left RingFinger"), true)); + mockDataSharePolicy(Lists.newArrayList(BiometricType.FINGER)); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertFalse(result.getIsValid()); + assertTrue(result.getInternalError()); + } + + @Test + public void biometricsNotFoundWithSegmentConfig() + throws ApisResourceAccessException, PacketManagerException, JsonProcessingException, IOException { + + defaultMockToProcess(); + + Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())) + .thenReturn(getBiometricRecord(Arrays.asList("Left Thumb", "Right Thumb", "Face"), false)); + mockDataSharePolicy(Lists.newArrayList(BiometricType.IRIS, BiometricType.FACE)); + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertFalse(result.getIsValid()); + assertTrue(result.getInternalError()); + } + + @Test + public void bioRecordDataNotFound() + throws ApisResourceAccessException, PacketManagerException, JsonProcessingException, IOException { + + defaultMockToProcess(); + + Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())).thenReturn(null); + mockDataSharePolicy(Lists.newArrayList(BiometricType.IRIS, BiometricType.FINGER, BiometricType.FACE)); + + + MessageDTO dto = new MessageDTO(); + dto.setRid("10003100030001520190422074511"); + MessageDTO result = abisHandlerStage.process(dto); + + assertFalse(result.getIsValid()); + assertTrue(result.getInternalError()); + } +} diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java index 3e2f6883595..b489c29c5ab 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java @@ -1250,6 +1250,23 @@ public enum PlatformErrorMessages { RPR_ERROR_IN_ABIS_HANDLER_IDENTIFY_REQUEST(PlatformConstants.RPR_ABIS_HANDLER + "004", "Internal Error occured in Abis Handler identify request"), + RPR_ABIS_HANDLER_STAGE_FAILED(PlatformConstants.RPR_ABIS_HANDLER + "005", "ABIS Handler Stage failed"), + + RPR_BIOMETRIC_RECORD_VALIDATION_FAILED(PlatformConstants.RPR_ABIS_HANDLER + "006", + "Biometric record validation error"), + + RPR_DATASHARE_MODALITIES_EMPTY(PlatformConstants.RPR_ABIS_HANDLER + "007", + "Data Share Policy Modalities were Empty"), + + RPR_NO_BIOMETRICS_FOUND_WITH_DATASHARE(PlatformConstants.RPR_ABIS_HANDLER + "008", + "No Biometrics Found with Data Share Policy"), + + RPR_BIOMETRIC_SEGMENT_NOT_CONFIGURED_FOR_MODALITY(PlatformConstants.RPR_ABIS_HANDLER + "009", + "Biometrics Segments Not Configured for modality : %s"), + + RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE(PlatformConstants.RPR_ABIS_HANDLER + "010", + "No Biometric Matched with Data Share Policy"), + /** The rpr demo sending for manual. */ RPR_DEMO_SENDING_FOR_MANUAL(PlatformConstants.RPR_DEMO_DEDUPE_MODULE + "001", "ABIS response Details found. Hence sending to manual adjudication"), diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java index 240aa628f0b..673ceffdfce 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/status/util/StatusConstants.java @@ -109,6 +109,8 @@ public final class StatusConstants { public static final String REQUEST_HANDLER_MODULE_SUCCESS = REQUEST_HANDLER_MODULE + SUCCESS; public static final String REQUEST_HANDLER_MODULE_FAILED = REQUEST_HANDLER_MODULE + FAILED; - - + // Abis Handler stage + public static final String ABIS_HANDLER_MODULE = RPR_REGISTRATION_PROCESSOR_PREFIX + "ABH-"; + public static final String ABIS_HANDLER_MODULE_SUCCESS = ABIS_HANDLER_MODULE + SUCCESS; + public static final String ABIS_HANDLER_MODULE_FAILED = ABIS_HANDLER_MODULE + FAILED; } 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 275fef92df4..ed6264d560c 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 @@ -1,241 +1,246 @@ -package io.mosip.registration.processor.core.status.util; - -import io.mosip.registration.processor.core.exception.util.PlatformConstants; - -public enum StatusUtil { - // Packet Receiver Stage - PACKET_RECEIVED(StatusConstants.PACKET_RECEIVER_MODULE_SUCCESS + "001","Packet has reached Packet Receiver"), - PACKET_UPLOADED_TO_LANDING_ZONE(StatusConstants.PACKET_RECEIVER_MODULE_SUCCESS + "002","Packet is Uploaded to Landing Zone"), - VIRUS_SCANNER_FAILED(StatusConstants.PACKET_RECEIVER_MODULE_FAILURE + "001","Packet is Virus Infected"), - PACKET_DECRYPTION_FAILED(StatusConstants.PACKET_RECEIVER_MODULE_FAILURE + "002", "Packet Decryption Failed"), - - // securezone notification stage - NOTIFICATION_RECEIVED_TO_SECUREZONE(StatusConstants.SECUREZONE_NOTIFICATION_SUCCESS + "001","Notification received to securezone"), - - // Packet uploader stage - PACKET_UPLOADED(StatusConstants.PACKET_UPLOADER_MODULE_SUCCESS + "001","Packet is Uploaded to Packet Store"), - PACKET_CLEANUP_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "001","Packet Clean Up Failed from Landing Zone"), - PACKET_ARCHIVAL_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "002","Packet Archival Failed"), - PACKET_UPLOAD_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "003","Packet Upload Failed"), - PACKET_NOT_FOUND_LANDING_ZIONE(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "004","Packet Not Found in Landing Zone"), - PACKET_HASHCODE_VALIDATION_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "005","Packet Hash Code Validation Failed"), - VIRUS_SCANNER_FAILED_UPLOADER(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "006","Packet is Virus Infected"), - PACKET_UPLOAD_DECRYPTION_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "007", "Packet Decryption Failed"), - PACKET_ALREADY_UPLOADED(StatusConstants.PACKET_UPLOADER_MODULE_SUCCESS + "008","Packet is already present in Packet Store"), - - // Quality checker stage - INDIVIDUAL_BIOMETRIC_NOT_FOUND(StatusConstants.QUALITY_CHECKER_MODULE_SUCCESS + "001","Individual Biometric Parameter Not Found in ID JSON"), - BIOMETRIC_QUALITY_CHECK_SUCCESS(StatusConstants.QUALITY_CHECKER_MODULE_SUCCESS + "002","Biometric Quality Check is Successful"), - BIOMETRIC_QUALITY_CHECK_FAILED(StatusConstants.QUALITY_CHECKER_MODULE_FAILED + "001","Quality Score of Biometrics Captured is Below the Threshold"), - - // packet validator stage - PACKET_STRUCTURAL_VALIDATION_SUCCESS(StatusConstants.PACKET_VALIDATOR_MODULE_SUCCESS + "001","Packet Validation is Successful"), - FILE_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "001","File Validation Failed"), - SCHEMA_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "002","Schema Validation Failed"), - CHECKSUM_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "003","Check Sum Validation Failed"), - INDIVIDUAL_BIOMETRIC_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "004","Individual Biometric Validation Failed"), - APPLICANT_DOCUMENT_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "005","Applicant Document Validation Failed"), - MASTER_DATA_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "006","Master Data Validation Failed"), - ACTIVATE_DEACTIVATE_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "007","Packet Validation for Activate/Deactivate Packet Failed"), - UIN_NOT_FOUND_IDREPO(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "008","UIN is Not Found in ID Repository"), - MANDATORY_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "009", "Mandatory Fields are Not Present in ID Object"), - RID_AND_TYPE_SYNC_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "010", "RID & Type not matched from sync table"), - PACKET_REJECTED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "011", "Rejected by Supervisor"), - PACKET_MANAGER_VALIDATION_FAILURE(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "012", "Packet validation failed in packet manager"), - BIOMETRICS_VALIDATION_FAILURE(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "013", "Biometric file validation failed"), - PACKET_MANAGER_EXCEPTION(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "014", "Exception occured in packet manager."), - - // packet classifier stage - PACKET_CLASSIFICATION_SUCCESS(StatusConstants.PACKET_CLASSIFIER_MODULE_SUCCESS + "001","Packet Classification is Successful"), - - // External stage - EXTERNAL_STAGE_SUCCESS(StatusConstants.EXTERNAL_SATGE_MODULE_SUCCESS + "001", "Packet processing in External stage is sucessful"), - EXTERNAL_STAGE_FAILED(StatusConstants.EXTERNAL_SATGE_MODULE_SUCCESS + "001", "Packet processing in External stage failed"), - - // OSI Validator stage - // 1.UMC Validator stage - GPS_DETAILS_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "001", "GPS Details are Not Found in Packet"), - CENTER_ID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "002","Center ID Not Found in Master DB - "), - CENTER_ID_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "003","Center was InActive during Packet Creation - "), - MACHINE_ID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "004","Machine ID Not Found in Master DB - "), - MACHINE_ID_NOT_ACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "005","Machine ID was InActive during Packet Creation - "), - SUPERVISOR_OFFICER_NOT_ACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "006","SupervisorId and OfficerId are inActive"), - CENTER_DEVICE_MAPPING_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "007","Center-Device Mapping Not Found - "), - CENTER_DEVICE_MAPPING_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "008","Center-Device Mapping was InActive during Packet Creation - "), - DEVICE_NOT_FOUND_MASTER_DB(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "009","Device Not Found in Master DB - "), - DEVICE_VALIDATION_FAILED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "010", "Device Validation Failed"), - PACKET_CREATION_WORKING_HOURS(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "011", "Packet was Not Created during Working Hours - "), - REGISTRATION_CENTER_TIMESTAMP_FAILURE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "012", "Registration Center timestamp failed"), - FAILED_TO_GET_MACHINE_DETAIL(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "013", "Failed to Get machine id details "), - FAILED_TO_GET_CENTER_DETAIL(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "014", "Failed to Get center id details "), - PACKET_IS_ON_HOLD(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "015", "Packet is on Hold due to parent packet processing"), - - SUPERVISOR_OFFICER_NOT_FOUND_PACKET(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "012","Both Officer and Supervisor IDs are NULL"), - SUPERVISOR_OR_OFFICER_WAS_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "013","Officer or Supervisor was Not Active during Packet Creation - "), - PACKET_CREATION_DATE_NOT_FOUND_IN_PACKET(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "014","Packet Creation Date is NULL"), - PASSWORD_OTP_FAILURE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "015","Password or OTP Verification Failed for Officer - "), - OFFICER_SUPERVISOR_AUTHENTICATION_FAILED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "016","Officer or Supervisor Biometric Authentication Failed - "), - PASSWORD_OTP_FAILURE_SUPERVISOR(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "017","Password or OTP Verification Failed for Supervisor - "), - UIN_RID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "018", "UIN or RID of Parent Not Found in Packet"), - PARENT_UIN_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "019", "Parent UIN not Found for the Given RID"), - PARENT_BIOMETRIC_FILE_NAME_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "020", "Parent Biometric File Name Not Found"), - PACKET_ON_HOLD(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "021", "Packet On-Hold as Parent RID Not Found"), - CHILD_PACKET_REJECTED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "022", "Packet Rejected as Parent Packet is Rejected"), - MACHINE_ID_NOT_FOUND_MASTER_DB(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "023", "MachineId not found in master db - "), - OSI_VALIDATION_SUCCESS(StatusConstants.OSI_VALIDAOR_MODULE_SUCCESS + "001", "OSI Validation is Successful"), - - // printing stage - PRINT_REQUEST_SUCCESS(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "001", "Print request submitted"), - PDF_ADDED_TO_QUEUE_FAILED(StatusConstants.PRINT_STAGE_MODULE_FAILED + "001","PDF was not added to Queue due to Queue Failure"), - PRINT_POST_COMPLETED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "002","Printing and Post Completed"), - RESEND_UIN_CARD(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "003","Re-Sent UIN Card for Printing"), - PDF_GENERATION_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "004","Pdf Generation failed for "), - TEMPLATE_PROCESSING_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "005","Pdf Generation failed for "), - QUEUE_CONNECTION_NOT_FOUND(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "006","Queue Connection not found "), - QUEUE_CONNECTION_UNAVAILABLE(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "007","Queue Connection unavailable for "), - PDF_SIGNTURED_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "008", "Pdf Signature failed "), - PRINT_REQUEST_FAILED(StatusConstants.PRINT_STAGE_MODULE_FAILED + "009", - "Print request failed"), - UIN_NOT_FOUND_IN_DATABASE(StatusConstants.PRINT_STAGE_MODULE_FAILED + "010", "UIN not found in database"), - /** The rpr prt vid exception. */ - VID_NOT_AVAILABLE(PlatformConstants.RPR_PRINTING_MODULE + "011", - "vid not available"), - - // Abis middleware stage - INSERT_IDENTIFY_REQUEST_SUCCESS(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "001","Insert or Identify Request sent to ABIS Queue is succesful"), - INSERT_IDENTIFY_REQUEST_FAILED(StatusConstants.ABIS_MIDDLEWARE_MODULE_FAILED + "001","Insert or Identify Request sent to ABIS Queue is Unsuccesful"), - INSERT_IDENTIFY_RESPONSE_SUCCESS(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "002","Recived sucessful response from ABIS"), - INSERT_IDENTIFY_RESPONSE_FAILED(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "002", "Received failed response from ABIS - "), - - // System Exceptions - // Bio dedupe stage - BIO_DEDUPE_INPROGRESS(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "001", "Biometric Deduplication In-Progress"), - BIO_DEDUPE_SUCCESS(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "002", "Biometric Deduplication is Successful"), - BIO_DEDUPE_POTENTIAL_MATCH(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "001", "Potential Biometric Match Found while Processing Packet"), - LOST_PACKET_BIOMETRICS_NOT_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "002", "No Match was Found for the Biometrics Received"), - LOST_PACKET_UNIQUE_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "003", "Unique Match was Found for the Biometrics Received"), - LOST_PACKET_MULTIPLE_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "003", "Multiple Match was Found for the Biometrics Received"), - - // Biometric authentication stage - BIOMETRIC_AUTHENTICATION_FAILED(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_FAILED + "001", "Biometric Authentication has Failed"), - BIOMETRIC_AUTHENTICATION_SUCCESS(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_SUCCESS + "001", "Biometric Authentication is Successful"), - BIOMETRIC_FILE_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Biometric File Not Found"), - BIOMETRIC_AUTHENTICATION_FAILED_FILE_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Biometric Authentication Failed File is not present inside identity json"), - INDIVIDUAL_BIOMETRIC_AUTHENTICATION_FAILED(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_FAILED + "001","Individual authentication failed"), - - // Demo dedupe stage - DEMO_DEDUPE_SUCCESS(StatusConstants.DEMO_DEDUPE_MODULE_SUCCESS + "001", "Demo Dedupe is Successful"), - POTENTIAL_MATCH_FOUND_IN_ABIS(StatusConstants.DEMO_DEDUPE_MODULE_FAILED + "001","Biometric Duplicate was Found in ABIS"), - POTENTIAL_MATCH_FOUND(StatusConstants.DEMO_DEDUPE_MODULE_FAILED + "002","Potential Demo Match was Found"), - DEMO_DEDUPE_SKIPPED(StatusConstants.DEMO_DEDUPE_MODULE_SKIPPED + "003", "Demographic Deduplication Skipped"), - - // Manual verification stage - MANUAL_VERIFIER_APPROVED_PACKET(StatusConstants.MANUAL_VERIFICATION_MODULE_SUCCESS + "001", "Match Not Found by Manual Verifier"), - MANUAL_VERIFIER_REJECTED_PACKET(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "002", "Match Found by Manual Verifier"), - RPR_MANUAL_VERIFICATION_RESEND(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "003", "Error in manual verification"), - RPR_MANUAL_VERIFICATION_SENT_TO_QUEUE(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "004", "Manual verification Sent to queue"), - // Uin generator stage - UIN_GENERATED_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "001","UIN Generated Successfully"), - UIN_DATA_UPDATION_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "002","UIN Data is Updated Successfully"), - UIN_ACTIVATED_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "003", "UIN is Activated"), - UIN_DEACTIVATION_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "004", "UIN is Deactivated"), - LINK_RID_FOR_LOST_PACKET_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "005","RID linked Successfully for Lost UIN Packet"), - - UIN_ALREADY_ACTIVATED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "001","UIN is already Activated"), - UIN_ACTIVATED_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "002","UIN Activation Failed"), - UIN_ALREADY_DEACTIVATED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "003", "UIN already deactivated"), - - UIN_GENERATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "004","UIN Generation failed - "), - UIN_DATA_UPDATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "005", "UIN Updation failed - "), - UIN_REACTIVATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "006", "UIN Reactivation failed - "), - UIN_DEACTIVATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "007", "UIN Deactivation failed - "), - LINK_RID_FOR_LOST_PACKET_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "008","UIn not found the the matched RID"), - UIN_ALREADY_EXIST_IN_IDREPO(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "009", "Received ID record already exists error from idrepo even after trying with force merge"), - OLD_APPLICATION_ID(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "010","Received error as old application ID reprocessing not allowed from idrepo"), - - //Request handler service - //1)Resident UIN update - RESIDENT_UPDATE_SUCCES(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "Resident Uin data updated sucessfully"), - RESIDENT_UPDATE_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Resident Uin update failed"), - INVALID_REQUEST(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Invalid Request Value - "), - INVALID_CENTER(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "002" , "Invalid Request Value - "), - INVALID_MACHINE(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "003" , "Invalid Request Value - "), - - //2)PacketGeneration - PACKET_GENERATION_SUCCESS(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "Packet generated sucessfully"), - PACKET_GENERATION_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Packet generated failed"), - - //3)Uin card reprint - UIN_CARD_REPRINT_SUCCESS(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "UIN card reprint success"), - UIN_CARD_REPRINT_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "UIN card reprint failed"), - - - // System Exceptions - VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE(StatusConstants.SYSTEM_EXCEPTION_CODE,"Virus Scanner Service is not accessible"), - DB_NOT_ACCESSIBLE(StatusConstants.SYSTEM_EXCEPTION_CODE,"Databse Not Accessible"), - PACKET_NOT_FOUND_PACKET_STORE(StatusConstants.SYSTEM_EXCEPTION_CODE, "Packet not found in File System"), - OBJECT_STORE_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Object store exception occured"), - JSCH_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE,"JSCH Connection Exception Occurred"), - NGINX_ACCESS_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"NGINX url is not accessible"), - IO_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"IO Exception Occurred"), - BIO_METRIC_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Biometric Exception Occurred in IDA "), - BIO_METRIC_FILE_MISSING(StatusConstants.SYSTEM_EXCEPTION_CODE,"Applicant biometric fileName/file is missing"), - BIO_METRIC_TYPE_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Requested biometric type not found"), - - UNKNOWN_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Unknown exception occured "), - API_RESOUCE_ACCESS_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Unable to access API resource"), - AUTH_SYSTEM_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Auth System Exception"), - JSON_PARSING_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Error Occurred while Parsing JSON"), - BASE_CHECKED_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Packet validation failed "), - BASE_UNCHECKED_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE, "Packet validation failed "), - - OFFICER_AUTHENTICATION_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Officer Authentication Failed: "), - SUPERVISOR_AUTHENTICATION_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Supervisor Authentication Failed: "), - - IDENTIFY_RESPONSE_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Identify Response Failed for Request ID - "), - INSERT_RESPONSE_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Insert Response Failed for Request ID - "), - SYSTEM_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE, "Internal error occured - "), - - CBEF_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Unable to Find Applicant CBEFF for Adult"), - - IIEGAL_ARGUMENT_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Illegal Argument Exception Occurred - "), - DEMO_DEDUPE_FAILED_IN_ABIS(StatusConstants.SYSTEM_EXCEPTION_CODE,"Demo Dedupe Failed in ABIS"), - RE_PROCESS_FAILED(StatusConstants.RE_PROCESS_MODULE_FAILED + "001", "Reprocess count has exceeded the configured attempts"), - RE_PROCESS_COMPLETED(StatusConstants.RE_PROCESS_MODULE_SUCCESS + "001", "Reprocess Completed"), - - // Message sender stage - NOTIFICATION_SUCESSFUL(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "001","Notification Sent Successfully"), - TEMPLATE_CONFIGURATION_NOT_FOUND(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "002","Template configuration and language not found"), - EMAIL_PHONE_TEMPLATE_NOTIFICATION_MISSING(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "003","Email ID or Phone or Template or Notification Type is Missing"), - NOTIFICATION_FAILED_FOR_LOST(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "004","Unable to Send Notification - UIN was not found for the Lost Packet"), - - MESSAGE_SENDER_NOTIF_SUCC(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "001","Email and SMS Notification were sent"), - MESSAGE_SENDER_NOT_CONFIGURED(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "002", "Notification was not sent as notification type was not set"), - MESSAGE_SENDER_EMAIL_SUCCESS(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "003","Email Notification was sent"), - MESSAGE_SENDER_SMS_SUCCESS(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "004","SMS Notification was sent"), - MESSAGE_SENDER_EMAIL_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "005","Notification was not sent as the required mode of channel was not available"), - MESSAGE_SENDER_SMS_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "006","Notification was not sent as the required mode of channel was not available"), - MESSAGE_SENDER_NOTIFICATION_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "006","Notification was not sent as the required mode of channel was not available"); - - private final String statusComment; - private final String statusCode; - - private StatusUtil(String statusCode, String statusComment) { - this.statusCode = statusCode; - this.statusComment = statusComment; - } - - public String getMessage() { - return this.statusComment; - } - - /** - * Gets the error code. - * - * @return the error code - */ - public String getCode() { - return this.statusCode; - } - -} +package io.mosip.registration.processor.core.status.util; + +import io.mosip.registration.processor.core.exception.util.PlatformConstants; + +public enum StatusUtil { + // Packet Receiver Stage + PACKET_RECEIVED(StatusConstants.PACKET_RECEIVER_MODULE_SUCCESS + "001","Packet has reached Packet Receiver"), + PACKET_UPLOADED_TO_LANDING_ZONE(StatusConstants.PACKET_RECEIVER_MODULE_SUCCESS + "002","Packet is Uploaded to Landing Zone"), + VIRUS_SCANNER_FAILED(StatusConstants.PACKET_RECEIVER_MODULE_FAILURE + "001","Packet is Virus Infected"), + PACKET_DECRYPTION_FAILED(StatusConstants.PACKET_RECEIVER_MODULE_FAILURE + "002", "Packet Decryption Failed"), + + // securezone notification stage + NOTIFICATION_RECEIVED_TO_SECUREZONE(StatusConstants.SECUREZONE_NOTIFICATION_SUCCESS + "001","Notification received to securezone"), + + // Packet uploader stage + PACKET_UPLOADED(StatusConstants.PACKET_UPLOADER_MODULE_SUCCESS + "001","Packet is Uploaded to Packet Store"), + PACKET_CLEANUP_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "001","Packet Clean Up Failed from Landing Zone"), + PACKET_ARCHIVAL_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "002","Packet Archival Failed"), + PACKET_UPLOAD_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "003","Packet Upload Failed"), + PACKET_NOT_FOUND_LANDING_ZIONE(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "004","Packet Not Found in Landing Zone"), + PACKET_HASHCODE_VALIDATION_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "005","Packet Hash Code Validation Failed"), + VIRUS_SCANNER_FAILED_UPLOADER(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "006","Packet is Virus Infected"), + PACKET_UPLOAD_DECRYPTION_FAILED(StatusConstants.PACKET_UPLOADER_MODULE_FAILED + "007", "Packet Decryption Failed"), + PACKET_ALREADY_UPLOADED(StatusConstants.PACKET_UPLOADER_MODULE_SUCCESS + "008","Packet is already present in Packet Store"), + + // Quality checker stage + INDIVIDUAL_BIOMETRIC_NOT_FOUND(StatusConstants.QUALITY_CHECKER_MODULE_SUCCESS + "001","Individual Biometric Parameter Not Found in ID JSON"), + BIOMETRIC_QUALITY_CHECK_SUCCESS(StatusConstants.QUALITY_CHECKER_MODULE_SUCCESS + "002","Biometric Quality Check is Successful"), + BIOMETRIC_QUALITY_CHECK_FAILED(StatusConstants.QUALITY_CHECKER_MODULE_FAILED + "001","Quality Score of Biometrics Captured is Below the Threshold"), + + // packet validator stage + PACKET_STRUCTURAL_VALIDATION_SUCCESS(StatusConstants.PACKET_VALIDATOR_MODULE_SUCCESS + "001","Packet Validation is Successful"), + FILE_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "001","File Validation Failed"), + SCHEMA_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "002","Schema Validation Failed"), + CHECKSUM_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "003","Check Sum Validation Failed"), + INDIVIDUAL_BIOMETRIC_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "004","Individual Biometric Validation Failed"), + APPLICANT_DOCUMENT_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "005","Applicant Document Validation Failed"), + MASTER_DATA_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "006","Master Data Validation Failed"), + ACTIVATE_DEACTIVATE_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "007","Packet Validation for Activate/Deactivate Packet Failed"), + UIN_NOT_FOUND_IDREPO(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "008","UIN is Not Found in ID Repository"), + MANDATORY_VALIDATION_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "009", "Mandatory Fields are Not Present in ID Object"), + RID_AND_TYPE_SYNC_FAILED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "010", "RID & Type not matched from sync table"), + PACKET_REJECTED(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "011", "Rejected by Supervisor"), + PACKET_MANAGER_VALIDATION_FAILURE(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "012", "Packet validation failed in packet manager"), + BIOMETRICS_VALIDATION_FAILURE(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "013", "Biometric file validation failed"), + PACKET_MANAGER_EXCEPTION(StatusConstants.PACKET_VALIDATOR_MODULE_FAILED + "014", "Exception occured in packet manager."), + + // packet classifier stage + PACKET_CLASSIFICATION_SUCCESS(StatusConstants.PACKET_CLASSIFIER_MODULE_SUCCESS + "001","Packet Classification is Successful"), + + // External stage + EXTERNAL_STAGE_SUCCESS(StatusConstants.EXTERNAL_SATGE_MODULE_SUCCESS + "001", "Packet processing in External stage is sucessful"), + EXTERNAL_STAGE_FAILED(StatusConstants.EXTERNAL_SATGE_MODULE_SUCCESS + "001", "Packet processing in External stage failed"), + + // OSI Validator stage + // 1.UMC Validator stage + GPS_DETAILS_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "001", "GPS Details are Not Found in Packet"), + CENTER_ID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "002","Center ID Not Found in Master DB - "), + CENTER_ID_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "003","Center was InActive during Packet Creation - "), + MACHINE_ID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "004","Machine ID Not Found in Master DB - "), + MACHINE_ID_NOT_ACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "005","Machine ID was InActive during Packet Creation - "), + SUPERVISOR_OFFICER_NOT_ACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "006","SupervisorId and OfficerId are inActive"), + CENTER_DEVICE_MAPPING_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "007","Center-Device Mapping Not Found - "), + CENTER_DEVICE_MAPPING_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "008","Center-Device Mapping was InActive during Packet Creation - "), + DEVICE_NOT_FOUND_MASTER_DB(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "009","Device Not Found in Master DB - "), + DEVICE_VALIDATION_FAILED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "010", "Device Validation Failed"), + PACKET_CREATION_WORKING_HOURS(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "011", "Packet was Not Created during Working Hours - "), + REGISTRATION_CENTER_TIMESTAMP_FAILURE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "012", "Registration Center timestamp failed"), + FAILED_TO_GET_MACHINE_DETAIL(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "013", "Failed to Get machine id details "), + FAILED_TO_GET_CENTER_DETAIL(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "014", "Failed to Get center id details "), + PACKET_IS_ON_HOLD(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "015", "Packet is on Hold due to parent packet processing"), + + SUPERVISOR_OFFICER_NOT_FOUND_PACKET(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "012","Both Officer and Supervisor IDs are NULL"), + SUPERVISOR_OR_OFFICER_WAS_INACTIVE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "013","Officer or Supervisor was Not Active during Packet Creation - "), + PACKET_CREATION_DATE_NOT_FOUND_IN_PACKET(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "014","Packet Creation Date is NULL"), + PASSWORD_OTP_FAILURE(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "015","Password or OTP Verification Failed for Officer - "), + OFFICER_SUPERVISOR_AUTHENTICATION_FAILED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "016","Officer or Supervisor Biometric Authentication Failed - "), + PASSWORD_OTP_FAILURE_SUPERVISOR(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "017","Password or OTP Verification Failed for Supervisor - "), + UIN_RID_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "018", "UIN or RID of Parent Not Found in Packet"), + PARENT_UIN_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "019", "Parent UIN not Found for the Given RID"), + PARENT_BIOMETRIC_FILE_NAME_NOT_FOUND(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "020", "Parent Biometric File Name Not Found"), + PACKET_ON_HOLD(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "021", "Packet On-Hold as Parent RID Not Found"), + CHILD_PACKET_REJECTED(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "022", "Packet Rejected as Parent Packet is Rejected"), + MACHINE_ID_NOT_FOUND_MASTER_DB(StatusConstants.OSI_VALIDAOR_MODULE_FAILED + "023", "MachineId not found in master db - "), + OSI_VALIDATION_SUCCESS(StatusConstants.OSI_VALIDAOR_MODULE_SUCCESS + "001", "OSI Validation is Successful"), + + // printing stage + PRINT_REQUEST_SUCCESS(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "001", "Print request submitted"), + PDF_ADDED_TO_QUEUE_FAILED(StatusConstants.PRINT_STAGE_MODULE_FAILED + "001","PDF was not added to Queue due to Queue Failure"), + PRINT_POST_COMPLETED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "002","Printing and Post Completed"), + RESEND_UIN_CARD(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "003","Re-Sent UIN Card for Printing"), + PDF_GENERATION_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "004","Pdf Generation failed for "), + TEMPLATE_PROCESSING_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "005","Pdf Generation failed for "), + QUEUE_CONNECTION_NOT_FOUND(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "006","Queue Connection not found "), + QUEUE_CONNECTION_UNAVAILABLE(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "007","Queue Connection unavailable for "), + PDF_SIGNTURED_FAILED(StatusConstants.PRINT_STAGE_MODULE_SUCCESS + "008", "Pdf Signature failed "), + PRINT_REQUEST_FAILED(StatusConstants.PRINT_STAGE_MODULE_FAILED + "009", + "Print request failed"), + UIN_NOT_FOUND_IN_DATABASE(StatusConstants.PRINT_STAGE_MODULE_FAILED + "010", "UIN not found in database"), + /** The rpr prt vid exception. */ + VID_NOT_AVAILABLE(PlatformConstants.RPR_PRINTING_MODULE + "011", + "vid not available"), + + // Abis middleware stage + INSERT_IDENTIFY_REQUEST_SUCCESS(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "001","Insert or Identify Request sent to ABIS Queue is succesful"), + INSERT_IDENTIFY_REQUEST_FAILED(StatusConstants.ABIS_MIDDLEWARE_MODULE_FAILED + "001","Insert or Identify Request sent to ABIS Queue is Unsuccesful"), + INSERT_IDENTIFY_RESPONSE_SUCCESS(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "002","Recived sucessful response from ABIS"), + INSERT_IDENTIFY_RESPONSE_FAILED(StatusConstants.ABIS_MIDDLEWARE_MODULE_SUCCESS + "002", "Received failed response from ABIS - "), + + // System Exceptions + // Bio dedupe stage + BIO_DEDUPE_INPROGRESS(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "001", "Biometric Deduplication In-Progress"), + BIO_DEDUPE_SUCCESS(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "002", "Biometric Deduplication is Successful"), + BIO_DEDUPE_POTENTIAL_MATCH(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "001", "Potential Biometric Match Found while Processing Packet"), + LOST_PACKET_BIOMETRICS_NOT_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "002", "No Match was Found for the Biometrics Received"), + LOST_PACKET_UNIQUE_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_SUCCESS + "003", "Unique Match was Found for the Biometrics Received"), + LOST_PACKET_MULTIPLE_MATCH_FOUND(StatusConstants.BIO_DEDUPE_MODULE_FAILED + "003", "Multiple Match was Found for the Biometrics Received"), + + // Biometric authentication stage + BIOMETRIC_AUTHENTICATION_FAILED(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_FAILED + "001", "Biometric Authentication has Failed"), + BIOMETRIC_AUTHENTICATION_SUCCESS(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_SUCCESS + "001", "Biometric Authentication is Successful"), + BIOMETRIC_FILE_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Biometric File Not Found"), + BIOMETRIC_AUTHENTICATION_FAILED_FILE_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Biometric Authentication Failed File is not present inside identity json"), + INDIVIDUAL_BIOMETRIC_AUTHENTICATION_FAILED(StatusConstants.BIO_METRIC_AUTHENTICATION_MODULE_FAILED + "001","Individual authentication failed"), + + // Demo dedupe stage + DEMO_DEDUPE_SUCCESS(StatusConstants.DEMO_DEDUPE_MODULE_SUCCESS + "001", "Demo Dedupe is Successful"), + POTENTIAL_MATCH_FOUND_IN_ABIS(StatusConstants.DEMO_DEDUPE_MODULE_FAILED + "001","Biometric Duplicate was Found in ABIS"), + POTENTIAL_MATCH_FOUND(StatusConstants.DEMO_DEDUPE_MODULE_FAILED + "002","Potential Demo Match was Found"), + DEMO_DEDUPE_SKIPPED(StatusConstants.DEMO_DEDUPE_MODULE_SKIPPED + "003", "Demographic Deduplication Skipped"), + + // Manual verification stage + MANUAL_VERIFIER_APPROVED_PACKET(StatusConstants.MANUAL_VERIFICATION_MODULE_SUCCESS + "001", "Match Not Found by Manual Verifier"), + MANUAL_VERIFIER_REJECTED_PACKET(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "002", "Match Found by Manual Verifier"), + RPR_MANUAL_VERIFICATION_RESEND(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "003", "Error in manual verification"), + RPR_MANUAL_VERIFICATION_SENT_TO_QUEUE(StatusConstants.MANUAL_VERIFICATION_MODULE_FAILED + "004", "Manual verification Sent to queue"), + // Uin generator stage + UIN_GENERATED_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "001","UIN Generated Successfully"), + UIN_DATA_UPDATION_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "002","UIN Data is Updated Successfully"), + UIN_ACTIVATED_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "003", "UIN is Activated"), + UIN_DEACTIVATION_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "004", "UIN is Deactivated"), + LINK_RID_FOR_LOST_PACKET_SUCCESS(StatusConstants.UIN_GENERATOR_MODULE_SUCCESS + "005","RID linked Successfully for Lost UIN Packet"), + + UIN_ALREADY_ACTIVATED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "001","UIN is already Activated"), + UIN_ACTIVATED_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "002","UIN Activation Failed"), + UIN_ALREADY_DEACTIVATED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "003", "UIN already deactivated"), + + UIN_GENERATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "004","UIN Generation failed - "), + UIN_DATA_UPDATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "005", "UIN Updation failed - "), + UIN_REACTIVATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "006", "UIN Reactivation failed - "), + UIN_DEACTIVATION_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "007", "UIN Deactivation failed - "), + LINK_RID_FOR_LOST_PACKET_FAILED(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "008","UIn not found the the matched RID"), + UIN_ALREADY_EXIST_IN_IDREPO(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "009", "Received ID record already exists error from idrepo even after trying with force merge"), + OLD_APPLICATION_ID(StatusConstants.UIN_GENERATOR_MODULE_FAILED + "010","Received error as old application ID reprocessing not allowed from idrepo"), + + //Request handler service + //1)Resident UIN update + RESIDENT_UPDATE_SUCCES(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "Resident Uin data updated sucessfully"), + RESIDENT_UPDATE_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Resident Uin update failed"), + INVALID_REQUEST(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Invalid Request Value - "), + INVALID_CENTER(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "002" , "Invalid Request Value - "), + INVALID_MACHINE(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "003" , "Invalid Request Value - "), + + //2)PacketGeneration + PACKET_GENERATION_SUCCESS(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "Packet generated sucessfully"), + PACKET_GENERATION_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "Packet generated failed"), + + //3)Uin card reprint + UIN_CARD_REPRINT_SUCCESS(StatusConstants.REQUEST_HANDLER_MODULE_SUCCESS + "001" , "UIN card reprint success"), + UIN_CARD_REPRINT_FAILED(StatusConstants.REQUEST_HANDLER_MODULE_FAILED + "001" , "UIN card reprint failed"), + + + // System Exceptions + VIRUS_SCANNER_SERVICE_NOT_ACCESSIBLE(StatusConstants.SYSTEM_EXCEPTION_CODE,"Virus Scanner Service is not accessible"), + DB_NOT_ACCESSIBLE(StatusConstants.SYSTEM_EXCEPTION_CODE,"Databse Not Accessible"), + PACKET_NOT_FOUND_PACKET_STORE(StatusConstants.SYSTEM_EXCEPTION_CODE, "Packet not found in File System"), + OBJECT_STORE_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Object store exception occured"), + JSCH_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE,"JSCH Connection Exception Occurred"), + NGINX_ACCESS_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"NGINX url is not accessible"), + IO_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"IO Exception Occurred"), + BIO_METRIC_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Biometric Exception Occurred in IDA "), + BIO_METRIC_FILE_MISSING(StatusConstants.SYSTEM_EXCEPTION_CODE,"Applicant biometric fileName/file is missing"), + BIO_METRIC_TYPE_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Requested biometric type not found"), + + UNKNOWN_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Unknown exception occured "), + API_RESOUCE_ACCESS_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Unable to access API resource"), + AUTH_SYSTEM_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Auth System Exception"), + JSON_PARSING_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Error Occurred while Parsing JSON"), + BASE_CHECKED_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Packet validation failed "), + BASE_UNCHECKED_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE, "Packet validation failed "), + + OFFICER_AUTHENTICATION_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Officer Authentication Failed: "), + SUPERVISOR_AUTHENTICATION_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Supervisor Authentication Failed: "), + + IDENTIFY_RESPONSE_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Identify Response Failed for Request ID - "), + INSERT_RESPONSE_FAILED(StatusConstants.SYSTEM_EXCEPTION_CODE,"Insert Response Failed for Request ID - "), + SYSTEM_EXCEPTION_OCCURED(StatusConstants.SYSTEM_EXCEPTION_CODE, "Internal error occured - "), + + CBEF_NOT_FOUND(StatusConstants.SYSTEM_EXCEPTION_CODE, "Unable to Find Applicant CBEFF for Adult"), + + IIEGAL_ARGUMENT_EXCEPTION(StatusConstants.SYSTEM_EXCEPTION_CODE,"Illegal Argument Exception Occurred - "), + DEMO_DEDUPE_FAILED_IN_ABIS(StatusConstants.SYSTEM_EXCEPTION_CODE,"Demo Dedupe Failed in ABIS"), + RE_PROCESS_FAILED(StatusConstants.RE_PROCESS_MODULE_FAILED + "001", "Reprocess count has exceeded the configured attempts"), + RE_PROCESS_COMPLETED(StatusConstants.RE_PROCESS_MODULE_SUCCESS + "001", "Reprocess Completed"), + + // Message sender stage + NOTIFICATION_SUCESSFUL(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "001","Notification Sent Successfully"), + TEMPLATE_CONFIGURATION_NOT_FOUND(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "002","Template configuration and language not found"), + EMAIL_PHONE_TEMPLATE_NOTIFICATION_MISSING(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "003","Email ID or Phone or Template or Notification Type is Missing"), + NOTIFICATION_FAILED_FOR_LOST(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "004","Unable to Send Notification - UIN was not found for the Lost Packet"), + + MESSAGE_SENDER_NOTIF_SUCC(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "001","Email and SMS Notification were sent"), + MESSAGE_SENDER_NOT_CONFIGURED(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "002", "Notification was not sent as notification type was not set"), + MESSAGE_SENDER_EMAIL_SUCCESS(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "003","Email Notification was sent"), + MESSAGE_SENDER_SMS_SUCCESS(StatusConstants.MESSAGE_SENDER_NOTIF_SUCCESS_CODE + "004","SMS Notification was sent"), + MESSAGE_SENDER_EMAIL_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "005","Notification was not sent as the required mode of channel was not available"), + MESSAGE_SENDER_SMS_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "006","Notification was not sent as the required mode of channel was not available"), + MESSAGE_SENDER_NOTIFICATION_FAILED(StatusConstants.MESSAGE_SENDER__FAILED_CODE + "006", + "Notification was not sent as the required mode of channel was not available"), + + // ABIS handler stage + BIOMTERIC_RECORD_VALIDAITON_FAILED(StatusConstants.ABIS_HANDLER_MODULE_FAILED + "001", + "Biometric record validation failed"); + + private final String statusComment; + private final String statusCode; + + private StatusUtil(String statusCode, String statusComment) { + this.statusCode = statusCode; + this.statusComment = statusComment; + } + + public String getMessage() { + return this.statusComment; + } + + /** + * Gets the error code. + * + * @return the error code + */ + public String getCode() { + return this.statusCode; + } + +} From c2ef7d0231e6f94add653c0b761e0fbd8655e8ca Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Thu, 10 Aug 2023 12:16:01 +0530 Subject: [PATCH 2/6] MOSIP-23147 Code fix --- .../processor/abis/handler/stage/AbisHandlerStage.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java index b1621ed9cc4..c078d51a554 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java @@ -257,7 +257,8 @@ public MessageDTO process(MessageDTO object) { } registrationStatusDto.setStatusCode(statusCode); registrationStatusDto.setStatusComment(trimExceptionMessage - .trimExceptionMessage(StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + e.getMessage())); + .trimExceptionMessage( + StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + "->" + e.getErrorText())); String moduleId = description.getCode(); String moduleName = ModuleName.ABIS_HANDLER.toString(); registrationStatusService.updateRegistrationStatus(registrationStatusDto, moduleId, moduleName); From d37846b4b6c37031ed0e8a014a879e5c40b01d06 Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Fri, 11 Aug 2023 16:08:00 +0530 Subject: [PATCH 3/6] MOSIP-23147 Code review comments fixed --- .../abis/handler/stage/AbisHandlerStage.java | 31 +++++++------------ .../stage/test/AbisHandlerStageTest.java | 11 +++++-- .../exception/util/PlatformErrorMessages.java | 3 -- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java index c078d51a554..4f1958f1008 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java @@ -125,12 +125,9 @@ public class AbisHandlerStage extends MosipVerticleAPIManager { @Value("${registration.processor.subscriber.id}") private String subscriberId; - - @Value("#{${mosip.regproc.abis.handler.biometric-modalities-segments-mapping}}") - private Map> biometricModalitySegmentsMap; - @Value("${mosip.regproc.abis.handler.status.code:REJECTED}") - private String statusCode; + @Value("${mosip.regproc.abis.handler.insufficient.biometrics.status.code:REJECTED}") + private String insufficentBiometricsStatusCode; @Autowired private RegistrationProcessorRestClientService registrationProcessorRestClientService; @@ -255,7 +252,7 @@ public MessageDTO process(MessageDTO object) { } else if (transactionTypeCode.equalsIgnoreCase(AbisHandlerStageConstant.BIOGRAPHIC_VERIFICATION)) { registrationStatusDto.setRegistrationStageName(AbisHandlerStageConstant.BIO_DEDUPE_STAGE); } - registrationStatusDto.setStatusCode(statusCode); + registrationStatusDto.setStatusCode(insufficentBiometricsStatusCode); registrationStatusDto.setStatusComment(trimExceptionMessage .trimExceptionMessage( StatusUtil.BIOMTERIC_RECORD_VALIDAITON_FAILED.getMessage() + "->" + e.getErrorText())); @@ -574,7 +571,7 @@ private String getDataShareUrl(String id, String process) throws Exception { MappingJsonConstants.VALUE); BiometricRecord biometricRecord = priorityBasedPacketManagerService.getBiometrics( id, individualBiometricsLabel, modalities, process, ProviderStageName.BIO_DEDUPE); - validateBiometricRecord(biometricRecord, modalities, biometricModalitySegmentsMap); + validateBiometricRecord(biometricRecord, modalities); byte[] content = cbeffutil.createXML(BIRConverter.convertSegmentsToBIRList(biometricRecord.getSegments())); MultiValueMap map = new LinkedMultiValueMap<>(); @@ -631,8 +628,7 @@ public Map> createTypeSubtypeMapping() throws ApisResourceA } - private void validateBiometricRecord(BiometricRecord biometricRecord, List modalities, - Map> biometricModalitySegmentsMap) + private void validateBiometricRecord(BiometricRecord biometricRecord, List modalities) throws BiometricRecordValidationException, JsonParseException, JsonMappingException, IOException { if (modalities == null || modalities.isEmpty()) { throw new BiometricRecordValidationException(PlatformErrorMessages.RPR_DATASHARE_MODALITIES_EMPTY.getCode(),PlatformErrorMessages.RPR_DATASHARE_MODALITIES_EMPTY.getMessage()); @@ -642,12 +638,7 @@ private void validateBiometricRecord(BiometricRecord biometricRecord, List optionalBIR = Optional.empty(); if (segment.equalsIgnoreCase("Face")) { optionalBIR = biometricRecord.getSegments().stream() @@ -669,13 +660,13 @@ private void validateBiometricRecord(BiometricRecord biometricRecord, List> getMockDataSharePolicy( for (BiometricType bioType : sherableBiometricList) { Filter filter = new Filter(); filter.setType(bioType.value()); + if (BiometricType.FINGER.equals(bioType)) { + filter.setSubType(getFingerList()); + } else if (BiometricType.FINGER.equals(bioType)) { + filter.setSubType(getIrisList()); + } + Source src = new Source(); src.setFilter(Lists.newArrayList(filter)); sourceList.add(src); @@ -625,7 +630,7 @@ public void biometricsNotFoundWithSegmentConfig() Mockito.when(packetManagerService.getBiometrics(any(), any(), any(), any(), any())) .thenReturn(getBiometricRecord(Arrays.asList("Left Thumb", "Right Thumb", "Face"), false)); - mockDataSharePolicy(Lists.newArrayList(BiometricType.IRIS, BiometricType.FACE)); + mockDataSharePolicy(Lists.newArrayList(BiometricType.IRIS)); MessageDTO dto = new MessageDTO(); dto.setRid("10003100030001520190422074511"); diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java index b489c29c5ab..0e8da0da61d 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java @@ -1261,9 +1261,6 @@ public enum PlatformErrorMessages { RPR_NO_BIOMETRICS_FOUND_WITH_DATASHARE(PlatformConstants.RPR_ABIS_HANDLER + "008", "No Biometrics Found with Data Share Policy"), - RPR_BIOMETRIC_SEGMENT_NOT_CONFIGURED_FOR_MODALITY(PlatformConstants.RPR_ABIS_HANDLER + "009", - "Biometrics Segments Not Configured for modality : %s"), - RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE(PlatformConstants.RPR_ABIS_HANDLER + "010", "No Biometric Matched with Data Share Policy"), From e3df02df99c9d8ccf284047b9d4b6050baf600db Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Fri, 11 Aug 2023 16:15:41 +0530 Subject: [PATCH 4/6] MOSIP-23147 Code review comments fixed --- .../abis/handler/stage/test/AbisHandlerStageTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java index e3b3e226b3f..0783f5dbc6b 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/test/java/io/mosip/registration/processor/abis/handler/stage/test/AbisHandlerStageTest.java @@ -522,23 +522,23 @@ private BiometricRecord getBiometricRecord(List bioAttributes, boolean i return biometricRecord; } - private void mockDataSharePolicy(List sherableBiometricList) throws ApisResourceAccessException { + private void mockDataSharePolicy(List shareableBiometricList) throws ApisResourceAccessException { when(registrationProcessorRestClientService.getApi(any(), any(), anyString(), anyString(), any())) - .thenReturn(getMockDataSharePolicy(sherableBiometricList)); + .thenReturn(getMockDataSharePolicy(shareableBiometricList)); } private ResponseWrapper> getMockDataSharePolicy( - List sherableBiometricList) { + List shareableBiometricList) { ObjectMapper mapper = new ObjectMapper(); List attr = new LinkedList<>(); - if (sherableBiometricList != null && !sherableBiometricList.isEmpty()) { + if (shareableBiometricList != null && !shareableBiometricList.isEmpty()) { ShareableAttributes shareableAttributes = new ShareableAttributes(); List sourceList = new ArrayList<>(); - for (BiometricType bioType : sherableBiometricList) { + for (BiometricType bioType : shareableBiometricList) { Filter filter = new Filter(); filter.setType(bioType.value()); if (BiometricType.FINGER.equals(bioType)) { From 57d5bcd6e6fe782653ebf9c15171633d73a838db Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Wed, 16 Aug 2023 11:04:06 +0530 Subject: [PATCH 5/6] MOSIP-23147 code review comments fixed --- .../processor/abis/handler/stage/AbisHandlerStage.java | 2 +- .../processor/core/exception/util/PlatformErrorMessages.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java index 4f1958f1008..4562d40fc24 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/src/main/java/io/mosip/registration/processor/abis/handler/stage/AbisHandlerStage.java @@ -126,7 +126,7 @@ public class AbisHandlerStage extends MosipVerticleAPIManager { @Value("${registration.processor.subscriber.id}") private String subscriberId; - @Value("${mosip.regproc.abis.handler.insufficient.biometrics.status.code:REJECTED}") + @Value("${mosip.regproc.abis.handler.insufficient-biometrics-status-code:REJECTED}") private String insufficentBiometricsStatusCode; @Autowired private RegistrationProcessorRestClientService registrationProcessorRestClientService; diff --git a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java index 0e8da0da61d..5f7ab7d8813 100644 --- a/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java +++ b/registration-processor/registration-processor-core/src/main/java/io/mosip/registration/processor/core/exception/util/PlatformErrorMessages.java @@ -1261,7 +1261,7 @@ public enum PlatformErrorMessages { RPR_NO_BIOMETRICS_FOUND_WITH_DATASHARE(PlatformConstants.RPR_ABIS_HANDLER + "008", "No Biometrics Found with Data Share Policy"), - RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE(PlatformConstants.RPR_ABIS_HANDLER + "010", + RPR_NO_BIOMETRIC_MATCH_WTIH_DATASAHRE(PlatformConstants.RPR_ABIS_HANDLER + "009", "No Biometric Matched with Data Share Policy"), /** The rpr demo sending for manual. */ From 2bbe21c2968f9971396688a8f26057b56a678e99 Mon Sep 17 00:00:00 2001 From: Sowmya Ujjappa Banakar Date: Thu, 17 Aug 2023 11:33:06 +0530 Subject: [PATCH 6/6] MOSIP-23147 updated versions --- pom.xml | 2 +- registration-processor/core-processor/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../registration-processor-abis/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- registration-processor/init/pom.xml | 2 +- .../pom.xml | 4 +- .../pom.xml | 4 +- registration-processor/pom.xml | 12 +- registration-processor/post-processor/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- registration-processor/pre-processor/pom.xml | 4 +- .../pom.xml | 152 +++++----- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 276 +++++++++--------- .../pom.xml | 4 +- .../pom.xml | 4 +- .../qc-users-manger/pom.xml | 156 +++++----- .../pom.xml | 4 +- .../pom.xml | 4 +- .../registration-processor-core/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 192 ++++++------ .../pom.xml | 168 +++++------ .../pom.xml | 4 +- .../pom.xml | 4 +- 38 files changed, 540 insertions(+), 540 deletions(-) diff --git a/pom.xml b/pom.xml index 947660b5cd9..9c774e1588b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.mosip registration - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT pom MOSIP Registration Parent POM diff --git a/registration-processor/core-processor/pom.xml b/registration-processor/core-processor/pom.xml index 4075f04f078..d080d15f29c 100644 --- a/registration-processor/core-processor/pom.xml +++ b/registration-processor/core-processor/pom.xml @@ -5,9 +5,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT core-processor core-processor diff --git a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml index 51798f94c4d..41d03c857dd 100644 --- a/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-handler-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-abis-handler-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml index 952705f2a9b..07b9691f1d6 100644 --- a/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis-middleware-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-abis-middleware-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-abis/pom.xml b/registration-processor/core-processor/registration-processor-abis/pom.xml index c70c2fd5d28..04150ccdd9b 100644 --- a/registration-processor/core-processor/registration-processor-abis/pom.xml +++ b/registration-processor/core-processor/registration-processor-abis/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-abis - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-abis UTF-8 diff --git a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml index c4c058e2c2f..ec16417b196 100644 --- a/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-bio-dedupe-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-bio-dedupe-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml index df3bd5adf86..a3bf1eeadcc 100644 --- a/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-biometric-authentication-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-biometric-authentication-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml index 0e27cb4710e..a10dbc391b8 100644 --- a/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-demo-dedupe-stage/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-demo-dedupe-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml b/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml index d291ac5d154..c243b9d8994 100644 --- a/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-manual-verification-stage/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-manual-verification-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml b/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml index 3f4f96438c2..c90ff4a2b54 100644 --- a/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-reprocessor-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-reprocessor-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-reprocessor-stage UTF-8 diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml index afa98dd3cf9..115adc48b41 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/pom.xml @@ -4,10 +4,10 @@ io.mosip.registrationprocessor core-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-uin-generator-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/init/pom.xml b/registration-processor/init/pom.xml index 5c50fea909a..f6f806dd9ee 100644 --- a/registration-processor/init/pom.xml +++ b/registration-processor/init/pom.xml @@ -6,7 +6,7 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT init diff --git a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml index 1918b176b66..88fac49f3b4 100644 --- a/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml +++ b/registration-processor/init/registration-processor-packet-receiver-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor init - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-packet-receiver-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-packet-receiver-stage diff --git a/registration-processor/init/registration-processor-registration-status-service/pom.xml b/registration-processor/init/registration-processor-registration-status-service/pom.xml index 06cd7703b1c..11ea0a83a1f 100644 --- a/registration-processor/init/registration-processor-registration-status-service/pom.xml +++ b/registration-processor/init/registration-processor-registration-status-service/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor init - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-registration-status-service - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-registration-status-service diff --git a/registration-processor/pom.xml b/registration-processor/pom.xml index 0647d05551f..0819180aec1 100644 --- a/registration-processor/pom.xml +++ b/registration-processor/pom.xml @@ -5,12 +5,12 @@ io.mosip registration - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT pom registration-processor @@ -107,11 +107,11 @@ 0.1.55 - 1.1.5.5-P4 - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT + 1.1.5.5-P5-SNAPSHOT 1.1.5.5 - 1.1.5.5-P4 - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT + 1.1.5.5-P5-SNAPSHOT 1.1.5.5 1.1.5.5 diff --git a/registration-processor/post-processor/pom.xml b/registration-processor/post-processor/pom.xml index 0cf2708dd90..b1045600aa3 100644 --- a/registration-processor/post-processor/pom.xml +++ b/registration-processor/post-processor/pom.xml @@ -6,9 +6,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT post-processor post-processor diff --git a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml index 63f28d9fe43..75e5f3827b0 100644 --- a/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-message-sender-stage/pom.xml @@ -7,11 +7,11 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-message-sender-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/post-processor/registration-processor-printing-stage/pom.xml b/registration-processor/post-processor/registration-processor-printing-stage/pom.xml index ac379ec77e3..19bcc47d336 100644 --- a/registration-processor/post-processor/registration-processor-printing-stage/pom.xml +++ b/registration-processor/post-processor/registration-processor-printing-stage/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-printing-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml index 40076accef1..912e3f3d74d 100644 --- a/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml +++ b/registration-processor/post-processor/registration-processor-registration-transaction-service/pom.xml @@ -5,10 +5,10 @@ io.mosip.registrationprocessor post-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-registration-transaction-service - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-registration-transaction-service UTF-8 diff --git a/registration-processor/pre-processor/pom.xml b/registration-processor/pre-processor/pom.xml index 965002296e5..27668c0c054 100644 --- a/registration-processor/pre-processor/pom.xml +++ b/registration-processor/pre-processor/pom.xml @@ -7,9 +7,9 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT pre-processor pre-processor diff --git a/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml b/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml index 812df9173ff..3c89393a1b9 100644 --- a/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml +++ b/registration-processor/pre-processor/registration-processor-external-integration-service/pom.xml @@ -1,76 +1,76 @@ - - - 4.0.0 - - io.mosip.registrationprocessor - pre-processor - 1.1.5.5-P4 - - registration-processor-external-integration-service - 1.1.5.5-P4 - - - UTF-8 - UTF-8 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-actuator - ${spring.boot.version} - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-config.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - org.springframework.boot - spring-boot-starter-test - test - - - org.projectlombok - lombok - ${lombok.version} - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - true - - - - - build-info - repackage - - - - - - - - + + + 4.0.0 + + io.mosip.registrationprocessor + pre-processor + 1.1.5.5-P5-SNAPSHOT + + registration-processor-external-integration-service + 1.1.5.5-P5-SNAPSHOT + + + UTF-8 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + ${spring.boot.version} + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-config.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + ${lombok.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + + + + + build-info + repackage + + + + + + + + diff --git a/registration-processor/pre-processor/registration-processor-external-stage/pom.xml b/registration-processor/pre-processor/registration-processor-external-stage/pom.xml index 9bdf379c06c..baa6663e509 100644 --- a/registration-processor/pre-processor/registration-processor-external-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-external-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-external-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml index 1f2b9cd3ecb..d258e6dbe7f 100644 --- a/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-osi-validator-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-osi-validator-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml index 50f4ab392c8..8b23121d9b7 100644 --- a/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-classifier-stage/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-packet-classifier-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml index 9749f0a08c2..0798010881c 100644 --- a/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-uploader-stage/pom.xml @@ -9,9 +9,9 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml index acb3cdb95bd..c6343ae9144 100644 --- a/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-packet-validator-stage/pom.xml @@ -1,138 +1,138 @@ - - - 4.0.0 - - - io.mosip.registrationprocessor - pre-processor - 1.1.5.5-P4 - - registration-processor-packet-validator-stage - 1.1.5.5-P4 - - UTF-8 - UTF-8 - - - - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-config.version} - - - org.springframework.boot - spring-boot-starter-actuator - - - org.mockito - mockito-core - ${mockito.version} - test - - - com.h2database - h2 - ${h2.version} - - - - - - org.springframework - spring-context - ${spring-framework.version} - - - io.mosip.registrationprocessor - registration-processor-packet-manager - ${packet.manager.version} - - - io.mosip.registrationprocessor - registration-processor-registration-status-service-impl - ${registration.status.service.version} - - - io.mosip.registrationprocessor - registration-processor-rest-client - ${registration.processor.rest.client.version} - - - io.mosip.registrationprocessor - registration-processor-message-sender-impl - ${registration.processor.message.sender.version} - - - commons-io - commons-io - ${commons.io.version} - - - junit - junit - 4.12 - test - - - io.mosip.registrationprocessor - registration-processor-core - ${registration.processor.core.version} - - - org.powermock - powermock-module-junit4 - ${powermock.module.junit4.version} - test - - - org.powermock - powermock-api-mockito2 - ${powermock.api.mockito.version} - test - - - io.mosip.registrationprocessor - registration-processor-info-storage-service - ${packet.info.storage.service.version} - - - io.mosip.kernel - kernel-core - ${kernel.core.version} - - - org.springframework.boot - spring-boot-starter-webflux - ${spring.boot.version} - - - io.mosip.registrationprocessor - registration-processor-packet-classifier-stage - 1.1.5.5-P4 - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - true - - - - - build-info - repackage - - - - - - - + + + 4.0.0 + + + io.mosip.registrationprocessor + pre-processor + 1.1.5.5-P5-SNAPSHOT + + registration-processor-packet-validator-stage + 1.1.5.5-P5-SNAPSHOT + + UTF-8 + UTF-8 + + + + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-config.version} + + + org.springframework.boot + spring-boot-starter-actuator + + + org.mockito + mockito-core + ${mockito.version} + test + + + com.h2database + h2 + ${h2.version} + + + + + + org.springframework + spring-context + ${spring-framework.version} + + + io.mosip.registrationprocessor + registration-processor-packet-manager + ${packet.manager.version} + + + io.mosip.registrationprocessor + registration-processor-registration-status-service-impl + ${registration.status.service.version} + + + io.mosip.registrationprocessor + registration-processor-rest-client + ${registration.processor.rest.client.version} + + + io.mosip.registrationprocessor + registration-processor-message-sender-impl + ${registration.processor.message.sender.version} + + + commons-io + commons-io + ${commons.io.version} + + + junit + junit + 4.12 + test + + + io.mosip.registrationprocessor + registration-processor-core + ${registration.processor.core.version} + + + org.powermock + powermock-module-junit4 + ${powermock.module.junit4.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.api.mockito.version} + test + + + io.mosip.registrationprocessor + registration-processor-info-storage-service + ${packet.info.storage.service.version} + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + org.springframework.boot + spring-boot-starter-webflux + ${spring.boot.version} + + + io.mosip.registrationprocessor + registration-processor-packet-classifier-stage + 1.1.5.5-P5-SNAPSHOT + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + true + + + + + build-info + repackage + + + + + + + diff --git a/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml b/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml index f1e26e88057..2cd5d436d29 100644 --- a/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-quality-checker-stage/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor pre-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-quality-checker-stage - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml index f9bdb15c80a..293439d08c3 100644 --- a/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml +++ b/registration-processor/pre-processor/registration-processor-securezone-notification-stage/pom.xml @@ -5,10 +5,10 @@ pre-processor io.mosip.registrationprocessor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT 4.0.0 - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-securezone-notification-stage diff --git a/registration-processor/qc-users-manger/pom.xml b/registration-processor/qc-users-manger/pom.xml index 71f03d505b8..96ef4e493ad 100644 --- a/registration-processor/qc-users-manger/pom.xml +++ b/registration-processor/qc-users-manger/pom.xml @@ -1,78 +1,78 @@ - - - 4.0.0 - - - qc-users-manger - - io.mosip.registrationprocessor - registration-processor - 1.1.5.5-P4 - - - - UTF-8 - UTF-8 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - io.mosip.kernel - kernel-core - ${kernel.core.version} - - - org.postgresql - postgresql - - - io.mosip.kernel - kernel-dataaccess-hibernate - ${kernel.core.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - exec - - - - - - - - + + + 4.0.0 + + + qc-users-manger + + io.mosip.registrationprocessor + registration-processor + 1.1.5.5-P5-SNAPSHOT + + + + UTF-8 + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + org.postgresql + postgresql + + + io.mosip.kernel + kernel-dataaccess-hibernate + ${kernel.core.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + exec + + + + + + + + diff --git a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml index 8bf90295310..0eb9e57861a 100644 --- a/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml +++ b/registration-processor/registration-processor-bio-dedupe-service-impl/pom.xml @@ -5,11 +5,11 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-bio-dedupe-service-impl - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-bio-dedupe-service-impl diff --git a/registration-processor/registration-processor-common-camel-bridge/pom.xml b/registration-processor/registration-processor-common-camel-bridge/pom.xml index 59f2f978565..0e5b2580c5c 100644 --- a/registration-processor/registration-processor-common-camel-bridge/pom.xml +++ b/registration-processor/registration-processor-common-camel-bridge/pom.xml @@ -6,10 +6,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-common-camel-bridge - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT jar diff --git a/registration-processor/registration-processor-core/pom.xml b/registration-processor/registration-processor-core/pom.xml index 3ab2bf658d6..d6452185d51 100644 --- a/registration-processor/registration-processor-core/pom.xml +++ b/registration-processor/registration-processor-core/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-core - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT org.mockito diff --git a/registration-processor/registration-processor-info-storage-service/pom.xml b/registration-processor/registration-processor-info-storage-service/pom.xml index ff24c39ed7b..215fe9e010f 100644 --- a/registration-processor/registration-processor-info-storage-service/pom.xml +++ b/registration-processor/registration-processor-info-storage-service/pom.xml @@ -7,10 +7,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-info-storage-service - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-info-storage-service UTF-8 diff --git a/registration-processor/registration-processor-message-sender-impl/pom.xml b/registration-processor/registration-processor-message-sender-impl/pom.xml index a2475fc5328..cbf8374e56b 100644 --- a/registration-processor/registration-processor-message-sender-impl/pom.xml +++ b/registration-processor/registration-processor-message-sender-impl/pom.xml @@ -8,11 +8,11 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-message-sender-impl - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/registration-processor-packet-manager/pom.xml b/registration-processor/registration-processor-packet-manager/pom.xml index 0cee9a13f91..916630f622d 100644 --- a/registration-processor/registration-processor-packet-manager/pom.xml +++ b/registration-processor/registration-processor-packet-manager/pom.xml @@ -1,97 +1,97 @@ - - - 4.0.0 - jar - - io.mosip.registrationprocessor - registration-processor - 1.1.5.5-P4 - - - registration-processor-packet-manager - registration-processor-packet-manager - 1.1.5.5-P4 - - UTF-8 - - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - commons-pool - commons-pool - ${commons.pool} - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-config.version} - - - junit - junit - test - - - org.springframework.boot - spring-boot-starter - - - io.mosip.registrationprocessor - registration-processor-core - ${registration.processor.core.version} - - - io.mosip.registrationprocessor - registration-processor-rest-client - ${registration.processor.rest.client.version} - - - io.mosip.kernel - kernel-core - ${kernel.core.version} - - - commons-io - commons-io - ${commons-io} - - - com.h2database - h2 - - - com.jcraft - jsch - ${jsch.version} - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.powermock - powermock-module-junit4 - ${powermock.module.junit4.version} - test - - - org.powermock - powermock-api-mockito2 - ${powermock.api.mockito.version} - test - - + + + 4.0.0 + jar + + io.mosip.registrationprocessor + registration-processor + 1.1.5.5-P5-SNAPSHOT + + + registration-processor-packet-manager + registration-processor-packet-manager + 1.1.5.5-P5-SNAPSHOT + + UTF-8 + + + + + org.mockito + mockito-core + ${mockito.version} + test + + + + + + commons-pool + commons-pool + ${commons.pool} + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-config.version} + + + junit + junit + test + + + org.springframework.boot + spring-boot-starter + + + io.mosip.registrationprocessor + registration-processor-core + ${registration.processor.core.version} + + + io.mosip.registrationprocessor + registration-processor-rest-client + ${registration.processor.rest.client.version} + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + commons-io + commons-io + ${commons-io} + + + com.h2database + h2 + + + com.jcraft + jsch + ${jsch.version} + + + org.mockito + mockito-core + ${mockito.version} + test + + + org.powermock + powermock-module-junit4 + ${powermock.module.junit4.version} + test + + + org.powermock + powermock-api-mockito2 + ${powermock.api.mockito.version} + test + + \ No newline at end of file diff --git a/registration-processor/registration-processor-quality-checker/pom.xml b/registration-processor/registration-processor-quality-checker/pom.xml index e797a4aad94..f452f7165ab 100644 --- a/registration-processor/registration-processor-quality-checker/pom.xml +++ b/registration-processor/registration-processor-quality-checker/pom.xml @@ -1,84 +1,84 @@ - - - 4.0.0 - - registration-processor-quality-checker - - - io.mosip.registrationprocessor - registration-processor - 1.1.5.5-P4 - - - - UTF-8 - UTF-8 - - - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-config.version} - - - io.mosip.kernel - kernel-core - ${kernel.core.version} - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - org.postgresql - postgresql - - - org.springframework.boot - spring-boot-starter-test - test - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.mosip.registrationprocessor - registration-processor-info-storage-service - ${packet.info.storage.service.version} - - - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring.boot.version} - - - - repackage - - - exec - - - - - - - - + + + 4.0.0 + + registration-processor-quality-checker + + + io.mosip.registrationprocessor + registration-processor + 1.1.5.5-P5-SNAPSHOT + + + + UTF-8 + UTF-8 + + + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-config.version} + + + io.mosip.kernel + kernel-core + ${kernel.core.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + org.postgresql + postgresql + + + org.springframework.boot + spring-boot-starter-test + test + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.mosip.registrationprocessor + registration-processor-info-storage-service + ${packet.info.storage.service.version} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + exec + + + + + + + + diff --git a/registration-processor/registration-processor-registration-status-service-impl/pom.xml b/registration-processor/registration-processor-registration-status-service-impl/pom.xml index a23582e7c18..f07dfe64174 100644 --- a/registration-processor/registration-processor-registration-status-service-impl/pom.xml +++ b/registration-processor/registration-processor-registration-status-service-impl/pom.xml @@ -8,10 +8,10 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-registration-status-service-impl - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8 diff --git a/registration-processor/registration-processor-rest-client/pom.xml b/registration-processor/registration-processor-rest-client/pom.xml index 2249b02dcba..2f0e397c9e6 100644 --- a/registration-processor/registration-processor-rest-client/pom.xml +++ b/registration-processor/registration-processor-rest-client/pom.xml @@ -9,12 +9,12 @@ io.mosip.registrationprocessor registration-processor - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT registration-processor-rest-client registration-processor-rest-client - 1.1.5.5-P4 + 1.1.5.5-P5-SNAPSHOT UTF-8