Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump spring-webflux from 5.0.6.RELEASE to 5.2.20.RELEASE in /admin/hotlist-service #836

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f02362c
MOSIP-18127 : loc_holiday update bug fix
balaji-alluru Apr 11, 2022
3ce6cac
Revert "MOSIP-18127 : loc_holiday update bug fix"
balaji-alluru Apr 18, 2022
0e934a8
Update release_changes.yml
ckm007 May 12, 2022
6c712cf
Merge pull request #741 from mosip/ckm007-patch-1
syedsalman3753 May 12, 2022
f719459
[ MOSIP-20021 ] updated release_changes.yml to update README.md badges
May 19, 2022
71ef114
Merge pull request #744 from syed-salman-technoforte/release-1.2.0.1
ckm007 May 20, 2022
b9b59cc
MOSIP-21337 : code validation bug fix
balaji-alluru Jun 2, 2022
764c9c1
Merge pull request #756 from balaji-alluru/1.2.0.1
ase-101 Jun 3, 2022
1fecc4a
MOSIP-22377 : Fixed the failing testcases in admin-services
balaji-alluru Jun 7, 2022
1787f56
MOSIP-22377 : Fixed the failing testcases in admin-services
balaji-alluru Jun 8, 2022
b9c06f7
Merge pull request #759 from balaji-alluru/1.2.0.1
ckm007 Jun 10, 2022
f5f93f9
MOSIP-22377
dhanendra06 Jun 10, 2022
4518538
Merge pull request #763 from dhanendra06/mosip-220
ckm007 Jun 10, 2022
07813e4
MOSIP-22027,MOSIP-22143,MOSIP-22145
dhanendra06 Jun 8, 2022
32dbe0d
MOSIP-22143
dhanendra06 Jun 8, 2022
44c4bb5
Dynamic field and ui-spec Migration scripts added
Jun 23, 2022
407498a
Dynamic field and ui-spec Migration scripts added
Jun 23, 2022
1281485
Corrected migration sql and added not on pre-reg ui-spec update
Jun 23, 2022
03d03d4
Delete migration-schema.py
ase-101 Jun 24, 2022
104651d
Update README.md
ase-101 Jun 24, 2022
5cfec4e
ClientType check during encrypt and signature validation changes added
Mar 29, 2022
2800661
Added key index into MDC for logging
Apr 29, 2022
fac2dea
MOSIP-21692 config and userdetails response encryption based on clien…
May 19, 2022
e3f8e03
Added language data in clientsettings API
May 19, 2022
b6a2b37
Added details in the readme
Jul 15, 2022
6bf1b3a
Added comment
Jul 15, 2022
0924add
Update README.md
ase-101 Jul 15, 2022
63c32d7
[MOSIP-20028] added action for tagging
ckm007 Jul 18, 2022
c0644a6
[MOSIP-20028] added action for tagging
ckm007 Jul 18, 2022
904668a
updated migration scripts with migration fixes from develop to 1.2.0.1
ase-101 Jul 20, 2022
1ce173f
Update 1.2.0_master-scripts_release.sql
ase-101 Jul 20, 2022
972c31e
added PRIMARY_LANGUAGE_CODE
ase-101 Jul 20, 2022
6d84915
Added PRIMARY_LANGUAGE_CODE
ase-101 Jul 20, 2022
961310f
Update 1.2.0_master-scripts_release.sql
ase-101 Jul 25, 2022
b6e811b
Create 1.2.0_master-scripts_revoke.sql
ase-101 Jul 25, 2022
7fede67
Update 1.2.0_master-scripts_revoke.sql
ase-101 Jul 25, 2022
c6d2870
MOSIP-18127
balaji-alluru Jul 27, 2022
146ad17
Revoke and release script tested
Jul 29, 2022
30d3ea1
Fixes for API test rig failures
Jul 29, 2022
cf8219c
Fixes for API test rig failures
Jul 29, 2022
374756a
Updated the readme
Jul 29, 2022
6a38a22
Merge pull request #779 from ase-101/release-1.2.0.1
ckm007 Jul 29, 2022
2839a77
Merge branch 'mosip:master' into patch
balaji-alluru Aug 1, 2022
1c7c50a
MOSIP-18127 : Updated pk constraints
balaji-alluru Aug 1, 2022
2e7c243
Merge pull request #782 from balaji-alluru/patch
ckm007 Aug 1, 2022
bd8613b
MOSIP-18127: Fix for failed testcases.
balaji-alluru Aug 2, 2022
8644e67
MOSIP-21303 : Added validator for blocklisted words
balaji-alluru Aug 2, 2022
0b15f0a
Merge pull request #783 from balaji-alluru/patch
ckm007 Aug 2, 2022
9f494bd
Fixed code for backward compatibility
Aug 11, 2022
3961c4c
Merge pull request #787 from HimajaDhanyamraju2/release-1.2.0.1_fork
ckm007 Aug 16, 2022
22aa420
DB release script names re-structurisation changes
Aug 17, 2022
704ad3f
id-schema sync failure in 1.1.5* reg-client fix
Aug 18, 2022
fd6fe39
Merge pull request #790 from ase-101/upgrade_fix_1202
ckm007 Aug 18, 2022
fdfba8a
Merge pull request #788 from ase-101/name_change_release-1.2.0.1
ckm007 Aug 18, 2022
0ba53aa
MOSIP-23663: Fixed locationHierarchy sync issue
Aug 23, 2022
a853c56
Fixed error and test cases
Aug 25, 2022
f18ea8f
Modified code as per review comments
Aug 25, 2022
b0bee0b
MOSIP-23855
ase-101 Sep 5, 2022
39d1e44
MOSIP-23852
ase-101 Sep 5, 2022
bad0b71
removed owner alter stmt
ase-101 Sep 6, 2022
3a05cb7
Update master-ca_cert_store.sql
ase-101 Sep 6, 2022
d291dcf
Merge pull request #799 from mosip/ase-101-patch-1
ckm007 Sep 6, 2022
ee18aa0
Merge pull request #794 from HimajaDhanyamraju2/release-1.2.0.1_fork
ase-101 Sep 20, 2022
b055aa0
Release Bot Pre-release changes
pramod444 Sep 29, 2022
7ddd0f1
Merge pull request #808 from mosip/release-branch
ckm007 Sep 29, 2022
66ee808
Fix for failed test cases
balaji-alluru Sep 30, 2022
bd7c445
Merge pull request #809 from balaji-alluru/branch1201
ckm007 Sep 30, 2022
e25c83c
Bump spring-webflux in /admin/hotlist-service
dependabot[bot] Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ jobs:

- name: Publish the maven package
run: |
cd admin && mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.OSSRH_SNAPSHOT_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
cd admin && mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.RELEASE_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_TTY: $(tty)
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV

- name: update Branch name in badges
run: |
sed -i 's/branch=.*)]/branch=${{ env.BRANCH_NAME }}\)]/g' README.md
sed -i 's/branch=.*\&/branch=${{ env.BRANCH_NAME }}\&/g' README.md

- name: Mannualy changing the pom versions
run: find . -type f -name "*pom.xml" -print0 | xargs -0 sed -i "s/${{ github.event.inputs.snapshotTags }}/${{ github.event.inputs.releaseTags }}/g"

Expand All @@ -48,7 +53,7 @@ jobs:
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTION_PAT }}
commit-message: Updated Pom versions for release changes
commit-message: Release Bot Pre-release changes
title: Release changes
body: Automated PR for ${{ github.event.inputs.releaseTags }} release.
branch: release-branch
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tagging of repos

env:
tag: v1.2.3

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be published'
required: true
default: 'v1.2.3'
type: string
body:
description: 'Release body message'
required: true
default: 'Changes in this Release'
type: string
pre-release:
description: 'Pre-release? True/False'
required: true
default: False
type: string

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
body: |
${{ github.event.inputs.body }}
draft: false
prerelease: ${{fromJSON(github.event.inputs.pre-release)}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven Package upon a push](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml)
[![Maven Package upon a push](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_admin-services)


Expand Down
6 changes: 3 additions & 3 deletions admin/admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
<parent>
<groupId>io.mosip.admin</groupId>
<artifactId>admin-parent</artifactId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.0.1-B1</version>
</parent>
<artifactId>admin-service</artifactId>
<name>admin-service</name>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.0.1-B1</version>
<url>http://maven.apache.org</url>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-cloud-config.version>2.0.4.RELEASE</spring-cloud-config.version>
<springdoc.version>1.5.10</springdoc.version>
<kernel.version>1.2.0.1-SNAPSHOT</kernel.version>
<kernel.version>1.2.0.1-B1</kernel.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;

import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;

public class CustomLineMapper <T> implements LineMapper<T>, InitializingBean {

Expand Down Expand Up @@ -41,6 +44,10 @@ public T mapLine(String line, int lineNumber) throws Exception {
throw new Exception("Invalid language code provided");
}
}
Set<ConstraintViolation<T>> violations = validator.validate(fieldSetMapper.mapFieldSet(tokenizer.tokenize(line)));
if (!violations.isEmpty()) {
throw new ConstraintViolationException(violations);
}

return fieldSetMapper.mapFieldSet(tokenizer.tokenize(line));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.ArrayList;
import java.util.List;

import javax.validation.ConstraintViolationException;

public class JobResultListener implements JobExecutionListener {

private static final Logger logger = LoggerFactory.getLogger(JobResultListener.class);
Expand Down Expand Up @@ -58,9 +60,13 @@ public void afterJob(JobExecution jobExecution) {
List<String> failures = new ArrayList<String>();
jobExecution.getStepExecutions().forEach(step -> {
step.getFailureExceptions().forEach(failure -> {
if (failure instanceof FlatFileParseException) {
if (failure instanceof FlatFileParseException && failure.getCause() instanceof ConstraintViolationException) {
failures.add("Line --> " + ((FlatFileParseException) failure).getLineNumber() + " --> "+
((FlatFileParseException) failure).getCause().getMessage());
}
else if(failure instanceof FlatFileParseException){
failures.add("Line --> " + ((FlatFileParseException) failure).getLineNumber() +
" --> Datatype mismatch / Failed to write into object");
" --> Datatype mismatch/ Validation error / Failed to write into object");
} else
failures.add(failure.getCause() != null ? failure.getCause().getMessage() : failure.getMessage());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.persistence.Id;
import javax.persistence.Table;

import io.mosip.admin.validator.AlphabeticValidator;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -37,6 +38,7 @@ public class BlocklistedWords extends BaseEntity implements Serializable {
*/
@Id
@Column(name = "word", length = 128)
@AlphabeticValidator(message = "Blocklisted word can only contain Alphabets")
private String word;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import io.mosip.admin.bulkdataupload.entity.id.CodeAndLanguageCodeID;
import io.mosip.admin.bulkdataupload.entity.id.IdAndLanguageCodeID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -18,6 +21,7 @@
@AllArgsConstructor
@Entity
@Table(name = "module_detail", schema = "master")
@IdClass(IdAndLanguageCodeID.class)
public class ModuleDetail extends BaseEntity implements Serializable {

/**
Expand All @@ -29,6 +33,7 @@ public class ModuleDetail extends BaseEntity implements Serializable {
@Column(name = "id", nullable = false, length = 36)
private String id;

@Id
@Column(name = "lang_code", nullable = false, length = 3)
private String langCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public class Template extends BaseEntity implements Serializable {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "module_id", referencedColumnName = "id", insertable = false, updatable = false) })
@JoinColumn(name = "module_id", referencedColumnName = "id", insertable = false, updatable = false),
@JoinColumn(name = "lang_code", referencedColumnName = "lang_code", insertable = false, updatable = false) })
private ModuleDetail moduleDetail;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,5 @@ public class HolidayID implements Serializable {
@Column(name = "lang_code", nullable = false, length = 3)
private String langCode;

@Column(name = "holiday_name", nullable = false, length = 64)
private String holidayName;

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import javax.validation.Validator;

import io.mosip.admin.bulkdataupload.batch.CustomLineMapper;
import io.mosip.admin.bulkdataupload.batch.JobResultListener;
Expand Down Expand Up @@ -108,6 +109,9 @@ public class BulkDataUploadServiceImpl implements BulkDataService {

@Autowired
private RestTemplate restTemplate;

@Autowired
private Validator validator;

@Autowired
private BulkUploadTranscationRepository bulkTranscationRepo;
Expand Down Expand Up @@ -474,7 +478,7 @@ public void handleLine(String s) {
fieldSetMapper.setTargetType(clazz);
fieldSetMapper.setConversionService(customConversionService());

CustomLineMapper<Object> lineMapper = new CustomLineMapper<Object>(setupLanguages(), null);
CustomLineMapper<Object> lineMapper = new CustomLineMapper<Object>(setupLanguages(), validator);
lineMapper.setLineTokenizer(lineTokenizer);
lineMapper.setFieldSetMapper(fieldSetMapper);
flatFileItemReader.setLineMapper(lineMapper);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;



@Documented
@Constraint(validatedBy = LanguageCharacterValidator.class)
@Target({ ElementType.FIELD, ElementType.TYPE_USE, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
public @interface AlphabeticValidator {
String message() default "Numbers and Special characters not allowed";

Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.mosip.admin.validator;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Component
public class LanguageCharacterValidator implements ConstraintValidator<AlphabeticValidator, String> {
@Value("${mosip.kernel.masterdata.name.validate.regex:[^a-zA-Z]}")
private String allowedCharactersRegex ;

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
if(allowedCharactersRegex==null) {
/* Note: An additional validation was getting triggered by doInvoke() method of
* RepositoryListItemWriter class with allowedCharactersRegex 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()) {
Pattern p = Pattern.compile(allowedCharactersRegex, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(value.trim());
return !(m.find());
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,6 @@ mosip.admin.masterdata.service.version=v1
mosip.admin.keymanager.service.version=v1
mosip.admin.base.url=https://dev.mosip.net
mosip.service.end-points=/**/masterdata/**,/**/keymanager/**
auth.allowed.urls=http://localhost:5000/
auth.allowed.urls=http://localhost:5000/
mosip.iam.certs_endpoint=http://localhost:5000/auth/realms/mosip/protocol/openid-connect/certs
mosip.kernel.masterdata.name.validate.regex=[^A-Za-z]
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void t002lostRidTest() throws Exception {
AdminDataUtil.checkResponse(
(mockMvc.perform(MockMvcRequestBuilders.post("/lostRid").contentType(MediaType.APPLICATION_JSON)
.content(mapper.writeValueAsString(searchInfoReq))).andReturn()),
"ADMN-LRID-001");
null);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,29 @@ public void t001getTranscationDetailTest() throws Exception {

}

@Test
@WithUserDetails("global-admin")
public void BlocklistedWordsConstraintvalidationNegativeTest() throws Exception {
String content="word,description,langCode,isActive,isDeleted\r\n" +
"Some Random Words,Test,eng,TRUE,FALSE\r\n";
MockMultipartFile blocklisted_words = new MockMultipartFile("data", "filename.csv", "multipart/form-data", content.getBytes());
AdminDataUtil.checkResponse(
mockMvc.perform(MockMvcRequestBuilders.multipart("/bulkupload").file(blocklisted_words).param("tableName","blocklisted_words").param("operation","insert").param("category","masterdata")).andReturn(),
"ADM-BLK-007");

}


@Test
@WithUserDetails("global-admin")
public void BlocklistedWordsConstraintvalidationPositiveTest() throws Exception {
String content="word,description,langCode,isActive\r\n" +
"SomeWord,DDD,eng,TRUE";
MockMultipartFile gender = new MockMultipartFile("files", "gender.csv", "multipart/form-data", content.getBytes());
AdminDataUtil.checkResponse(
mockMvc.perform(MockMvcRequestBuilders.multipart("/bulkupload").file(gender).param("tableName","blocklisted_words").param("operation","insert").param("category","masterdata")).andReturn(),null);
}

@Test
@WithUserDetails("global-admin")
public void t001getTranscationDetailTestFail() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,27 @@ public static void checkResponse(MvcResult rst, String expectedCode) {
try {
ObjectMapper mapper = new ObjectMapper();
if (rst.getResponse().getContentAsString().isEmpty() && rst.getResponse().getStatus() == 404) {
assertEquals(404, rst.getResponse().getStatus());
assertEquals(404,rst.getResponse().getStatus());

} else {
Map m = mapper.readValue(rst.getResponse().getContentAsString(), Map.class);
assertEquals(200, rst.getResponse().getStatus());
if (m.containsKey("errors") && null != m.get("errors")) {
// assertEquals(((List<Map<String, String>>) m.get("errors")).get(0).get("errorCode"), actualCode);
assertEquals(expectedCode, ((List<Map<String, String>>) m.get("errors")).get(0).get("errorCode"));
}
assertEquals(200,rst.getResponse().getStatus());
assertEquals(expectedCode, getErrorCode(m));
}
} catch (Exception e) {
e.printStackTrace();
}

}

private static String getErrorCode(Map map){
if(map.containsKey("errors") && null != map.get("errors")){
List<Map<String ,String>> data=(List<Map<String, String>>) map.get("errors");
return data.isEmpty()?null:data.get(0).get("errorCode");
}
return null;
}

public static void checkErrorResponse(MvcResult rst, String s) {
assertEquals(rst.getResponse().getStatus(), 500);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,4 @@ mosip.admin.base.url=https://dev.mosip.net
mosip.service.end-points=/**/masterdata/**,/**/keymanager/**
auth.allowed.urls=http://localhost:5000/

mosip.kernel.masterdata.name.validate.regex=[^A-Za-z]
Loading