Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nandhu-kumar committed Nov 26, 2024
2 parents 99287a2 + 26ae4f1 commit 01efa80
Show file tree
Hide file tree
Showing 13 changed files with 720 additions and 40 deletions.
2 changes: 1 addition & 1 deletion api-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mosipdev/openjdk-21-jre:latest
FROM mosipid/openjdk-21-jre:21.0.4

ARG SOURCE
ARG COMMIT_HASH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static void main(String[] arg) {
KeycloakUserManager.removeUser();
KeycloakUserManager.createUsers();
KeycloakUserManager.closeKeycloakInstance();
AdminTestUtil.getRequiredField();

List<String> localLanguageList = new ArrayList<>(BaseTestCase.getLanguageList());
AdminTestUtil.getLocationData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import io.mosip.testrig.apirig.dto.OutputValidationDto;
import io.mosip.testrig.apirig.dto.TestCaseDTO;
import io.mosip.testrig.apirig.idrepo.utils.IdRepoArrayHandle;
import io.mosip.testrig.apirig.idrepo.utils.IdRepoConfigManager;
import io.mosip.testrig.apirig.idrepo.utils.IdRepoUtil;
import io.mosip.testrig.apirig.testrunner.BaseTestCase;
Expand Down Expand Up @@ -144,7 +145,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad

JSONObject jsonString = new JSONObject(inputJson);
if (jsonString.getJSONObject("request").getJSONObject("identity").has("selectedHandles")) {
inputJson = replaceArrayHandleValues(inputJson,testCaseName);
inputJson = IdRepoArrayHandle.replaceArrayHandleValues(inputJson,testCaseName);
}
if (testCaseName.contains("_withInvalidEmail") || testCaseName.contains("_invalid_Email")) {
inputJson = replaceKeywordWithValue(inputJson, "$EMAILVALUE$", "@#$DDFFGG");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import io.mosip.testrig.apirig.dto.OutputValidationDto;
import io.mosip.testrig.apirig.dto.TestCaseDTO;
import io.mosip.testrig.apirig.idrepo.utils.IdRepoArrayHandle;
import io.mosip.testrig.apirig.idrepo.utils.IdRepoConfigManager;
import io.mosip.testrig.apirig.testrunner.BaseTestCase;
import io.mosip.testrig.apirig.testrunner.HealthChecker;
Expand Down Expand Up @@ -157,7 +158,7 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad

JSONObject jsonString = new JSONObject(inputJson);
if (jsonString.getJSONObject("request").getJSONObject("identity").has("selectedHandles")) {
inputJson = replaceArrayHandleValuesForUpdateIdentity(inputJson,testCaseName);
inputJson = IdRepoArrayHandle.replaceArrayHandleValuesForUpdateIdentity(inputJson,testCaseName);
}

Response response = patchWithBodyAndCookie(ApplnURI + testCaseDTO.getEndPoint(), inputJson, COOKIENAME,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ GetUpdateCount:
"idType": "UIN",
"attribute_list": "fullName"
}'
output: "404"
output: '{
"errors": [
{
"errorCode": "IDR-IDC-003"
}
]
}'

IdRepository_GetUpdateCount_Uin_SpaceVal_IndivId:
endPoint: /idrepository/v1/identity/{individualId}/update-counts?idType={idType}&attribute_list={attribute_list}
Expand Down Expand Up @@ -136,7 +142,7 @@ GetUpdateCount:
output: '{
"errors": [
{
"errorCode": "IDR-IDC-003"
"errorCode": "IDR-IDC-002"
}
]
}'
Expand All @@ -156,7 +162,7 @@ GetUpdateCount:
output: '{
"errors": [
{
"errorCode": "IDR-IDC-003"
"errorCode": "IDR-IDC-002"
}
]
}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ RetrieveIdentityByRid:
input: '{
"RID":""
}'
output: "404"
output: '{
"errors": [
{
"errorCode": "IDR-IDC-003"
}
]
}'

IdRepository_RetrieveIdentityByRid_SpaceVal_Rid_Neg:
endPoint: /idrepository/v1/identity/idvid/{RID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RetrieveVIDByUIN:
inputTemplate: idRepository/RetrieveVIDByUIN/retrieveVIDByUIN
outputTemplate: idRepository/RetrieveVIDByUIN/retrieveVIDByUINResult
input: '{
"UIN":"$ID:AddIdentity_withValidParameters_smoke_Pos_UIN$"
"UIN":"$ID:AddIdentity_ValidParam_smoke_Pos_UIN$"
}'
output: '{
"vidType": "$IGNORE$"
Expand All @@ -27,7 +27,7 @@ RetrieveVIDByUIN:
output: '{
"errors": [
{
"errorCode": "IDR-VID-003"
"errorCode": "IDR-IDC-007"
}
]
}'
Expand Down Expand Up @@ -93,7 +93,7 @@ RetrieveVIDByUIN:
output: '{
"errors": [
{
"errorCode": "IDR-IDC-002"
"errorCode": "IDR-IDC-003"
}
]
}'
Expand Down
5 changes: 3 additions & 2 deletions api-test/src/main/resources/testCaseSkippedList.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
##### JIRA number;testcase
#MOSIP-12456------Mimoto_AddIdentity_Binding_smoke_Pos
######JIRA number;testcase
#MOSIP-37220------IdRepository_AddIdentity_array_handle_post_update_value_smoke_Pos

Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
-- ------------------------------------------------------------------------------------------
-- Revoke script for Migrating Spring batch version to 5.0 as part of Java 21 Migration.
-- References:
-- 1. https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-5.0-Migration-Guide#ms-sqlserver
-- 2. https://github.com/spring-projects/spring-batch/blob/main/spring-batch-core/src/main/resources/org/springframework/batch/core/migration/5.0/migration-postgresql.sql
-- Rollback script for Migrating Spring batch version back from 5.0 as part of Java 21 Migration.
-- ------------------------------------------------------------------------------------------
ALTER TABLE BATCH_STEP_EXECUTION DROP CREATE_TIME TIMESTAMP NOT NULL DEFAULT '1970-01-01 00:00:00';
ALTER TABLE BATCH_STEP_EXECUTION ALTER COLUMN START_TIME ADD NULL;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN DATE_VAL;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN LONG_VAL;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN DOUBLE_VAL;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN TYPE_CD TYPE VARCHAR(6);
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_TYPE TO TYPE_CD;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN KEY_NAME TYPE VARCHAR(100);
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_NAME TO KEY_NAME;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN STRING_VAL TYPE VARCHAR(250);
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_VALUE TO STRING_VAL;
ALTER TABLE BATCH_JOB_EXECUTION ADD COLUMN JOB_CONFIGURATION_LOCATION;

DROP SEQUENCE BATCH_STEP_EXECUTION_SEQ;
DROP SEQUENCE BATCH_JOB_EXECUTION_SEQ;
DROP SEQUENCE BATCH_JOB_SEQ;

TRUNCATE TABLE batch_job_execution CASCADE;
TRUNCATE TABLE batch_job_execution_context CASCADE;
TRUNCATE TABLE batch_job_execution_params CASCADE;
TRUNCATE TABLE batch_job_instance CASCADE;
TRUNCATE TABLE batch_step_execution CASCADE;
TRUNCATE TABLE batch_step_execution_context CASCADE;

GRANT usage, SELECT ON ALL SEQUENCES
IN SCHEMA credential
TO credentialuser;

-- Revert ALTER on BATCH_STEP_EXECUTION
ALTER TABLE BATCH_STEP_EXECUTION DROP COLUMN CREATE_TIME; -- Remove the column added
ALTER TABLE BATCH_STEP_EXECUTION ALTER COLUMN START_TIME SET NOT NULL; -- Revert to NOT NULL

-- Revert changes on BATCH_JOB_EXECUTION_PARAMS
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN DATE_VAL TIMESTAMP; -- Add back the DATE_VAL column
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN LONG_VAL BIGINT; -- Add back the LONG_VAL column
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ADD COLUMN DOUBLE_VAL DOUBLE PRECISION; -- Add back the DOUBLE_VAL column

ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_TYPE TO TYPE_CD; -- Revert the column name
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN TYPE_CD TYPE VARCHAR(100);

ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN PARAMETER_NAME TYPE VARCHAR(100); -- Revert back the type change
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_NAME TO KEY_NAME; -- Revert the column name

ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN PARAMETER_VALUE TYPE VARCHAR(250); -- Revert the type change
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME PARAMETER_VALUE TO STRING_VAL; -- Revert the column name

-- Revert DROP on BATCH_JOB_EXECUTION
ALTER TABLE BATCH_JOB_EXECUTION ADD COLUMN JOB_CONFIGURATION_LOCATION VARCHAR(2500); -- Add back the column
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME KEY_NAME TO PARAMETER_NAME;
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS ALTER COLUMN STRING_VAL TYPE VARCHAR(2500);
ALTER TABLE BATCH_JOB_EXECUTION_PARAMS RENAME STRING_VAL TO PARAMETER_VALUE;
ALTER TABLE BATCH_JOB_EXECUTION DROP COLUMN JOB_CONFIGURATION_LOCATION;

CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE BATCH_JOB_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CYCLE;
2 changes: 1 addition & 1 deletion id-repository/id-repository-identity-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mosipdev/openjdk-21-jre:latest
FROM mosipid/openjdk-21-jre:21.0.4

ARG SOURCE
ARG COMMIT_HASH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
import com.jayway.jsonpath.InvalidJsonException;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.Option;

/**
* @author Manoj SP
*
Expand All @@ -113,7 +112,6 @@ public class IdRepoDraftServiceImpl extends IdRepoServiceImpl implements IdRepoD

private static final Logger idrepoDraftLogger = IdRepoLogger.getLogger(IdRepoDraftServiceImpl.class);
private static final String COMMA = ",";

private static final String DEFAULT_ATTRIBUTE_LIST = "UIN,verifiedAttributes,IDSchemaVersion";

@Value("${" + MOSIP_KERNEL_IDREPO_JSON_PATH + "}")
Expand Down Expand Up @@ -272,6 +270,8 @@ private void updateDemographicData(IdRequestDTO request, UinDraft draftToUpdate)
Configuration configuration = Configuration.builder().options(Option.DEFAULT_PATH_LEAF_TO_NULL).build();
DocumentContext inputData = JsonPath.using(configuration).parse(requestDTO.getIdentity());
DocumentContext dbData = JsonPath.using(configuration).parse(new String(draftToUpdate.getUinData()));
LinkedHashMap<String, Integer> map = dbData.json();
int dataLength = map.size();
JsonPath uinJsonPath = JsonPath.compile(uinPath.replace(ROOT_PATH, "$"));
inputData.set(uinJsonPath, dbData.read(uinJsonPath));
super.updateVerifiedAttributes(requestDTO, inputData, dbData);
Expand All @@ -281,7 +281,11 @@ private void updateDemographicData(IdRequestDTO request, UinDraft draftToUpdate)
if (comparisonResult.failed()) {
super.updateJsonObject(draftToUpdate.getUinHash(), inputData, dbData, comparisonResult, false);
}
draftToUpdate.setUinData(convertToBytes(convertToObject(dbData.jsonString().getBytes(), Map.class)));
if(dataLength == 1) {
draftToUpdate.setUinData(convertToBytes(dbData.json()));
}else {
draftToUpdate.setUinData(convertToBytes(convertToObject(dbData.jsonString().getBytes(), Map.class)));
}
draftToUpdate.setUinDataHash(securityManager.hash(draftToUpdate.getUinData()));
draftToUpdate.setUpdatedBy(IdRepoSecurityManager.getUser());
draftToUpdate.setUpdatedDateTime(DateUtils.getUTCCurrentDateTime());
Expand Down

0 comments on commit 01efa80

Please sign in to comment.