From 71db745392d8d1741e4277c343ea71854918371c Mon Sep 17 00:00:00 2001 From: Balaji <74903654+balaji-alluru@users.noreply.github.com> Date: Tue, 27 Sep 2022 12:12:34 +0530 Subject: [PATCH 1/3] MOSIP-23551: Added validators for DocType and DocCat code in valid document entity Signed-off-by: Balaji <74903654+balaji-alluru@users.noreply.github.com> --- .../bulkdataupload/entity/ValidDocument.java | 11 ++-- .../DocumentCategoryRepository.java | 3 ++ .../repositories/DocumentTypeRepository.java | 3 ++ .../io/mosip/admin/validator/DocCatCode.java | 23 ++++++++ .../admin/validator/DocCatCodeValidator.java | 50 +++++++++++++++++ .../io/mosip/admin/validator/DocTypeCode.java | 27 ++++++++++ .../admin/validator/DocTypeCodeValidator.java | 53 +++++++++++++++++++ .../controller/test/AdminControllerTest.java | 4 +- .../resources/application-test.properties | 3 +- 9 files changed, 170 insertions(+), 7 deletions(-) create mode 100644 admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java create mode 100644 admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java create mode 100644 admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java create mode 100644 admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java index e5270e83177..b8a972a55a0 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java @@ -15,6 +15,8 @@ import javax.persistence.Table; import io.mosip.admin.bulkdataupload.entity.id.ValidDocumentID; +import io.mosip.admin.validator.DocCatCode; +import io.mosip.admin.validator.DocTypeCode; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -43,12 +45,13 @@ public class ValidDocument extends BaseEntity implements Serializable { private static final long serialVersionUID = -3111581667845281498L; @Id - @AttributeOverrides({ - @AttributeOverride(name = "docTypeCode", column = @Column(name = "doctyp_code", nullable = false, length = 36)), - @AttributeOverride(name = "docCategoryCode", column = @Column(name = "doccat_code", nullable = false, length = 36)) }) - + @Column(name = "doctyp_code", nullable = false, length = 36) + @DocTypeCode(message = "docType is Invalid") private String docTypeCode; + @Id + @Column(name = "doccat_code", nullable = false, length = 36) + @DocCatCode(message = "docCategory is Invalid") private String docCategoryCode; @ManyToOne(fetch = FetchType.LAZY) diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentCategoryRepository.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentCategoryRepository.java index e025fe01229..02af055c513 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentCategoryRepository.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentCategoryRepository.java @@ -63,4 +63,7 @@ public interface DocumentCategoryRepository extends BaseRepository findAllByIsDeletedFalseOrIsDeletedIsNull(); } diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentTypeRepository.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentTypeRepository.java index 9d2cdfa4b77..7a07328b4a5 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentTypeRepository.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/repositories/DocumentTypeRepository.java @@ -71,4 +71,7 @@ public interface DocumentTypeRepository extends BaseRepository findAllByLangCodeAndIsDeletedFalseOrIsDeletedIsNull(String langCode); + + @Query(value = "select dt.code from master.doc_type dt where (dt.is_deleted = false or dt.is_deleted is null) AND dt.is_active = true", nativeQuery = true) + List findAllByIsDeletedFalseOrIsDeletedIsNull(); } diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java new file mode 100644 index 00000000000..1da5ee9c642 --- /dev/null +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java @@ -0,0 +1,23 @@ +package io.mosip.admin.validator; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; + +@Documented +@Constraint(validatedBy = DocCatCodeValidator.class) +@Target({ ElementType.FIELD, ElementType.TYPE_USE, ElementType.PARAMETER }) +@Retention(RetentionPolicy.RUNTIME) +public @interface DocCatCode { + + String message() default "docCategory is Invalid"; + + Class[] groups() default {}; + + Class[] payload() default {}; +} diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java new file mode 100644 index 00000000000..84d4e120b4f --- /dev/null +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java @@ -0,0 +1,50 @@ +package io.mosip.admin.validator; + +import java.util.List; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +import io.mosip.admin.bulkdataupload.repositories.DocumentCategoryRepository; +import org.springframework.beans.factory.annotation.Autowired; + +public class DocCatCodeValidator implements ConstraintValidator { + + private List docCatCode; + + @Autowired + private DocumentCategoryRepository documentCategoryRepository; + + @Override + public void initialize(DocCatCode constraintAnnotation) { + if(documentCategoryRepository == null){ + /* Note: An additional validation was getting triggered by doInvoke() method of + * RepositoryListItemWriter class with documentCategoryRepository equal to null + * which is not desired. This if clause is being used to escape that additional + * validation step. + */ + return; + } + docCatCode = documentCategoryRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); + } + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + + if(documentCategoryRepository == null){ + /* Note: An additional validation was getting triggered by doInvoke() method of + * RepositoryListItemWriter class with documentCategoryRepository equal to null + * which is not desired. This if clause is being used to escape that additional + * validation step. + */ + return true; + } + + if(null != value && !value.isEmpty()) { + return docCatCode.contains(value); + } + return false; + } + + +} diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java new file mode 100644 index 00000000000..47846993203 --- /dev/null +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java @@ -0,0 +1,27 @@ +package io.mosip.admin.validator; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; + + + + +@Documented +@Constraint(validatedBy = DocTypeCodeValidator.class) +@Target({ ElementType.FIELD, ElementType.TYPE_USE, ElementType.PARAMETER }) +@Retention(RetentionPolicy.RUNTIME) +public @interface DocTypeCode { + + String message() default "docType is Invalid"; + + Class[] groups() default {}; + + Class[] payload() default {}; + +} diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java new file mode 100644 index 00000000000..84b7b110da1 --- /dev/null +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java @@ -0,0 +1,53 @@ +package io.mosip.admin.validator; + +import java.util.List; + +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; + +import org.springframework.beans.factory.annotation.Autowired; + +import io.mosip.admin.bulkdataupload.repositories.DocumentTypeRepository; + +public class DocTypeCodeValidator implements ConstraintValidator { + + private List docTypeCode; + + @Autowired + DocumentTypeRepository documentTypeRepository; + + + @Override + public void initialize(DocTypeCode constraintAnnotation) { + if(documentTypeRepository == null){ + /* Note: An additional validation was getting triggered by doInvoke() method of + * RepositoryListItemWriter class with documentTypeRepository equal to null + * which is not desired. This if clause is being used to escape that additional + * validation step. + */ + return; + } + docTypeCode = documentTypeRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); + } + + + + @Override + public boolean isValid(String value, ConstraintValidatorContext context) { + if(documentTypeRepository == null){ + /* Note: An additional validation was getting triggered by doInvoke() method of + * RepositoryListItemWriter class with documentTypeRepository equal to null + * which is not desired. This if clause is being used to escape that additional + * validation step. + */ + return true; + } + + if(null != value && !value.isEmpty()) { + return docTypeCode.contains(value); + } + return false; + } + + +} diff --git a/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java b/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java index c9e8d9fb983..06443cd753f 100644 --- a/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java +++ b/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java @@ -113,7 +113,7 @@ public void setUp() throws Exception { @Test @WithUserDetails(value = "zonal-admin") public void t002lostRidTest() throws Exception { - String str = "{\r\n \"id\": null,\r\n \"version\": null,\r\n \"responsetime\": \"2019-12-02T09:45:24.512Z\",\r\n \"metadata\": null,\r\n \"response\": [{\"registrationId\":\"1234\",\"registrationDate\":\"2021-12-14 16:29:13,436\"}],\r\n \"errors\": []\r\n}"; + String str = "{\r\n \"id\": null,\r\n \"version\": null,\r\n \"responsetime\": \"2019-12-02T09:45:24.512Z\",\r\n \"metadata\": null,\r\n \"response\": [{\"registrationId\":\"1234\",\"registrationDate\":\"2022-09-14 16:29:13,436\"}],\r\n \"errors\": []\r\n}"; searchInfoReq.getRequest().setSort(new ArrayList()); mockRestServiceServer.expect(requestTo(lstRidUrl)) @@ -122,7 +122,7 @@ public void t002lostRidTest() throws Exception { AdminDataUtil.checkResponse( (mockMvc.perform(MockMvcRequestBuilders.post("/lostRid").contentType(MediaType.APPLICATION_JSON) .content(mapper.writeValueAsString(searchInfoReq))).andReturn()), - null); + "ADMN-LRID-001"); } diff --git a/admin/admin-service/src/test/resources/application-test.properties b/admin/admin-service/src/test/resources/application-test.properties index 2d28fc46708..14d02a6de45 100644 --- a/admin/admin-service/src/test/resources/application-test.properties +++ b/admin/admin-service/src/test/resources/application-test.properties @@ -474,4 +474,5 @@ mosip.admin.applicant-details.exposed-identity-fields=dob,applicantPhoto DIGITAL_CARD_STATUS_URL=https://qa3.mosip.net/v1/digitalcard RETRIEVE_IDENTITY_API=https://dev.mosip.net/idrepository/v1/identity/idvid PACKET_MANAGER_BIOMETRIC=https://api-internal.dev.mosip.net/commons/v1/packetmanager/biometrics -PACKET_MANAGER_SEARCHFIELDS=https://api-internal.dev.mosip.net/commons/v1/packetmanager/searchFields \ No newline at end of file +PACKET_MANAGER_SEARCHFIELDS=https://api-internal.dev.mosip.net/commons/v1/packetmanager/searchFields +mosip.registration.processor.lostrid.max-registration-date-filter-interval=30 From f554cd01da8576ac69b615612e9bea72fb1acf42 Mon Sep 17 00:00:00 2001 From: Balaji <74903654+balaji-alluru@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:58:14 +0530 Subject: [PATCH 2/3] updated doctype and doccode validators Signed-off-by: Balaji <74903654+balaji-alluru@users.noreply.github.com> --- .../constant/ErrorConstants.java | 7 +++ .../bulkdataupload/entity/ValidDocument.java | 5 +- .../io/mosip/admin/config/CommonConfig.java | 48 +++++++++++++++++++ .../io/mosip/admin/validator/DocCatCode.java | 3 +- .../admin/validator/DocCatCodeValidator.java | 21 ++------ .../io/mosip/admin/validator/DocTypeCode.java | 4 +- .../admin/validator/DocTypeCodeValidator.java | 23 ++------- .../resources/application-local1.properties | 1 + .../resources/application-test.properties | 1 + 9 files changed, 71 insertions(+), 42 deletions(-) create mode 100644 admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/constant/ErrorConstants.java diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/constant/ErrorConstants.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/constant/ErrorConstants.java new file mode 100644 index 00000000000..215bc254845 --- /dev/null +++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/constant/ErrorConstants.java @@ -0,0 +1,7 @@ +package io.mosip.admin.bulkdataupload.constant; + +public class ErrorConstants { + + public static final String INVALID_DOC_CAT_CODE = "DocCategory is Invalid"; + public static final String INVALID_DOC_TYPE_CODE ="DocType is Invalid"; +} diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java index b8a972a55a0..5bf194fb923 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ValidDocument.java @@ -17,6 +17,7 @@ import io.mosip.admin.bulkdataupload.entity.id.ValidDocumentID; import io.mosip.admin.validator.DocCatCode; import io.mosip.admin.validator.DocTypeCode; +import io.mosip.admin.bulkdataupload.constant.ErrorConstants; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -46,12 +47,12 @@ public class ValidDocument extends BaseEntity implements Serializable { @Id @Column(name = "doctyp_code", nullable = false, length = 36) - @DocTypeCode(message = "docType is Invalid") + @DocTypeCode(message = ErrorConstants.INVALID_DOC_TYPE_CODE) private String docTypeCode; @Id @Column(name = "doccat_code", nullable = false, length = 36) - @DocCatCode(message = "docCategory is Invalid") + @DocCatCode(message = ErrorConstants.INVALID_DOC_CAT_CODE) private String docCategoryCode; @ManyToOne(fetch = FetchType.LAZY) diff --git a/admin/admin-service/src/main/java/io/mosip/admin/config/CommonConfig.java b/admin/admin-service/src/main/java/io/mosip/admin/config/CommonConfig.java index 5e42da9cd7e..0017bf72246 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/config/CommonConfig.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/config/CommonConfig.java @@ -2,18 +2,24 @@ import javax.servlet.Filter; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.Scope; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.filter.CommonsRequestLoggingFilter; +import io.mosip.admin.bulkdataupload.repositories.DocumentCategoryRepository; +import io.mosip.admin.bulkdataupload.repositories.DocumentTypeRepository; import io.mosip.admin.httpfilter.ReqResFilter; import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Properties; /** @@ -24,6 +30,36 @@ @Configuration public class CommonConfig { + @Autowired + private DocumentCategoryRepository documentCategoryRepository; + + @Autowired + private DocumentTypeRepository documentTypeRepository; + + private List docCatCodes; + + private List docTypeCodes; + + private List getDocCatCodes(){ + if(docCatCodes.isEmpty()) { + docCatCodes = documentCategoryRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); + } + return docCatCodes; + } + + private List getDocTypeCodes(){ + if(docTypeCodes.isEmpty()) { + docTypeCodes = documentTypeRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); + } + return docTypeCodes; + } + + @Scheduled(fixedRateString = "#{60 * 60 * 1000 * ${mosip.admin.doccodes-cleanup.fixed-rate}}") + private void clearDocCodes() { + docCatCodes.clear(); + docTypeCodes.clear(); + } + @Bean public CommonsRequestLoggingFilter logFilter() { CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); @@ -56,4 +92,16 @@ public Properties packetProperties() { } catch (IOException e) { } return properties; } + + @Bean("DocCatCodes") + @Scope(value = "prototype") + public List docCatCodes(){ + return getDocCatCodes(); + } + + @Bean("DocTypeCodes") + @Scope(value = "prototype") + public List docTypeCodes(){ + return getDocTypeCodes(); + } } diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java index 1da5ee9c642..3bd5d4f252d 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCode.java @@ -5,6 +5,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import io.mosip.admin.bulkdataupload.constant.ErrorConstants; import javax.validation.Constraint; import javax.validation.Payload; @@ -15,7 +16,7 @@ @Retention(RetentionPolicy.RUNTIME) public @interface DocCatCode { - String message() default "docCategory is Invalid"; + String message() default ErrorConstants.INVALID_DOC_CAT_CODE; Class[] groups() default {}; diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java index 84d4e120b4f..ecf1ccb3d82 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocCatCodeValidator.java @@ -10,28 +10,13 @@ public class DocCatCodeValidator implements ConstraintValidator { - private List docCatCode; - @Autowired - private DocumentCategoryRepository documentCategoryRepository; - - @Override - public void initialize(DocCatCode constraintAnnotation) { - if(documentCategoryRepository == null){ - /* Note: An additional validation was getting triggered by doInvoke() method of - * RepositoryListItemWriter class with documentCategoryRepository equal to null - * which is not desired. This if clause is being used to escape that additional - * validation step. - */ - return; - } - docCatCode = documentCategoryRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); - } + private List docCatCodes; @Override public boolean isValid(String value, ConstraintValidatorContext context) { - if(documentCategoryRepository == null){ + if(docCatCodes == null){ /* Note: An additional validation was getting triggered by doInvoke() method of * RepositoryListItemWriter class with documentCategoryRepository equal to null * which is not desired. This if clause is being used to escape that additional @@ -41,7 +26,7 @@ public boolean isValid(String value, ConstraintValidatorContext context) { } if(null != value && !value.isEmpty()) { - return docCatCode.contains(value); + return docCatCodes.contains(value); } return false; } diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java index 47846993203..31987b7cbc2 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCode.java @@ -9,6 +9,8 @@ import javax.validation.Constraint; import javax.validation.Payload; +import io.mosip.admin.bulkdataupload.constant.ErrorConstants; + @@ -18,7 +20,7 @@ @Retention(RetentionPolicy.RUNTIME) public @interface DocTypeCode { - String message() default "docType is Invalid"; + String message() default ErrorConstants.INVALID_DOC_TYPE_CODE; Class[] groups() default {}; diff --git a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java index 84b7b110da1..98b746244db 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/validator/DocTypeCodeValidator.java @@ -11,30 +11,13 @@ public class DocTypeCodeValidator implements ConstraintValidator { - private List docTypeCode; - @Autowired - DocumentTypeRepository documentTypeRepository; - - - @Override - public void initialize(DocTypeCode constraintAnnotation) { - if(documentTypeRepository == null){ - /* Note: An additional validation was getting triggered by doInvoke() method of - * RepositoryListItemWriter class with documentTypeRepository equal to null - * which is not desired. This if clause is being used to escape that additional - * validation step. - */ - return; - } - docTypeCode = documentTypeRepository.findAllByIsDeletedFalseOrIsDeletedIsNull(); - } - + private List docTypeCodes; @Override public boolean isValid(String value, ConstraintValidatorContext context) { - if(documentTypeRepository == null){ + if(docTypeCodes == null){ /* Note: An additional validation was getting triggered by doInvoke() method of * RepositoryListItemWriter class with documentTypeRepository equal to null * which is not desired. This if clause is being used to escape that additional @@ -44,7 +27,7 @@ public boolean isValid(String value, ConstraintValidatorContext context) { } if(null != value && !value.isEmpty()) { - return docTypeCode.contains(value); + return docTypeCodes.contains(value); } return false; } diff --git a/admin/admin-service/src/main/resources/application-local1.properties b/admin/admin-service/src/main/resources/application-local1.properties index 435ad139c8a..09f79d5077b 100644 --- a/admin/admin-service/src/main/resources/application-local1.properties +++ b/admin/admin-service/src/main/resources/application-local1.properties @@ -6,6 +6,7 @@ auth.server.user-add-password-url=https://api-internal.dev.mosip.io/v1/authmanag mosip.kernel.config.server.file.storage.uri=https://qa3.mosip.net/config/print/mz/qa3-1.1.5/ mosip.admin.identityMappingJson=identity-mapping.json mosip.admin.applicant-details.exposed-identity-fields=dob,applicantPhoto +mosip.admin.doccodes-cleanup.fixed-rate=24 RETRIEVE_IDENTITY_API=https://api-internal.dev1.mosip.net/idrepository/v1/identity/idvid ## this property is used to configure max limit of search for the login user to get applicantDetails mosip.admin.applicant-details.max.login.count=30 diff --git a/admin/admin-service/src/test/resources/application-test.properties b/admin/admin-service/src/test/resources/application-test.properties index 14d02a6de45..f60d94fddb0 100644 --- a/admin/admin-service/src/test/resources/application-test.properties +++ b/admin/admin-service/src/test/resources/application-test.properties @@ -10,6 +10,7 @@ spring.batch.initializer.enabled=false mosip.admin-appid=admin mosip.admin-otp-context=auth-otp mosip.admin-userid-otp-type=USERID +mosip.admin.doccodes-cleanup.fixed-rate=24 #-----------------UINActive/Deactive--------------------------------- mosip.admin.uinmgmt.uin-detail-search=http://localhost:8080/idrepository/v1/identity/uin/{uin} From 08a5a05dc518ebdef7eab6a213ffd256fcb886e7 Mon Sep 17 00:00:00 2001 From: Balaji <74903654+balaji-alluru@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:37:03 +0530 Subject: [PATCH 3/3] renamed test methods Signed-off-by: Balaji <74903654+balaji-alluru@users.noreply.github.com> --- .../io/mosip/admin/controller/test/AdminControllerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java b/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java index 06443cd753f..edc144a3ec2 100644 --- a/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java +++ b/admin/admin-service/src/test/java/io/mosip/admin/controller/test/AdminControllerTest.java @@ -112,7 +112,7 @@ public void setUp() throws Exception { @Test @WithUserDetails(value = "zonal-admin") - public void t002lostRidTest() throws Exception { + public void lostRid_withValidInput_thenFail() throws Exception { String str = "{\r\n \"id\": null,\r\n \"version\": null,\r\n \"responsetime\": \"2019-12-02T09:45:24.512Z\",\r\n \"metadata\": null,\r\n \"response\": [{\"registrationId\":\"1234\",\"registrationDate\":\"2022-09-14 16:29:13,436\"}],\r\n \"errors\": []\r\n}"; searchInfoReq.getRequest().setSort(new ArrayList()); @@ -128,7 +128,7 @@ public void t002lostRidTest() throws Exception { @Test @WithUserDetails(value = "zonal-admin") - public void t003lostRidDetailsTest() throws Exception { + public void lostRid_withValidInput_thenPass() throws Exception { String str = "{\"id\":null,\"version\":null,\"responsetime\":\"2023-07-19T05:58:54.874Z\",\"metadata\":null,\"response\":{\"fields\":{\"fullName\":\"[ {\\n \\\"language\\\" : \\\"eng\\\",\\n \\\"value\\\" : \\\"test new 2\\\"\\n}, {\\n \\\"language\\\" : \\\"fra\\\",\\n \\\"value\\\" : \\\"test new 2\\\"\\n} ]\",\"dateOfBirth\":\"1995/01/01\"}},\"errors\":[]}"; String biometricResponse = new String(Files.readAllBytes(Paths.get(getClass().getResource("/biometricApiResponse.json").toURI())), StandardCharsets.UTF_8);