diff --git a/.gitignore b/.gitignore index 50f7684..4dd6fcb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ ###################### # Project Specific ###################### -/src/main/webapp/content/css/main.css /target/classes/static/** /src/test/javascript/coverage/ diff --git a/.husky/pre-commit b/.husky/pre-commit index adefefb..3efbda8 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,4 @@ . "$(dirname "$0")/_/husky.sh" -"$(dirname "$0")/../npmw" exec --no-install lint-staged +npx --no-install lint-staged diff --git a/.jhipster/Ethnicity.json b/.jhipster/Ethnicity.json new file mode 100644 index 0000000..eb84cdb --- /dev/null +++ b/.jhipster/Ethnicity.json @@ -0,0 +1,28 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084716", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "ethnicity", + "fields": [ + { + "fieldName": "name", + "fieldType": "String", + "fieldValidateRules": ["required"] + }, + { + "fieldName": "urduName", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "Ethnicity", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimAccounts.json b/.jhipster/FimAccounts.json new file mode 100644 index 0000000..f7c2d5e --- /dev/null +++ b/.jhipster/FimAccounts.json @@ -0,0 +1,127 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084707", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_accounts", + "fields": [ + { + "fieldName": "accountId", + "fieldType": "String" + }, + { + "fieldName": "custId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "5" + }, + { + "fieldName": "operInst", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "isAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "bndAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "closingId", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "subSegment", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "branchCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "acctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "acctOwners", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "100" + }, + { + "fieldName": "remarks", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "200" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimAccounts", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimAccountsHistory.json b/.jhipster/FimAccountsHistory.json new file mode 100644 index 0000000..f1d4d75 --- /dev/null +++ b/.jhipster/FimAccountsHistory.json @@ -0,0 +1,131 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084709", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_accounts_history", + "fields": [ + { + "fieldName": "accountId", + "fieldType": "String" + }, + { + "fieldName": "historyTs", + "fieldType": "Instant" + }, + { + "fieldName": "custId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "5" + }, + { + "fieldName": "operInst", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "isAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "bndAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "closingId", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "subSegment", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "branchCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "acctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "acctOwners", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "100" + }, + { + "fieldName": "remarks", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "200" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimAccountsHistory", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimAccountsWq.json b/.jhipster/FimAccountsWq.json new file mode 100644 index 0000000..e8e0a56 --- /dev/null +++ b/.jhipster/FimAccountsWq.json @@ -0,0 +1,131 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084708", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_accounts_wq", + "fields": [ + { + "fieldName": "accountId", + "fieldType": "String" + }, + { + "fieldName": "custId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "relnType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "5" + }, + { + "fieldName": "operInst", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "isAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "bndAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "closingId", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "subSegment", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "branchCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "acctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "acctOwners", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "100" + }, + { + "fieldName": "remarks", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "200" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "uploadRemark", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimAccountsWq", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimCust.json b/.jhipster/FimCust.json new file mode 100644 index 0000000..8495f17 --- /dev/null +++ b/.jhipster/FimCust.json @@ -0,0 +1,69 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084713", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_cust", + "fields": [ + { + "fieldName": "custId", + "fieldType": "String" + }, + { + "fieldName": "clientId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "idType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String" + }, + { + "fieldName": "uploadRemark", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimCust", + "pagination": "pagination", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimCustHistory.json b/.jhipster/FimCustHistory.json new file mode 100644 index 0000000..1dddd1e --- /dev/null +++ b/.jhipster/FimCustHistory.json @@ -0,0 +1,69 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084715", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_cust_history", + "fields": [ + { + "fieldName": "custId", + "fieldType": "String" + }, + { + "fieldName": "historyTs", + "fieldType": "Instant" + }, + { + "fieldName": "clientId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "idType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimCustHistory", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimCustWq.json b/.jhipster/FimCustWq.json new file mode 100644 index 0000000..3d4e88b --- /dev/null +++ b/.jhipster/FimCustWq.json @@ -0,0 +1,69 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084714", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_cust_wq", + "fields": [ + { + "fieldName": "custId", + "fieldType": "String" + }, + { + "fieldName": "clientId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "idType", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "ctryCode", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String" + }, + { + "fieldName": "uploadRemark", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimCustWq", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimSettAcct.json b/.jhipster/FimSettAcct.json new file mode 100644 index 0000000..5c97ddb --- /dev/null +++ b/.jhipster/FimSettAcct.json @@ -0,0 +1,73 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084710", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_sett_acct", + "fields": [ + { + "fieldName": "settaccId", + "fieldType": "String" + }, + { + "fieldName": "accountId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "15" + }, + { + "fieldName": "settAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "settCcy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "settAcctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimSettAcct", + "pagination": "pagination", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimSettAcctHistory.json b/.jhipster/FimSettAcctHistory.json new file mode 100644 index 0000000..d9e5bf7 --- /dev/null +++ b/.jhipster/FimSettAcctHistory.json @@ -0,0 +1,77 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084712", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_sett_acct_history", + "fields": [ + { + "fieldName": "settaccId", + "fieldType": "String" + }, + { + "fieldName": "historyTs", + "fieldType": "Instant" + }, + { + "fieldName": "accountId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "15" + }, + { + "fieldName": "settAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "settCcy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "settAcctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimSettAcctHistory", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.jhipster/FimSettAcctWq.json b/.jhipster/FimSettAcctWq.json new file mode 100644 index 0000000..bd88454 --- /dev/null +++ b/.jhipster/FimSettAcctWq.json @@ -0,0 +1,77 @@ +{ + "applications": ["FIM"], + "changelogDate": "20220404084711", + "clientRootFolder": "FIM", + "databaseType": "sql", + "dto": "mapstruct", + "embedded": false, + "entityTableName": "fim_sett_acct_wq", + "fields": [ + { + "fieldName": "settaccId", + "fieldType": "String" + }, + { + "fieldName": "accountId", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "15" + }, + { + "fieldName": "settAcctNbr", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "30" + }, + { + "fieldName": "settCcy", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "3" + }, + { + "fieldName": "settAcctStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength", "required"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "createdBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "createdTs", + "fieldType": "Instant" + }, + { + "fieldName": "updatedBy", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "8" + }, + { + "fieldName": "updatedTs", + "fieldType": "Instant" + }, + { + "fieldName": "recordStatus", + "fieldType": "String", + "fieldValidateRules": ["maxlength"], + "fieldValidateRulesMaxlength": "10" + }, + { + "fieldName": "uploadRemark", + "fieldType": "String" + } + ], + "fluentMethods": true, + "jpaMetamodelFiltering": false, + "microserviceName": "FIM", + "name": "FimSettAcctWq", + "pagination": "no", + "readOnly": false, + "relationships": [], + "service": "serviceClass" +} diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 6876878..dad2893 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,3 +1,3 @@ module.exports = { - '{,src/**/,webpack/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}': ['prettier --write'], + '{,src/**/}*.{md,json,yml,html,java}': ['prettier --write'], }; diff --git a/.yo-rc.json b/.yo-rc.json index f103428..be39885 100644 --- a/.yo-rc.json +++ b/.yo-rc.json @@ -1,11 +1,12 @@ { "generator-jhipster": { + "applicationIndex": 0, "applicationType": "microservice", "authenticationType": "jwt", - "baseName": "Springboot", + "baseName": "FIM", "blueprints": [], "buildTool": "maven", - "cacheProvider": "no", + "cacheProvider": "ehcache", "clientFramework": "angularX", "clientPackageManager": "npm", "clientTheme": "none", @@ -16,28 +17,42 @@ "devServerPort": 4200, "dtoSuffix": "DTO", "enableGradleEnterprise": false, - "enableHibernateCache": false, + "enableHibernateCache": true, "enableSwaggerCodegen": false, - "enableTranslation": false, + "enableTranslation": true, + "entities": [ + "FimAccounts", + "FimAccountsWq", + "FimAccountsHistory", + "FimSettAcct", + "FimSettAcctWq", + "FimSettAcctHistory", + "FimCust", + "FimCustWq", + "FimCustHistory", + "Ethnicity" + ], "entitySuffix": "", "gitCompany": "", + "gradleEnterpriseHost": "", "jhiPrefix": "jhi", "jhipsterVersion": "7.7.0", "jwtSecretKey": "NDM3ZDQxYjZkNDU5YTY4MTAwNGJjOGJkMmIzNDAwZTQwMzliODhkYWM5ZjQ1OTdjYmI3MTI1NzM4YzFmMWVmZjQyZDY2YjJkODQ4YmI2OTI2OTAwMTM2YTczODkxNzUyMDExNWQzMDEwN2MyOTQxMDUwMGMzZjcwYTQ2MDkwMzA=", "languages": ["en"], + "lastLiquibaseTimestamp": 1649062036000, "messageBroker": false, "nativeLanguage": "en", "otherModules": [], - "packageFolder": "com/sc/myapp", - "packageName": "com.sc.myapp", + "packageFolder": "com/scb/fimob", + "packageName": "com.scb.fimob", "pages": [], "prodDatabaseType": "mssql", "reactive": false, "searchEngine": false, - "serverPort": 8081, + "serverPort": "8081", "serviceDiscoveryType": "eureka", "skipCheckLengthOfIdentifier": false, - "skipClient": false, + "skipClient": true, "skipFakeData": false, "skipUserManagement": true, "testFrameworks": [], diff --git a/README.md b/README.md index fbd0610..13f1b9a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Springboot +# FIM This application was generated using JHipster 7.7.0, you can find documentation and help at [https://www.jhipster.tech](https://www.jhipster.tech). @@ -18,131 +18,18 @@ In the project root, JHipster generates configuration files for tools like git, - `.yo-resolve` (optional) - Yeoman conflict resolver Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match `[pattern] [action]` with pattern been a [Minimatch](https://github.com/isaacs/minimatch#minimatch) pattern and action been one of skip (default if ommited) or force. Lines starting with `#` are considered comments and are ignored. - `.jhipster/*.json` - JHipster entity configuration files - -- `npmw` - wrapper to use locally installed npm. - JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using `./npmw` instead of the traditional `npm` you can configure a Node-less environment to develop or test your application. - `/src/main/docker` - Docker configurations for the application and services that the application depends on ## Development -Before you can build this project, you must install and configure the following dependencies on your machine: - -1. [Node.js][]: We use Node to run a development web server and build the project. - Depending on your system, you can install Node either from source or as a pre-packaged bundle. - -After installing Node, you should be able to run the following command to install development tools. -You will only need to run this command when dependencies change in [package.json](package.json). - -``` -npm install -``` - -We use npm scripts and [Angular CLI][] with [Webpack][] as our build system. - -Run the following commands in two separate terminals to create a blissful development experience where your browser -auto-refreshes when files change on your hard drive. +To start your application in the dev profile, run: ``` ./mvnw -npm start -``` - -Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by -specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies. -Add the `help` flag on any command to see how you can use it. For example, `npm help update`. - -The `npm run` command will list all of the scripts available to run for this project. - -### PWA Support - -JHipster ships with PWA (Progressive Web App) support, and it's turned off by default. One of the main components of a PWA is a service worker. - -The service worker initialization code is disabled by default. To enable it, uncomment the following code in `src/main/webapp/app/app.module.ts`: - -```typescript -ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }), -``` - -### Managing dependencies - -For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command: - -``` -npm install --save --save-exact leaflet -``` - -To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command: - -``` -npm install --save-dev --save-exact @types/leaflet -``` - -Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them: -Edit [src/main/webapp/app/app.module.ts](src/main/webapp/app/app.module.ts) file: - -``` -import 'leaflet/dist/leaflet.js'; -``` - -Edit [src/main/webapp/content/scss/vendor.scss](src/main/webapp/content/scss/vendor.scss) file: - -``` -@import '~leaflet/dist/leaflet.css'; ``` -Note: There are still a few other things remaining to do for Leaflet that we won't detail here. - For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][]. -### Developing Microfrontend - -Microservices doesn't contain every required backend feature to allow microfrontends to run alone. -You must start a pre-built gateway version or from source. - -Start gateway from source: - -``` -cd gateway -npm run docker:db:up # start database if necessary -npm run docker:others:up # start service discovery and authentication service if necessary -npm run app:start # alias for ./(mvnw|gradlew) -``` - -Microfrontend's `build-watch` script is configured to watch and compile microfrontend's sources and synchronizes with gateway's frontend. -Start it using: - -``` -cd microfrontend -npm run docker:db:up # start database if necessary -npm run build-watch -``` - -It's possible to run microfrontend's frontend standalone using: - -``` -cd microfrontend -npm run docker:db:up # start database if necessary -npm watch # alias for `npm start` and `npm run backend:start` in parallel -``` - -### Using Angular CLI - -You can also use [Angular CLI][] to generate some custom client code. - -For example, the following command: - -``` -ng generate component my-component -``` - -will generate few files: - -``` -create src/main/webapp/app/my-component/my-component.component.html -create src/main/webapp/app/my-component/my-component.component.ts -update src/main/webapp/app/app.module.ts -``` - ### JHipster Control Center JHipster Control Center can help you manage and control your application(s). You can start a local control center server (accessible on http://localhost:7419) with: @@ -155,21 +42,18 @@ docker-compose -f src/main/docker/jhipster-control-center.yml up ### Packaging as jar -To build the final jar and optimize the Springboot application for production, run: +To build the final jar and optimize the FIM application for production, run: ``` ./mvnw -Pprod clean verify ``` -This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files. To ensure everything worked, run: ``` java -jar target/*.jar ``` -Then navigate to [http://localhost:8081](http://localhost:8081) in your browser. - Refer to [Using JHipster in production][] for more details. ### Packaging as war @@ -188,14 +72,6 @@ To launch your application's tests, run: ./mvnw verify ``` -### Client tests - -Unit tests are run by [Jest][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with: - -``` -npm test -``` - For more information, refer to the [Running tests page][]. ### Code quality @@ -271,9 +147,3 @@ To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`) [setting up continuous integration]: https://www.jhipster.tech/setting-up-ci/ [node.js]: https://nodejs.org/ [npm]: https://www.npmjs.com/ -[webpack]: https://webpack.github.io/ -[browsersync]: https://www.browsersync.io/ -[jest]: https://facebook.github.io/jest/ -[leaflet]: https://leafletjs.com/ -[definitelytyped]: https://definitelytyped.org/ -[angular cli]: https://cli.angular.io/ diff --git a/package.json b/package.json index 744b36d..edfbad2 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "springboot", - "version": "0.0.1-SNAPSHOT", + "name": "fim", + "version": "0.0.0", "private": true, - "description": "Description for Springboot", + "description": "Description for FIM", "license": "UNLICENSED", "scripts": { "app:start": "./mvnw", @@ -11,22 +11,16 @@ "backend:doc:test": "./mvnw -ntp javadoc:javadoc --batch-mode", "backend:info": "./mvnw -ntp enforcer:display-info --batch-mode", "backend:nohttp:test": "./mvnw -ntp checkstyle:check --batch-mode", - "backend:start": "./mvnw -Dskip.installnodenpm -Dskip.npm", - "backend:unit:test": "./mvnw -ntp -Dskip.installnodenpm -Dskip.npm verify --batch-mode -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.sc.myapp=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF", - "build": "npm run webapp:prod --", - "build-watch": "concurrently 'npm run webapp:build:dev -- --watch' npm:backend:start", + "backend:start": "./mvnw", + "backend:unit:test": "./mvnw -ntp verify --batch-mode -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.scb.fimob=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF", "ci:backend:test": "npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test -- -P$npm_package_config_default_environment", "ci:e2e:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment -- -Pe2e -Denforcer.skip=true", "ci:e2e:prepare": "npm run ci:e2e:prepare:docker", "ci:e2e:prepare:docker": "npm run docker:db:up && npm run docker:others:up && docker ps -a", "preci:e2e:server:start": "npm run docker:db:await --if-present && npm run docker:others:await --if-present", - "ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=e2e,$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.sc.myapp=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR", + "ci:e2e:server:start": "java -jar target/e2e.$npm_package_config_packaging --spring.profiles.active=e2e,$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.org.zalando=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.com.scb.fimob=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR", "ci:e2e:teardown": "npm run ci:e2e:teardown:docker", "ci:e2e:teardown:docker": "npm run docker:db:down --if-present && npm run docker:others:down && docker ps -a", - "ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment", - "ci:frontend:test": "npm run ci:frontend:build && npm test", - "clean-www": "rimraf target/classes/static/app/{src,target/}", - "cleanup": "rimraf target/classes/static/", "docker:app:up": "docker-compose -f src/main/docker/app.yml up -d", "docker:db:down": "docker-compose -f src/main/docker/mssql.yml down -v --remove-orphans", "docker:db:up": "docker-compose -f src/main/docker/mssql.yml up -d", @@ -46,105 +40,27 @@ "java:war": "./mvnw -ntp verify -DskipTests --batch-mode -Pwar", "java:war:dev": "npm run java:war -- -Pdev,webapp", "java:war:prod": "npm run java:war -- -Pprod", - "jest": "jest --coverage --logHeapUsage --maxWorkers=2 --config jest.conf.js", - "lint": "eslint . --ext .js,.ts", - "lint:fix": "npm run lint -- --fix", "prepare": "husky install", - "prettier:check": "prettier --check \"{,src/**/,webpack/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}\"", - "prettier:format": "prettier --write \"{,src/**/,webpack/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}\"", - "serve": "npm run start --", - "start": "ng serve", - "start-tls": "npm run webapp:dev-ssl", - "pretest": "npm run lint", - "test": "ng test --coverage --log-heap-usage -w=2", - "test:watch": "npm run test -- --watch", - "watch": "concurrently npm:start npm:backend:start", - "webapp:build": "npm run clean-www && npm run webapp:build:dev", - "webapp:build:dev": "ng build --configuration development", - "webapp:build:prod": "ng build --configuration production", - "webapp:dev": "ng serve", - "webapp:dev-ssl": "ng serve --ssl", - "webapp:dev-verbose": "ng serve --verbose", - "webapp:prod": "npm run clean-www && npm run webapp:build:prod", - "webapp:test": "npm run test --" + "prettier:check": "prettier --check \"{,src/**/}*.{md,json,yml,html,java}\"", + "prettier:format": "prettier --write \"{,src/**/}*.{md,json,yml,html,java}\"" }, "config": { - "backend_port": 8081, + "backend_port": "8081", "default_environment": "prod", "packaging": "jar" }, - "dependencies": { - "@angular/common": "13.2.4", - "@angular/compiler": "13.2.4", - "@angular/core": "13.2.4", - "@angular/forms": "13.2.4", - "@angular/localize": "13.2.4", - "@angular/platform-browser": "13.2.4", - "@angular/platform-browser-dynamic": "13.2.4", - "@angular/router": "13.2.4", - "@fortawesome/angular-fontawesome": "0.10.1", - "@fortawesome/fontawesome-svg-core": "1.3.0", - "@fortawesome/free-solid-svg-icons": "6.0.0", - "@ng-bootstrap/ng-bootstrap": "12.0.0", - "@popperjs/core": "2.11.2", - "bootstrap": "5.1.3", - "dayjs": "1.10.7", - "ngx-infinite-scroll": "10.0.1", - "ngx-webstorage": "9.0.0", - "rxjs": "7.5.4", - "swagger-ui-dist": "4.5.2", - "tslib": "2.3.1", - "zone.js": "0.11.4" - }, "devDependencies": { - "@angular-builders/custom-webpack": "13.1.0", - "@angular-builders/jest": "13.0.3", - "@angular-devkit/build-angular": "13.2.5", - "@angular-eslint/eslint-plugin": "13.1.0", - "@angular/cli": "13.2.5", - "@angular/compiler-cli": "13.2.4", - "@angular/service-worker": "13.2.4", - "@types/jest": "27.4.1", - "@types/node": "16.11.26", - "@typescript-eslint/eslint-plugin": "5.12.1", - "@typescript-eslint/parser": "5.12.1", - "browser-sync": "2.27.7", - "browser-sync-webpack-plugin": "2.3.0", - "concurrently": "7.0.0", - "copy-webpack-plugin": "10.2.4", - "eslint": "8.9.0", - "eslint-config-prettier": "8.4.0", - "eslint-webpack-plugin": "3.1.1", "generator-jhipster": "7.7.0", "husky": "7.0.4", - "jest": "27.5.1", - "jest-date-mock": "1.0.8", - "jest-junit": "13.0.0", - "jest-preset-angular": "11.1.1", - "jest-sonar-reporter": "2.0.0", "lint-staged": "12.3.4", "prettier": "2.5.1", "prettier-plugin-java": "1.6.1", - "prettier-plugin-packagejson": "2.2.15", - "rimraf": "3.0.2", - "ts-jest": "27.1.3", - "typescript": "4.5.5", - "wait-on": "6.0.1", - "webpack-bundle-analyzer": "4.5.0", - "webpack-merge": "5.8.0", - "webpack-notifier": "1.15.0" + "prettier-plugin-packagejson": "2.2.15" }, "engines": { "node": ">=16.14.0" }, "cacheDirectories": [ "node_modules" - ], - "jestSonar": { - "reportPath": "target/test-results/jest", - "reportFile": "TESTS-results-sonar.xml" - }, - "overrides": { - "webpack": "5.69.1" - } + ] } diff --git a/pom.xml b/pom.xml index f5f5696..ee0c6f9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.sc.myapp - springboot + com.scb.fimob + fim 0.0.1-SNAPSHOT jar - Springboot - Description for Springboot + FIM + Description for FIM @@ -26,15 +26,12 @@ 3.3.9 11 - v16.14.0 - 8.4.1 - UTF-8 UTF-8 yyyyMMddHHmmss ${java.version} ${java.version} - com.sc.myapp.SpringbootApp + com.scb.fimob.FimApp -Djava.security.egd=file:/dev/./urandom -Xmx256m jdt_apt false @@ -77,9 +74,6 @@ 3.1.2 9.3 0.0.10 - 1.12.1 - 1.11 - 3.0.0 5.0.0 2.3.0 0.8.7 @@ -114,6 +108,10 @@ javax.annotation javax.annotation-api + + org.springframework.boot + spring-boot-starter-cache + com.fasterxml.jackson.module jackson-module-jaxb-annotations @@ -146,6 +144,18 @@ org.apache.commons commons-lang3 + + javax.cache + cache-api + + + org.ehcache + ehcache + + + org.hibernate + hibernate-jcache + org.hibernate hibernate-jpamodelgen @@ -477,23 +487,6 @@ WEB-INF/**,META-INF/** false - target/classes/static/ - - - src/main/webapp - - WEB-INF/** - - - - - - - com.github.eirslett - frontend-maven-plugin - ${frontend-maven-plugin.version} - - target @@ -604,7 +597,7 @@ - springboot:latest + fim:latest @@ -829,140 +822,6 @@ ,tls - - webapp - - true - - - - com.h2database - h2 - - - - - - net.nicoulaj.maven.plugins - checksum-maven-plugin - ${checksum-maven-plugin.version} - - - create-pre-compiled-webapp-checksum - - files - - generate-resources - - - create-compiled-webapp-checksum - - files - - compile - - checksums.csv.old - - - - - - - ${project.basedir} - - src/main/webapp/**/*.* - target/classes/static/**/*.* - package-lock.json - package.json - webpack/*.* - tsconfig.json - tsconfig.app.json - - - **/app/**/service-worker.js - **/app/**/vendor.css - - - - false - false - false - - SHA-1 - - true - true - - - - org.apache.maven.plugins - maven-antrun-plugin - ${maven-antrun-plugin.version} - - - eval-frontend-checksum - generate-resources - - run - - - - - - - - - - - - true - - - - - - com.github.eirslett - frontend-maven-plugin - - - install-node-and-npm - - install-node-and-npm - - - ${node.version} - ${npm.version} - - - - npm install - - npm - - - - webapp build dev - - npm - - generate-resources - - run webapp:build - - ${project.version} - - false - - - - - - - - - dev${profile.no-liquibase} - - dev @@ -996,11 +855,11 @@ ${project.basedir}/src/main/resources/config/liquibase/master.xml ${project.basedir}/src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml org.h2.Driver - jdbc:h2:file:${project.build.directory}/h2db/db/springboot + jdbc:h2:file:${project.build.directory}/h2db/db/fim - Springboot + FIM - hibernate:spring:com.sc.myapp.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + hibernate:spring:com.scb.fimob.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy true debug !test @@ -1082,53 +941,6 @@ - - com.github.eirslett - frontend-maven-plugin - - - install-node-and-npm - - install-node-and-npm - - - ${node.version} - ${npm.version} - - - - npm install - - npm - - - - webapp build test - - npm - - test - - run webapp:test - false - - - - webapp build prod - - npm - - generate-resources - - run webapp:prod - - ${project.version} - - false - - - - io.github.git-commit-id git-commit-id-maven-plugin @@ -1233,20 +1045,6 @@ - - - com.github.eirslett - frontend-maven-plugin - ${frontend-maven-plugin.version} - - install-node-and-npm - npm - - - - - - diff --git a/sonar-project.properties b/sonar-project.properties index 24f8ee0..dedcdd7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,16 +1,14 @@ -sonar.projectKey=Springboot -sonar.projectName=Springboot generated by jhipster +sonar.projectKey=FIM +sonar.projectName=FIM generated by jhipster sonar.projectVersion=1.0 sonar.sources=src/main/ sonar.host.url=http://localhost:9001 -sonar.test.inclusions=src/test/**/*.*, src/main/webapp/app/**/*.spec.ts +sonar.tests=src/test/ sonar.coverage.jacoco.xmlReportPaths=target/site/**/jacoco*.xml sonar.java.codeCoveragePlugin=jacoco sonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports -sonar.testExecutionReportPaths=target/test-results/jest/TESTS-results-sonar.xml -sonar.javascript.lcov.reportPaths=target/test-results/lcov.info sonar.sourceEncoding=UTF-8 sonar.exclusions=src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, target/classes/static/**/*.* diff --git a/src/main/docker/app.yml b/src/main/docker/app.yml index 5d1665a..3a80341 100644 --- a/src/main/docker/app.yml +++ b/src/main/docker/app.yml @@ -1,18 +1,18 @@ # This configuration is intended for development purpose, it's **your** responsibility to harden it for production version: '3.8' services: - springboot-app: - image: springboot + fim-app: + image: fim environment: - _JAVA_OPTIONS=-Xmx512m -Xms256m - SPRING_PROFILES_ACTIVE=prod,api-docs - MANAGEMENT_METRICS_EXPORT_PROMETHEUS_ENABLED=true - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka - SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config - - SPRING_DATASOURCE_URL=jdbc:sqlserver://springboot-mssql:1433;database=Springboot - - SPRING_LIQUIBASE_URL=jdbc:sqlserver://springboot-mssql:1433;database=Springboot + - SPRING_DATASOURCE_URL=jdbc:sqlserver://fim-mssql:1433;database=FIM + - SPRING_LIQUIBASE_URL=jdbc:sqlserver://fim-mssql:1433;database=FIM - JHIPSTER_SLEEP=60 # gives time for mssql server to start - springboot-mssql: + fim-mssql: image: mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04 # volumes are not supported on macOS # volumes: @@ -21,7 +21,7 @@ services: - ACCEPT_EULA=Y - MSSQL_PID=Express - SA_PASSWORD=yourStrong(!)Password - - MSSQL_DATABASE=Springboot + - MSSQL_DATABASE=FIM - MSSQL_SLEEP=60 # If you want to expose these ports outside your dev PC, # remove the "127.0.0.1:" prefix diff --git a/src/main/docker/jib/entrypoint.sh b/src/main/docker/jib/entrypoint.sh index 11d5ca0..06ee80d 100644 --- a/src/main/docker/jib/entrypoint.sh +++ b/src/main/docker/jib/entrypoint.sh @@ -1,4 +1,4 @@ #!/bin/sh echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} -exec java ${JAVA_OPTS} -noverify -XX:+AlwaysPreTouch -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "com.sc.myapp.SpringbootApp" "$@" +exec java ${JAVA_OPTS} -noverify -XX:+AlwaysPreTouch -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "com.scb.fimob.FimApp" "$@" diff --git a/src/main/docker/monitoring.yml b/src/main/docker/monitoring.yml index 8ddf310..f91e524 100644 --- a/src/main/docker/monitoring.yml +++ b/src/main/docker/monitoring.yml @@ -1,7 +1,7 @@ # This configuration is intended for development purpose, it's **your** responsibility to harden it for production version: '3.8' services: - springboot-prometheus: + fim-prometheus: image: prom/prometheus:v2.33.3 volumes: - ./prometheus/:/etc/prometheus/ @@ -14,7 +14,7 @@ services: # On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and # grafana/provisioning/datasources/datasource.yml network_mode: 'host' # to test locally running service - springboot-grafana: + fim-grafana: image: grafana/grafana:8.4.1 volumes: - ./grafana/provisioning/:/etc/grafana/provisioning/ diff --git a/src/main/docker/mssql.yml b/src/main/docker/mssql.yml index ea5d472..938ec5c 100644 --- a/src/main/docker/mssql.yml +++ b/src/main/docker/mssql.yml @@ -1,7 +1,7 @@ # This configuration is intended for development purpose, it's **your** responsibility to harden it for production version: '3.8' services: - springboot-mssql: + fim-mssql: image: mcr.microsoft.com/mssql/server:2019-CU15-ubuntu-20.04 # volumes are not supported on macOS # volumes: @@ -10,7 +10,7 @@ services: - ACCEPT_EULA=Y - MSSQL_PID=Express - SA_PASSWORD=yourStrong(!)Password - - MSSQL_DATABASE=Springboot + - MSSQL_DATABASE=FIM - MSSQL_SLEEP=60 # If you want to expose these ports outside your dev PC, # remove the "127.0.0.1:" prefix diff --git a/src/main/docker/sonar.yml b/src/main/docker/sonar.yml index 2c4af55..be77934 100644 --- a/src/main/docker/sonar.yml +++ b/src/main/docker/sonar.yml @@ -1,7 +1,7 @@ # This configuration is intended for development purpose, it's **your** responsibility to harden it for production version: '3.8' services: - springboot-sonar: + fim-sonar: image: sonarqube:9.3.0-community # Authentication is turned off for out of the box experience while trying out SonarQube # For real use cases delete sonar.forceAuthentication variable or set sonar.forceAuthentication=true diff --git a/src/main/java/com/scb/fimob/ApplicationWebXml.java b/src/main/java/com/scb/fimob/ApplicationWebXml.java new file mode 100644 index 0000000..1e26692 --- /dev/null +++ b/src/main/java/com/scb/fimob/ApplicationWebXml.java @@ -0,0 +1,19 @@ +package com.scb.fimob; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import tech.jhipster.config.DefaultProfileUtil; + +/** + * This is a helper Java class that provides an alternative to creating a {@code web.xml}. + * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. + */ +public class ApplicationWebXml extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + // set a default to use when no profile is configured. + DefaultProfileUtil.addDefaultProfile(application.application()); + return application.sources(FimApp.class); + } +} diff --git a/src/main/java/com/scb/fimob/FimApp.java b/src/main/java/com/scb/fimob/FimApp.java new file mode 100644 index 0000000..30c0def --- /dev/null +++ b/src/main/java/com/scb/fimob/FimApp.java @@ -0,0 +1,113 @@ +package com.scb.fimob; + +import com.scb.fimob.config.ApplicationProperties; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Optional; +import javax.annotation.PostConstruct; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.core.env.Environment; +import tech.jhipster.config.DefaultProfileUtil; +import tech.jhipster.config.JHipsterConstants; + +@SpringBootApplication +@EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class }) +public class FimApp { + + private static final Logger log = LoggerFactory.getLogger(FimApp.class); + + private final Environment env; + + public FimApp(Environment env) { + this.env = env; + } + + /** + * Initializes FIM. + *

+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile + *

+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/. + */ + @PostConstruct + public void initApplication() { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if ( + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION) + ) { + log.error( + "You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time." + ); + } + if ( + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD) + ) { + log.error( + "You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time." + ); + } + } + + /** + * Main method, used to run the application. + * + * @param args the command line arguments. + */ + public static void main(String[] args) { + SpringApplication app = new SpringApplication(FimApp.class); + DefaultProfileUtil.addDefaultProfile(app); + Environment env = app.run(args).getEnvironment(); + logApplicationStartup(env); + } + + private static void logApplicationStartup(Environment env) { + String protocol = Optional.ofNullable(env.getProperty("server.ssl.key-store")).map(key -> "https").orElse("http"); + String serverPort = env.getProperty("server.port"); + String contextPath = Optional + .ofNullable(env.getProperty("server.servlet.context-path")) + .filter(StringUtils::isNotBlank) + .orElse("/"); + String hostAddress = "localhost"; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.warn("The host name could not be determined, using `localhost` as fallback"); + } + log.info( + "\n----------------------------------------------------------\n\t" + + "Application '{}' is running! Access URLs:\n\t" + + "Local: \t\t{}://localhost:{}{}\n\t" + + "External: \t{}://{}:{}{}\n\t" + + "Profile(s): \t{}\n----------------------------------------------------------", + env.getProperty("spring.application.name"), + protocol, + serverPort, + contextPath, + protocol, + hostAddress, + serverPort, + contextPath, + env.getActiveProfiles().length == 0 ? env.getDefaultProfiles() : env.getActiveProfiles() + ); + + String configServerStatus = env.getProperty("configserver.status"); + if (configServerStatus == null) { + configServerStatus = "Not found or not setup for this application"; + } + log.info( + "\n----------------------------------------------------------\n\t" + + "Config Server: \t{}\n----------------------------------------------------------", + configServerStatus + ); + } +} diff --git a/src/main/java/com/scb/fimob/GeneratedByJHipster.java b/src/main/java/com/scb/fimob/GeneratedByJHipster.java new file mode 100644 index 0000000..e4df433 --- /dev/null +++ b/src/main/java/com/scb/fimob/GeneratedByJHipster.java @@ -0,0 +1,13 @@ +package com.scb.fimob; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.annotation.Generated; + +@Generated(value = "JHipster", comments = "Generated by JHipster 7.7.0") +@Retention(RetentionPolicy.SOURCE) +@Target({ ElementType.TYPE }) +public @interface GeneratedByJHipster { +} diff --git a/src/main/java/com/scb/fimob/aop/logging/LoggingAspect.java b/src/main/java/com/scb/fimob/aop/logging/LoggingAspect.java new file mode 100644 index 0000000..063be53 --- /dev/null +++ b/src/main/java/com/scb/fimob/aop/logging/LoggingAspect.java @@ -0,0 +1,111 @@ +package com.scb.fimob.aop.logging; + +import java.util.Arrays; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import tech.jhipster.config.JHipsterConstants; + +/** + * Aspect for logging execution of service and repository Spring components. + * + * By default, it only runs with the "dev" profile. + */ +@Aspect +public class LoggingAspect { + + private final Environment env; + + public LoggingAspect(Environment env) { + this.env = env; + } + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut( + "within(@org.springframework.stereotype.Repository *)" + + " || within(@org.springframework.stereotype.Service *)" + + " || within(@org.springframework.web.bind.annotation.RestController *)" + ) + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Pointcut that matches all Spring beans in the application's main packages. + */ + @Pointcut("within(com.scb.fimob.repository..*)" + " || within(com.scb.fimob.service..*)" + " || within(com.scb.fimob.web.rest..*)") + public void applicationPackagePointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Retrieves the {@link Logger} associated to the given {@link JoinPoint}. + * + * @param joinPoint join point we want the logger for. + * @return {@link Logger} associated to the given {@link JoinPoint}. + */ + private Logger logger(JoinPoint joinPoint) { + return LoggerFactory.getLogger(joinPoint.getSignature().getDeclaringTypeName()); + } + + /** + * Advice that logs methods throwing exceptions. + * + * @param joinPoint join point for advice. + * @param e exception. + */ + @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { + logger(joinPoint) + .error( + "Exception in {}() with cause = '{}' and exception = '{}'", + joinPoint.getSignature().getName(), + e.getCause() != null ? e.getCause() : "NULL", + e.getMessage(), + e + ); + } else { + logger(joinPoint) + .error( + "Exception in {}() with cause = {}", + joinPoint.getSignature().getName(), + e.getCause() != null ? e.getCause() : "NULL" + ); + } + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice. + * @return result. + * @throws Throwable throws {@link IllegalArgumentException}. + */ + @Around("applicationPackagePointcut() && springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Logger log = logger(joinPoint); + if (log.isDebugEnabled()) { + log.debug("Enter: {}() with argument[s] = {}", joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + Object result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}() with result = {}", joinPoint.getSignature().getName(), result); + } + return result; + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}()", Arrays.toString(joinPoint.getArgs()), joinPoint.getSignature().getName()); + throw e; + } + } +} diff --git a/src/main/java/com/scb/fimob/client/UserFeignClientInterceptor.java b/src/main/java/com/scb/fimob/client/UserFeignClientInterceptor.java new file mode 100644 index 0000000..c525cf1 --- /dev/null +++ b/src/main/java/com/scb/fimob/client/UserFeignClientInterceptor.java @@ -0,0 +1,18 @@ +package com.scb.fimob.client; + +import com.scb.fimob.security.SecurityUtils; +import feign.RequestInterceptor; +import feign.RequestTemplate; +import org.springframework.stereotype.Component; + +@Component +public class UserFeignClientInterceptor implements RequestInterceptor { + + private static final String AUTHORIZATION_HEADER = "Authorization"; + private static final String BEARER = "Bearer"; + + @Override + public void apply(RequestTemplate template) { + SecurityUtils.getCurrentUserJWT().ifPresent(s -> template.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER, s))); + } +} diff --git a/src/main/java/com/scb/fimob/config/ApplicationProperties.java b/src/main/java/com/scb/fimob/config/ApplicationProperties.java new file mode 100644 index 0000000..2701175 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/ApplicationProperties.java @@ -0,0 +1,12 @@ +package com.scb.fimob.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties specific to FIM. + *

+ * Properties are configured in the {@code application.yml} file. + * See {@link tech.jhipster.config.JHipsterProperties} for a good example. + */ +@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) +public class ApplicationProperties {} diff --git a/src/main/java/com/scb/fimob/config/AsyncConfiguration.java b/src/main/java/com/scb/fimob/config/AsyncConfiguration.java new file mode 100644 index 0000000..4271f44 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/AsyncConfiguration.java @@ -0,0 +1,46 @@ +package com.scb.fimob.config; + +import java.util.concurrent.Executor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; +import org.springframework.boot.autoconfigure.task.TaskExecutionProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor; + +@Configuration +@EnableAsync +@EnableScheduling +public class AsyncConfiguration implements AsyncConfigurer { + + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); + + private final TaskExecutionProperties taskExecutionProperties; + + public AsyncConfiguration(TaskExecutionProperties taskExecutionProperties) { + this.taskExecutionProperties = taskExecutionProperties; + } + + @Override + @Bean(name = "taskExecutor") + public Executor getAsyncExecutor() { + log.debug("Creating Async Task Executor"); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(taskExecutionProperties.getPool().getCoreSize()); + executor.setMaxPoolSize(taskExecutionProperties.getPool().getMaxSize()); + executor.setQueueCapacity(taskExecutionProperties.getPool().getQueueCapacity()); + executor.setThreadNamePrefix(taskExecutionProperties.getThreadNamePrefix()); + return new ExceptionHandlingAsyncTaskExecutor(executor); + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SimpleAsyncUncaughtExceptionHandler(); + } +} diff --git a/src/main/java/com/scb/fimob/config/CacheConfiguration.java b/src/main/java/com/scb/fimob/config/CacheConfiguration.java new file mode 100644 index 0000000..e9cbec7 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/CacheConfiguration.java @@ -0,0 +1,86 @@ +package com.scb.fimob.config; + +import java.time.Duration; +import org.ehcache.config.builders.*; +import org.ehcache.jsr107.Eh107Configuration; +import org.hibernate.cache.jcache.ConfigSettings; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; +import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer; +import org.springframework.boot.info.BuildProperties; +import org.springframework.boot.info.GitProperties; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.cloud.client.ServiceInstance; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.cloud.client.serviceregistry.Registration; +import org.springframework.context.annotation.*; +import tech.jhipster.config.JHipsterProperties; +import tech.jhipster.config.cache.PrefixedKeyGenerator; + +@Configuration +@EnableCaching +public class CacheConfiguration { + + private GitProperties gitProperties; + private BuildProperties buildProperties; + private final javax.cache.configuration.Configuration jcacheConfiguration; + + public CacheConfiguration(JHipsterProperties jHipsterProperties) { + JHipsterProperties.Cache.Ehcache ehcache = jHipsterProperties.getCache().getEhcache(); + + jcacheConfiguration = + Eh107Configuration.fromEhcacheCacheConfiguration( + CacheConfigurationBuilder + .newCacheConfigurationBuilder(Object.class, Object.class, ResourcePoolsBuilder.heap(ehcache.getMaxEntries())) + .withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofSeconds(ehcache.getTimeToLiveSeconds()))) + .build() + ); + } + + @Bean + public HibernatePropertiesCustomizer hibernatePropertiesCustomizer(javax.cache.CacheManager cacheManager) { + return hibernateProperties -> hibernateProperties.put(ConfigSettings.CACHE_MANAGER, cacheManager); + } + + @Bean + public JCacheManagerCustomizer cacheManagerCustomizer() { + return cm -> { + createCache(cm, com.scb.fimob.domain.FimAccounts.class.getName()); + createCache(cm, com.scb.fimob.domain.FimAccountsWq.class.getName()); + createCache(cm, com.scb.fimob.domain.FimAccountsHistory.class.getName()); + createCache(cm, com.scb.fimob.domain.FimSettAcct.class.getName()); + createCache(cm, com.scb.fimob.domain.FimSettAcctWq.class.getName()); + createCache(cm, com.scb.fimob.domain.FimSettAcctHistory.class.getName()); + createCache(cm, com.scb.fimob.domain.FimCust.class.getName()); + createCache(cm, com.scb.fimob.domain.FimCustWq.class.getName()); + createCache(cm, com.scb.fimob.domain.FimCustHistory.class.getName()); + createCache(cm, com.scb.fimob.domain.Ethnicity.class.getName()); + // jhipster-needle-ehcache-add-entry + }; + } + + private void createCache(javax.cache.CacheManager cm, String cacheName) { + javax.cache.Cache cache = cm.getCache(cacheName); + if (cache != null) { + cache.clear(); + } else { + cm.createCache(cacheName, jcacheConfiguration); + } + } + + @Autowired(required = false) + public void setGitProperties(GitProperties gitProperties) { + this.gitProperties = gitProperties; + } + + @Autowired(required = false) + public void setBuildProperties(BuildProperties buildProperties) { + this.buildProperties = buildProperties; + } + + @Bean + public KeyGenerator keyGenerator() { + return new PrefixedKeyGenerator(this.gitProperties, this.buildProperties); + } +} diff --git a/src/main/java/com/scb/fimob/config/Constants.java b/src/main/java/com/scb/fimob/config/Constants.java new file mode 100644 index 0000000..9a4ebc3 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/Constants.java @@ -0,0 +1,11 @@ +package com.scb.fimob.config; + +/** + * Application constants. + */ +public final class Constants { + + public static final String SYSTEM = "system"; + + private Constants() {} +} diff --git a/src/main/java/com/scb/fimob/config/DatabaseConfiguration.java b/src/main/java/com/scb/fimob/config/DatabaseConfiguration.java new file mode 100644 index 0000000..92c0f3d --- /dev/null +++ b/src/main/java/com/scb/fimob/config/DatabaseConfiguration.java @@ -0,0 +1,57 @@ +package com.scb.fimob.config; + +import java.sql.SQLException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.h2.H2ConfigurationHelper; + +@Configuration +@EnableJpaRepositories({ "com.scb.fimob.repository" }) +@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") +@EnableTransactionManagement +public class DatabaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class); + + private final Environment env; + + public DatabaseConfiguration(Environment env) { + this.env = env; + } + + /** + * Open the TCP port for the H2 database, so it is available remotely. + * + * @return the H2 database TCP server. + * @throws SQLException if the server failed to start. + */ + @Bean(initMethod = "start", destroyMethod = "stop") + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public Object h2TCPServer() throws SQLException { + String port = getValidPortForH2(); + log.debug("H2 database is available on port {}", port); + return H2ConfigurationHelper.createServer(port); + } + + private String getValidPortForH2() { + int port = Integer.parseInt(env.getProperty("server.port")); + if (port < 10000) { + port = 10000 + port; + } else { + if (port < 63536) { + port = port + 2000; + } else { + port = port - 2000; + } + } + return String.valueOf(port); + } +} diff --git a/src/main/java/com/scb/fimob/config/DateTimeFormatConfiguration.java b/src/main/java/com/scb/fimob/config/DateTimeFormatConfiguration.java new file mode 100644 index 0000000..69d9bad --- /dev/null +++ b/src/main/java/com/scb/fimob/config/DateTimeFormatConfiguration.java @@ -0,0 +1,20 @@ +package com.scb.fimob.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Configure the converters to use the ISO format for dates by default. + */ +@Configuration +public class DateTimeFormatConfiguration implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(registry); + } +} diff --git a/src/main/java/com/scb/fimob/config/FeignConfiguration.java b/src/main/java/com/scb/fimob/config/FeignConfiguration.java new file mode 100644 index 0000000..5dd3fd7 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/FeignConfiguration.java @@ -0,0 +1,21 @@ +package com.scb.fimob.config; + +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.cloud.openfeign.FeignClientsConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@EnableFeignClients(basePackages = "com.scb.fimob") +@Import(FeignClientsConfiguration.class) +public class FeignConfiguration { + + /** + * Set the Feign specific log level to log client REST requests. + */ + @Bean + feign.Logger.Level feignLoggerLevel() { + return feign.Logger.Level.BASIC; + } +} diff --git a/src/main/java/com/scb/fimob/config/JacksonConfiguration.java b/src/main/java/com/scb/fimob/config/JacksonConfiguration.java new file mode 100644 index 0000000..c74f4b7 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/JacksonConfiguration.java @@ -0,0 +1,51 @@ +package com.scb.fimob.config; + +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.zalando.problem.jackson.ProblemModule; +import org.zalando.problem.violations.ConstraintViolationProblemModule; + +@Configuration +public class JacksonConfiguration { + + /** + * Support for Java date and time API. + * @return the corresponding Jackson module. + */ + @Bean + public JavaTimeModule javaTimeModule() { + return new JavaTimeModule(); + } + + @Bean + public Jdk8Module jdk8TimeModule() { + return new Jdk8Module(); + } + + /* + * Support for Hibernate types in Jackson. + */ + @Bean + public Hibernate5Module hibernate5Module() { + return new Hibernate5Module(); + } + + /* + * Module for serialization/deserialization of RFC7807 Problem. + */ + @Bean + public ProblemModule problemModule() { + return new ProblemModule(); + } + + /* + * Module for serialization/deserialization of ConstraintViolationProblem. + */ + @Bean + public ConstraintViolationProblemModule constraintViolationProblemModule() { + return new ConstraintViolationProblemModule(); + } +} diff --git a/src/main/java/com/scb/fimob/config/LiquibaseConfiguration.java b/src/main/java/com/scb/fimob/config/LiquibaseConfiguration.java new file mode 100644 index 0000000..946b2b0 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/LiquibaseConfiguration.java @@ -0,0 +1,69 @@ +package com.scb.fimob.config; + +import java.util.concurrent.Executor; +import javax.sql.DataSource; +import liquibase.integration.spring.SpringLiquibase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.liquibase.SpringLiquibaseUtil; + +@Configuration +public class LiquibaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); + + private final Environment env; + + public LiquibaseConfiguration(Environment env) { + this.env = env; + } + + @Bean + public SpringLiquibase liquibase( + @Qualifier("taskExecutor") Executor executor, + @LiquibaseDataSource ObjectProvider liquibaseDataSource, + LiquibaseProperties liquibaseProperties, + ObjectProvider dataSource, + DataSourceProperties dataSourceProperties + ) { + // If you don't want Liquibase to start asynchronously, substitute by this: + // SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDataSource.getIfAvailable(), liquibaseProperties, dataSource.getIfUnique(), dataSourceProperties); + SpringLiquibase liquibase = SpringLiquibaseUtil.createAsyncSpringLiquibase( + this.env, + executor, + liquibaseDataSource.getIfAvailable(), + liquibaseProperties, + dataSource.getIfUnique(), + dataSourceProperties + ); + liquibase.setChangeLog("classpath:config/liquibase/master.xml"); + liquibase.setContexts(liquibaseProperties.getContexts()); + liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); + liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema()); + liquibase.setLiquibaseTablespace(liquibaseProperties.getLiquibaseTablespace()); + liquibase.setDatabaseChangeLogLockTable(liquibaseProperties.getDatabaseChangeLogLockTable()); + liquibase.setDatabaseChangeLogTable(liquibaseProperties.getDatabaseChangeLogTable()); + liquibase.setDropFirst(liquibaseProperties.isDropFirst()); + liquibase.setLabels(liquibaseProperties.getLabels()); + liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); + liquibase.setRollbackFile(liquibaseProperties.getRollbackFile()); + liquibase.setTestRollbackOnUpdate(liquibaseProperties.isTestRollbackOnUpdate()); + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE))) { + liquibase.setShouldRun(false); + } else { + liquibase.setShouldRun(liquibaseProperties.isEnabled()); + log.debug("Configuring Liquibase"); + } + return liquibase; + } +} diff --git a/src/main/java/com/scb/fimob/config/LocaleConfiguration.java b/src/main/java/com/scb/fimob/config/LocaleConfiguration.java new file mode 100644 index 0000000..fb9d808 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/LocaleConfiguration.java @@ -0,0 +1,26 @@ +package com.scb.fimob.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; +import tech.jhipster.config.locale.AngularCookieLocaleResolver; + +@Configuration +public class LocaleConfiguration implements WebMvcConfigurer { + + @Bean + public LocaleResolver localeResolver() { + AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver(); + cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY"); + return cookieLocaleResolver; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + registry.addInterceptor(localeChangeInterceptor); + } +} diff --git a/src/main/java/com/scb/fimob/config/LoggingAspectConfiguration.java b/src/main/java/com/scb/fimob/config/LoggingAspectConfiguration.java new file mode 100644 index 0000000..e69fa65 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/LoggingAspectConfiguration.java @@ -0,0 +1,17 @@ +package com.scb.fimob.config; + +import com.scb.fimob.aop.logging.LoggingAspect; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; +import tech.jhipster.config.JHipsterConstants; + +@Configuration +@EnableAspectJAutoProxy +public class LoggingAspectConfiguration { + + @Bean + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public LoggingAspect loggingAspect(Environment env) { + return new LoggingAspect(env); + } +} diff --git a/src/main/java/com/scb/fimob/config/LoggingConfiguration.java b/src/main/java/com/scb/fimob/config/LoggingConfiguration.java new file mode 100644 index 0000000..66c49ed --- /dev/null +++ b/src/main/java/com/scb/fimob/config/LoggingConfiguration.java @@ -0,0 +1,53 @@ +package com.scb.fimob.config; + +import static tech.jhipster.config.logging.LoggingUtils.*; + +import ch.qos.logback.classic.LoggerContext; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.info.BuildProperties; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.context.annotation.Configuration; +import tech.jhipster.config.JHipsterProperties; + +/* + * Configures the console and Logstash log appenders from the app properties + */ +@Configuration +@RefreshScope +public class LoggingConfiguration { + + public LoggingConfiguration( + @Value("${spring.application.name}") String appName, + @Value("${server.port}") String serverPort, + JHipsterProperties jHipsterProperties, + ObjectProvider buildProperties, + ObjectMapper mapper + ) throws JsonProcessingException { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + Map map = new HashMap<>(); + map.put("app_name", appName); + map.put("app_port", serverPort); + buildProperties.ifAvailable(it -> map.put("version", it.getVersion())); + String customFields = mapper.writeValueAsString(map); + + JHipsterProperties.Logging loggingProperties = jHipsterProperties.getLogging(); + JHipsterProperties.Logging.Logstash logstashProperties = loggingProperties.getLogstash(); + + if (loggingProperties.isUseJsonFormat()) { + addJsonConsoleAppender(context, customFields); + } + if (logstashProperties.isEnabled()) { + addLogstashTcpSocketAppender(context, customFields, logstashProperties); + } + if (loggingProperties.isUseJsonFormat() || logstashProperties.isEnabled()) { + addContextListener(context, customFields, loggingProperties); + } + } +} diff --git a/src/main/java/com/scb/fimob/config/SecurityConfiguration.java b/src/main/java/com/scb/fimob/config/SecurityConfiguration.java new file mode 100644 index 0000000..14aa171 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/SecurityConfiguration.java @@ -0,0 +1,83 @@ +package com.scb.fimob.config; + +import com.scb.fimob.security.*; +import com.scb.fimob.security.jwt.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter; +import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport; +import tech.jhipster.config.JHipsterProperties; + +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +@Import(SecurityProblemSupport.class) +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + private final JHipsterProperties jHipsterProperties; + + private final TokenProvider tokenProvider; + private final SecurityProblemSupport problemSupport; + + public SecurityConfiguration( + TokenProvider tokenProvider, + JHipsterProperties jHipsterProperties, + SecurityProblemSupport problemSupport + ) { + this.tokenProvider = tokenProvider; + this.problemSupport = problemSupport; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void configure(WebSecurity web) { + web.ignoring().antMatchers("/h2-console/**"); + } + + @Override + public void configure(HttpSecurity http) throws Exception { + // @formatter:off + http + .csrf() + .disable() + .exceptionHandling() + .authenticationEntryPoint(problemSupport) + .accessDeniedHandler(problemSupport) + .and() + .headers() + .contentSecurityPolicy(jHipsterProperties.getSecurity().getContentSecurityPolicy()) + .and() + .referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN) + .and() + .permissionsPolicy().policy("camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()") + .and() + .frameOptions() + .deny() + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/api/authenticate").permitAll() + .antMatchers("/api/admin/**").hasAuthority(AuthoritiesConstants.ADMIN) + .antMatchers("/api/**").authenticated() + .antMatchers("/management/health").permitAll() + .antMatchers("/management/health/**").permitAll() + .antMatchers("/management/info").permitAll() + .antMatchers("/management/prometheus").permitAll() + .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN) + .and() + .apply(securityConfigurerAdapter()); + // @formatter:on + } + + private JWTConfigurer securityConfigurerAdapter() { + return new JWTConfigurer(tokenProvider); + } +} diff --git a/src/main/java/com/scb/fimob/config/WebConfigurer.java b/src/main/java/com/scb/fimob/config/WebConfigurer.java new file mode 100644 index 0000000..7bce68a --- /dev/null +++ b/src/main/java/com/scb/fimob/config/WebConfigurer.java @@ -0,0 +1,71 @@ +package com.scb.fimob.config; + +import javax.servlet.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.web.server.*; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import org.springframework.util.CollectionUtils; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; +import tech.jhipster.config.h2.H2ConfigurationHelper; + +/** + * Configuration of web application with Servlet 3.0 APIs. + */ +@Configuration +public class WebConfigurer implements ServletContextInitializer { + + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); + + private final Environment env; + + private final JHipsterProperties jHipsterProperties; + + public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { + this.env = env; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + if (env.getActiveProfiles().length != 0) { + log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); + } + + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { + initH2Console(servletContext); + } + log.info("Web application fully configured"); + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = jHipsterProperties.getCors(); + if (!CollectionUtils.isEmpty(config.getAllowedOrigins()) || !CollectionUtils.isEmpty(config.getAllowedOriginPatterns())) { + log.debug("Registering CORS filter"); + source.registerCorsConfiguration("/api/**", config); + source.registerCorsConfiguration("/management/**", config); + source.registerCorsConfiguration("/v3/api-docs", config); + source.registerCorsConfiguration("/swagger-ui/**", config); + } + return new CorsFilter(source); + } + + /** + * Initializes H2 console. + */ + private void initH2Console(ServletContext servletContext) { + log.debug("Initialize H2 console"); + H2ConfigurationHelper.initH2Console(servletContext); + } +} diff --git a/src/main/java/com/scb/fimob/config/package-info.java b/src/main/java/com/scb/fimob/config/package-info.java new file mode 100644 index 0000000..886c2f2 --- /dev/null +++ b/src/main/java/com/scb/fimob/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Framework configuration files. + */ +package com.scb.fimob.config; diff --git a/src/main/java/com/scb/fimob/domain/AbstractAuditingEntity.java b/src/main/java/com/scb/fimob/domain/AbstractAuditingEntity.java new file mode 100644 index 0000000..4093b17 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/AbstractAuditingEntity.java @@ -0,0 +1,76 @@ +package com.scb.fimob.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.Column; +import javax.persistence.EntityListeners; +import javax.persistence.MappedSuperclass; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +/** + * Base abstract class for entities which will hold definitions for created, last modified, created by, + * last modified by attributes. + */ +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +public abstract class AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @CreatedBy + @Column(name = "created_by", nullable = false, length = 50, updatable = false) + @JsonIgnore + private String createdBy; + + @CreatedDate + @Column(name = "created_date", updatable = false) + @JsonIgnore + private Instant createdDate = Instant.now(); + + @LastModifiedBy + @Column(name = "last_modified_by", length = 50) + @JsonIgnore + private String lastModifiedBy; + + @LastModifiedDate + @Column(name = "last_modified_date") + @JsonIgnore + private Instant lastModifiedDate = Instant.now(); + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } +} diff --git a/src/main/java/com/scb/fimob/domain/Ethnicity.java b/src/main/java/com/scb/fimob/domain/Ethnicity.java new file mode 100644 index 0000000..924cfe9 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/Ethnicity.java @@ -0,0 +1,101 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A Ethnicity. + */ +@Entity +@Table(name = "ethnicity") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class Ethnicity implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @NotNull + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "urdu_name") + private String urduName; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public Ethnicity id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return this.name; + } + + public Ethnicity name(String name) { + this.setName(name); + return this; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrduName() { + return this.urduName; + } + + public Ethnicity urduName(String urduName) { + this.setUrduName(urduName); + return this; + } + + public void setUrduName(String urduName) { + this.urduName = urduName; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Ethnicity)) { + return false; + } + return id != null && id.equals(((Ethnicity) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "Ethnicity{" + + "id=" + getId() + + ", name='" + getName() + "'" + + ", urduName='" + getUrduName() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimAccounts.java b/src/main/java/com/scb/fimob/domain/FimAccounts.java new file mode 100644 index 0000000..6dde181 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimAccounts.java @@ -0,0 +1,412 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimAccounts. + */ +@Entity +@Table(name = "fim_accounts") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimAccounts implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "account_id") + private String accountId; + + @NotNull + @Size(max = 30) + @Column(name = "cust_id", length = 30, nullable = false) + private String custId; + + @NotNull + @Size(max = 30) + @Column(name = "reln_id", length = 30, nullable = false) + private String relnId; + + @NotNull + @Size(max = 5) + @Column(name = "reln_type", length = 5, nullable = false) + private String relnType; + + @Size(max = 10) + @Column(name = "oper_inst", length = 10) + private String operInst; + + @NotNull + @Size(max = 30) + @Column(name = "is_acct_nbr", length = 30, nullable = false) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + @Column(name = "bnd_acct_nbr", length = 30, nullable = false) + private String bndAcctNbr; + + @Size(max = 10) + @Column(name = "closing_id", length = 10) + private String closingId; + + @Size(max = 10) + @Column(name = "sub_segment", length = 10) + private String subSegment; + + @Size(max = 10) + @Column(name = "branch_code", length = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + @Column(name = "acct_status", length = 10, nullable = false) + private String acctStatus; + + @Size(max = 3) + @Column(name = "ctry_code", length = 3) + private String ctryCode; + + @Size(max = 100) + @Column(name = "acct_owners", length = 100) + private String acctOwners; + + @Size(max = 200) + @Column(name = "remarks", length = 200) + private String remarks; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimAccounts id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return this.accountId; + } + + public FimAccounts accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getCustId() { + return this.custId; + } + + public FimAccounts custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return this.relnId; + } + + public FimAccounts relnId(String relnId) { + this.setRelnId(relnId); + return this; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return this.relnType; + } + + public FimAccounts relnType(String relnType) { + this.setRelnType(relnType); + return this; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return this.operInst; + } + + public FimAccounts operInst(String operInst) { + this.setOperInst(operInst); + return this; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return this.isAcctNbr; + } + + public FimAccounts isAcctNbr(String isAcctNbr) { + this.setIsAcctNbr(isAcctNbr); + return this; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return this.bndAcctNbr; + } + + public FimAccounts bndAcctNbr(String bndAcctNbr) { + this.setBndAcctNbr(bndAcctNbr); + return this; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return this.closingId; + } + + public FimAccounts closingId(String closingId) { + this.setClosingId(closingId); + return this; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return this.subSegment; + } + + public FimAccounts subSegment(String subSegment) { + this.setSubSegment(subSegment); + return this; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return this.branchCode; + } + + public FimAccounts branchCode(String branchCode) { + this.setBranchCode(branchCode); + return this; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return this.acctStatus; + } + + public FimAccounts acctStatus(String acctStatus) { + this.setAcctStatus(acctStatus); + return this; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimAccounts ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return this.acctOwners; + } + + public FimAccounts acctOwners(String acctOwners) { + this.setAcctOwners(acctOwners); + return this; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return this.remarks; + } + + public FimAccounts remarks(String remarks) { + this.setRemarks(remarks); + return this; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimAccounts createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimAccounts createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimAccounts updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimAccounts updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimAccounts recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccounts)) { + return false; + } + return id != null && id.equals(((FimAccounts) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccounts{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimAccountsHistory.java b/src/main/java/com/scb/fimob/domain/FimAccountsHistory.java new file mode 100644 index 0000000..d18f857 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimAccountsHistory.java @@ -0,0 +1,429 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimAccountsHistory. + */ +@Entity +@Table(name = "fim_accounts_history") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimAccountsHistory implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "account_id") + private String accountId; + + @Column(name = "history_ts") + private Instant historyTs; + + @NotNull + @Size(max = 30) + @Column(name = "cust_id", length = 30, nullable = false) + private String custId; + + @NotNull + @Size(max = 30) + @Column(name = "reln_id", length = 30, nullable = false) + private String relnId; + + @NotNull + @Size(max = 5) + @Column(name = "reln_type", length = 5, nullable = false) + private String relnType; + + @Size(max = 10) + @Column(name = "oper_inst", length = 10) + private String operInst; + + @NotNull + @Size(max = 30) + @Column(name = "is_acct_nbr", length = 30, nullable = false) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + @Column(name = "bnd_acct_nbr", length = 30, nullable = false) + private String bndAcctNbr; + + @Size(max = 10) + @Column(name = "closing_id", length = 10) + private String closingId; + + @Size(max = 10) + @Column(name = "sub_segment", length = 10) + private String subSegment; + + @Size(max = 10) + @Column(name = "branch_code", length = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + @Column(name = "acct_status", length = 10, nullable = false) + private String acctStatus; + + @Size(max = 3) + @Column(name = "ctry_code", length = 3) + private String ctryCode; + + @Size(max = 100) + @Column(name = "acct_owners", length = 100) + private String acctOwners; + + @Size(max = 200) + @Column(name = "remarks", length = 200) + private String remarks; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimAccountsHistory id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return this.accountId; + } + + public FimAccountsHistory accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public Instant getHistoryTs() { + return this.historyTs; + } + + public FimAccountsHistory historyTs(Instant historyTs) { + this.setHistoryTs(historyTs); + return this; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getCustId() { + return this.custId; + } + + public FimAccountsHistory custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return this.relnId; + } + + public FimAccountsHistory relnId(String relnId) { + this.setRelnId(relnId); + return this; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return this.relnType; + } + + public FimAccountsHistory relnType(String relnType) { + this.setRelnType(relnType); + return this; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return this.operInst; + } + + public FimAccountsHistory operInst(String operInst) { + this.setOperInst(operInst); + return this; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return this.isAcctNbr; + } + + public FimAccountsHistory isAcctNbr(String isAcctNbr) { + this.setIsAcctNbr(isAcctNbr); + return this; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return this.bndAcctNbr; + } + + public FimAccountsHistory bndAcctNbr(String bndAcctNbr) { + this.setBndAcctNbr(bndAcctNbr); + return this; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return this.closingId; + } + + public FimAccountsHistory closingId(String closingId) { + this.setClosingId(closingId); + return this; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return this.subSegment; + } + + public FimAccountsHistory subSegment(String subSegment) { + this.setSubSegment(subSegment); + return this; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return this.branchCode; + } + + public FimAccountsHistory branchCode(String branchCode) { + this.setBranchCode(branchCode); + return this; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return this.acctStatus; + } + + public FimAccountsHistory acctStatus(String acctStatus) { + this.setAcctStatus(acctStatus); + return this; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimAccountsHistory ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return this.acctOwners; + } + + public FimAccountsHistory acctOwners(String acctOwners) { + this.setAcctOwners(acctOwners); + return this; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return this.remarks; + } + + public FimAccountsHistory remarks(String remarks) { + this.setRemarks(remarks); + return this; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimAccountsHistory createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimAccountsHistory createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimAccountsHistory updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimAccountsHistory updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimAccountsHistory recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccountsHistory)) { + return false; + } + return id != null && id.equals(((FimAccountsHistory) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccountsHistory{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimAccountsWq.java b/src/main/java/com/scb/fimob/domain/FimAccountsWq.java new file mode 100644 index 0000000..183902d --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimAccountsWq.java @@ -0,0 +1,429 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimAccountsWq. + */ +@Entity +@Table(name = "fim_accounts_wq") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimAccountsWq implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "account_id") + private String accountId; + + @NotNull + @Size(max = 30) + @Column(name = "cust_id", length = 30, nullable = false) + private String custId; + + @NotNull + @Size(max = 30) + @Column(name = "reln_id", length = 30, nullable = false) + private String relnId; + + @NotNull + @Size(max = 5) + @Column(name = "reln_type", length = 5, nullable = false) + private String relnType; + + @Size(max = 10) + @Column(name = "oper_inst", length = 10) + private String operInst; + + @NotNull + @Size(max = 30) + @Column(name = "is_acct_nbr", length = 30, nullable = false) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + @Column(name = "bnd_acct_nbr", length = 30, nullable = false) + private String bndAcctNbr; + + @Size(max = 10) + @Column(name = "closing_id", length = 10) + private String closingId; + + @Size(max = 10) + @Column(name = "sub_segment", length = 10) + private String subSegment; + + @Size(max = 10) + @Column(name = "branch_code", length = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + @Column(name = "acct_status", length = 10, nullable = false) + private String acctStatus; + + @Size(max = 3) + @Column(name = "ctry_code", length = 3) + private String ctryCode; + + @Size(max = 100) + @Column(name = "acct_owners", length = 100) + private String acctOwners; + + @Size(max = 200) + @Column(name = "remarks", length = 200) + private String remarks; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + @Column(name = "upload_remark") + private String uploadRemark; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimAccountsWq id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return this.accountId; + } + + public FimAccountsWq accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getCustId() { + return this.custId; + } + + public FimAccountsWq custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return this.relnId; + } + + public FimAccountsWq relnId(String relnId) { + this.setRelnId(relnId); + return this; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return this.relnType; + } + + public FimAccountsWq relnType(String relnType) { + this.setRelnType(relnType); + return this; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return this.operInst; + } + + public FimAccountsWq operInst(String operInst) { + this.setOperInst(operInst); + return this; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return this.isAcctNbr; + } + + public FimAccountsWq isAcctNbr(String isAcctNbr) { + this.setIsAcctNbr(isAcctNbr); + return this; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return this.bndAcctNbr; + } + + public FimAccountsWq bndAcctNbr(String bndAcctNbr) { + this.setBndAcctNbr(bndAcctNbr); + return this; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return this.closingId; + } + + public FimAccountsWq closingId(String closingId) { + this.setClosingId(closingId); + return this; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return this.subSegment; + } + + public FimAccountsWq subSegment(String subSegment) { + this.setSubSegment(subSegment); + return this; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return this.branchCode; + } + + public FimAccountsWq branchCode(String branchCode) { + this.setBranchCode(branchCode); + return this; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return this.acctStatus; + } + + public FimAccountsWq acctStatus(String acctStatus) { + this.setAcctStatus(acctStatus); + return this; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimAccountsWq ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return this.acctOwners; + } + + public FimAccountsWq acctOwners(String acctOwners) { + this.setAcctOwners(acctOwners); + return this; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return this.remarks; + } + + public FimAccountsWq remarks(String remarks) { + this.setRemarks(remarks); + return this; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimAccountsWq createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimAccountsWq createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimAccountsWq updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimAccountsWq updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimAccountsWq recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return this.uploadRemark; + } + + public FimAccountsWq uploadRemark(String uploadRemark) { + this.setUploadRemark(uploadRemark); + return this; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccountsWq)) { + return false; + } + return id != null && id.equals(((FimAccountsWq) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccountsWq{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimCust.java b/src/main/java/com/scb/fimob/domain/FimCust.java new file mode 100644 index 0000000..a9f11ce --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimCust.java @@ -0,0 +1,246 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimCust. + */ +@Entity +@Table(name = "fim_cust") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimCust implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "cust_id") + private String custId; + + @NotNull + @Size(max = 30) + @Column(name = "client_id", length = 30, nullable = false) + private String clientId; + + @NotNull + @Size(max = 10) + @Column(name = "id_type", length = 10, nullable = false) + private String idType; + + @NotNull + @Size(max = 3) + @Column(name = "ctry_code", length = 3, nullable = false) + private String ctryCode; + + @NotNull + @Size(max = 8) + @Column(name = "created_by", length = 8, nullable = false) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Column(name = "record_status") + private String recordStatus; + + @Column(name = "upload_remark") + private String uploadRemark; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimCust id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return this.custId; + } + + public FimCust custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getClientId() { + return this.clientId; + } + + public FimCust clientId(String clientId) { + this.setClientId(clientId); + return this; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return this.idType; + } + + public FimCust idType(String idType) { + this.setIdType(idType); + return this; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimCust ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimCust createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimCust createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimCust updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimCust updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimCust recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return this.uploadRemark; + } + + public FimCust uploadRemark(String uploadRemark) { + this.setUploadRemark(uploadRemark); + return this; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCust)) { + return false; + } + return id != null && id.equals(((FimCust) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCust{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimCustHistory.java b/src/main/java/com/scb/fimob/domain/FimCustHistory.java new file mode 100644 index 0000000..34aea3f --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimCustHistory.java @@ -0,0 +1,246 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimCustHistory. + */ +@Entity +@Table(name = "fim_cust_history") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimCustHistory implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "cust_id") + private String custId; + + @Column(name = "history_ts") + private Instant historyTs; + + @NotNull + @Size(max = 30) + @Column(name = "client_id", length = 30, nullable = false) + private String clientId; + + @NotNull + @Size(max = 10) + @Column(name = "id_type", length = 10, nullable = false) + private String idType; + + @NotNull + @Size(max = 3) + @Column(name = "ctry_code", length = 3, nullable = false) + private String ctryCode; + + @NotNull + @Size(max = 8) + @Column(name = "created_by", length = 8, nullable = false) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Column(name = "record_status") + private String recordStatus; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimCustHistory id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return this.custId; + } + + public FimCustHistory custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public Instant getHistoryTs() { + return this.historyTs; + } + + public FimCustHistory historyTs(Instant historyTs) { + this.setHistoryTs(historyTs); + return this; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getClientId() { + return this.clientId; + } + + public FimCustHistory clientId(String clientId) { + this.setClientId(clientId); + return this; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return this.idType; + } + + public FimCustHistory idType(String idType) { + this.setIdType(idType); + return this; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimCustHistory ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimCustHistory createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimCustHistory createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimCustHistory updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimCustHistory updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimCustHistory recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCustHistory)) { + return false; + } + return id != null && id.equals(((FimCustHistory) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCustHistory{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimCustWq.java b/src/main/java/com/scb/fimob/domain/FimCustWq.java new file mode 100644 index 0000000..185c30b --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimCustWq.java @@ -0,0 +1,246 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimCustWq. + */ +@Entity +@Table(name = "fim_cust_wq") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimCustWq implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "cust_id") + private String custId; + + @NotNull + @Size(max = 30) + @Column(name = "client_id", length = 30, nullable = false) + private String clientId; + + @NotNull + @Size(max = 10) + @Column(name = "id_type", length = 10, nullable = false) + private String idType; + + @NotNull + @Size(max = 3) + @Column(name = "ctry_code", length = 3, nullable = false) + private String ctryCode; + + @NotNull + @Size(max = 8) + @Column(name = "created_by", length = 8, nullable = false) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Column(name = "record_status") + private String recordStatus; + + @Column(name = "upload_remark") + private String uploadRemark; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimCustWq id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return this.custId; + } + + public FimCustWq custId(String custId) { + this.setCustId(custId); + return this; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getClientId() { + return this.clientId; + } + + public FimCustWq clientId(String clientId) { + this.setClientId(clientId); + return this; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return this.idType; + } + + public FimCustWq idType(String idType) { + this.setIdType(idType); + return this; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return this.ctryCode; + } + + public FimCustWq ctryCode(String ctryCode) { + this.setCtryCode(ctryCode); + return this; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimCustWq createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimCustWq createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimCustWq updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimCustWq updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimCustWq recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return this.uploadRemark; + } + + public FimCustWq uploadRemark(String uploadRemark) { + this.setUploadRemark(uploadRemark); + return this; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCustWq)) { + return false; + } + return id != null && id.equals(((FimCustWq) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCustWq{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimSettAcct.java b/src/main/java/com/scb/fimob/domain/FimSettAcct.java new file mode 100644 index 0000000..08572c8 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimSettAcct.java @@ -0,0 +1,248 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimSettAcct. + */ +@Entity +@Table(name = "fim_sett_acct") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimSettAcct implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "settacc_id") + private String settaccId; + + @NotNull + @Size(max = 15) + @Column(name = "account_id", length = 15, nullable = false) + private String accountId; + + @NotNull + @Size(max = 30) + @Column(name = "sett_acct_nbr", length = 30, nullable = false) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + @Column(name = "sett_ccy", length = 3, nullable = false) + private String settCcy; + + @NotNull + @Size(max = 10) + @Column(name = "sett_acct_status", length = 10, nullable = false) + private String settAcctStatus; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimSettAcct id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return this.settaccId; + } + + public FimSettAcct settaccId(String settaccId) { + this.setSettaccId(settaccId); + return this; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public String getAccountId() { + return this.accountId; + } + + public FimSettAcct accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return this.settAcctNbr; + } + + public FimSettAcct settAcctNbr(String settAcctNbr) { + this.setSettAcctNbr(settAcctNbr); + return this; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return this.settCcy; + } + + public FimSettAcct settCcy(String settCcy) { + this.setSettCcy(settCcy); + return this; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return this.settAcctStatus; + } + + public FimSettAcct settAcctStatus(String settAcctStatus) { + this.setSettAcctStatus(settAcctStatus); + return this; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimSettAcct createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimSettAcct createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimSettAcct updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimSettAcct updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimSettAcct recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcct)) { + return false; + } + return id != null && id.equals(((FimSettAcct) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcct{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimSettAcctHistory.java b/src/main/java/com/scb/fimob/domain/FimSettAcctHistory.java new file mode 100644 index 0000000..080789a --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimSettAcctHistory.java @@ -0,0 +1,265 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimSettAcctHistory. + */ +@Entity +@Table(name = "fim_sett_acct_history") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimSettAcctHistory implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "settacc_id") + private String settaccId; + + @Column(name = "history_ts") + private Instant historyTs; + + @NotNull + @Size(max = 15) + @Column(name = "account_id", length = 15, nullable = false) + private String accountId; + + @NotNull + @Size(max = 30) + @Column(name = "sett_acct_nbr", length = 30, nullable = false) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + @Column(name = "sett_ccy", length = 3, nullable = false) + private String settCcy; + + @NotNull + @Size(max = 10) + @Column(name = "sett_acct_status", length = 10, nullable = false) + private String settAcctStatus; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimSettAcctHistory id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return this.settaccId; + } + + public FimSettAcctHistory settaccId(String settaccId) { + this.setSettaccId(settaccId); + return this; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public Instant getHistoryTs() { + return this.historyTs; + } + + public FimSettAcctHistory historyTs(Instant historyTs) { + this.setHistoryTs(historyTs); + return this; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getAccountId() { + return this.accountId; + } + + public FimSettAcctHistory accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return this.settAcctNbr; + } + + public FimSettAcctHistory settAcctNbr(String settAcctNbr) { + this.setSettAcctNbr(settAcctNbr); + return this; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return this.settCcy; + } + + public FimSettAcctHistory settCcy(String settCcy) { + this.setSettCcy(settCcy); + return this; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return this.settAcctStatus; + } + + public FimSettAcctHistory settAcctStatus(String settAcctStatus) { + this.setSettAcctStatus(settAcctStatus); + return this; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimSettAcctHistory createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimSettAcctHistory createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimSettAcctHistory updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimSettAcctHistory updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimSettAcctHistory recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcctHistory)) { + return false; + } + return id != null && id.equals(((FimSettAcctHistory) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcctHistory{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/FimSettAcctWq.java b/src/main/java/com/scb/fimob/domain/FimSettAcctWq.java new file mode 100644 index 0000000..b2a096c --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/FimSettAcctWq.java @@ -0,0 +1,265 @@ +package com.scb.fimob.domain; + +import java.io.Serializable; +import java.time.Instant; +import javax.persistence.*; +import javax.validation.constraints.*; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.CacheConcurrencyStrategy; + +/** + * A FimSettAcctWq. + */ +@Entity +@Table(name = "fim_sett_acct_wq") +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +public class FimSettAcctWq implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + @Column(name = "id") + private Long id; + + @Column(name = "settacc_id") + private String settaccId; + + @NotNull + @Size(max = 15) + @Column(name = "account_id", length = 15, nullable = false) + private String accountId; + + @NotNull + @Size(max = 30) + @Column(name = "sett_acct_nbr", length = 30, nullable = false) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + @Column(name = "sett_ccy", length = 3, nullable = false) + private String settCcy; + + @NotNull + @Size(max = 10) + @Column(name = "sett_acct_status", length = 10, nullable = false) + private String settAcctStatus; + + @Size(max = 8) + @Column(name = "created_by", length = 8) + private String createdBy; + + @Column(name = "created_ts") + private Instant createdTs; + + @Size(max = 8) + @Column(name = "updated_by", length = 8) + private String updatedBy; + + @Column(name = "updated_ts") + private Instant updatedTs; + + @Size(max = 10) + @Column(name = "record_status", length = 10) + private String recordStatus; + + @Column(name = "upload_remark") + private String uploadRemark; + + // jhipster-needle-entity-add-field - JHipster will add fields here + + public Long getId() { + return this.id; + } + + public FimSettAcctWq id(Long id) { + this.setId(id); + return this; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return this.settaccId; + } + + public FimSettAcctWq settaccId(String settaccId) { + this.setSettaccId(settaccId); + return this; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public String getAccountId() { + return this.accountId; + } + + public FimSettAcctWq accountId(String accountId) { + this.setAccountId(accountId); + return this; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return this.settAcctNbr; + } + + public FimSettAcctWq settAcctNbr(String settAcctNbr) { + this.setSettAcctNbr(settAcctNbr); + return this; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return this.settCcy; + } + + public FimSettAcctWq settCcy(String settCcy) { + this.setSettCcy(settCcy); + return this; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return this.settAcctStatus; + } + + public FimSettAcctWq settAcctStatus(String settAcctStatus) { + this.setSettAcctStatus(settAcctStatus); + return this; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return this.createdBy; + } + + public FimSettAcctWq createdBy(String createdBy) { + this.setCreatedBy(createdBy); + return this; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return this.createdTs; + } + + public FimSettAcctWq createdTs(Instant createdTs) { + this.setCreatedTs(createdTs); + return this; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return this.updatedBy; + } + + public FimSettAcctWq updatedBy(String updatedBy) { + this.setUpdatedBy(updatedBy); + return this; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return this.updatedTs; + } + + public FimSettAcctWq updatedTs(Instant updatedTs) { + this.setUpdatedTs(updatedTs); + return this; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return this.recordStatus; + } + + public FimSettAcctWq recordStatus(String recordStatus) { + this.setRecordStatus(recordStatus); + return this; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return this.uploadRemark; + } + + public FimSettAcctWq uploadRemark(String uploadRemark) { + this.setUploadRemark(uploadRemark); + return this; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcctWq)) { + return false; + } + return id != null && id.equals(((FimSettAcctWq) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcctWq{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/domain/package-info.java b/src/main/java/com/scb/fimob/domain/package-info.java new file mode 100644 index 0000000..a1d7ea0 --- /dev/null +++ b/src/main/java/com/scb/fimob/domain/package-info.java @@ -0,0 +1,4 @@ +/** + * JPA domain objects. + */ +package com.scb.fimob.domain; diff --git a/src/main/java/com/scb/fimob/management/SecurityMetersService.java b/src/main/java/com/scb/fimob/management/SecurityMetersService.java new file mode 100644 index 0000000..dae300d --- /dev/null +++ b/src/main/java/com/scb/fimob/management/SecurityMetersService.java @@ -0,0 +1,51 @@ +package com.scb.fimob.management; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.stereotype.Service; + +@Service +public class SecurityMetersService { + + public static final String INVALID_TOKENS_METER_NAME = "security.authentication.invalid-tokens"; + public static final String INVALID_TOKENS_METER_DESCRIPTION = + "Indicates validation error count of the tokens presented by the clients."; + public static final String INVALID_TOKENS_METER_BASE_UNIT = "errors"; + public static final String INVALID_TOKENS_METER_CAUSE_DIMENSION = "cause"; + + private final Counter tokenInvalidSignatureCounter; + private final Counter tokenExpiredCounter; + private final Counter tokenUnsupportedCounter; + private final Counter tokenMalformedCounter; + + public SecurityMetersService(MeterRegistry registry) { + this.tokenInvalidSignatureCounter = invalidTokensCounterForCauseBuilder("invalid-signature").register(registry); + this.tokenExpiredCounter = invalidTokensCounterForCauseBuilder("expired").register(registry); + this.tokenUnsupportedCounter = invalidTokensCounterForCauseBuilder("unsupported").register(registry); + this.tokenMalformedCounter = invalidTokensCounterForCauseBuilder("malformed").register(registry); + } + + private Counter.Builder invalidTokensCounterForCauseBuilder(String cause) { + return Counter + .builder(INVALID_TOKENS_METER_NAME) + .baseUnit(INVALID_TOKENS_METER_BASE_UNIT) + .description(INVALID_TOKENS_METER_DESCRIPTION) + .tag(INVALID_TOKENS_METER_CAUSE_DIMENSION, cause); + } + + public void trackTokenInvalidSignature() { + this.tokenInvalidSignatureCounter.increment(); + } + + public void trackTokenExpired() { + this.tokenExpiredCounter.increment(); + } + + public void trackTokenUnsupported() { + this.tokenUnsupportedCounter.increment(); + } + + public void trackTokenMalformed() { + this.tokenMalformedCounter.increment(); + } +} diff --git a/src/main/java/com/scb/fimob/repository/EthnicityRepository.java b/src/main/java/com/scb/fimob/repository/EthnicityRepository.java new file mode 100644 index 0000000..57802e9 --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/EthnicityRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.Ethnicity; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the Ethnicity entity. + */ +@SuppressWarnings("unused") +@Repository +public interface EthnicityRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimAccountsHistoryRepository.java b/src/main/java/com/scb/fimob/repository/FimAccountsHistoryRepository.java new file mode 100644 index 0000000..ba3f1a5 --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimAccountsHistoryRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimAccountsHistory; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimAccountsHistory entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimAccountsHistoryRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimAccountsRepository.java b/src/main/java/com/scb/fimob/repository/FimAccountsRepository.java new file mode 100644 index 0000000..b10fd94 --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimAccountsRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimAccounts; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimAccounts entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimAccountsRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimAccountsWqRepository.java b/src/main/java/com/scb/fimob/repository/FimAccountsWqRepository.java new file mode 100644 index 0000000..467552c --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimAccountsWqRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimAccountsWq; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimAccountsWq entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimAccountsWqRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimCustHistoryRepository.java b/src/main/java/com/scb/fimob/repository/FimCustHistoryRepository.java new file mode 100644 index 0000000..772be2b --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimCustHistoryRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimCustHistory; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimCustHistory entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimCustHistoryRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimCustRepository.java b/src/main/java/com/scb/fimob/repository/FimCustRepository.java new file mode 100644 index 0000000..684ad0b --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimCustRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimCust; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimCust entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimCustRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimCustWqRepository.java b/src/main/java/com/scb/fimob/repository/FimCustWqRepository.java new file mode 100644 index 0000000..5fb89aa --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimCustWqRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimCustWq; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimCustWq entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimCustWqRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimSettAcctHistoryRepository.java b/src/main/java/com/scb/fimob/repository/FimSettAcctHistoryRepository.java new file mode 100644 index 0000000..b7a5e62 --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimSettAcctHistoryRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimSettAcctHistory; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimSettAcctHistory entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimSettAcctHistoryRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimSettAcctRepository.java b/src/main/java/com/scb/fimob/repository/FimSettAcctRepository.java new file mode 100644 index 0000000..3fcf45c --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimSettAcctRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimSettAcct; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimSettAcct entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimSettAcctRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/FimSettAcctWqRepository.java b/src/main/java/com/scb/fimob/repository/FimSettAcctWqRepository.java new file mode 100644 index 0000000..ee19a06 --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/FimSettAcctWqRepository.java @@ -0,0 +1,12 @@ +package com.scb.fimob.repository; + +import com.scb.fimob.domain.FimSettAcctWq; +import org.springframework.data.jpa.repository.*; +import org.springframework.stereotype.Repository; + +/** + * Spring Data SQL repository for the FimSettAcctWq entity. + */ +@SuppressWarnings("unused") +@Repository +public interface FimSettAcctWqRepository extends JpaRepository {} diff --git a/src/main/java/com/scb/fimob/repository/package-info.java b/src/main/java/com/scb/fimob/repository/package-info.java new file mode 100644 index 0000000..ad7cdfc --- /dev/null +++ b/src/main/java/com/scb/fimob/repository/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Data JPA repositories. + */ +package com.scb.fimob.repository; diff --git a/src/main/java/com/scb/fimob/security/AuthoritiesConstants.java b/src/main/java/com/scb/fimob/security/AuthoritiesConstants.java new file mode 100644 index 0000000..d5669e8 --- /dev/null +++ b/src/main/java/com/scb/fimob/security/AuthoritiesConstants.java @@ -0,0 +1,15 @@ +package com.scb.fimob.security; + +/** + * Constants for Spring Security authorities. + */ +public final class AuthoritiesConstants { + + public static final String ADMIN = "ROLE_ADMIN"; + + public static final String USER = "ROLE_USER"; + + public static final String ANONYMOUS = "ROLE_ANONYMOUS"; + + private AuthoritiesConstants() {} +} diff --git a/src/main/java/com/scb/fimob/security/SecurityUtils.java b/src/main/java/com/scb/fimob/security/SecurityUtils.java new file mode 100644 index 0000000..76535a0 --- /dev/null +++ b/src/main/java/com/scb/fimob/security/SecurityUtils.java @@ -0,0 +1,100 @@ +package com.scb.fimob.security; + +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; + +/** + * Utility class for Spring Security. + */ +public final class SecurityUtils { + + private SecurityUtils() {} + + /** + * Get the login of the current user. + * + * @return the login of the current user. + */ + public static Optional getCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(extractPrincipal(securityContext.getAuthentication())); + } + + private static String extractPrincipal(Authentication authentication) { + if (authentication == null) { + return null; + } else if (authentication.getPrincipal() instanceof UserDetails) { + UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); + return springSecurityUser.getUsername(); + } else if (authentication.getPrincipal() instanceof String) { + return (String) authentication.getPrincipal(); + } + return null; + } + + /** + * Get the JWT of the current user. + * + * @return the JWT of the current user. + */ + public static Optional getCurrentUserJWT() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional + .ofNullable(securityContext.getAuthentication()) + .filter(authentication -> authentication.getCredentials() instanceof String) + .map(authentication -> (String) authentication.getCredentials()); + } + + /** + * Check if a user is authenticated. + * + * @return true if the user is authenticated, false otherwise. + */ + public static boolean isAuthenticated() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return authentication != null && getAuthorities(authentication).noneMatch(AuthoritiesConstants.ANONYMOUS::equals); + } + + /** + * Checks if the current user has any of the authorities. + * + * @param authorities the authorities to check. + * @return true if the current user has any of the authorities, false otherwise. + */ + public static boolean hasCurrentUserAnyOfAuthorities(String... authorities) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return ( + authentication != null && getAuthorities(authentication).anyMatch(authority -> Arrays.asList(authorities).contains(authority)) + ); + } + + /** + * Checks if the current user has none of the authorities. + * + * @param authorities the authorities to check. + * @return true if the current user has none of the authorities, false otherwise. + */ + public static boolean hasCurrentUserNoneOfAuthorities(String... authorities) { + return !hasCurrentUserAnyOfAuthorities(authorities); + } + + /** + * Checks if the current user has a specific authority. + * + * @param authority the authority to check. + * @return true if the current user has the authority, false otherwise. + */ + public static boolean hasCurrentUserThisAuthority(String authority) { + return hasCurrentUserAnyOfAuthorities(authority); + } + + private static Stream getAuthorities(Authentication authentication) { + return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority); + } +} diff --git a/src/main/java/com/scb/fimob/security/SpringSecurityAuditorAware.java b/src/main/java/com/scb/fimob/security/SpringSecurityAuditorAware.java new file mode 100644 index 0000000..6bc50ec --- /dev/null +++ b/src/main/java/com/scb/fimob/security/SpringSecurityAuditorAware.java @@ -0,0 +1,18 @@ +package com.scb.fimob.security; + +import com.scb.fimob.config.Constants; +import java.util.Optional; +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +/** + * Implementation of {@link AuditorAware} based on Spring Security. + */ +@Component +public class SpringSecurityAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM)); + } +} diff --git a/src/main/java/com/scb/fimob/security/jwt/JWTConfigurer.java b/src/main/java/com/scb/fimob/security/jwt/JWTConfigurer.java new file mode 100644 index 0000000..0ea743a --- /dev/null +++ b/src/main/java/com/scb/fimob/security/jwt/JWTConfigurer.java @@ -0,0 +1,21 @@ +package com.scb.fimob.security.jwt; + +import org.springframework.security.config.annotation.SecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.web.DefaultSecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +public class JWTConfigurer extends SecurityConfigurerAdapter { + + private final TokenProvider tokenProvider; + + public JWTConfigurer(TokenProvider tokenProvider) { + this.tokenProvider = tokenProvider; + } + + @Override + public void configure(HttpSecurity http) { + JWTFilter customFilter = new JWTFilter(tokenProvider); + http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); + } +} diff --git a/src/main/java/com/scb/fimob/security/jwt/JWTFilter.java b/src/main/java/com/scb/fimob/security/jwt/JWTFilter.java new file mode 100644 index 0000000..0cc1e37 --- /dev/null +++ b/src/main/java/com/scb/fimob/security/jwt/JWTFilter.java @@ -0,0 +1,47 @@ +package com.scb.fimob.security.jwt; + +import java.io.IOException; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.StringUtils; +import org.springframework.web.filter.GenericFilterBean; + +/** + * Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is + * found. + */ +public class JWTFilter extends GenericFilterBean { + + public static final String AUTHORIZATION_HEADER = "Authorization"; + + private final TokenProvider tokenProvider; + + public JWTFilter(TokenProvider tokenProvider) { + this.tokenProvider = tokenProvider; + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) + throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; + String jwt = resolveToken(httpServletRequest); + if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) { + Authentication authentication = this.tokenProvider.getAuthentication(jwt); + SecurityContextHolder.getContext().setAuthentication(authentication); + } + filterChain.doFilter(servletRequest, servletResponse); + } + + private String resolveToken(HttpServletRequest request) { + String bearerToken = request.getHeader(AUTHORIZATION_HEADER); + if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { + return bearerToken.substring(7); + } + return null; + } +} diff --git a/src/main/java/com/scb/fimob/security/jwt/TokenProvider.java b/src/main/java/com/scb/fimob/security/jwt/TokenProvider.java new file mode 100644 index 0000000..d9de092 --- /dev/null +++ b/src/main/java/com/scb/fimob/security/jwt/TokenProvider.java @@ -0,0 +1,126 @@ +package com.scb.fimob.security.jwt; + +import com.scb.fimob.management.SecurityMetersService; +import io.jsonwebtoken.*; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import io.jsonwebtoken.security.SignatureException; +import java.nio.charset.StandardCharsets; +import java.security.Key; +import java.util.*; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import tech.jhipster.config.JHipsterProperties; + +@Component +public class TokenProvider { + + private final Logger log = LoggerFactory.getLogger(TokenProvider.class); + + private static final String AUTHORITIES_KEY = "auth"; + + private static final String INVALID_JWT_TOKEN = "Invalid JWT token."; + + private final Key key; + + private final JwtParser jwtParser; + + private final long tokenValidityInMilliseconds; + + private final long tokenValidityInMillisecondsForRememberMe; + + private final SecurityMetersService securityMetersService; + + public TokenProvider(JHipsterProperties jHipsterProperties, SecurityMetersService securityMetersService) { + byte[] keyBytes; + String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getBase64Secret(); + if (!ObjectUtils.isEmpty(secret)) { + log.debug("Using a Base64-encoded JWT secret key"); + keyBytes = Decoders.BASE64.decode(secret); + } else { + log.warn( + "Warning: the JWT key used is not Base64-encoded. " + + "We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security." + ); + secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret(); + keyBytes = secret.getBytes(StandardCharsets.UTF_8); + } + key = Keys.hmacShaKeyFor(keyBytes); + jwtParser = Jwts.parserBuilder().setSigningKey(key).build(); + this.tokenValidityInMilliseconds = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds(); + this.tokenValidityInMillisecondsForRememberMe = + 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSecondsForRememberMe(); + + this.securityMetersService = securityMetersService; + } + + public String createToken(Authentication authentication, boolean rememberMe) { + String authorities = authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(",")); + + long now = (new Date()).getTime(); + Date validity; + if (rememberMe) { + validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe); + } else { + validity = new Date(now + this.tokenValidityInMilliseconds); + } + + return Jwts + .builder() + .setSubject(authentication.getName()) + .claim(AUTHORITIES_KEY, authorities) + .signWith(key, SignatureAlgorithm.HS512) + .setExpiration(validity) + .compact(); + } + + public Authentication getAuthentication(String token) { + Claims claims = jwtParser.parseClaimsJws(token).getBody(); + + Collection authorities = Arrays + .stream(claims.get(AUTHORITIES_KEY).toString().split(",")) + .filter(auth -> !auth.trim().isEmpty()) + .map(SimpleGrantedAuthority::new) + .collect(Collectors.toList()); + + User principal = new User(claims.getSubject(), "", authorities); + + return new UsernamePasswordAuthenticationToken(principal, token, authorities); + } + + public boolean validateToken(String authToken) { + try { + jwtParser.parseClaimsJws(authToken); + + return true; + } catch (ExpiredJwtException e) { + this.securityMetersService.trackTokenExpired(); + + log.trace(INVALID_JWT_TOKEN, e); + } catch (UnsupportedJwtException e) { + this.securityMetersService.trackTokenUnsupported(); + + log.trace(INVALID_JWT_TOKEN, e); + } catch (MalformedJwtException e) { + this.securityMetersService.trackTokenMalformed(); + + log.trace(INVALID_JWT_TOKEN, e); + } catch (SignatureException e) { + this.securityMetersService.trackTokenInvalidSignature(); + + log.trace(INVALID_JWT_TOKEN, e); + } catch (IllegalArgumentException e) { // TODO: should we let it bubble (no catch), to avoid defensive programming and follow the fail-fast principle? + log.error("Token validation error {}", e.getMessage()); + } + + return false; + } +} diff --git a/src/main/java/com/scb/fimob/security/package-info.java b/src/main/java/com/scb/fimob/security/package-info.java new file mode 100644 index 0000000..7ee8d7f --- /dev/null +++ b/src/main/java/com/scb/fimob/security/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring Security configuration. + */ +package com.scb.fimob.security; diff --git a/src/main/java/com/scb/fimob/service/EthnicityService.java b/src/main/java/com/scb/fimob/service/EthnicityService.java new file mode 100644 index 0000000..ee7e7c8 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/EthnicityService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.Ethnicity; +import com.scb.fimob.repository.EthnicityRepository; +import com.scb.fimob.service.dto.EthnicityDTO; +import com.scb.fimob.service.mapper.EthnicityMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link Ethnicity}. + */ +@Service +@Transactional +public class EthnicityService { + + private final Logger log = LoggerFactory.getLogger(EthnicityService.class); + + private final EthnicityRepository ethnicityRepository; + + private final EthnicityMapper ethnicityMapper; + + public EthnicityService(EthnicityRepository ethnicityRepository, EthnicityMapper ethnicityMapper) { + this.ethnicityRepository = ethnicityRepository; + this.ethnicityMapper = ethnicityMapper; + } + + /** + * Save a ethnicity. + * + * @param ethnicityDTO the entity to save. + * @return the persisted entity. + */ + public EthnicityDTO save(EthnicityDTO ethnicityDTO) { + log.debug("Request to save Ethnicity : {}", ethnicityDTO); + Ethnicity ethnicity = ethnicityMapper.toEntity(ethnicityDTO); + ethnicity = ethnicityRepository.save(ethnicity); + return ethnicityMapper.toDto(ethnicity); + } + + /** + * Partially update a ethnicity. + * + * @param ethnicityDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(EthnicityDTO ethnicityDTO) { + log.debug("Request to partially update Ethnicity : {}", ethnicityDTO); + + return ethnicityRepository + .findById(ethnicityDTO.getId()) + .map(existingEthnicity -> { + ethnicityMapper.partialUpdate(existingEthnicity, ethnicityDTO); + + return existingEthnicity; + }) + .map(ethnicityRepository::save) + .map(ethnicityMapper::toDto); + } + + /** + * Get all the ethnicities. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all Ethnicities"); + return ethnicityRepository.findAll().stream().map(ethnicityMapper::toDto).collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one ethnicity by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get Ethnicity : {}", id); + return ethnicityRepository.findById(id).map(ethnicityMapper::toDto); + } + + /** + * Delete the ethnicity by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete Ethnicity : {}", id); + ethnicityRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimAccountsHistoryService.java b/src/main/java/com/scb/fimob/service/FimAccountsHistoryService.java new file mode 100644 index 0000000..adbfdf3 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimAccountsHistoryService.java @@ -0,0 +1,106 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimAccountsHistory; +import com.scb.fimob.repository.FimAccountsHistoryRepository; +import com.scb.fimob.service.dto.FimAccountsHistoryDTO; +import com.scb.fimob.service.mapper.FimAccountsHistoryMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimAccountsHistory}. + */ +@Service +@Transactional +public class FimAccountsHistoryService { + + private final Logger log = LoggerFactory.getLogger(FimAccountsHistoryService.class); + + private final FimAccountsHistoryRepository fimAccountsHistoryRepository; + + private final FimAccountsHistoryMapper fimAccountsHistoryMapper; + + public FimAccountsHistoryService( + FimAccountsHistoryRepository fimAccountsHistoryRepository, + FimAccountsHistoryMapper fimAccountsHistoryMapper + ) { + this.fimAccountsHistoryRepository = fimAccountsHistoryRepository; + this.fimAccountsHistoryMapper = fimAccountsHistoryMapper; + } + + /** + * Save a fimAccountsHistory. + * + * @param fimAccountsHistoryDTO the entity to save. + * @return the persisted entity. + */ + public FimAccountsHistoryDTO save(FimAccountsHistoryDTO fimAccountsHistoryDTO) { + log.debug("Request to save FimAccountsHistory : {}", fimAccountsHistoryDTO); + FimAccountsHistory fimAccountsHistory = fimAccountsHistoryMapper.toEntity(fimAccountsHistoryDTO); + fimAccountsHistory = fimAccountsHistoryRepository.save(fimAccountsHistory); + return fimAccountsHistoryMapper.toDto(fimAccountsHistory); + } + + /** + * Partially update a fimAccountsHistory. + * + * @param fimAccountsHistoryDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimAccountsHistoryDTO fimAccountsHistoryDTO) { + log.debug("Request to partially update FimAccountsHistory : {}", fimAccountsHistoryDTO); + + return fimAccountsHistoryRepository + .findById(fimAccountsHistoryDTO.getId()) + .map(existingFimAccountsHistory -> { + fimAccountsHistoryMapper.partialUpdate(existingFimAccountsHistory, fimAccountsHistoryDTO); + + return existingFimAccountsHistory; + }) + .map(fimAccountsHistoryRepository::save) + .map(fimAccountsHistoryMapper::toDto); + } + + /** + * Get all the fimAccountsHistories. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimAccountsHistories"); + return fimAccountsHistoryRepository + .findAll() + .stream() + .map(fimAccountsHistoryMapper::toDto) + .collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimAccountsHistory by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimAccountsHistory : {}", id); + return fimAccountsHistoryRepository.findById(id).map(fimAccountsHistoryMapper::toDto); + } + + /** + * Delete the fimAccountsHistory by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimAccountsHistory : {}", id); + fimAccountsHistoryRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimAccountsService.java b/src/main/java/com/scb/fimob/service/FimAccountsService.java new file mode 100644 index 0000000..3bbdb21 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimAccountsService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimAccounts; +import com.scb.fimob.repository.FimAccountsRepository; +import com.scb.fimob.service.dto.FimAccountsDTO; +import com.scb.fimob.service.mapper.FimAccountsMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimAccounts}. + */ +@Service +@Transactional +public class FimAccountsService { + + private final Logger log = LoggerFactory.getLogger(FimAccountsService.class); + + private final FimAccountsRepository fimAccountsRepository; + + private final FimAccountsMapper fimAccountsMapper; + + public FimAccountsService(FimAccountsRepository fimAccountsRepository, FimAccountsMapper fimAccountsMapper) { + this.fimAccountsRepository = fimAccountsRepository; + this.fimAccountsMapper = fimAccountsMapper; + } + + /** + * Save a fimAccounts. + * + * @param fimAccountsDTO the entity to save. + * @return the persisted entity. + */ + public FimAccountsDTO save(FimAccountsDTO fimAccountsDTO) { + log.debug("Request to save FimAccounts : {}", fimAccountsDTO); + FimAccounts fimAccounts = fimAccountsMapper.toEntity(fimAccountsDTO); + fimAccounts = fimAccountsRepository.save(fimAccounts); + return fimAccountsMapper.toDto(fimAccounts); + } + + /** + * Partially update a fimAccounts. + * + * @param fimAccountsDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimAccountsDTO fimAccountsDTO) { + log.debug("Request to partially update FimAccounts : {}", fimAccountsDTO); + + return fimAccountsRepository + .findById(fimAccountsDTO.getId()) + .map(existingFimAccounts -> { + fimAccountsMapper.partialUpdate(existingFimAccounts, fimAccountsDTO); + + return existingFimAccounts; + }) + .map(fimAccountsRepository::save) + .map(fimAccountsMapper::toDto); + } + + /** + * Get all the fimAccounts. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimAccounts"); + return fimAccountsRepository.findAll().stream().map(fimAccountsMapper::toDto).collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimAccounts by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimAccounts : {}", id); + return fimAccountsRepository.findById(id).map(fimAccountsMapper::toDto); + } + + /** + * Delete the fimAccounts by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimAccounts : {}", id); + fimAccountsRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimAccountsWqService.java b/src/main/java/com/scb/fimob/service/FimAccountsWqService.java new file mode 100644 index 0000000..227aae5 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimAccountsWqService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimAccountsWq; +import com.scb.fimob.repository.FimAccountsWqRepository; +import com.scb.fimob.service.dto.FimAccountsWqDTO; +import com.scb.fimob.service.mapper.FimAccountsWqMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimAccountsWq}. + */ +@Service +@Transactional +public class FimAccountsWqService { + + private final Logger log = LoggerFactory.getLogger(FimAccountsWqService.class); + + private final FimAccountsWqRepository fimAccountsWqRepository; + + private final FimAccountsWqMapper fimAccountsWqMapper; + + public FimAccountsWqService(FimAccountsWqRepository fimAccountsWqRepository, FimAccountsWqMapper fimAccountsWqMapper) { + this.fimAccountsWqRepository = fimAccountsWqRepository; + this.fimAccountsWqMapper = fimAccountsWqMapper; + } + + /** + * Save a fimAccountsWq. + * + * @param fimAccountsWqDTO the entity to save. + * @return the persisted entity. + */ + public FimAccountsWqDTO save(FimAccountsWqDTO fimAccountsWqDTO) { + log.debug("Request to save FimAccountsWq : {}", fimAccountsWqDTO); + FimAccountsWq fimAccountsWq = fimAccountsWqMapper.toEntity(fimAccountsWqDTO); + fimAccountsWq = fimAccountsWqRepository.save(fimAccountsWq); + return fimAccountsWqMapper.toDto(fimAccountsWq); + } + + /** + * Partially update a fimAccountsWq. + * + * @param fimAccountsWqDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimAccountsWqDTO fimAccountsWqDTO) { + log.debug("Request to partially update FimAccountsWq : {}", fimAccountsWqDTO); + + return fimAccountsWqRepository + .findById(fimAccountsWqDTO.getId()) + .map(existingFimAccountsWq -> { + fimAccountsWqMapper.partialUpdate(existingFimAccountsWq, fimAccountsWqDTO); + + return existingFimAccountsWq; + }) + .map(fimAccountsWqRepository::save) + .map(fimAccountsWqMapper::toDto); + } + + /** + * Get all the fimAccountsWqs. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimAccountsWqs"); + return fimAccountsWqRepository.findAll().stream().map(fimAccountsWqMapper::toDto).collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimAccountsWq by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimAccountsWq : {}", id); + return fimAccountsWqRepository.findById(id).map(fimAccountsWqMapper::toDto); + } + + /** + * Delete the fimAccountsWq by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimAccountsWq : {}", id); + fimAccountsWqRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimCustHistoryService.java b/src/main/java/com/scb/fimob/service/FimCustHistoryService.java new file mode 100644 index 0000000..6e4bda9 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimCustHistoryService.java @@ -0,0 +1,103 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimCustHistory; +import com.scb.fimob.repository.FimCustHistoryRepository; +import com.scb.fimob.service.dto.FimCustHistoryDTO; +import com.scb.fimob.service.mapper.FimCustHistoryMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimCustHistory}. + */ +@Service +@Transactional +public class FimCustHistoryService { + + private final Logger log = LoggerFactory.getLogger(FimCustHistoryService.class); + + private final FimCustHistoryRepository fimCustHistoryRepository; + + private final FimCustHistoryMapper fimCustHistoryMapper; + + public FimCustHistoryService(FimCustHistoryRepository fimCustHistoryRepository, FimCustHistoryMapper fimCustHistoryMapper) { + this.fimCustHistoryRepository = fimCustHistoryRepository; + this.fimCustHistoryMapper = fimCustHistoryMapper; + } + + /** + * Save a fimCustHistory. + * + * @param fimCustHistoryDTO the entity to save. + * @return the persisted entity. + */ + public FimCustHistoryDTO save(FimCustHistoryDTO fimCustHistoryDTO) { + log.debug("Request to save FimCustHistory : {}", fimCustHistoryDTO); + FimCustHistory fimCustHistory = fimCustHistoryMapper.toEntity(fimCustHistoryDTO); + fimCustHistory = fimCustHistoryRepository.save(fimCustHistory); + return fimCustHistoryMapper.toDto(fimCustHistory); + } + + /** + * Partially update a fimCustHistory. + * + * @param fimCustHistoryDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimCustHistoryDTO fimCustHistoryDTO) { + log.debug("Request to partially update FimCustHistory : {}", fimCustHistoryDTO); + + return fimCustHistoryRepository + .findById(fimCustHistoryDTO.getId()) + .map(existingFimCustHistory -> { + fimCustHistoryMapper.partialUpdate(existingFimCustHistory, fimCustHistoryDTO); + + return existingFimCustHistory; + }) + .map(fimCustHistoryRepository::save) + .map(fimCustHistoryMapper::toDto); + } + + /** + * Get all the fimCustHistories. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimCustHistories"); + return fimCustHistoryRepository + .findAll() + .stream() + .map(fimCustHistoryMapper::toDto) + .collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimCustHistory by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimCustHistory : {}", id); + return fimCustHistoryRepository.findById(id).map(fimCustHistoryMapper::toDto); + } + + /** + * Delete the fimCustHistory by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimCustHistory : {}", id); + fimCustHistoryRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimCustService.java b/src/main/java/com/scb/fimob/service/FimCustService.java new file mode 100644 index 0000000..3c526d6 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimCustService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimCust; +import com.scb.fimob.repository.FimCustRepository; +import com.scb.fimob.service.dto.FimCustDTO; +import com.scb.fimob.service.mapper.FimCustMapper; +import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimCust}. + */ +@Service +@Transactional +public class FimCustService { + + private final Logger log = LoggerFactory.getLogger(FimCustService.class); + + private final FimCustRepository fimCustRepository; + + private final FimCustMapper fimCustMapper; + + public FimCustService(FimCustRepository fimCustRepository, FimCustMapper fimCustMapper) { + this.fimCustRepository = fimCustRepository; + this.fimCustMapper = fimCustMapper; + } + + /** + * Save a fimCust. + * + * @param fimCustDTO the entity to save. + * @return the persisted entity. + */ + public FimCustDTO save(FimCustDTO fimCustDTO) { + log.debug("Request to save FimCust : {}", fimCustDTO); + FimCust fimCust = fimCustMapper.toEntity(fimCustDTO); + fimCust = fimCustRepository.save(fimCust); + return fimCustMapper.toDto(fimCust); + } + + /** + * Partially update a fimCust. + * + * @param fimCustDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimCustDTO fimCustDTO) { + log.debug("Request to partially update FimCust : {}", fimCustDTO); + + return fimCustRepository + .findById(fimCustDTO.getId()) + .map(existingFimCust -> { + fimCustMapper.partialUpdate(existingFimCust, fimCustDTO); + + return existingFimCust; + }) + .map(fimCustRepository::save) + .map(fimCustMapper::toDto); + } + + /** + * Get all the fimCusts. + * + * @param pageable the pagination information. + * @return the list of entities. + */ + @Transactional(readOnly = true) + public Page findAll(Pageable pageable) { + log.debug("Request to get all FimCusts"); + return fimCustRepository.findAll(pageable).map(fimCustMapper::toDto); + } + + /** + * Get one fimCust by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimCust : {}", id); + return fimCustRepository.findById(id).map(fimCustMapper::toDto); + } + + /** + * Delete the fimCust by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimCust : {}", id); + fimCustRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimCustWqService.java b/src/main/java/com/scb/fimob/service/FimCustWqService.java new file mode 100644 index 0000000..137d5a7 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimCustWqService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimCustWq; +import com.scb.fimob.repository.FimCustWqRepository; +import com.scb.fimob.service.dto.FimCustWqDTO; +import com.scb.fimob.service.mapper.FimCustWqMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimCustWq}. + */ +@Service +@Transactional +public class FimCustWqService { + + private final Logger log = LoggerFactory.getLogger(FimCustWqService.class); + + private final FimCustWqRepository fimCustWqRepository; + + private final FimCustWqMapper fimCustWqMapper; + + public FimCustWqService(FimCustWqRepository fimCustWqRepository, FimCustWqMapper fimCustWqMapper) { + this.fimCustWqRepository = fimCustWqRepository; + this.fimCustWqMapper = fimCustWqMapper; + } + + /** + * Save a fimCustWq. + * + * @param fimCustWqDTO the entity to save. + * @return the persisted entity. + */ + public FimCustWqDTO save(FimCustWqDTO fimCustWqDTO) { + log.debug("Request to save FimCustWq : {}", fimCustWqDTO); + FimCustWq fimCustWq = fimCustWqMapper.toEntity(fimCustWqDTO); + fimCustWq = fimCustWqRepository.save(fimCustWq); + return fimCustWqMapper.toDto(fimCustWq); + } + + /** + * Partially update a fimCustWq. + * + * @param fimCustWqDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimCustWqDTO fimCustWqDTO) { + log.debug("Request to partially update FimCustWq : {}", fimCustWqDTO); + + return fimCustWqRepository + .findById(fimCustWqDTO.getId()) + .map(existingFimCustWq -> { + fimCustWqMapper.partialUpdate(existingFimCustWq, fimCustWqDTO); + + return existingFimCustWq; + }) + .map(fimCustWqRepository::save) + .map(fimCustWqMapper::toDto); + } + + /** + * Get all the fimCustWqs. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimCustWqs"); + return fimCustWqRepository.findAll().stream().map(fimCustWqMapper::toDto).collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimCustWq by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimCustWq : {}", id); + return fimCustWqRepository.findById(id).map(fimCustWqMapper::toDto); + } + + /** + * Delete the fimCustWq by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimCustWq : {}", id); + fimCustWqRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimSettAcctHistoryService.java b/src/main/java/com/scb/fimob/service/FimSettAcctHistoryService.java new file mode 100644 index 0000000..9cd5bc9 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimSettAcctHistoryService.java @@ -0,0 +1,106 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimSettAcctHistory; +import com.scb.fimob.repository.FimSettAcctHistoryRepository; +import com.scb.fimob.service.dto.FimSettAcctHistoryDTO; +import com.scb.fimob.service.mapper.FimSettAcctHistoryMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimSettAcctHistory}. + */ +@Service +@Transactional +public class FimSettAcctHistoryService { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctHistoryService.class); + + private final FimSettAcctHistoryRepository fimSettAcctHistoryRepository; + + private final FimSettAcctHistoryMapper fimSettAcctHistoryMapper; + + public FimSettAcctHistoryService( + FimSettAcctHistoryRepository fimSettAcctHistoryRepository, + FimSettAcctHistoryMapper fimSettAcctHistoryMapper + ) { + this.fimSettAcctHistoryRepository = fimSettAcctHistoryRepository; + this.fimSettAcctHistoryMapper = fimSettAcctHistoryMapper; + } + + /** + * Save a fimSettAcctHistory. + * + * @param fimSettAcctHistoryDTO the entity to save. + * @return the persisted entity. + */ + public FimSettAcctHistoryDTO save(FimSettAcctHistoryDTO fimSettAcctHistoryDTO) { + log.debug("Request to save FimSettAcctHistory : {}", fimSettAcctHistoryDTO); + FimSettAcctHistory fimSettAcctHistory = fimSettAcctHistoryMapper.toEntity(fimSettAcctHistoryDTO); + fimSettAcctHistory = fimSettAcctHistoryRepository.save(fimSettAcctHistory); + return fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + } + + /** + * Partially update a fimSettAcctHistory. + * + * @param fimSettAcctHistoryDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimSettAcctHistoryDTO fimSettAcctHistoryDTO) { + log.debug("Request to partially update FimSettAcctHistory : {}", fimSettAcctHistoryDTO); + + return fimSettAcctHistoryRepository + .findById(fimSettAcctHistoryDTO.getId()) + .map(existingFimSettAcctHistory -> { + fimSettAcctHistoryMapper.partialUpdate(existingFimSettAcctHistory, fimSettAcctHistoryDTO); + + return existingFimSettAcctHistory; + }) + .map(fimSettAcctHistoryRepository::save) + .map(fimSettAcctHistoryMapper::toDto); + } + + /** + * Get all the fimSettAcctHistories. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimSettAcctHistories"); + return fimSettAcctHistoryRepository + .findAll() + .stream() + .map(fimSettAcctHistoryMapper::toDto) + .collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimSettAcctHistory by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimSettAcctHistory : {}", id); + return fimSettAcctHistoryRepository.findById(id).map(fimSettAcctHistoryMapper::toDto); + } + + /** + * Delete the fimSettAcctHistory by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimSettAcctHistory : {}", id); + fimSettAcctHistoryRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimSettAcctService.java b/src/main/java/com/scb/fimob/service/FimSettAcctService.java new file mode 100644 index 0000000..5c7302e --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimSettAcctService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimSettAcct; +import com.scb.fimob.repository.FimSettAcctRepository; +import com.scb.fimob.service.dto.FimSettAcctDTO; +import com.scb.fimob.service.mapper.FimSettAcctMapper; +import java.util.Optional; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimSettAcct}. + */ +@Service +@Transactional +public class FimSettAcctService { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctService.class); + + private final FimSettAcctRepository fimSettAcctRepository; + + private final FimSettAcctMapper fimSettAcctMapper; + + public FimSettAcctService(FimSettAcctRepository fimSettAcctRepository, FimSettAcctMapper fimSettAcctMapper) { + this.fimSettAcctRepository = fimSettAcctRepository; + this.fimSettAcctMapper = fimSettAcctMapper; + } + + /** + * Save a fimSettAcct. + * + * @param fimSettAcctDTO the entity to save. + * @return the persisted entity. + */ + public FimSettAcctDTO save(FimSettAcctDTO fimSettAcctDTO) { + log.debug("Request to save FimSettAcct : {}", fimSettAcctDTO); + FimSettAcct fimSettAcct = fimSettAcctMapper.toEntity(fimSettAcctDTO); + fimSettAcct = fimSettAcctRepository.save(fimSettAcct); + return fimSettAcctMapper.toDto(fimSettAcct); + } + + /** + * Partially update a fimSettAcct. + * + * @param fimSettAcctDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimSettAcctDTO fimSettAcctDTO) { + log.debug("Request to partially update FimSettAcct : {}", fimSettAcctDTO); + + return fimSettAcctRepository + .findById(fimSettAcctDTO.getId()) + .map(existingFimSettAcct -> { + fimSettAcctMapper.partialUpdate(existingFimSettAcct, fimSettAcctDTO); + + return existingFimSettAcct; + }) + .map(fimSettAcctRepository::save) + .map(fimSettAcctMapper::toDto); + } + + /** + * Get all the fimSettAccts. + * + * @param pageable the pagination information. + * @return the list of entities. + */ + @Transactional(readOnly = true) + public Page findAll(Pageable pageable) { + log.debug("Request to get all FimSettAccts"); + return fimSettAcctRepository.findAll(pageable).map(fimSettAcctMapper::toDto); + } + + /** + * Get one fimSettAcct by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimSettAcct : {}", id); + return fimSettAcctRepository.findById(id).map(fimSettAcctMapper::toDto); + } + + /** + * Delete the fimSettAcct by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimSettAcct : {}", id); + fimSettAcctRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/FimSettAcctWqService.java b/src/main/java/com/scb/fimob/service/FimSettAcctWqService.java new file mode 100644 index 0000000..a34d93f --- /dev/null +++ b/src/main/java/com/scb/fimob/service/FimSettAcctWqService.java @@ -0,0 +1,99 @@ +package com.scb.fimob.service; + +import com.scb.fimob.domain.FimSettAcctWq; +import com.scb.fimob.repository.FimSettAcctWqRepository; +import com.scb.fimob.service.dto.FimSettAcctWqDTO; +import com.scb.fimob.service.mapper.FimSettAcctWqMapper; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Service Implementation for managing {@link FimSettAcctWq}. + */ +@Service +@Transactional +public class FimSettAcctWqService { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctWqService.class); + + private final FimSettAcctWqRepository fimSettAcctWqRepository; + + private final FimSettAcctWqMapper fimSettAcctWqMapper; + + public FimSettAcctWqService(FimSettAcctWqRepository fimSettAcctWqRepository, FimSettAcctWqMapper fimSettAcctWqMapper) { + this.fimSettAcctWqRepository = fimSettAcctWqRepository; + this.fimSettAcctWqMapper = fimSettAcctWqMapper; + } + + /** + * Save a fimSettAcctWq. + * + * @param fimSettAcctWqDTO the entity to save. + * @return the persisted entity. + */ + public FimSettAcctWqDTO save(FimSettAcctWqDTO fimSettAcctWqDTO) { + log.debug("Request to save FimSettAcctWq : {}", fimSettAcctWqDTO); + FimSettAcctWq fimSettAcctWq = fimSettAcctWqMapper.toEntity(fimSettAcctWqDTO); + fimSettAcctWq = fimSettAcctWqRepository.save(fimSettAcctWq); + return fimSettAcctWqMapper.toDto(fimSettAcctWq); + } + + /** + * Partially update a fimSettAcctWq. + * + * @param fimSettAcctWqDTO the entity to update partially. + * @return the persisted entity. + */ + public Optional partialUpdate(FimSettAcctWqDTO fimSettAcctWqDTO) { + log.debug("Request to partially update FimSettAcctWq : {}", fimSettAcctWqDTO); + + return fimSettAcctWqRepository + .findById(fimSettAcctWqDTO.getId()) + .map(existingFimSettAcctWq -> { + fimSettAcctWqMapper.partialUpdate(existingFimSettAcctWq, fimSettAcctWqDTO); + + return existingFimSettAcctWq; + }) + .map(fimSettAcctWqRepository::save) + .map(fimSettAcctWqMapper::toDto); + } + + /** + * Get all the fimSettAcctWqs. + * + * @return the list of entities. + */ + @Transactional(readOnly = true) + public List findAll() { + log.debug("Request to get all FimSettAcctWqs"); + return fimSettAcctWqRepository.findAll().stream().map(fimSettAcctWqMapper::toDto).collect(Collectors.toCollection(LinkedList::new)); + } + + /** + * Get one fimSettAcctWq by id. + * + * @param id the id of the entity. + * @return the entity. + */ + @Transactional(readOnly = true) + public Optional findOne(Long id) { + log.debug("Request to get FimSettAcctWq : {}", id); + return fimSettAcctWqRepository.findById(id).map(fimSettAcctWqMapper::toDto); + } + + /** + * Delete the fimSettAcctWq by id. + * + * @param id the id of the entity. + */ + public void delete(Long id) { + log.debug("Request to delete FimSettAcctWq : {}", id); + fimSettAcctWqRepository.deleteById(id); + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/EthnicityDTO.java b/src/main/java/com/scb/fimob/service/dto/EthnicityDTO.java new file mode 100644 index 0000000..a63059d --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/EthnicityDTO.java @@ -0,0 +1,73 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.Ethnicity} entity. + */ +public class EthnicityDTO implements Serializable { + + private Long id; + + @NotNull + private String name; + + private String urduName; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrduName() { + return urduName; + } + + public void setUrduName(String urduName) { + this.urduName = urduName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof EthnicityDTO)) { + return false; + } + + EthnicityDTO ethnicityDTO = (EthnicityDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, ethnicityDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "EthnicityDTO{" + + "id=" + getId() + + ", name='" + getName() + "'" + + ", urduName='" + getUrduName() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimAccountsDTO.java b/src/main/java/com/scb/fimob/service/dto/FimAccountsDTO.java new file mode 100644 index 0000000..c11aec5 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimAccountsDTO.java @@ -0,0 +1,282 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimAccounts} entity. + */ +public class FimAccountsDTO implements Serializable { + + private Long id; + + private String accountId; + + @NotNull + @Size(max = 30) + private String custId; + + @NotNull + @Size(max = 30) + private String relnId; + + @NotNull + @Size(max = 5) + private String relnType; + + @Size(max = 10) + private String operInst; + + @NotNull + @Size(max = 30) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + private String bndAcctNbr; + + @Size(max = 10) + private String closingId; + + @Size(max = 10) + private String subSegment; + + @Size(max = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + private String acctStatus; + + @Size(max = 3) + private String ctryCode; + + @Size(max = 100) + private String acctOwners; + + @Size(max = 200) + private String remarks; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return relnId; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return relnType; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return operInst; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return isAcctNbr; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return bndAcctNbr; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return closingId; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return subSegment; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return branchCode; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return acctStatus; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return acctOwners; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccountsDTO)) { + return false; + } + + FimAccountsDTO fimAccountsDTO = (FimAccountsDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimAccountsDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccountsDTO{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimAccountsHistoryDTO.java b/src/main/java/com/scb/fimob/service/dto/FimAccountsHistoryDTO.java new file mode 100644 index 0000000..cc3f76b --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimAccountsHistoryDTO.java @@ -0,0 +1,293 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimAccountsHistory} entity. + */ +public class FimAccountsHistoryDTO implements Serializable { + + private Long id; + + private String accountId; + + private Instant historyTs; + + @NotNull + @Size(max = 30) + private String custId; + + @NotNull + @Size(max = 30) + private String relnId; + + @NotNull + @Size(max = 5) + private String relnType; + + @Size(max = 10) + private String operInst; + + @NotNull + @Size(max = 30) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + private String bndAcctNbr; + + @Size(max = 10) + private String closingId; + + @Size(max = 10) + private String subSegment; + + @Size(max = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + private String acctStatus; + + @Size(max = 3) + private String ctryCode; + + @Size(max = 100) + private String acctOwners; + + @Size(max = 200) + private String remarks; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public Instant getHistoryTs() { + return historyTs; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return relnId; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return relnType; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return operInst; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return isAcctNbr; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return bndAcctNbr; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return closingId; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return subSegment; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return branchCode; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return acctStatus; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return acctOwners; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccountsHistoryDTO)) { + return false; + } + + FimAccountsHistoryDTO fimAccountsHistoryDTO = (FimAccountsHistoryDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimAccountsHistoryDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccountsHistoryDTO{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimAccountsWqDTO.java b/src/main/java/com/scb/fimob/service/dto/FimAccountsWqDTO.java new file mode 100644 index 0000000..2d0f270 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimAccountsWqDTO.java @@ -0,0 +1,293 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimAccountsWq} entity. + */ +public class FimAccountsWqDTO implements Serializable { + + private Long id; + + private String accountId; + + @NotNull + @Size(max = 30) + private String custId; + + @NotNull + @Size(max = 30) + private String relnId; + + @NotNull + @Size(max = 5) + private String relnType; + + @Size(max = 10) + private String operInst; + + @NotNull + @Size(max = 30) + private String isAcctNbr; + + @NotNull + @Size(max = 30) + private String bndAcctNbr; + + @Size(max = 10) + private String closingId; + + @Size(max = 10) + private String subSegment; + + @Size(max = 10) + private String branchCode; + + @NotNull + @Size(max = 10) + private String acctStatus; + + @Size(max = 3) + private String ctryCode; + + @Size(max = 100) + private String acctOwners; + + @Size(max = 200) + private String remarks; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + private String uploadRemark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getRelnId() { + return relnId; + } + + public void setRelnId(String relnId) { + this.relnId = relnId; + } + + public String getRelnType() { + return relnType; + } + + public void setRelnType(String relnType) { + this.relnType = relnType; + } + + public String getOperInst() { + return operInst; + } + + public void setOperInst(String operInst) { + this.operInst = operInst; + } + + public String getIsAcctNbr() { + return isAcctNbr; + } + + public void setIsAcctNbr(String isAcctNbr) { + this.isAcctNbr = isAcctNbr; + } + + public String getBndAcctNbr() { + return bndAcctNbr; + } + + public void setBndAcctNbr(String bndAcctNbr) { + this.bndAcctNbr = bndAcctNbr; + } + + public String getClosingId() { + return closingId; + } + + public void setClosingId(String closingId) { + this.closingId = closingId; + } + + public String getSubSegment() { + return subSegment; + } + + public void setSubSegment(String subSegment) { + this.subSegment = subSegment; + } + + public String getBranchCode() { + return branchCode; + } + + public void setBranchCode(String branchCode) { + this.branchCode = branchCode; + } + + public String getAcctStatus() { + return acctStatus; + } + + public void setAcctStatus(String acctStatus) { + this.acctStatus = acctStatus; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getAcctOwners() { + return acctOwners; + } + + public void setAcctOwners(String acctOwners) { + this.acctOwners = acctOwners; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return uploadRemark; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimAccountsWqDTO)) { + return false; + } + + FimAccountsWqDTO fimAccountsWqDTO = (FimAccountsWqDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimAccountsWqDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimAccountsWqDTO{" + + "id=" + getId() + + ", accountId='" + getAccountId() + "'" + + ", custId='" + getCustId() + "'" + + ", relnId='" + getRelnId() + "'" + + ", relnType='" + getRelnType() + "'" + + ", operInst='" + getOperInst() + "'" + + ", isAcctNbr='" + getIsAcctNbr() + "'" + + ", bndAcctNbr='" + getBndAcctNbr() + "'" + + ", closingId='" + getClosingId() + "'" + + ", subSegment='" + getSubSegment() + "'" + + ", branchCode='" + getBranchCode() + "'" + + ", acctStatus='" + getAcctStatus() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", acctOwners='" + getAcctOwners() + "'" + + ", remarks='" + getRemarks() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimCustDTO.java b/src/main/java/com/scb/fimob/service/dto/FimCustDTO.java new file mode 100644 index 0000000..a084be6 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimCustDTO.java @@ -0,0 +1,170 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimCust} entity. + */ +public class FimCustDTO implements Serializable { + + private Long id; + + private String custId; + + @NotNull + @Size(max = 30) + private String clientId; + + @NotNull + @Size(max = 10) + private String idType; + + @NotNull + @Size(max = 3) + private String ctryCode; + + @NotNull + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + private String recordStatus; + + private String uploadRemark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return idType; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return uploadRemark; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCustDTO)) { + return false; + } + + FimCustDTO fimCustDTO = (FimCustDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimCustDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCustDTO{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimCustHistoryDTO.java b/src/main/java/com/scb/fimob/service/dto/FimCustHistoryDTO.java new file mode 100644 index 0000000..202250e --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimCustHistoryDTO.java @@ -0,0 +1,170 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimCustHistory} entity. + */ +public class FimCustHistoryDTO implements Serializable { + + private Long id; + + private String custId; + + private Instant historyTs; + + @NotNull + @Size(max = 30) + private String clientId; + + @NotNull + @Size(max = 10) + private String idType; + + @NotNull + @Size(max = 3) + private String ctryCode; + + @NotNull + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + private String recordStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public Instant getHistoryTs() { + return historyTs; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return idType; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCustHistoryDTO)) { + return false; + } + + FimCustHistoryDTO fimCustHistoryDTO = (FimCustHistoryDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimCustHistoryDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCustHistoryDTO{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimCustWqDTO.java b/src/main/java/com/scb/fimob/service/dto/FimCustWqDTO.java new file mode 100644 index 0000000..acddad2 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimCustWqDTO.java @@ -0,0 +1,170 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimCustWq} entity. + */ +public class FimCustWqDTO implements Serializable { + + private Long id; + + private String custId; + + @NotNull + @Size(max = 30) + private String clientId; + + @NotNull + @Size(max = 10) + private String idType; + + @NotNull + @Size(max = 3) + private String ctryCode; + + @NotNull + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + private String recordStatus; + + private String uploadRemark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustId() { + return custId; + } + + public void setCustId(String custId) { + this.custId = custId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getIdType() { + return idType; + } + + public void setIdType(String idType) { + this.idType = idType; + } + + public String getCtryCode() { + return ctryCode; + } + + public void setCtryCode(String ctryCode) { + this.ctryCode = ctryCode; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return uploadRemark; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimCustWqDTO)) { + return false; + } + + FimCustWqDTO fimCustWqDTO = (FimCustWqDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimCustWqDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimCustWqDTO{" + + "id=" + getId() + + ", custId='" + getCustId() + "'" + + ", clientId='" + getClientId() + "'" + + ", idType='" + getIdType() + "'" + + ", ctryCode='" + getCtryCode() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimSettAcctDTO.java b/src/main/java/com/scb/fimob/service/dto/FimSettAcctDTO.java new file mode 100644 index 0000000..3b359e2 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimSettAcctDTO.java @@ -0,0 +1,172 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimSettAcct} entity. + */ +public class FimSettAcctDTO implements Serializable { + + private Long id; + + private String settaccId; + + @NotNull + @Size(max = 15) + private String accountId; + + @NotNull + @Size(max = 30) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + private String settCcy; + + @NotNull + @Size(max = 10) + private String settAcctStatus; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return settaccId; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return settAcctNbr; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return settCcy; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return settAcctStatus; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcctDTO)) { + return false; + } + + FimSettAcctDTO fimSettAcctDTO = (FimSettAcctDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimSettAcctDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcctDTO{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTO.java b/src/main/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTO.java new file mode 100644 index 0000000..4d755ee --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTO.java @@ -0,0 +1,183 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimSettAcctHistory} entity. + */ +public class FimSettAcctHistoryDTO implements Serializable { + + private Long id; + + private String settaccId; + + private Instant historyTs; + + @NotNull + @Size(max = 15) + private String accountId; + + @NotNull + @Size(max = 30) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + private String settCcy; + + @NotNull + @Size(max = 10) + private String settAcctStatus; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return settaccId; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public Instant getHistoryTs() { + return historyTs; + } + + public void setHistoryTs(Instant historyTs) { + this.historyTs = historyTs; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return settAcctNbr; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return settCcy; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return settAcctStatus; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcctHistoryDTO)) { + return false; + } + + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = (FimSettAcctHistoryDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimSettAcctHistoryDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcctHistoryDTO{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", historyTs='" + getHistoryTs() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/dto/FimSettAcctWqDTO.java b/src/main/java/com/scb/fimob/service/dto/FimSettAcctWqDTO.java new file mode 100644 index 0000000..59ade92 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/dto/FimSettAcctWqDTO.java @@ -0,0 +1,183 @@ +package com.scb.fimob.service.dto; + +import java.io.Serializable; +import java.time.Instant; +import java.util.Objects; +import javax.validation.constraints.*; + +/** + * A DTO for the {@link com.scb.fimob.domain.FimSettAcctWq} entity. + */ +public class FimSettAcctWqDTO implements Serializable { + + private Long id; + + private String settaccId; + + @NotNull + @Size(max = 15) + private String accountId; + + @NotNull + @Size(max = 30) + private String settAcctNbr; + + @NotNull + @Size(max = 3) + private String settCcy; + + @NotNull + @Size(max = 10) + private String settAcctStatus; + + @Size(max = 8) + private String createdBy; + + private Instant createdTs; + + @Size(max = 8) + private String updatedBy; + + private Instant updatedTs; + + @Size(max = 10) + private String recordStatus; + + private String uploadRemark; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettaccId() { + return settaccId; + } + + public void setSettaccId(String settaccId) { + this.settaccId = settaccId; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getSettAcctNbr() { + return settAcctNbr; + } + + public void setSettAcctNbr(String settAcctNbr) { + this.settAcctNbr = settAcctNbr; + } + + public String getSettCcy() { + return settCcy; + } + + public void setSettCcy(String settCcy) { + this.settCcy = settCcy; + } + + public String getSettAcctStatus() { + return settAcctStatus; + } + + public void setSettAcctStatus(String settAcctStatus) { + this.settAcctStatus = settAcctStatus; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedTs() { + return createdTs; + } + + public void setCreatedTs(Instant createdTs) { + this.createdTs = createdTs; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public Instant getUpdatedTs() { + return updatedTs; + } + + public void setUpdatedTs(Instant updatedTs) { + this.updatedTs = updatedTs; + } + + public String getRecordStatus() { + return recordStatus; + } + + public void setRecordStatus(String recordStatus) { + this.recordStatus = recordStatus; + } + + public String getUploadRemark() { + return uploadRemark; + } + + public void setUploadRemark(String uploadRemark) { + this.uploadRemark = uploadRemark; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FimSettAcctWqDTO)) { + return false; + } + + FimSettAcctWqDTO fimSettAcctWqDTO = (FimSettAcctWqDTO) o; + if (this.id == null) { + return false; + } + return Objects.equals(this.id, fimSettAcctWqDTO.id); + } + + @Override + public int hashCode() { + return Objects.hash(this.id); + } + + // prettier-ignore + @Override + public String toString() { + return "FimSettAcctWqDTO{" + + "id=" + getId() + + ", settaccId='" + getSettaccId() + "'" + + ", accountId='" + getAccountId() + "'" + + ", settAcctNbr='" + getSettAcctNbr() + "'" + + ", settCcy='" + getSettCcy() + "'" + + ", settAcctStatus='" + getSettAcctStatus() + "'" + + ", createdBy='" + getCreatedBy() + "'" + + ", createdTs='" + getCreatedTs() + "'" + + ", updatedBy='" + getUpdatedBy() + "'" + + ", updatedTs='" + getUpdatedTs() + "'" + + ", recordStatus='" + getRecordStatus() + "'" + + ", uploadRemark='" + getUploadRemark() + "'" + + "}"; + } +} diff --git a/src/main/java/com/scb/fimob/service/mapper/EntityMapper.java b/src/main/java/com/scb/fimob/service/mapper/EntityMapper.java new file mode 100644 index 0000000..5ea4a0b --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/EntityMapper.java @@ -0,0 +1,28 @@ +package com.scb.fimob.service.mapper; + +import java.util.List; +import org.mapstruct.BeanMapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.Named; +import org.mapstruct.NullValuePropertyMappingStrategy; + +/** + * Contract for a generic dto to entity mapper. + * + * @param - DTO type parameter. + * @param - Entity type parameter. + */ + +public interface EntityMapper { + E toEntity(D dto); + + D toDto(E entity); + + List toEntity(List dtoList); + + List toDto(List entityList); + + @Named("partialUpdate") + @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) + void partialUpdate(@MappingTarget E entity, D dto); +} diff --git a/src/main/java/com/scb/fimob/service/mapper/EthnicityMapper.java b/src/main/java/com/scb/fimob/service/mapper/EthnicityMapper.java new file mode 100644 index 0000000..afa03a8 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/EthnicityMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.Ethnicity; +import com.scb.fimob.service.dto.EthnicityDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link Ethnicity} and its DTO {@link EthnicityDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface EthnicityMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapper.java new file mode 100644 index 0000000..729a248 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimAccountsHistory; +import com.scb.fimob.service.dto.FimAccountsHistoryDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimAccountsHistory} and its DTO {@link FimAccountsHistoryDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimAccountsHistoryMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimAccountsMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimAccountsMapper.java new file mode 100644 index 0000000..f641501 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimAccountsMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimAccounts; +import com.scb.fimob.service.dto.FimAccountsDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimAccounts} and its DTO {@link FimAccountsDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimAccountsMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimAccountsWqMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimAccountsWqMapper.java new file mode 100644 index 0000000..099f7ff --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimAccountsWqMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimAccountsWq; +import com.scb.fimob.service.dto.FimAccountsWqDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimAccountsWq} and its DTO {@link FimAccountsWqDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimAccountsWqMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimCustHistoryMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimCustHistoryMapper.java new file mode 100644 index 0000000..ebff720 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimCustHistoryMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimCustHistory; +import com.scb.fimob.service.dto.FimCustHistoryDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimCustHistory} and its DTO {@link FimCustHistoryDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimCustHistoryMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimCustMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimCustMapper.java new file mode 100644 index 0000000..c9927ba --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimCustMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimCust; +import com.scb.fimob.service.dto.FimCustDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimCust} and its DTO {@link FimCustDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimCustMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimCustWqMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimCustWqMapper.java new file mode 100644 index 0000000..eb44f9c --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimCustWqMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimCustWq; +import com.scb.fimob.service.dto.FimCustWqDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimCustWq} and its DTO {@link FimCustWqDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimCustWqMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapper.java new file mode 100644 index 0000000..d619720 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimSettAcctHistory; +import com.scb.fimob.service.dto.FimSettAcctHistoryDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimSettAcctHistory} and its DTO {@link FimSettAcctHistoryDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimSettAcctHistoryMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimSettAcctMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctMapper.java new file mode 100644 index 0000000..cc3d4a4 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimSettAcct; +import com.scb.fimob.service.dto.FimSettAcctDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimSettAcct} and its DTO {@link FimSettAcctDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimSettAcctMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/mapper/FimSettAcctWqMapper.java b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctWqMapper.java new file mode 100644 index 0000000..46c306c --- /dev/null +++ b/src/main/java/com/scb/fimob/service/mapper/FimSettAcctWqMapper.java @@ -0,0 +1,11 @@ +package com.scb.fimob.service.mapper; + +import com.scb.fimob.domain.FimSettAcctWq; +import com.scb.fimob.service.dto.FimSettAcctWqDTO; +import org.mapstruct.*; + +/** + * Mapper for the entity {@link FimSettAcctWq} and its DTO {@link FimSettAcctWqDTO}. + */ +@Mapper(componentModel = "spring", uses = {}) +public interface FimSettAcctWqMapper extends EntityMapper {} diff --git a/src/main/java/com/scb/fimob/service/package-info.java b/src/main/java/com/scb/fimob/service/package-info.java new file mode 100644 index 0000000..6f84ba0 --- /dev/null +++ b/src/main/java/com/scb/fimob/service/package-info.java @@ -0,0 +1,4 @@ +/** + * Service layer beans. + */ +package com.scb.fimob.service; diff --git a/src/main/java/com/scb/fimob/web/rest/EthnicityResource.java b/src/main/java/com/scb/fimob/web/rest/EthnicityResource.java new file mode 100644 index 0000000..4aa6fbd --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/EthnicityResource.java @@ -0,0 +1,174 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.EthnicityRepository; +import com.scb.fimob.service.EthnicityService; +import com.scb.fimob.service.dto.EthnicityDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.Ethnicity}. + */ +@RestController +@RequestMapping("/api") +public class EthnicityResource { + + private final Logger log = LoggerFactory.getLogger(EthnicityResource.class); + + private static final String ENTITY_NAME = "fimEthnicity"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final EthnicityService ethnicityService; + + private final EthnicityRepository ethnicityRepository; + + public EthnicityResource(EthnicityService ethnicityService, EthnicityRepository ethnicityRepository) { + this.ethnicityService = ethnicityService; + this.ethnicityRepository = ethnicityRepository; + } + + /** + * {@code POST /ethnicities} : Create a new ethnicity. + * + * @param ethnicityDTO the ethnicityDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new ethnicityDTO, or with status {@code 400 (Bad Request)} if the ethnicity has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/ethnicities") + public ResponseEntity createEthnicity(@Valid @RequestBody EthnicityDTO ethnicityDTO) throws URISyntaxException { + log.debug("REST request to save Ethnicity : {}", ethnicityDTO); + if (ethnicityDTO.getId() != null) { + throw new BadRequestAlertException("A new ethnicity cannot already have an ID", ENTITY_NAME, "idexists"); + } + EthnicityDTO result = ethnicityService.save(ethnicityDTO); + return ResponseEntity + .created(new URI("/api/ethnicities/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /ethnicities/:id} : Updates an existing ethnicity. + * + * @param id the id of the ethnicityDTO to save. + * @param ethnicityDTO the ethnicityDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ethnicityDTO, + * or with status {@code 400 (Bad Request)} if the ethnicityDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the ethnicityDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/ethnicities/{id}") + public ResponseEntity updateEthnicity( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody EthnicityDTO ethnicityDTO + ) throws URISyntaxException { + log.debug("REST request to update Ethnicity : {}, {}", id, ethnicityDTO); + if (ethnicityDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, ethnicityDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!ethnicityRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + EthnicityDTO result = ethnicityService.save(ethnicityDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, ethnicityDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /ethnicities/:id} : Partial updates given fields of an existing ethnicity, field will ignore if it is null + * + * @param id the id of the ethnicityDTO to save. + * @param ethnicityDTO the ethnicityDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated ethnicityDTO, + * or with status {@code 400 (Bad Request)} if the ethnicityDTO is not valid, + * or with status {@code 404 (Not Found)} if the ethnicityDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the ethnicityDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/ethnicities/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateEthnicity( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody EthnicityDTO ethnicityDTO + ) throws URISyntaxException { + log.debug("REST request to partial update Ethnicity partially : {}, {}", id, ethnicityDTO); + if (ethnicityDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, ethnicityDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!ethnicityRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = ethnicityService.partialUpdate(ethnicityDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, ethnicityDTO.getId().toString()) + ); + } + + /** + * {@code GET /ethnicities} : get all the ethnicities. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of ethnicities in body. + */ + @GetMapping("/ethnicities") + public List getAllEthnicities() { + log.debug("REST request to get all Ethnicities"); + return ethnicityService.findAll(); + } + + /** + * {@code GET /ethnicities/:id} : get the "id" ethnicity. + * + * @param id the id of the ethnicityDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the ethnicityDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/ethnicities/{id}") + public ResponseEntity getEthnicity(@PathVariable Long id) { + log.debug("REST request to get Ethnicity : {}", id); + Optional ethnicityDTO = ethnicityService.findOne(id); + return ResponseUtil.wrapOrNotFound(ethnicityDTO); + } + + /** + * {@code DELETE /ethnicities/:id} : delete the "id" ethnicity. + * + * @param id the id of the ethnicityDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/ethnicities/{id}") + public ResponseEntity deleteEthnicity(@PathVariable Long id) { + log.debug("REST request to delete Ethnicity : {}", id); + ethnicityService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimAccountsHistoryResource.java b/src/main/java/com/scb/fimob/web/rest/FimAccountsHistoryResource.java new file mode 100644 index 0000000..bf1e769 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimAccountsHistoryResource.java @@ -0,0 +1,178 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimAccountsHistoryRepository; +import com.scb.fimob.service.FimAccountsHistoryService; +import com.scb.fimob.service.dto.FimAccountsHistoryDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimAccountsHistory}. + */ +@RestController +@RequestMapping("/api") +public class FimAccountsHistoryResource { + + private final Logger log = LoggerFactory.getLogger(FimAccountsHistoryResource.class); + + private static final String ENTITY_NAME = "fimFimAccountsHistory"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimAccountsHistoryService fimAccountsHistoryService; + + private final FimAccountsHistoryRepository fimAccountsHistoryRepository; + + public FimAccountsHistoryResource( + FimAccountsHistoryService fimAccountsHistoryService, + FimAccountsHistoryRepository fimAccountsHistoryRepository + ) { + this.fimAccountsHistoryService = fimAccountsHistoryService; + this.fimAccountsHistoryRepository = fimAccountsHistoryRepository; + } + + /** + * {@code POST /fim-accounts-histories} : Create a new fimAccountsHistory. + * + * @param fimAccountsHistoryDTO the fimAccountsHistoryDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimAccountsHistoryDTO, or with status {@code 400 (Bad Request)} if the fimAccountsHistory has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-accounts-histories") + public ResponseEntity createFimAccountsHistory(@Valid @RequestBody FimAccountsHistoryDTO fimAccountsHistoryDTO) + throws URISyntaxException { + log.debug("REST request to save FimAccountsHistory : {}", fimAccountsHistoryDTO); + if (fimAccountsHistoryDTO.getId() != null) { + throw new BadRequestAlertException("A new fimAccountsHistory cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimAccountsHistoryDTO result = fimAccountsHistoryService.save(fimAccountsHistoryDTO); + return ResponseEntity + .created(new URI("/api/fim-accounts-histories/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-accounts-histories/:id} : Updates an existing fimAccountsHistory. + * + * @param id the id of the fimAccountsHistoryDTO to save. + * @param fimAccountsHistoryDTO the fimAccountsHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsHistoryDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-accounts-histories/{id}") + public ResponseEntity updateFimAccountsHistory( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimAccountsHistoryDTO fimAccountsHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to update FimAccountsHistory : {}, {}", id, fimAccountsHistoryDTO); + if (fimAccountsHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimAccountsHistoryDTO result = fimAccountsHistoryService.save(fimAccountsHistoryDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsHistoryDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-accounts-histories/:id} : Partial updates given fields of an existing fimAccountsHistory, field will ignore if it is null + * + * @param id the id of the fimAccountsHistoryDTO to save. + * @param fimAccountsHistoryDTO the fimAccountsHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsHistoryDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimAccountsHistoryDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-accounts-histories/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimAccountsHistory( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimAccountsHistoryDTO fimAccountsHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimAccountsHistory partially : {}, {}", id, fimAccountsHistoryDTO); + if (fimAccountsHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimAccountsHistoryService.partialUpdate(fimAccountsHistoryDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsHistoryDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-accounts-histories} : get all the fimAccountsHistories. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimAccountsHistories in body. + */ + @GetMapping("/fim-accounts-histories") + public List getAllFimAccountsHistories() { + log.debug("REST request to get all FimAccountsHistories"); + return fimAccountsHistoryService.findAll(); + } + + /** + * {@code GET /fim-accounts-histories/:id} : get the "id" fimAccountsHistory. + * + * @param id the id of the fimAccountsHistoryDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimAccountsHistoryDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-accounts-histories/{id}") + public ResponseEntity getFimAccountsHistory(@PathVariable Long id) { + log.debug("REST request to get FimAccountsHistory : {}", id); + Optional fimAccountsHistoryDTO = fimAccountsHistoryService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimAccountsHistoryDTO); + } + + /** + * {@code DELETE /fim-accounts-histories/:id} : delete the "id" fimAccountsHistory. + * + * @param id the id of the fimAccountsHistoryDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-accounts-histories/{id}") + public ResponseEntity deleteFimAccountsHistory(@PathVariable Long id) { + log.debug("REST request to delete FimAccountsHistory : {}", id); + fimAccountsHistoryService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimAccountsResource.java b/src/main/java/com/scb/fimob/web/rest/FimAccountsResource.java new file mode 100644 index 0000000..291ba1a --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimAccountsResource.java @@ -0,0 +1,174 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimAccountsRepository; +import com.scb.fimob.service.FimAccountsService; +import com.scb.fimob.service.dto.FimAccountsDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimAccounts}. + */ +@RestController +@RequestMapping("/api") +public class FimAccountsResource { + + private final Logger log = LoggerFactory.getLogger(FimAccountsResource.class); + + private static final String ENTITY_NAME = "fimFimAccounts"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimAccountsService fimAccountsService; + + private final FimAccountsRepository fimAccountsRepository; + + public FimAccountsResource(FimAccountsService fimAccountsService, FimAccountsRepository fimAccountsRepository) { + this.fimAccountsService = fimAccountsService; + this.fimAccountsRepository = fimAccountsRepository; + } + + /** + * {@code POST /fim-accounts} : Create a new fimAccounts. + * + * @param fimAccountsDTO the fimAccountsDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimAccountsDTO, or with status {@code 400 (Bad Request)} if the fimAccounts has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-accounts") + public ResponseEntity createFimAccounts(@Valid @RequestBody FimAccountsDTO fimAccountsDTO) throws URISyntaxException { + log.debug("REST request to save FimAccounts : {}", fimAccountsDTO); + if (fimAccountsDTO.getId() != null) { + throw new BadRequestAlertException("A new fimAccounts cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimAccountsDTO result = fimAccountsService.save(fimAccountsDTO); + return ResponseEntity + .created(new URI("/api/fim-accounts/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-accounts/:id} : Updates an existing fimAccounts. + * + * @param id the id of the fimAccountsDTO to save. + * @param fimAccountsDTO the fimAccountsDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-accounts/{id}") + public ResponseEntity updateFimAccounts( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimAccountsDTO fimAccountsDTO + ) throws URISyntaxException { + log.debug("REST request to update FimAccounts : {}, {}", id, fimAccountsDTO); + if (fimAccountsDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimAccountsDTO result = fimAccountsService.save(fimAccountsDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-accounts/:id} : Partial updates given fields of an existing fimAccounts, field will ignore if it is null + * + * @param id the id of the fimAccountsDTO to save. + * @param fimAccountsDTO the fimAccountsDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimAccountsDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-accounts/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimAccounts( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimAccountsDTO fimAccountsDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimAccounts partially : {}, {}", id, fimAccountsDTO); + if (fimAccountsDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimAccountsService.partialUpdate(fimAccountsDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-accounts} : get all the fimAccounts. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimAccounts in body. + */ + @GetMapping("/fim-accounts") + public List getAllFimAccounts() { + log.debug("REST request to get all FimAccounts"); + return fimAccountsService.findAll(); + } + + /** + * {@code GET /fim-accounts/:id} : get the "id" fimAccounts. + * + * @param id the id of the fimAccountsDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimAccountsDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-accounts/{id}") + public ResponseEntity getFimAccounts(@PathVariable Long id) { + log.debug("REST request to get FimAccounts : {}", id); + Optional fimAccountsDTO = fimAccountsService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimAccountsDTO); + } + + /** + * {@code DELETE /fim-accounts/:id} : delete the "id" fimAccounts. + * + * @param id the id of the fimAccountsDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-accounts/{id}") + public ResponseEntity deleteFimAccounts(@PathVariable Long id) { + log.debug("REST request to delete FimAccounts : {}", id); + fimAccountsService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimAccountsWqResource.java b/src/main/java/com/scb/fimob/web/rest/FimAccountsWqResource.java new file mode 100644 index 0000000..37bbb74 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimAccountsWqResource.java @@ -0,0 +1,175 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimAccountsWqRepository; +import com.scb.fimob.service.FimAccountsWqService; +import com.scb.fimob.service.dto.FimAccountsWqDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimAccountsWq}. + */ +@RestController +@RequestMapping("/api") +public class FimAccountsWqResource { + + private final Logger log = LoggerFactory.getLogger(FimAccountsWqResource.class); + + private static final String ENTITY_NAME = "fimFimAccountsWq"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimAccountsWqService fimAccountsWqService; + + private final FimAccountsWqRepository fimAccountsWqRepository; + + public FimAccountsWqResource(FimAccountsWqService fimAccountsWqService, FimAccountsWqRepository fimAccountsWqRepository) { + this.fimAccountsWqService = fimAccountsWqService; + this.fimAccountsWqRepository = fimAccountsWqRepository; + } + + /** + * {@code POST /fim-accounts-wqs} : Create a new fimAccountsWq. + * + * @param fimAccountsWqDTO the fimAccountsWqDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimAccountsWqDTO, or with status {@code 400 (Bad Request)} if the fimAccountsWq has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-accounts-wqs") + public ResponseEntity createFimAccountsWq(@Valid @RequestBody FimAccountsWqDTO fimAccountsWqDTO) + throws URISyntaxException { + log.debug("REST request to save FimAccountsWq : {}", fimAccountsWqDTO); + if (fimAccountsWqDTO.getId() != null) { + throw new BadRequestAlertException("A new fimAccountsWq cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimAccountsWqDTO result = fimAccountsWqService.save(fimAccountsWqDTO); + return ResponseEntity + .created(new URI("/api/fim-accounts-wqs/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-accounts-wqs/:id} : Updates an existing fimAccountsWq. + * + * @param id the id of the fimAccountsWqDTO to save. + * @param fimAccountsWqDTO the fimAccountsWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsWqDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsWqDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-accounts-wqs/{id}") + public ResponseEntity updateFimAccountsWq( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimAccountsWqDTO fimAccountsWqDTO + ) throws URISyntaxException { + log.debug("REST request to update FimAccountsWq : {}, {}", id, fimAccountsWqDTO); + if (fimAccountsWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimAccountsWqDTO result = fimAccountsWqService.save(fimAccountsWqDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsWqDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-accounts-wqs/:id} : Partial updates given fields of an existing fimAccountsWq, field will ignore if it is null + * + * @param id the id of the fimAccountsWqDTO to save. + * @param fimAccountsWqDTO the fimAccountsWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimAccountsWqDTO, + * or with status {@code 400 (Bad Request)} if the fimAccountsWqDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimAccountsWqDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimAccountsWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-accounts-wqs/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimAccountsWq( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimAccountsWqDTO fimAccountsWqDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimAccountsWq partially : {}, {}", id, fimAccountsWqDTO); + if (fimAccountsWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimAccountsWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimAccountsWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimAccountsWqService.partialUpdate(fimAccountsWqDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimAccountsWqDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-accounts-wqs} : get all the fimAccountsWqs. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimAccountsWqs in body. + */ + @GetMapping("/fim-accounts-wqs") + public List getAllFimAccountsWqs() { + log.debug("REST request to get all FimAccountsWqs"); + return fimAccountsWqService.findAll(); + } + + /** + * {@code GET /fim-accounts-wqs/:id} : get the "id" fimAccountsWq. + * + * @param id the id of the fimAccountsWqDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimAccountsWqDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-accounts-wqs/{id}") + public ResponseEntity getFimAccountsWq(@PathVariable Long id) { + log.debug("REST request to get FimAccountsWq : {}", id); + Optional fimAccountsWqDTO = fimAccountsWqService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimAccountsWqDTO); + } + + /** + * {@code DELETE /fim-accounts-wqs/:id} : delete the "id" fimAccountsWq. + * + * @param id the id of the fimAccountsWqDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-accounts-wqs/{id}") + public ResponseEntity deleteFimAccountsWq(@PathVariable Long id) { + log.debug("REST request to delete FimAccountsWq : {}", id); + fimAccountsWqService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimCustHistoryResource.java b/src/main/java/com/scb/fimob/web/rest/FimCustHistoryResource.java new file mode 100644 index 0000000..8d2aa33 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimCustHistoryResource.java @@ -0,0 +1,175 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimCustHistoryRepository; +import com.scb.fimob.service.FimCustHistoryService; +import com.scb.fimob.service.dto.FimCustHistoryDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimCustHistory}. + */ +@RestController +@RequestMapping("/api") +public class FimCustHistoryResource { + + private final Logger log = LoggerFactory.getLogger(FimCustHistoryResource.class); + + private static final String ENTITY_NAME = "fimFimCustHistory"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimCustHistoryService fimCustHistoryService; + + private final FimCustHistoryRepository fimCustHistoryRepository; + + public FimCustHistoryResource(FimCustHistoryService fimCustHistoryService, FimCustHistoryRepository fimCustHistoryRepository) { + this.fimCustHistoryService = fimCustHistoryService; + this.fimCustHistoryRepository = fimCustHistoryRepository; + } + + /** + * {@code POST /fim-cust-histories} : Create a new fimCustHistory. + * + * @param fimCustHistoryDTO the fimCustHistoryDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimCustHistoryDTO, or with status {@code 400 (Bad Request)} if the fimCustHistory has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-cust-histories") + public ResponseEntity createFimCustHistory(@Valid @RequestBody FimCustHistoryDTO fimCustHistoryDTO) + throws URISyntaxException { + log.debug("REST request to save FimCustHistory : {}", fimCustHistoryDTO); + if (fimCustHistoryDTO.getId() != null) { + throw new BadRequestAlertException("A new fimCustHistory cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimCustHistoryDTO result = fimCustHistoryService.save(fimCustHistoryDTO); + return ResponseEntity + .created(new URI("/api/fim-cust-histories/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-cust-histories/:id} : Updates an existing fimCustHistory. + * + * @param id the id of the fimCustHistoryDTO to save. + * @param fimCustHistoryDTO the fimCustHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimCustHistoryDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimCustHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-cust-histories/{id}") + public ResponseEntity updateFimCustHistory( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimCustHistoryDTO fimCustHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to update FimCustHistory : {}, {}", id, fimCustHistoryDTO); + if (fimCustHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimCustHistoryDTO result = fimCustHistoryService.save(fimCustHistoryDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustHistoryDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-cust-histories/:id} : Partial updates given fields of an existing fimCustHistory, field will ignore if it is null + * + * @param id the id of the fimCustHistoryDTO to save. + * @param fimCustHistoryDTO the fimCustHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimCustHistoryDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimCustHistoryDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimCustHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-cust-histories/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimCustHistory( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimCustHistoryDTO fimCustHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimCustHistory partially : {}, {}", id, fimCustHistoryDTO); + if (fimCustHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimCustHistoryService.partialUpdate(fimCustHistoryDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustHistoryDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-cust-histories} : get all the fimCustHistories. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimCustHistories in body. + */ + @GetMapping("/fim-cust-histories") + public List getAllFimCustHistories() { + log.debug("REST request to get all FimCustHistories"); + return fimCustHistoryService.findAll(); + } + + /** + * {@code GET /fim-cust-histories/:id} : get the "id" fimCustHistory. + * + * @param id the id of the fimCustHistoryDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimCustHistoryDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-cust-histories/{id}") + public ResponseEntity getFimCustHistory(@PathVariable Long id) { + log.debug("REST request to get FimCustHistory : {}", id); + Optional fimCustHistoryDTO = fimCustHistoryService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimCustHistoryDTO); + } + + /** + * {@code DELETE /fim-cust-histories/:id} : delete the "id" fimCustHistory. + * + * @param id the id of the fimCustHistoryDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-cust-histories/{id}") + public ResponseEntity deleteFimCustHistory(@PathVariable Long id) { + log.debug("REST request to delete FimCustHistory : {}", id); + fimCustHistoryService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimCustResource.java b/src/main/java/com/scb/fimob/web/rest/FimCustResource.java new file mode 100644 index 0000000..672022a --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimCustResource.java @@ -0,0 +1,183 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimCustRepository; +import com.scb.fimob.service.FimCustService; +import com.scb.fimob.service.dto.FimCustDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.PaginationUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimCust}. + */ +@RestController +@RequestMapping("/api") +public class FimCustResource { + + private final Logger log = LoggerFactory.getLogger(FimCustResource.class); + + private static final String ENTITY_NAME = "fimFimCust"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimCustService fimCustService; + + private final FimCustRepository fimCustRepository; + + public FimCustResource(FimCustService fimCustService, FimCustRepository fimCustRepository) { + this.fimCustService = fimCustService; + this.fimCustRepository = fimCustRepository; + } + + /** + * {@code POST /fim-custs} : Create a new fimCust. + * + * @param fimCustDTO the fimCustDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimCustDTO, or with status {@code 400 (Bad Request)} if the fimCust has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-custs") + public ResponseEntity createFimCust(@Valid @RequestBody FimCustDTO fimCustDTO) throws URISyntaxException { + log.debug("REST request to save FimCust : {}", fimCustDTO); + if (fimCustDTO.getId() != null) { + throw new BadRequestAlertException("A new fimCust cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimCustDTO result = fimCustService.save(fimCustDTO); + return ResponseEntity + .created(new URI("/api/fim-custs/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-custs/:id} : Updates an existing fimCust. + * + * @param id the id of the fimCustDTO to save. + * @param fimCustDTO the fimCustDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustDTO, + * or with status {@code 400 (Bad Request)} if the fimCustDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimCustDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-custs/{id}") + public ResponseEntity updateFimCust( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimCustDTO fimCustDTO + ) throws URISyntaxException { + log.debug("REST request to update FimCust : {}, {}", id, fimCustDTO); + if (fimCustDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimCustDTO result = fimCustService.save(fimCustDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-custs/:id} : Partial updates given fields of an existing fimCust, field will ignore if it is null + * + * @param id the id of the fimCustDTO to save. + * @param fimCustDTO the fimCustDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustDTO, + * or with status {@code 400 (Bad Request)} if the fimCustDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimCustDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimCustDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-custs/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimCust( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimCustDTO fimCustDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimCust partially : {}, {}", id, fimCustDTO); + if (fimCustDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimCustService.partialUpdate(fimCustDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-custs} : get all the fimCusts. + * + * @param pageable the pagination information. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimCusts in body. + */ + @GetMapping("/fim-custs") + public ResponseEntity> getAllFimCusts(@org.springdoc.api.annotations.ParameterObject Pageable pageable) { + log.debug("REST request to get a page of FimCusts"); + Page page = fimCustService.findAll(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); + return ResponseEntity.ok().headers(headers).body(page.getContent()); + } + + /** + * {@code GET /fim-custs/:id} : get the "id" fimCust. + * + * @param id the id of the fimCustDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimCustDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-custs/{id}") + public ResponseEntity getFimCust(@PathVariable Long id) { + log.debug("REST request to get FimCust : {}", id); + Optional fimCustDTO = fimCustService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimCustDTO); + } + + /** + * {@code DELETE /fim-custs/:id} : delete the "id" fimCust. + * + * @param id the id of the fimCustDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-custs/{id}") + public ResponseEntity deleteFimCust(@PathVariable Long id) { + log.debug("REST request to delete FimCust : {}", id); + fimCustService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimCustWqResource.java b/src/main/java/com/scb/fimob/web/rest/FimCustWqResource.java new file mode 100644 index 0000000..85e537f --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimCustWqResource.java @@ -0,0 +1,174 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimCustWqRepository; +import com.scb.fimob.service.FimCustWqService; +import com.scb.fimob.service.dto.FimCustWqDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimCustWq}. + */ +@RestController +@RequestMapping("/api") +public class FimCustWqResource { + + private final Logger log = LoggerFactory.getLogger(FimCustWqResource.class); + + private static final String ENTITY_NAME = "fimFimCustWq"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimCustWqService fimCustWqService; + + private final FimCustWqRepository fimCustWqRepository; + + public FimCustWqResource(FimCustWqService fimCustWqService, FimCustWqRepository fimCustWqRepository) { + this.fimCustWqService = fimCustWqService; + this.fimCustWqRepository = fimCustWqRepository; + } + + /** + * {@code POST /fim-cust-wqs} : Create a new fimCustWq. + * + * @param fimCustWqDTO the fimCustWqDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimCustWqDTO, or with status {@code 400 (Bad Request)} if the fimCustWq has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-cust-wqs") + public ResponseEntity createFimCustWq(@Valid @RequestBody FimCustWqDTO fimCustWqDTO) throws URISyntaxException { + log.debug("REST request to save FimCustWq : {}", fimCustWqDTO); + if (fimCustWqDTO.getId() != null) { + throw new BadRequestAlertException("A new fimCustWq cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimCustWqDTO result = fimCustWqService.save(fimCustWqDTO); + return ResponseEntity + .created(new URI("/api/fim-cust-wqs/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-cust-wqs/:id} : Updates an existing fimCustWq. + * + * @param id the id of the fimCustWqDTO to save. + * @param fimCustWqDTO the fimCustWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustWqDTO, + * or with status {@code 400 (Bad Request)} if the fimCustWqDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimCustWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-cust-wqs/{id}") + public ResponseEntity updateFimCustWq( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimCustWqDTO fimCustWqDTO + ) throws URISyntaxException { + log.debug("REST request to update FimCustWq : {}, {}", id, fimCustWqDTO); + if (fimCustWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimCustWqDTO result = fimCustWqService.save(fimCustWqDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustWqDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-cust-wqs/:id} : Partial updates given fields of an existing fimCustWq, field will ignore if it is null + * + * @param id the id of the fimCustWqDTO to save. + * @param fimCustWqDTO the fimCustWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimCustWqDTO, + * or with status {@code 400 (Bad Request)} if the fimCustWqDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimCustWqDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimCustWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-cust-wqs/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimCustWq( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimCustWqDTO fimCustWqDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimCustWq partially : {}, {}", id, fimCustWqDTO); + if (fimCustWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimCustWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimCustWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimCustWqService.partialUpdate(fimCustWqDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimCustWqDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-cust-wqs} : get all the fimCustWqs. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimCustWqs in body. + */ + @GetMapping("/fim-cust-wqs") + public List getAllFimCustWqs() { + log.debug("REST request to get all FimCustWqs"); + return fimCustWqService.findAll(); + } + + /** + * {@code GET /fim-cust-wqs/:id} : get the "id" fimCustWq. + * + * @param id the id of the fimCustWqDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimCustWqDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-cust-wqs/{id}") + public ResponseEntity getFimCustWq(@PathVariable Long id) { + log.debug("REST request to get FimCustWq : {}", id); + Optional fimCustWqDTO = fimCustWqService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimCustWqDTO); + } + + /** + * {@code DELETE /fim-cust-wqs/:id} : delete the "id" fimCustWq. + * + * @param id the id of the fimCustWqDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-cust-wqs/{id}") + public ResponseEntity deleteFimCustWq(@PathVariable Long id) { + log.debug("REST request to delete FimCustWq : {}", id); + fimCustWqService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimSettAcctHistoryResource.java b/src/main/java/com/scb/fimob/web/rest/FimSettAcctHistoryResource.java new file mode 100644 index 0000000..105e673 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimSettAcctHistoryResource.java @@ -0,0 +1,178 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimSettAcctHistoryRepository; +import com.scb.fimob.service.FimSettAcctHistoryService; +import com.scb.fimob.service.dto.FimSettAcctHistoryDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimSettAcctHistory}. + */ +@RestController +@RequestMapping("/api") +public class FimSettAcctHistoryResource { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctHistoryResource.class); + + private static final String ENTITY_NAME = "fimFimSettAcctHistory"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimSettAcctHistoryService fimSettAcctHistoryService; + + private final FimSettAcctHistoryRepository fimSettAcctHistoryRepository; + + public FimSettAcctHistoryResource( + FimSettAcctHistoryService fimSettAcctHistoryService, + FimSettAcctHistoryRepository fimSettAcctHistoryRepository + ) { + this.fimSettAcctHistoryService = fimSettAcctHistoryService; + this.fimSettAcctHistoryRepository = fimSettAcctHistoryRepository; + } + + /** + * {@code POST /fim-sett-acct-histories} : Create a new fimSettAcctHistory. + * + * @param fimSettAcctHistoryDTO the fimSettAcctHistoryDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimSettAcctHistoryDTO, or with status {@code 400 (Bad Request)} if the fimSettAcctHistory has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-sett-acct-histories") + public ResponseEntity createFimSettAcctHistory(@Valid @RequestBody FimSettAcctHistoryDTO fimSettAcctHistoryDTO) + throws URISyntaxException { + log.debug("REST request to save FimSettAcctHistory : {}", fimSettAcctHistoryDTO); + if (fimSettAcctHistoryDTO.getId() != null) { + throw new BadRequestAlertException("A new fimSettAcctHistory cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimSettAcctHistoryDTO result = fimSettAcctHistoryService.save(fimSettAcctHistoryDTO); + return ResponseEntity + .created(new URI("/api/fim-sett-acct-histories/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-sett-acct-histories/:id} : Updates an existing fimSettAcctHistory. + * + * @param id the id of the fimSettAcctHistoryDTO to save. + * @param fimSettAcctHistoryDTO the fimSettAcctHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctHistoryDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-sett-acct-histories/{id}") + public ResponseEntity updateFimSettAcctHistory( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimSettAcctHistoryDTO fimSettAcctHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to update FimSettAcctHistory : {}, {}", id, fimSettAcctHistoryDTO); + if (fimSettAcctHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimSettAcctHistoryDTO result = fimSettAcctHistoryService.save(fimSettAcctHistoryDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctHistoryDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-sett-acct-histories/:id} : Partial updates given fields of an existing fimSettAcctHistory, field will ignore if it is null + * + * @param id the id of the fimSettAcctHistoryDTO to save. + * @param fimSettAcctHistoryDTO the fimSettAcctHistoryDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctHistoryDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctHistoryDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimSettAcctHistoryDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctHistoryDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-sett-acct-histories/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimSettAcctHistory( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimSettAcctHistoryDTO fimSettAcctHistoryDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimSettAcctHistory partially : {}, {}", id, fimSettAcctHistoryDTO); + if (fimSettAcctHistoryDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctHistoryDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctHistoryRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimSettAcctHistoryService.partialUpdate(fimSettAcctHistoryDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctHistoryDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-sett-acct-histories} : get all the fimSettAcctHistories. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimSettAcctHistories in body. + */ + @GetMapping("/fim-sett-acct-histories") + public List getAllFimSettAcctHistories() { + log.debug("REST request to get all FimSettAcctHistories"); + return fimSettAcctHistoryService.findAll(); + } + + /** + * {@code GET /fim-sett-acct-histories/:id} : get the "id" fimSettAcctHistory. + * + * @param id the id of the fimSettAcctHistoryDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimSettAcctHistoryDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-sett-acct-histories/{id}") + public ResponseEntity getFimSettAcctHistory(@PathVariable Long id) { + log.debug("REST request to get FimSettAcctHistory : {}", id); + Optional fimSettAcctHistoryDTO = fimSettAcctHistoryService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimSettAcctHistoryDTO); + } + + /** + * {@code DELETE /fim-sett-acct-histories/:id} : delete the "id" fimSettAcctHistory. + * + * @param id the id of the fimSettAcctHistoryDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-sett-acct-histories/{id}") + public ResponseEntity deleteFimSettAcctHistory(@PathVariable Long id) { + log.debug("REST request to delete FimSettAcctHistory : {}", id); + fimSettAcctHistoryService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimSettAcctResource.java b/src/main/java/com/scb/fimob/web/rest/FimSettAcctResource.java new file mode 100644 index 0000000..4ce5c2d --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimSettAcctResource.java @@ -0,0 +1,183 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimSettAcctRepository; +import com.scb.fimob.service.FimSettAcctService; +import com.scb.fimob.service.dto.FimSettAcctDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.PaginationUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimSettAcct}. + */ +@RestController +@RequestMapping("/api") +public class FimSettAcctResource { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctResource.class); + + private static final String ENTITY_NAME = "fimFimSettAcct"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimSettAcctService fimSettAcctService; + + private final FimSettAcctRepository fimSettAcctRepository; + + public FimSettAcctResource(FimSettAcctService fimSettAcctService, FimSettAcctRepository fimSettAcctRepository) { + this.fimSettAcctService = fimSettAcctService; + this.fimSettAcctRepository = fimSettAcctRepository; + } + + /** + * {@code POST /fim-sett-accts} : Create a new fimSettAcct. + * + * @param fimSettAcctDTO the fimSettAcctDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimSettAcctDTO, or with status {@code 400 (Bad Request)} if the fimSettAcct has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-sett-accts") + public ResponseEntity createFimSettAcct(@Valid @RequestBody FimSettAcctDTO fimSettAcctDTO) throws URISyntaxException { + log.debug("REST request to save FimSettAcct : {}", fimSettAcctDTO); + if (fimSettAcctDTO.getId() != null) { + throw new BadRequestAlertException("A new fimSettAcct cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimSettAcctDTO result = fimSettAcctService.save(fimSettAcctDTO); + return ResponseEntity + .created(new URI("/api/fim-sett-accts/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-sett-accts/:id} : Updates an existing fimSettAcct. + * + * @param id the id of the fimSettAcctDTO to save. + * @param fimSettAcctDTO the fimSettAcctDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-sett-accts/{id}") + public ResponseEntity updateFimSettAcct( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimSettAcctDTO fimSettAcctDTO + ) throws URISyntaxException { + log.debug("REST request to update FimSettAcct : {}, {}", id, fimSettAcctDTO); + if (fimSettAcctDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimSettAcctDTO result = fimSettAcctService.save(fimSettAcctDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-sett-accts/:id} : Partial updates given fields of an existing fimSettAcct, field will ignore if it is null + * + * @param id the id of the fimSettAcctDTO to save. + * @param fimSettAcctDTO the fimSettAcctDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimSettAcctDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-sett-accts/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimSettAcct( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimSettAcctDTO fimSettAcctDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimSettAcct partially : {}, {}", id, fimSettAcctDTO); + if (fimSettAcctDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimSettAcctService.partialUpdate(fimSettAcctDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-sett-accts} : get all the fimSettAccts. + * + * @param pageable the pagination information. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimSettAccts in body. + */ + @GetMapping("/fim-sett-accts") + public ResponseEntity> getAllFimSettAccts(@org.springdoc.api.annotations.ParameterObject Pageable pageable) { + log.debug("REST request to get a page of FimSettAccts"); + Page page = fimSettAcctService.findAll(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); + return ResponseEntity.ok().headers(headers).body(page.getContent()); + } + + /** + * {@code GET /fim-sett-accts/:id} : get the "id" fimSettAcct. + * + * @param id the id of the fimSettAcctDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimSettAcctDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-sett-accts/{id}") + public ResponseEntity getFimSettAcct(@PathVariable Long id) { + log.debug("REST request to get FimSettAcct : {}", id); + Optional fimSettAcctDTO = fimSettAcctService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimSettAcctDTO); + } + + /** + * {@code DELETE /fim-sett-accts/:id} : delete the "id" fimSettAcct. + * + * @param id the id of the fimSettAcctDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-sett-accts/{id}") + public ResponseEntity deleteFimSettAcct(@PathVariable Long id) { + log.debug("REST request to delete FimSettAcct : {}", id); + fimSettAcctService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/FimSettAcctWqResource.java b/src/main/java/com/scb/fimob/web/rest/FimSettAcctWqResource.java new file mode 100644 index 0000000..8d90ef8 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/FimSettAcctWqResource.java @@ -0,0 +1,175 @@ +package com.scb.fimob.web.rest; + +import com.scb.fimob.repository.FimSettAcctWqRepository; +import com.scb.fimob.service.FimSettAcctWqService; +import com.scb.fimob.service.dto.FimSettAcctWqDTO; +import com.scb.fimob.web.rest.errors.BadRequestAlertException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing {@link com.scb.fimob.domain.FimSettAcctWq}. + */ +@RestController +@RequestMapping("/api") +public class FimSettAcctWqResource { + + private final Logger log = LoggerFactory.getLogger(FimSettAcctWqResource.class); + + private static final String ENTITY_NAME = "fimFimSettAcctWq"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final FimSettAcctWqService fimSettAcctWqService; + + private final FimSettAcctWqRepository fimSettAcctWqRepository; + + public FimSettAcctWqResource(FimSettAcctWqService fimSettAcctWqService, FimSettAcctWqRepository fimSettAcctWqRepository) { + this.fimSettAcctWqService = fimSettAcctWqService; + this.fimSettAcctWqRepository = fimSettAcctWqRepository; + } + + /** + * {@code POST /fim-sett-acct-wqs} : Create a new fimSettAcctWq. + * + * @param fimSettAcctWqDTO the fimSettAcctWqDTO to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new fimSettAcctWqDTO, or with status {@code 400 (Bad Request)} if the fimSettAcctWq has already an ID. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PostMapping("/fim-sett-acct-wqs") + public ResponseEntity createFimSettAcctWq(@Valid @RequestBody FimSettAcctWqDTO fimSettAcctWqDTO) + throws URISyntaxException { + log.debug("REST request to save FimSettAcctWq : {}", fimSettAcctWqDTO); + if (fimSettAcctWqDTO.getId() != null) { + throw new BadRequestAlertException("A new fimSettAcctWq cannot already have an ID", ENTITY_NAME, "idexists"); + } + FimSettAcctWqDTO result = fimSettAcctWqService.save(fimSettAcctWqDTO); + return ResponseEntity + .created(new URI("/api/fim-sett-acct-wqs/" + result.getId())) + .headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString())) + .body(result); + } + + /** + * {@code PUT /fim-sett-acct-wqs/:id} : Updates an existing fimSettAcctWq. + * + * @param id the id of the fimSettAcctWqDTO to save. + * @param fimSettAcctWqDTO the fimSettAcctWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctWqDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctWqDTO is not valid, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PutMapping("/fim-sett-acct-wqs/{id}") + public ResponseEntity updateFimSettAcctWq( + @PathVariable(value = "id", required = false) final Long id, + @Valid @RequestBody FimSettAcctWqDTO fimSettAcctWqDTO + ) throws URISyntaxException { + log.debug("REST request to update FimSettAcctWq : {}, {}", id, fimSettAcctWqDTO); + if (fimSettAcctWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + FimSettAcctWqDTO result = fimSettAcctWqService.save(fimSettAcctWqDTO); + return ResponseEntity + .ok() + .headers(HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctWqDTO.getId().toString())) + .body(result); + } + + /** + * {@code PATCH /fim-sett-acct-wqs/:id} : Partial updates given fields of an existing fimSettAcctWq, field will ignore if it is null + * + * @param id the id of the fimSettAcctWqDTO to save. + * @param fimSettAcctWqDTO the fimSettAcctWqDTO to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated fimSettAcctWqDTO, + * or with status {@code 400 (Bad Request)} if the fimSettAcctWqDTO is not valid, + * or with status {@code 404 (Not Found)} if the fimSettAcctWqDTO is not found, + * or with status {@code 500 (Internal Server Error)} if the fimSettAcctWqDTO couldn't be updated. + * @throws URISyntaxException if the Location URI syntax is incorrect. + */ + @PatchMapping(value = "/fim-sett-acct-wqs/{id}", consumes = { "application/json", "application/merge-patch+json" }) + public ResponseEntity partialUpdateFimSettAcctWq( + @PathVariable(value = "id", required = false) final Long id, + @NotNull @RequestBody FimSettAcctWqDTO fimSettAcctWqDTO + ) throws URISyntaxException { + log.debug("REST request to partial update FimSettAcctWq partially : {}, {}", id, fimSettAcctWqDTO); + if (fimSettAcctWqDTO.getId() == null) { + throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); + } + if (!Objects.equals(id, fimSettAcctWqDTO.getId())) { + throw new BadRequestAlertException("Invalid ID", ENTITY_NAME, "idinvalid"); + } + + if (!fimSettAcctWqRepository.existsById(id)) { + throw new BadRequestAlertException("Entity not found", ENTITY_NAME, "idnotfound"); + } + + Optional result = fimSettAcctWqService.partialUpdate(fimSettAcctWqDTO); + + return ResponseUtil.wrapOrNotFound( + result, + HeaderUtil.createEntityUpdateAlert(applicationName, true, ENTITY_NAME, fimSettAcctWqDTO.getId().toString()) + ); + } + + /** + * {@code GET /fim-sett-acct-wqs} : get all the fimSettAcctWqs. + * + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of fimSettAcctWqs in body. + */ + @GetMapping("/fim-sett-acct-wqs") + public List getAllFimSettAcctWqs() { + log.debug("REST request to get all FimSettAcctWqs"); + return fimSettAcctWqService.findAll(); + } + + /** + * {@code GET /fim-sett-acct-wqs/:id} : get the "id" fimSettAcctWq. + * + * @param id the id of the fimSettAcctWqDTO to retrieve. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the fimSettAcctWqDTO, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/fim-sett-acct-wqs/{id}") + public ResponseEntity getFimSettAcctWq(@PathVariable Long id) { + log.debug("REST request to get FimSettAcctWq : {}", id); + Optional fimSettAcctWqDTO = fimSettAcctWqService.findOne(id); + return ResponseUtil.wrapOrNotFound(fimSettAcctWqDTO); + } + + /** + * {@code DELETE /fim-sett-acct-wqs/:id} : delete the "id" fimSettAcctWq. + * + * @param id the id of the fimSettAcctWqDTO to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/fim-sett-acct-wqs/{id}") + public ResponseEntity deleteFimSettAcctWq(@PathVariable Long id) { + log.debug("REST request to delete FimSettAcctWq : {}", id); + fimSettAcctWqService.delete(id); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, ENTITY_NAME, id.toString())) + .build(); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/errors/BadRequestAlertException.java b/src/main/java/com/scb/fimob/web/rest/errors/BadRequestAlertException.java new file mode 100644 index 0000000..1e11448 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/errors/BadRequestAlertException.java @@ -0,0 +1,41 @@ +package com.scb.fimob.web.rest.errors; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; +import org.zalando.problem.AbstractThrowableProblem; +import org.zalando.problem.Status; + +public class BadRequestAlertException extends AbstractThrowableProblem { + + private static final long serialVersionUID = 1L; + + private final String entityName; + + private final String errorKey; + + public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { + this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); + } + + public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { + super(type, defaultMessage, Status.BAD_REQUEST, null, null, null, getAlertParameters(entityName, errorKey)); + this.entityName = entityName; + this.errorKey = errorKey; + } + + public String getEntityName() { + return entityName; + } + + public String getErrorKey() { + return errorKey; + } + + private static Map getAlertParameters(String entityName, String errorKey) { + Map parameters = new HashMap<>(); + parameters.put("message", "error." + errorKey); + parameters.put("params", entityName); + return parameters; + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/errors/ErrorConstants.java b/src/main/java/com/scb/fimob/web/rest/errors/ErrorConstants.java new file mode 100644 index 0000000..ef5b9a0 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/errors/ErrorConstants.java @@ -0,0 +1,14 @@ +package com.scb.fimob.web.rest.errors; + +import java.net.URI; + +public final class ErrorConstants { + + public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; + public static final String ERR_VALIDATION = "error.validation"; + public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; + public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); + public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); + + private ErrorConstants() {} +} diff --git a/src/main/java/com/scb/fimob/web/rest/errors/ExceptionTranslator.java b/src/main/java/com/scb/fimob/web/rest/errors/ExceptionTranslator.java new file mode 100644 index 0000000..293a6e8 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/errors/ExceptionTranslator.java @@ -0,0 +1,188 @@ +package com.scb.fimob.web.rest.errors; + +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.servlet.http.HttpServletRequest; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.dao.DataAccessException; +import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageConversionException; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.NativeWebRequest; +import org.zalando.problem.DefaultProblem; +import org.zalando.problem.Problem; +import org.zalando.problem.ProblemBuilder; +import org.zalando.problem.Status; +import org.zalando.problem.StatusType; +import org.zalando.problem.spring.web.advice.ProblemHandling; +import org.zalando.problem.spring.web.advice.security.SecurityAdviceTrait; +import org.zalando.problem.violations.ConstraintViolationProblem; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.web.util.HeaderUtil; + +/** + * Controller advice to translate the server side exceptions to client-friendly json structures. + * The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807). + */ +@ControllerAdvice +public class ExceptionTranslator implements ProblemHandling, SecurityAdviceTrait { + + private static final String FIELD_ERRORS_KEY = "fieldErrors"; + private static final String MESSAGE_KEY = "message"; + private static final String PATH_KEY = "path"; + private static final String VIOLATIONS_KEY = "violations"; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final Environment env; + + public ExceptionTranslator(Environment env) { + this.env = env; + } + + /** + * Post-process the Problem payload to add the message key for the front-end if needed. + */ + @Override + public ResponseEntity process(@Nullable ResponseEntity entity, NativeWebRequest request) { + if (entity == null) { + return null; + } + Problem problem = entity.getBody(); + if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) { + return entity; + } + + HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class); + String requestUri = nativeRequest != null ? nativeRequest.getRequestURI() : StringUtils.EMPTY; + ProblemBuilder builder = Problem + .builder() + .withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType()) + .withStatus(problem.getStatus()) + .withTitle(problem.getTitle()) + .with(PATH_KEY, requestUri); + + if (problem instanceof ConstraintViolationProblem) { + builder + .with(VIOLATIONS_KEY, ((ConstraintViolationProblem) problem).getViolations()) + .with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION); + } else { + builder.withCause(((DefaultProblem) problem).getCause()).withDetail(problem.getDetail()).withInstance(problem.getInstance()); + problem.getParameters().forEach(builder::with); + if (!problem.getParameters().containsKey(MESSAGE_KEY) && problem.getStatus() != null) { + builder.with(MESSAGE_KEY, "error.http." + problem.getStatus().getStatusCode()); + } + } + return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode()); + } + + @Override + public ResponseEntity handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) { + BindingResult result = ex.getBindingResult(); + List fieldErrors = result + .getFieldErrors() + .stream() + .map(f -> + new FieldErrorVM( + f.getObjectName().replaceFirst("DTO$", ""), + f.getField(), + StringUtils.isNotBlank(f.getDefaultMessage()) ? f.getDefaultMessage() : f.getCode() + ) + ) + .collect(Collectors.toList()); + + Problem problem = Problem + .builder() + .withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE) + .withTitle("Method argument not valid") + .withStatus(defaultConstraintViolationStatus()) + .with(MESSAGE_KEY, ErrorConstants.ERR_VALIDATION) + .with(FIELD_ERRORS_KEY, fieldErrors) + .build(); + return create(ex, problem, request); + } + + @ExceptionHandler + public ResponseEntity handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) { + return create( + ex, + request, + HeaderUtil.createFailureAlert(applicationName, true, ex.getEntityName(), ex.getErrorKey(), ex.getMessage()) + ); + } + + @ExceptionHandler + public ResponseEntity handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) { + Problem problem = Problem.builder().withStatus(Status.CONFLICT).with(MESSAGE_KEY, ErrorConstants.ERR_CONCURRENCY_FAILURE).build(); + return create(ex, problem, request); + } + + @Override + public ProblemBuilder prepare(final Throwable throwable, final StatusType status, final URI type) { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + if (throwable instanceof HttpMessageConversionException) { + return Problem + .builder() + .withType(type) + .withTitle(status.getReasonPhrase()) + .withStatus(status) + .withDetail("Unable to convert http message") + .withCause( + Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null) + ); + } + if (throwable instanceof DataAccessException) { + return Problem + .builder() + .withType(type) + .withTitle(status.getReasonPhrase()) + .withStatus(status) + .withDetail("Failure during data access") + .withCause( + Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null) + ); + } + if (containsPackageName(throwable.getMessage())) { + return Problem + .builder() + .withType(type) + .withTitle(status.getReasonPhrase()) + .withStatus(status) + .withDetail("Unexpected runtime exception") + .withCause( + Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null) + ); + } + } + + return Problem + .builder() + .withType(type) + .withTitle(status.getReasonPhrase()) + .withStatus(status) + .withDetail(throwable.getMessage()) + .withCause( + Optional.ofNullable(throwable.getCause()).filter(cause -> isCausalChainsEnabled()).map(this::toProblem).orElse(null) + ); + } + + private boolean containsPackageName(String message) { + // This list is for sure not complete + return StringUtils.containsAny(message, "org.", "java.", "net.", "javax.", "com.", "io.", "de.", "com.scb.fimob"); + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/errors/FieldErrorVM.java b/src/main/java/com/scb/fimob/web/rest/errors/FieldErrorVM.java new file mode 100644 index 0000000..c147a1e --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/errors/FieldErrorVM.java @@ -0,0 +1,32 @@ +package com.scb.fimob.web.rest.errors; + +import java.io.Serializable; + +public class FieldErrorVM implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String objectName; + + private final String field; + + private final String message; + + public FieldErrorVM(String dto, String field, String message) { + this.objectName = dto; + this.field = field; + this.message = message; + } + + public String getObjectName() { + return objectName; + } + + public String getField() { + return field; + } + + public String getMessage() { + return message; + } +} diff --git a/src/main/java/com/scb/fimob/web/rest/errors/package-info.java b/src/main/java/com/scb/fimob/web/rest/errors/package-info.java new file mode 100644 index 0000000..67a3418 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/errors/package-info.java @@ -0,0 +1,6 @@ +/** + * Specific errors used with Zalando's "problem-spring-web" library. + * + * More information on https://github.com/zalando/problem-spring-web + */ +package com.scb.fimob.web.rest.errors; diff --git a/src/main/java/com/scb/fimob/web/rest/package-info.java b/src/main/java/com/scb/fimob/web/rest/package-info.java new file mode 100644 index 0000000..de310a2 --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/package-info.java @@ -0,0 +1,4 @@ +/** + * Spring MVC REST controllers. + */ +package com.scb.fimob.web.rest; diff --git a/src/main/java/com/scb/fimob/web/rest/vm/package-info.java b/src/main/java/com/scb/fimob/web/rest/vm/package-info.java new file mode 100644 index 0000000..7194f5c --- /dev/null +++ b/src/main/java/com/scb/fimob/web/rest/vm/package-info.java @@ -0,0 +1,4 @@ +/** + * View Models used by Spring MVC REST controllers. + */ +package com.scb.fimob.web.rest.vm; diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 59abfef..2162059 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,5 +1,5 @@ #H2 Server Properties -0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/springboot|Springboot +0=JHipster H2 (Disk)|org.h2.Driver|jdbc\:h2\:file\:./target/h2db/db/fim|FIM webAllowOthers=true webPort=8092 webSSL=false diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 0edbfee..12dad3a 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -18,7 +18,7 @@ logging: ROOT: DEBUG tech.jhipster: DEBUG org.hibernate.SQL: DEBUG - com.sc.myapp: DEBUG + com.scb.fimob: DEBUG eureka: instance: @@ -41,14 +41,14 @@ spring: config: uri: http://admin:${jhipster.registry.password}@localhost:8761/config # name of the config server's property source (file.yml) that we want to use - name: Springboot + name: FIM profile: dev label: main # toggle to switch to a different version of the configuration as stored in git # it can be set to any label, branch or commit of the configuration source Git repository datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:h2:file:./target/h2db/db/springboot;DB_CLOSE_DELAY=-1 - username: Springboot + url: jdbc:h2:file:./target/h2db/db/fim;DB_CLOSE_DELAY=-1 + username: FIM password: hikari: poolName: Hikari @@ -91,6 +91,10 @@ server: # =================================================================== jhipster: + cache: # Cache configuration + ehcache: # Ehcache configuration + time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache + max-entries: 100 # Number of objects in each cache entry registry: password: admin # CORS is disabled by default on microservices, as you should access them through a gateway. diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml index 1898bbb..45c7ee6 100644 --- a/src/main/resources/config/application-prod.yml +++ b/src/main/resources/config/application-prod.yml @@ -17,7 +17,7 @@ logging: level: ROOT: INFO tech.jhipster: INFO - com.sc.myapp: INFO + com.scb.fimob: INFO eureka: instance: @@ -46,13 +46,13 @@ spring: max-attempts: 100 uri: http://admin:${jhipster.registry.password}@localhost:8761/config # name of the config server's property source (file.yml) that we want to use - name: Springboot + name: FIM profile: prod label: main # toggle to switch to a different version of the configuration as stored in git # it can be set to any label, branch or commit of the configuration source Git repository datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:sqlserver://localhost:1433;database=Springboot + url: jdbc:sqlserver://localhost:1433;database=FIM username: SA password: yourStrong(!)Password hikari: @@ -86,7 +86,7 @@ spring: # =================================================================== # To enable TLS in production, generate a certificate using: -# keytool -genkey -alias springboot -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 +# keytool -genkey -alias fim -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 # # You can also use Let's Encrypt: # https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm @@ -121,6 +121,10 @@ jhipster: http: cache: # Used by the CachingHttpHeadersFilter timeToLiveInDays: 1461 + cache: # Cache configuration + ehcache: # Ehcache configuration + time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache + max-entries: 1000 # Number of objects in each cache entry registry: password: admin security: diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 86abddc..c1419e7 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -34,8 +34,8 @@ eureka: instance-info-replication-interval-seconds: 10 registry-fetch-interval-seconds: 10 instance: - appname: springboot - instanceId: springboot:${spring.application.instance-id:${random.value}} + appname: fim + instanceId: fim:${spring.application.instance-id:${random.value}} lease-renewal-interval-in-seconds: 5 lease-expiration-duration-in-seconds: 10 status-page-url-path: ${management.endpoints.web.base-path}/info @@ -73,6 +73,7 @@ management: 'loggers', 'prometheus', 'threaddump', + 'caches', 'liquibase', ] endpoint: @@ -123,7 +124,7 @@ management: spring: application: - name: Springboot + name: FIM profiles: # The commented value for `active` can be replaced with valid Spring profiles to load. # Otherwise, it will be filled in by maven when building the JAR file @@ -147,7 +148,7 @@ spring: hibernate.jdbc.time_zone: UTC hibernate.id.new_generator_mappings: true hibernate.connection.provider_disables_autocommit: true - hibernate.cache.use_second_level_cache: false + hibernate.cache.use_second_level_cache: true hibernate.cache.use_query_cache: false hibernate.generate_statistics: false # modify batch size as necessary @@ -174,13 +175,13 @@ spring: matching-strategy: ant_path_matcher task: execution: - thread-name-prefix: springboot-task- + thread-name-prefix: fim-task- pool: core-size: 2 max-size: 50 queue-capacity: 10000 scheduling: - thread-name-prefix: springboot-scheduling- + thread-name-prefix: fim-scheduling- pool: size: 2 thymeleaf: @@ -211,7 +212,7 @@ info: jhipster: clientApp: - name: 'springbootApp' + name: 'fimApp' # By default CORS is disabled. Uncomment to enable. # cors: # allowed-origins: "http://localhost:8100,http://localhost:9000" @@ -221,12 +222,12 @@ jhipster: # allow-credentials: true # max-age: 1800 mail: - from: Springboot@localhost + from: FIM@localhost api-docs: default-include-pattern: ${server.servlet.context-path:}/api/** management-include-pattern: ${server.servlet.context-path:}/management/** - title: Springboot API - description: Springboot API documentation + title: FIM API + description: FIM API documentation version: 0.0.1 terms-of-service-url: contact-name: diff --git a/src/main/resources/config/bootstrap-prod.yml b/src/main/resources/config/bootstrap-prod.yml index 3a630a9..04cf144 100644 --- a/src/main/resources/config/bootstrap-prod.yml +++ b/src/main/resources/config/bootstrap-prod.yml @@ -12,7 +12,7 @@ spring: max-attempts: 100 uri: http://admin:${jhipster.registry.password}@localhost:8761/config # name of the config server's property source (file.yml) that we want to use - name: Springboot + name: FIM profile: prod # profile(s) of the property source label: main # toggle to switch to a different version of the configuration as stored in git # it can be set to any label, branch or commit of the configuration source Git repository diff --git a/src/main/resources/config/bootstrap.yml b/src/main/resources/config/bootstrap.yml index ef66608..1ca00b2 100644 --- a/src/main/resources/config/bootstrap.yml +++ b/src/main/resources/config/bootstrap.yml @@ -9,7 +9,7 @@ jhipster: spring: application: - name: Springboot + name: FIM profiles: # The commented value for `active` can be replaced with valid Spring profiles to load. # Otherwise, it will be filled in by maven when building the JAR file @@ -20,7 +20,7 @@ spring: fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config uri: http://admin:${jhipster.registry.password}@localhost:8761/config # name of the config server's property source (file.yml) that we want to use - name: Springboot + name: FIM profile: dev # profile(s) of the property source label: main # toggle to switch to a different version of the configuration as stored in git # it can be set to any label, branch or commit of the configuration source Git repository diff --git a/src/main/resources/config/liquibase/changelog/20220404084707_added_entity_FimAccounts.xml b/src/main/resources/config/liquibase/changelog/20220404084707_added_entity_FimAccounts.xml new file mode 100644 index 0000000..335573d --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084707_added_entity_FimAccounts.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084708_added_entity_FimAccountsWq.xml b/src/main/resources/config/liquibase/changelog/20220404084708_added_entity_FimAccountsWq.xml new file mode 100644 index 0000000..23b7d13 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084708_added_entity_FimAccountsWq.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084709_added_entity_FimAccountsHistory.xml b/src/main/resources/config/liquibase/changelog/20220404084709_added_entity_FimAccountsHistory.xml new file mode 100644 index 0000000..779ee86 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084709_added_entity_FimAccountsHistory.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084710_added_entity_FimSettAcct.xml b/src/main/resources/config/liquibase/changelog/20220404084710_added_entity_FimSettAcct.xml new file mode 100644 index 0000000..c287f25 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084710_added_entity_FimSettAcct.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084711_added_entity_FimSettAcctWq.xml b/src/main/resources/config/liquibase/changelog/20220404084711_added_entity_FimSettAcctWq.xml new file mode 100644 index 0000000..1b58e4b --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084711_added_entity_FimSettAcctWq.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084712_added_entity_FimSettAcctHistory.xml b/src/main/resources/config/liquibase/changelog/20220404084712_added_entity_FimSettAcctHistory.xml new file mode 100644 index 0000000..55436be --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084712_added_entity_FimSettAcctHistory.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084713_added_entity_FimCust.xml b/src/main/resources/config/liquibase/changelog/20220404084713_added_entity_FimCust.xml new file mode 100644 index 0000000..4eea049 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084713_added_entity_FimCust.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084714_added_entity_FimCustWq.xml b/src/main/resources/config/liquibase/changelog/20220404084714_added_entity_FimCustWq.xml new file mode 100644 index 0000000..f3035cd --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084714_added_entity_FimCustWq.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084715_added_entity_FimCustHistory.xml b/src/main/resources/config/liquibase/changelog/20220404084715_added_entity_FimCustHistory.xml new file mode 100644 index 0000000..83d56f9 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084715_added_entity_FimCustHistory.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/changelog/20220404084716_added_entity_Ethnicity.xml b/src/main/resources/config/liquibase/changelog/20220404084716_added_entity_Ethnicity.xml new file mode 100644 index 0000000..1bfaed9 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/20220404084716_added_entity_Ethnicity.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/fake-data/ethnicity.csv b/src/main/resources/config/liquibase/fake-data/ethnicity.csv new file mode 100644 index 0000000..cfad7e1 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/ethnicity.csv @@ -0,0 +1,11 @@ +id;name;urdu_name +1;Intuitive;Ameliorated Innovative +2;bypass virtual;Buckinghamshire solid +3;Angola architectures SMS;Hawaii +4;Operative Towels Quality-focused;SSL EXE +5;Soft Marketing;mobile +6;auxiliary portals Borders;Oklahoma Global port +7;clear-thinking;Loan compressing +8;withdrawal e-commerce;generation +9;Comoro;Vietnam +10;users compelling;Money enterprise diff --git a/src/main/resources/config/liquibase/fake-data/fim_accounts.csv b/src/main/resources/config/liquibase/fake-data/fim_accounts.csv new file mode 100644 index 0000000..0ccd5ec --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_accounts.csv @@ -0,0 +1,11 @@ +id;account_id;cust_id;reln_id;reln_type;oper_inst;is_acct_nbr;bnd_acct_nbr;closing_id;sub_segment;branch_code;acct_status;ctry_code;acct_owners;remarks;created_by;created_ts;updated_by;updated_ts;record_status +1;grey;Montana virtual quantify;rich Chicken Borders;Opera;users Buck;web-enabled;Pizza;Zimbabwe N;Account;black Fran;Shirt;HTT;Renminbi Tasty leverage;Hat Berkshire override;Automoti;2022-04-03T15:40:22;Wooden w;2022-04-04T01:49:14;Automotive +2;Diverse interface;hub;parse platforms;Court;Towels Dyn;models;Ruble AGP;Unit Burki;Applicatio;Rubber;Cheese;bri;value-added Account;navigate;evolve c;2022-04-04T05:26:28;Home Syn;2022-04-03T18:38:56;Mountains +3;open-source copy architectures;ubiquitous;Investment Representative fuch;lime ;Bolivia pa;Shirt Ocean granular;reboot Dale;Leone Isla;Manager in;Global;Handcrafte;Fre;out-of-the-box;tangible;Licensed;2022-04-03T20:40:17;Identity;2022-04-03T09:42:06;monitor po +4;Manager;black Dirham;invoice needs-based;Lakes;Integratio;Self-enabling payment;Metrics grid-enabled SMS;driver Des;IB;Checking;workforce ;Bed;Product Wooden;contingency Practical;Tugrik F;2022-04-04T07:16:25;Practica;2022-04-03T08:54:49;experience +5;Money Operations;maroon;Loan Soft synthesizing;Custo;Steel Repr;synergize Keyboard;local;niches orc;collaborat;Avenue art;Legacy Cot;pol;Oklahoma Swaziland;Automotive;Dominica;2022-04-03T18:11:01;matrix c;2022-04-04T06:24:01;implement +6;white non-volatile;SQL;services needs-based deposit;drive;deposit Pl;monitor;Avon strategic Market;extensible;vertical g;Chile Acco;Cuban pane;Woo;deposit;De-engineered Cambridgeshire;Accounta;2022-04-03T15:15:22;Rustic O;2022-04-04T02:19:31;back-end Z +7;functionalities Home;hack;Persistent Handcrafted Optimiz;suppl;Associate ;Landing;Cheese;Reactive P;Wooden;Optimizati;Djibouti J;Fun;Research Architect Arizona;Australian;monitor;2022-04-03T12:33:23;azure co;2022-04-03T09:17:26;Fantastic +8;deposit;array Face;Indiana Lev Suriname;Bucki;national b;didactic Baby Prairie;cross-media;connect;task-force;violet orc;Pizza;bes;Zealand Dalasi Small;Optimization programming interface;IB Usabi;2022-04-03T08:49:02;Sleek ca;2022-04-03T20:41:28;Cheese hap +9;Borders compressing;Metal SDD Tuna;program;matri;value-adde;metrics;cohesive Virginia;Producer C;Sleek Comp;sticky New;Consultant;Lou;Refined;mint;mindshar;2022-04-03T11:09:31;olive;2022-04-03T17:26:49;calculate +10;Home Chicken channels;South;Alley;foreg;relationsh;Comoro Refined;invoice compress Mexico;GB enterpr;Unbranded;Quality-fo;RAM AGP op;Ric;JBOD Electronics out-of-the-box;open-source Phased Car;Turnpike;2022-04-03T16:24:24;XSS Plan;2022-04-04T06:27:48;Virginia h diff --git a/src/main/resources/config/liquibase/fake-data/fim_accounts_history.csv b/src/main/resources/config/liquibase/fake-data/fim_accounts_history.csv new file mode 100644 index 0000000..12548ef --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_accounts_history.csv @@ -0,0 +1,11 @@ +id;account_id;history_ts;cust_id;reln_id;reln_type;oper_inst;is_acct_nbr;bnd_acct_nbr;closing_id;sub_segment;branch_code;acct_status;ctry_code;acct_owners;remarks;created_by;created_ts;updated_by;updated_ts;record_status +1;Gorgeous;2022-04-04T04:14:54;Mouse;Granite structure;Accou;Function-b;Chair clear-thinking haptic;frame Facilitator wireless;Bedfordshi;Associate;Awesome Ir;Cross-grou;tra;Developer;multi-byte Rest;protocol;2022-04-04T07:48:11;Fantasti;2022-04-03T12:17:18;tolerance +2;protocol;2022-04-03T13:52:00;Green;Fresh Kyat;Rever;face reinv;Research Credit;Markets Manat transmit;Synergized;input;parsing;backing Gl;Sho;silver;Rico Fresh Books;Bypass M;2022-04-04T01:36:15;transmit;2022-04-04T05:03:46;auxiliary +3;Lesotho;2022-04-04T08:37:07;quantifying Cambridgeshire;Agent engage;COM;calculatin;Refined;Cambridgeshire Group Pants;quantify;enhance;backing;Jewelery m;SMT;Chicken Customer Agent;Cambridgeshire;Wooden P;2022-04-04T06:48:30;Green Av;2022-04-04T07:10:52;Account co +4;black Regional programming;2022-04-03T11:41:22;XML;Austria Avon;hiera;neural-net;Courts;International;Kids encom;Kuna redef;Account Li;ivory;Cot;gold Falls;override;emulatio;2022-04-03T12:25:28;monitor ;2022-04-03T13:58:11;time-frame +5;Intelligent Yemen scale;2022-04-03T18:43:19;Pike Ergonomic;metrics parsing;itera;Multi-laye;AI;grey world-class Berkshire;web-enable;Managed Ad;Republic;Steel Savi;mul;Steel;Agent engage;Mobility;2022-04-04T07:36:37;Dollar U;2022-04-04T01:43:29;Usability +6;Square online Metal;2022-04-03T18:43:33;convergence;optimize;mobil;Director H;Synchronised cross-platform;Quality;Grocery Ha;SMTP;transition;Checking;Sau;Barbuda Colorado;robust Fish;tan Mont;2022-04-03T22:59:16;object-o;2022-04-03T23:59:44;engage pin +7;ivory;2022-04-04T05:17:16;bluetooth Account;protocol;Direc;vortals op;De-engineered SAS;composite Stream Regional;Keyboard i;Strategist;Toys;Djibouti E;qua;Saint protocol Quality;Gloves Account Intelligent;Car Soap;2022-04-03T09:52:16;SCSI Ref;2022-04-03T20:02:15;internet +8;online;2022-04-03T11:44:10;Bacon Music Account;drive withdrawal Open-source;orche;Automotive;indexing;Wooden;implementa;optimize;reboot;Up-sized;Isr;defect;schemas Facilitator mesh;Table Ca;2022-04-03T16:20:49;backgrou;2022-04-04T04:51:56;Concrete +9;Savings;2022-04-04T04:37:21;green;Manager;quant;Technician;Money neural Hawaii;backing Credit feed;synthesizi;Soap Loan ;Health;back utili;pay;matrices;sky;Optimiza;2022-04-03T23:04:24;paradigm;2022-04-04T04:22:07;Kong +10;violet;2022-04-03T14:58:42;Metal;client-driven;Malay;Concrete b;Analyst;redundant efficient Account;Customizab;Dinar hack;Movies;Ngultrum P;Bea;Jewelery;Buckinghamshire Balanced architecture;bypass;2022-04-03T19:03:53;Unbrande;2022-04-04T02:35:56;Keyboard diff --git a/src/main/resources/config/liquibase/fake-data/fim_accounts_wq.csv b/src/main/resources/config/liquibase/fake-data/fim_accounts_wq.csv new file mode 100644 index 0000000..f57af6f --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_accounts_wq.csv @@ -0,0 +1,11 @@ +id;account_id;cust_id;reln_id;reln_type;oper_inst;is_acct_nbr;bnd_acct_nbr;closing_id;sub_segment;branch_code;acct_status;ctry_code;acct_owners;remarks;created_by;created_ts;updated_by;updated_ts;record_status;upload_remark +1;Bahamian invoice;Codes;generating Buckinghamshire;Music;Borders;lavender;Rial navigating;Minnesota ;Lithuania ;Tasty Exec;hard;dep;Human Toys;port Kids;1080p Li;2022-04-03T16:57:50;Arkansas;2022-04-03T16:50:18;Wooden Leg;network +2;Investor Orchestrator;Sausages Dollar one-to-one;brand interface;compr;Yemeni;methodical;Shoes Account;matrices;Borders In;Place;adapter;Hat;Organic Keyboard;Unbranded;Product;2022-04-04T07:22:14;Senegal ;2022-04-04T08:07:37;Checking;Dam +3;service-desk Refined Outdoors;Home;Industrial;upwar;Bedfordshi;Fantastic Industrial expedite;PCI;rich Glove;Garden Int;Loan quant;auxiliary ;cus;Supervisor Vatu;Account Integration copy;context-;2022-04-04T06:26:29;virtual ;2022-04-04T03:48:59;Towels;Camp +4;Square;Car Djibouti;withdrawal deploy;Coord;primary;Buckinghamshire Administrator ;PNG violet;alarm Repr;program So;Organic Bu;Chicken So;Mor;Executive Account;Cliffs Stream invoice;firewall;2022-04-04T01:45:16;3rd Mark;2022-04-04T04:19:12;Plains;District +5;Principal;back-end Integration;Metal Associate Mississippi;Accou;Implementa;back Open-architected feed;Brand;Fundamenta;Bacon vort;SMS plug-a;web-enable;Bor;definition;Granite;transiti;2022-04-04T05:46:59;Forges;2022-04-03T12:22:51;compress;SMS teal Games +6;overriding virtual;violet Union;Investment;analy;Paradigm w;Togo;payment;infrastruc;time-frame;Response;plug-and-p;dis;Spurs forecast firewall;Card reboot edge;Poland p;2022-04-03T20:38:36;Industri;2022-04-04T04:50:28;Gorgeous;Books +7;Guadeloupe;Bedfordshire Moldovan Licensed;Stand-alone Alaska Christmas;syste;Personal;Music Aruban Vision-oriented;Handmade encoding Oval;workforce ;Seychelles;Gorgeous;copying co;Chi;Hill Plastic asynchronous;Global blue Buckinghamshire;Kids com;2022-04-03T12:29:13;Rue;2022-04-04T00:44:30;structure ;Nebraska Enhanced +8;AI Cotton;target;firewall;Check;black Hill;invoice;Intelligent;Account br;compressin;Algeria so;matrix;XSS;Wisconsin haptic Mozambique;Technician;channels;2022-04-03T22:52:32;bandwidt;2022-04-03T20:17:59;Bacon;Berkshire +9;generating;Vanuatu Burundi;Handmade Markets Corporate;trans;Account Uz;Granite Berkshire;port paradigm end-to-end;Central;Refined lo;Liberian S;maroon fle;vir;Fort Pound face;engage;Buckingh;2022-04-03T20:24:12;navigate;2022-04-04T00:36:37;Utah Home ;Computer plum +10;programming Consultant Parkways;Sausages orchestrate paradigms;monitor;vorta;Lead maxim;payment Associate deposit;connect up;navigating;invoice In;SAS;microchip ;int;Cambridgeshire THX models;withdrawal;innovate;2022-04-03T11:27:03;Account ;2022-04-03T15:35:08;integrated;systems rich primary diff --git a/src/main/resources/config/liquibase/fake-data/fim_cust.csv b/src/main/resources/config/liquibase/fake-data/fim_cust.csv new file mode 100644 index 0000000..daec137 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_cust.csv @@ -0,0 +1,11 @@ +id;cust_id;client_id;id_type;ctry_code;created_by;created_ts;updated_by;updated_ts;record_status;upload_remark +1;Cambridgeshire;Ferry;expedite;mic;AGP Inve;2022-04-03T09:40:54;bleeding;2022-04-04T00:58:08;firewall function Lari;FTP Keyboard +2;Account Administrator;heuristic;haptic;SDD;Loan Cam;2022-04-03T20:03:45;Mandator;2022-04-04T06:01:16;Cotton;Maryland +3;Dollar;Branch mission-critical Macao;backing;pri;invoice ;2022-04-04T04:55:15;Buckingh;2022-04-04T04:56:00;initiatives Fish online;24/365 deposit magnetic +4;rich Unbranded;Checking whiteboard;encryption;Pin;Principa;2022-04-04T08:19:39;Clothing;2022-04-03T19:01:10;copying invoice Savings;leverage Ball Books +5;payment;withdrawal Credit Bolivia;Chicken sa;Rev;Forks AD;2022-04-03T11:49:16;logistic;2022-04-03T19:08:26;Auto;fuchsia web-enabled monitor +6;Bike SQL Incredible;Kuwaiti bandwidth;Account;Cor;Security;2022-04-04T01:22:13;invoice;2022-04-03T23:35:51;iterate Practical;Shoes scale +7;payment homogeneous bleeding-edge;Forge Rubber Forward;copying;Int;Soap Tun;2022-04-03T23:41:50;clicks-a;2022-04-03T09:07:39;Rustic initiative Health;hack calculate +8;Automotive;Table Kong visualize;Future Aut;bus;auxiliar;2022-04-03T20:59:48;bifurcat;2022-04-03T08:50:25;generate;Advanced +9;synergize;Investment User-centric;Fuerte;Mou;Health B;2022-04-03T12:30:37;invoice;2022-04-03T20:44:39;multi-byte;exploit redundant +10;Borders;Cotton Steel;Borders Te;emp;Dynamic;2022-04-04T04:29:00;Synchron;2022-04-03T20:32:19;deposit;invoice Hills diff --git a/src/main/resources/config/liquibase/fake-data/fim_cust_history.csv b/src/main/resources/config/liquibase/fake-data/fim_cust_history.csv new file mode 100644 index 0000000..a727810 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_cust_history.csv @@ -0,0 +1,11 @@ +id;cust_id;history_ts;client_id;id_type;ctry_code;created_by;created_ts;updated_by;updated_ts;record_status +1;matrix pixel;2022-04-04T08:34:58;Shoes;Consultant;Com;Central;2022-04-03T23:57:32;PCI depo;2022-04-03T17:38:00;Nebraska virtual +2;Engineer;2022-04-03T21:31:22;Movies;Guatemala ;enc;Plastic ;2022-04-03T13:14:44;withdraw;2022-04-03T10:10:29;Fresh +3;systematic;2022-04-04T01:48:16;Small;Mississipp;Pla;Configur;2022-04-04T01:50:39;Bike;2022-04-04T03:39:17;Handmade +4;Concrete orchid;2022-04-03T12:49:32;Self-enabling Vision-oriented ;Handmade T;hig;value-ad;2022-04-04T03:58:16;Gorgeous;2022-04-03T15:11:29;Checking +5;deposit e-tailers;2022-04-03T11:25:35;Dong virtual Steel;port Rusti;BCE;Berkshir;2022-04-03T18:05:06;Legacy E;2022-04-04T06:07:36;Distributed matrix +6;enhance Handcrafted Gorgeous;2022-04-04T03:01:04;Concrete vertical payment;generate b;inv;multi-ta;2022-04-03T09:57:02;Credit;2022-04-04T07:31:43;application Customer firmware +7;lavender Berkshire;2022-04-03T23:58:00;blue Persistent frictionless;revolution;Mil;Response;2022-04-03T13:06:17;Dinar;2022-04-04T05:11:52;Checking +8;functionalities Handmade Solutions;2022-04-03T22:40:42;Shoes Lilangeni multi-byte;holistic g;sex;Avon mic;2022-04-03T14:18:58;invoice ;2022-04-04T07:44:34;Markets Producer Coordinator +9;Bedfordshire;2022-04-04T08:26:52;array;Buckingham;whi;generate;2022-04-03T14:43:43;Up-sized;2022-04-03T11:50:35;withdrawal South Groves +10;platforms;2022-04-03T20:09:47;Cambridgeshire capacitor Marke;EXE;met;Metrics;2022-04-04T04:00:23;Executiv;2022-04-03T12:42:13;Direct azure Generic diff --git a/src/main/resources/config/liquibase/fake-data/fim_cust_wq.csv b/src/main/resources/config/liquibase/fake-data/fim_cust_wq.csv new file mode 100644 index 0000000..cc09da8 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_cust_wq.csv @@ -0,0 +1,11 @@ +id;cust_id;client_id;id_type;ctry_code;created_by;created_ts;updated_by;updated_ts;record_status;upload_remark +1;leading-edge Republic;pixel;Metal Shoe;met;Associat;2022-04-03T21:23:53;Tonga ha;2022-04-04T03:57:54;Beauty Grocery interface;Tobago +2;Baby;users green task-force;Fresh;bac;Strategi;2022-04-04T04:08:09;intangib;2022-04-03T13:39:19;Chips;haptic +3;firewall seize Generic;port turquoise Licensed;Bedfordshi;por;clear-th;2022-04-03T15:32:11;product ;2022-04-03T19:47:30;back-end line ROI;Car Wooden mesh +4;Cotton transparent;Buckinghamshire magenta;synthesizi;col;generate;2022-04-03T13:29:38;Future;2022-04-03T13:31:02;cutting-edge ADP viral;applications Danish Brand +5;Yemeni;RSS;collaborat;Sol;Bike Isl;2022-04-03T18:56:22;green Sp;2022-04-03T22:35:01;payment;optical Money +6;withdrawal Bedfordshire revolutionary;Table Cotton Togo;grey inter;Awe;override;2022-04-03T09:19:03;Jersey L;2022-04-04T00:14:45;invoice mindshare Moldova;plum Director Configuration +7;Lithuanian navigating;Versatile;bandwidth-;Fre;Beauty i;2022-04-03T09:46:58;neural H;2022-04-03T22:52:05;Wisconsin Director;Bedfordshire copy +8;USB haptic;Extension;copy trans;Bor;mobile R;2022-04-03T10:32:22;Identity;2022-04-04T06:16:05;Alaska FTP Way;Account +9;exuding;Guadeloupe Avon;JBOD Compu;wit;e-market;2022-04-03T14:29:30;3rd User;2022-04-03T16:52:12;network;leverage Eritrea quantifying +10;Uzbekistan Table 1080p;Wooden Democratic interface;Stand-alon;Car;Liaison ;2022-04-04T01:12:12;exploit ;2022-04-03T10:41:21;Credit;cutting-edge generate generating diff --git a/src/main/resources/config/liquibase/fake-data/fim_sett_acct.csv b/src/main/resources/config/liquibase/fake-data/fim_sett_acct.csv new file mode 100644 index 0000000..d725c80 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_sett_acct.csv @@ -0,0 +1,11 @@ +id;settacc_id;account_id;sett_acct_nbr;sett_ccy;sett_acct_status;created_by;created_ts;updated_by;updated_ts;record_status +1;out-of-the-box Computers;deposit;Buckinghamshire Shirt;inv;Burg SMTP;azure na;2022-04-03T15:13:34;Keys fee;2022-04-03T14:19:33;Germany Ch +2;cross-platform;compress plug-a;sky;Ova;Chicken;input tr;2022-04-04T06:04:43;SDD;2022-04-03T23:49:37;orchid +3;extensible;asymmetric Fant;Refined;Sai;Lesotho;Soap cli;2022-04-03T14:55:19;object-o;2022-04-03T16:23:55;impactful +4;Gloves withdrawal;instruction bus;revolutionize Practical;nav;solid;impactfu;2022-04-03T13:53:45;Usabilit;2022-04-03T10:13:49;deliverabl +5;open-source Games bluetooth;Games hacking;SDD Kiribati Director;cir;quantify;Electron;2022-04-04T02:15:44;Cross-pl;2022-04-03T17:12:26;Incredible +6;Synchronised Belarus;quantify Mobili;bluetooth;Ben;drive comp;protocol;2022-04-03T13:15:37;Savings ;2022-04-04T08:43:35;Gorgeous +7;parsing Jamaican Dollar;Republic back-e;Som cutting-edge;Cze;Central Dy;Reverse-;2022-04-03T20:50:29;Cambridg;2022-04-04T07:43:10;withdrawal +8;bluetooth Buckinghamshire;paradigms wirel;model Ameliorated;sys;Manors;payment ;2022-04-04T02:13:59;Brand St;2022-04-03T21:06:40;Sleek Toke +9;Granite;Avon GB Bacon;Handcrafted Streets;con;Consultant;1080p Li;2022-04-03T20:24:34;Shoes wh;2022-04-03T14:33:50;enable Sil +10;French Park synthesize;Card Automotive;experiences;Ser;Licensed r;Berkshir;2022-04-03T10:32:39;Industri;2022-04-03T17:40:38;set Lead F diff --git a/src/main/resources/config/liquibase/fake-data/fim_sett_acct_history.csv b/src/main/resources/config/liquibase/fake-data/fim_sett_acct_history.csv new file mode 100644 index 0000000..1647a88 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_sett_acct_history.csv @@ -0,0 +1,11 @@ +id;settacc_id;history_ts;account_id;sett_acct_nbr;sett_ccy;sett_acct_status;created_by;created_ts;updated_by;updated_ts;record_status +1;Table Persistent Computer;2022-04-03T17:39:52;red Product Hum;Focused Generic;cir;feed struc;Unbrande;2022-04-04T08:18:01;Avon Pra;2022-04-03T18:51:07;Argentina +2;Phased Market Security;2022-04-03T11:40:19;Station Optimiz;local Shirt;Fij;copying;program ;2022-04-04T05:06:44;Jewelery;2022-04-04T06:47:43;Operations +3;Chair;2022-04-03T16:10:00;harness Legacy ;Enhanced Centralized;por;SQL;index di;2022-04-04T02:48:29;Auto pay;2022-04-04T06:33:30;invoice Pl +4;Practical Mandatory;2022-04-03T18:34:21;fuchsia open-so;portal functionalities Wall;Ang;Technician;orchid;2022-04-04T01:23:51;card Bus;2022-04-03T13:53:29;HDD +5;ROI Keyboard networks;2022-04-04T01:43:23;Mexico;withdrawal Compatible AGP;Cro;initiative;Interact;2022-04-03T19:17:26;calculat;2022-04-03T18:26:43;Chair Harb +6;Field Fantastic;2022-04-04T01:18:30;Cheese;Kiribati;tan;Handmade;THX;2022-04-03T16:26:14;Awesome ;2022-04-03T08:49:08;experience +7;Antillian;2022-04-03T18:52:23;Bahraini Puerto;pixel harness;Ida;group depo;sensor;2022-04-03T17:30:03;quantify;2022-04-03T11:08:12;Trail +8;Estonia;2022-04-03T09:33:49;proactive;regional;Com;Manor mage;optical;2022-04-04T01:21:29;Central;2022-04-04T02:49:25;Concrete +9;Iowa;2022-04-04T02:39:00;HDD Bacon drive;Rubber North tangible;Pa';Sleek;Rubber;2022-04-04T07:04:55;Harbors;2022-04-03T09:56:14;initiative +10;infrastructure generation Cambridgeshire;2022-04-03T16:11:43;Card back;analyzing;gre;Investor;Pataca M;2022-04-04T08:40:54;Rupee va;2022-04-04T01:03:24;red schema diff --git a/src/main/resources/config/liquibase/fake-data/fim_sett_acct_wq.csv b/src/main/resources/config/liquibase/fake-data/fim_sett_acct_wq.csv new file mode 100644 index 0000000..a5c2bb7 --- /dev/null +++ b/src/main/resources/config/liquibase/fake-data/fim_sett_acct_wq.csv @@ -0,0 +1,11 @@ +id;settacc_id;account_id;sett_acct_nbr;sett_ccy;sett_acct_status;created_by;created_ts;updated_by;updated_ts;record_status;upload_remark +1;Beauty parsing;disintermediate;methodology withdrawal;Cus;synthesizi;Cheese c;2022-04-03T15:25:43;Highway;2022-04-03T20:40:57;Health Mau;Plastic +2;Tenge blue;matrix port Bor;parse sky;use;killer por;Senior b;2022-04-03T16:52:26;Computer;2022-04-03T16:59:26;bricks-and;Account +3;capacitor;Generic;Ariary Communications;uni;Director A;bypassin;2022-04-03T17:17:38;bus Turk;2022-04-04T03:50:28;payment;feed Executive +4;bypassing architecture;Director Granit;composite Guinea;Inv;Steel lime;Assistan;2022-04-03T11:23:23;applicat;2022-04-04T03:41:07;Soft;microchip Fall +5;upward-trending RAM;Fresh target dr;Electronics turquoise;Loa;blue servi;Missouri;2022-04-04T07:03:34;Rustic L;2022-04-04T03:08:37;Incredible;Profound non-volatile +6;Refined out-of-the-box Investor;Forward envisio;grid-enabled;Avo;Peso web S;Plaza;2022-04-03T14:13:39;cross-me;2022-04-03T20:00:38;input bus ;drive Fantastic +7;Rubber RSS systems;Eritrea;transmit Books;bus;Chips;modular;2022-04-03T08:53:34;AI Facto;2022-04-03T15:07:08;Greece;Data Tasty +8;SMTP;Jersey approach;payment Concrete Bedfordshire;Con;Practical;complexi;2022-04-03T15:32:55;leverage;2022-04-03T19:15:31;National g;indigo Refined maximize +9;Parks hub Cambridgeshire;Chicken Valleys;Response Mouse one-to-one;Buc;teal copyi;Avon red;2022-04-03T10:36:34;mobile;2022-04-04T07:53:55;Rhode Beau;Angola Account Courts +10;SSL;Cross-platform;Toys Micronesia Cotton;Ext;Mauritius;Idaho;2022-04-03T17:34:09;Grocery ;2022-04-03T21:06:21;paradigm;Yemen 24/7 multi-byte diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml index 1da9fa8..30c2ace 100644 --- a/src/main/resources/config/liquibase/master.xml +++ b/src/main/resources/config/liquibase/master.xml @@ -15,6 +15,16 @@ + + + + + + + + + + diff --git a/src/main/resources/i18n/messages_en.properties b/src/main/resources/i18n/messages_en.properties new file mode 100644 index 0000000..5fb5c54 --- /dev/null +++ b/src/main/resources/i18n/messages_en.properties @@ -0,0 +1,6 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 8ddd065..c813edc 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -40,6 +40,7 @@ + diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index ea92548..de6d400 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -80,11 +80,7 @@

Welcome, Java Hipster!

    -
  • - JHipster's microfrontends implementation doesn't provide a stand-alone UI. Packaged microfrontends should be accessed through a - JHipster gateway. -
  • -
  • Stand-alone development server can be started by `npm start`.
  • +
  • It does not have a front-end. The front-end should be generated on a JHipster gateway.
  • It is serving REST APIs, under the '/api' URLs.
  • diff --git a/src/test/java/com/scb/fimob/IntegrationTest.java b/src/test/java/com/scb/fimob/IntegrationTest.java new file mode 100644 index 0000000..81946e8 --- /dev/null +++ b/src/test/java/com/scb/fimob/IntegrationTest.java @@ -0,0 +1,17 @@ +package com.scb.fimob; + +import com.scb.fimob.FimApp; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * Base composite annotation for integration tests. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@SpringBootTest(classes = FimApp.class) +public @interface IntegrationTest { +} diff --git a/src/test/java/com/scb/fimob/TechnicalStructureTest.java b/src/test/java/com/scb/fimob/TechnicalStructureTest.java new file mode 100644 index 0000000..a551166 --- /dev/null +++ b/src/test/java/com/scb/fimob/TechnicalStructureTest.java @@ -0,0 +1,39 @@ +package com.scb.fimob; + +import static com.tngtech.archunit.base.DescribedPredicate.alwaysTrue; +import static com.tngtech.archunit.core.domain.JavaClass.Predicates.belongToAnyOf; +import static com.tngtech.archunit.library.Architectures.layeredArchitecture; + +import com.tngtech.archunit.core.importer.ImportOption.DoNotIncludeTests; +import com.tngtech.archunit.junit.AnalyzeClasses; +import com.tngtech.archunit.junit.ArchTest; +import com.tngtech.archunit.lang.ArchRule; + +@AnalyzeClasses(packagesOf = FimApp.class, importOptions = DoNotIncludeTests.class) +class TechnicalStructureTest { + + // prettier-ignore + @ArchTest + static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture() + .layer("Config").definedBy("..config..") + .layer("Client").definedBy("..client..") + .layer("Web").definedBy("..web..") + .optionalLayer("Service").definedBy("..service..") + .layer("Security").definedBy("..security..") + .layer("Persistence").definedBy("..repository..") + .layer("Domain").definedBy("..domain..") + + .whereLayer("Config").mayNotBeAccessedByAnyLayer() + .whereLayer("Client").mayNotBeAccessedByAnyLayer() + .whereLayer("Web").mayOnlyBeAccessedByLayers("Config") + .whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config") + .whereLayer("Security").mayOnlyBeAccessedByLayers("Config", "Client", "Service", "Web") + .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config") + .whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config") + + .ignoreDependency(belongToAnyOf(FimApp.class), alwaysTrue()) + .ignoreDependency(alwaysTrue(), belongToAnyOf( + com.scb.fimob.config.Constants.class, + com.scb.fimob.config.ApplicationProperties.class + )); +} diff --git a/src/test/java/com/scb/fimob/config/WebConfigurerTest.java b/src/test/java/com/scb/fimob/config/WebConfigurerTest.java new file mode 100644 index 0000000..e604d51 --- /dev/null +++ b/src/test/java/com/scb/fimob/config/WebConfigurerTest.java @@ -0,0 +1,134 @@ +package com.scb.fimob.config; + +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import java.util.*; +import javax.servlet.*; +import org.h2.server.web.WebServlet; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.env.MockEnvironment; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; + +/** + * Unit tests for the {@link WebConfigurer} class. + */ +class WebConfigurerTest { + + private WebConfigurer webConfigurer; + + private MockServletContext servletContext; + + private MockEnvironment env; + + private JHipsterProperties props; + + @BeforeEach + public void setup() { + servletContext = spy(new MockServletContext()); + doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class)); + doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class)); + + env = new MockEnvironment(); + props = new JHipsterProperties(); + + webConfigurer = new WebConfigurer(env, props); + } + + @Test + void shouldStartUpProdServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + + assertThatCode(() -> webConfigurer.onStartup(servletContext)).doesNotThrowAnyException(); + verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + void shouldStartUpDevServletContext() throws ServletException { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); + + assertThatCode(() -> webConfigurer.onStartup(servletContext)).doesNotThrowAnyException(); + verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class)); + } + + @Test + void shouldCorsFilterOnApiPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("other.domain.com")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform( + options("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST") + ) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) + .andExpect(header().string(HttpHeaders.VARY, "Origin")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); + } + + @Test + void shouldCorsFilterOnOtherPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/test/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + void shouldCorsFilterDeactivatedForNullAllowedOrigins() throws Exception { + props.getCors().setAllowedOrigins(null); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + void shouldCorsFilterDeactivatedForEmptyAllowedOrigins() throws Exception { + props.getCors().setAllowedOrigins(new ArrayList<>()); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } +} diff --git a/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java b/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java new file mode 100644 index 0000000..d05c569 --- /dev/null +++ b/src/test/java/com/scb/fimob/config/WebConfigurerTestController.java @@ -0,0 +1,14 @@ +package com.scb.fimob.config; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class WebConfigurerTestController { + + @GetMapping("/api/test-cors") + public void testCorsOnApiPath() {} + + @GetMapping("/test/test-cors") + public void testCorsOnOtherPath() {} +} diff --git a/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java b/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java new file mode 100644 index 0000000..4d6da57 --- /dev/null +++ b/src/test/java/com/scb/fimob/config/timezone/HibernateTimeZoneIT.java @@ -0,0 +1,162 @@ +package com.scb.fimob.config.timezone; + +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.repository.timezone.DateTimeWrapper; +import com.scb.fimob.repository.timezone.DateTimeWrapperRepository; +import java.time.*; +import java.time.format.DateTimeFormatter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.rowset.SqlRowSet; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the ZoneId Hibernate configuration. + */ +@IntegrationTest +class HibernateTimeZoneIT { + + @Autowired + private DateTimeWrapperRepository dateTimeWrapperRepository; + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Value("${spring.jpa.properties.hibernate.jdbc.time_zone:UTC}") + private String zoneId; + + private DateTimeWrapper dateTimeWrapper; + private DateTimeFormatter dateTimeFormatter; + private DateTimeFormatter timeFormatter; + private DateTimeFormatter dateFormatter; + + @BeforeEach + public void setup() { + dateTimeWrapper = new DateTimeWrapper(); + dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:50:00.0Z")); + dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:50:00.0")); + dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z")); + dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:30:00.0Z")); + dateTimeWrapper.setLocalTime(LocalTime.parse("14:30:00")); + dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:30:00+02:00")); + dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10")); + + dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S").withZone(ZoneId.of(zoneId)); + + timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.of(zoneId)); + + dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + } + + @Test + @Transactional + void storeInstantWithZoneIdConfigShouldBeStoredOnGMTTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("instant", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant()); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getLocalDateTime().atZone(ZoneId.systemDefault()).format(dateTimeFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeOffsetDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getOffsetDateTime().format(dateTimeFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeZoneDateTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getZonedDateTime().format(dateTimeFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper + .getLocalTime() + .atDate(LocalDate.of(1970, Month.JANUARY, 1)) + .atZone(ZoneId.systemDefault()) + .format(timeFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeOffsetTimeWithZoneIdConfigShouldBeStoredOnGMTTimeZoneAccordingToHis1stJan1970Value() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("offset_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper + .getOffsetTime() + .toLocalTime() + .atDate(LocalDate.of(1970, Month.JANUARY, 1)) + .atZone(ZoneId.systemDefault()) + .format(timeFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalDateWithZoneIdConfigShouldBeStoredWithoutTransformation() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_date", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getLocalDate().format(dateFormatter); + + assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(resultSet, expectedValue); + } + + private String generateSqlRequest(String fieldName, long id) { + return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id); + } + + private void assertThatDateStoredValueIsEqualToInsertDateValueOnGMTTimeZone(SqlRowSet sqlRowSet, String expectedValue) { + while (sqlRowSet.next()) { + String dbValue = sqlRowSet.getString(1); + + assertThat(dbValue).isNotNull(); + assertThat(dbValue).isEqualTo(expectedValue); + } + } +} diff --git a/src/test/java/com/scb/fimob/domain/EthnicityTest.java b/src/test/java/com/scb/fimob/domain/EthnicityTest.java new file mode 100644 index 0000000..e11575f --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/EthnicityTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class EthnicityTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(Ethnicity.class); + Ethnicity ethnicity1 = new Ethnicity(); + ethnicity1.setId(1L); + Ethnicity ethnicity2 = new Ethnicity(); + ethnicity2.setId(ethnicity1.getId()); + assertThat(ethnicity1).isEqualTo(ethnicity2); + ethnicity2.setId(2L); + assertThat(ethnicity1).isNotEqualTo(ethnicity2); + ethnicity1.setId(null); + assertThat(ethnicity1).isNotEqualTo(ethnicity2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java new file mode 100644 index 0000000..da38a9e --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimAccountsHistoryTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsHistoryTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccountsHistory.class); + FimAccountsHistory fimAccountsHistory1 = new FimAccountsHistory(); + fimAccountsHistory1.setId(1L); + FimAccountsHistory fimAccountsHistory2 = new FimAccountsHistory(); + fimAccountsHistory2.setId(fimAccountsHistory1.getId()); + assertThat(fimAccountsHistory1).isEqualTo(fimAccountsHistory2); + fimAccountsHistory2.setId(2L); + assertThat(fimAccountsHistory1).isNotEqualTo(fimAccountsHistory2); + fimAccountsHistory1.setId(null); + assertThat(fimAccountsHistory1).isNotEqualTo(fimAccountsHistory2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsTest.java new file mode 100644 index 0000000..72d5890 --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimAccountsTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccounts.class); + FimAccounts fimAccounts1 = new FimAccounts(); + fimAccounts1.setId(1L); + FimAccounts fimAccounts2 = new FimAccounts(); + fimAccounts2.setId(fimAccounts1.getId()); + assertThat(fimAccounts1).isEqualTo(fimAccounts2); + fimAccounts2.setId(2L); + assertThat(fimAccounts1).isNotEqualTo(fimAccounts2); + fimAccounts1.setId(null); + assertThat(fimAccounts1).isNotEqualTo(fimAccounts2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java b/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java new file mode 100644 index 0000000..4acf922 --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimAccountsWqTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsWqTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccountsWq.class); + FimAccountsWq fimAccountsWq1 = new FimAccountsWq(); + fimAccountsWq1.setId(1L); + FimAccountsWq fimAccountsWq2 = new FimAccountsWq(); + fimAccountsWq2.setId(fimAccountsWq1.getId()); + assertThat(fimAccountsWq1).isEqualTo(fimAccountsWq2); + fimAccountsWq2.setId(2L); + assertThat(fimAccountsWq1).isNotEqualTo(fimAccountsWq2); + fimAccountsWq1.setId(null); + assertThat(fimAccountsWq1).isNotEqualTo(fimAccountsWq2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java new file mode 100644 index 0000000..484da3e --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimCustHistoryTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustHistoryTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCustHistory.class); + FimCustHistory fimCustHistory1 = new FimCustHistory(); + fimCustHistory1.setId(1L); + FimCustHistory fimCustHistory2 = new FimCustHistory(); + fimCustHistory2.setId(fimCustHistory1.getId()); + assertThat(fimCustHistory1).isEqualTo(fimCustHistory2); + fimCustHistory2.setId(2L); + assertThat(fimCustHistory1).isNotEqualTo(fimCustHistory2); + fimCustHistory1.setId(null); + assertThat(fimCustHistory1).isNotEqualTo(fimCustHistory2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimCustTest.java b/src/test/java/com/scb/fimob/domain/FimCustTest.java new file mode 100644 index 0000000..158f1b7 --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimCustTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCust.class); + FimCust fimCust1 = new FimCust(); + fimCust1.setId(1L); + FimCust fimCust2 = new FimCust(); + fimCust2.setId(fimCust1.getId()); + assertThat(fimCust1).isEqualTo(fimCust2); + fimCust2.setId(2L); + assertThat(fimCust1).isNotEqualTo(fimCust2); + fimCust1.setId(null); + assertThat(fimCust1).isNotEqualTo(fimCust2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimCustWqTest.java b/src/test/java/com/scb/fimob/domain/FimCustWqTest.java new file mode 100644 index 0000000..f7e57fc --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimCustWqTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustWqTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCustWq.class); + FimCustWq fimCustWq1 = new FimCustWq(); + fimCustWq1.setId(1L); + FimCustWq fimCustWq2 = new FimCustWq(); + fimCustWq2.setId(fimCustWq1.getId()); + assertThat(fimCustWq1).isEqualTo(fimCustWq2); + fimCustWq2.setId(2L); + assertThat(fimCustWq1).isNotEqualTo(fimCustWq2); + fimCustWq1.setId(null); + assertThat(fimCustWq1).isNotEqualTo(fimCustWq2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java new file mode 100644 index 0000000..1ff5e5c --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimSettAcctHistoryTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctHistoryTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcctHistory.class); + FimSettAcctHistory fimSettAcctHistory1 = new FimSettAcctHistory(); + fimSettAcctHistory1.setId(1L); + FimSettAcctHistory fimSettAcctHistory2 = new FimSettAcctHistory(); + fimSettAcctHistory2.setId(fimSettAcctHistory1.getId()); + assertThat(fimSettAcctHistory1).isEqualTo(fimSettAcctHistory2); + fimSettAcctHistory2.setId(2L); + assertThat(fimSettAcctHistory1).isNotEqualTo(fimSettAcctHistory2); + fimSettAcctHistory1.setId(null); + assertThat(fimSettAcctHistory1).isNotEqualTo(fimSettAcctHistory2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java new file mode 100644 index 0000000..1f84aca --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimSettAcctTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcct.class); + FimSettAcct fimSettAcct1 = new FimSettAcct(); + fimSettAcct1.setId(1L); + FimSettAcct fimSettAcct2 = new FimSettAcct(); + fimSettAcct2.setId(fimSettAcct1.getId()); + assertThat(fimSettAcct1).isEqualTo(fimSettAcct2); + fimSettAcct2.setId(2L); + assertThat(fimSettAcct1).isNotEqualTo(fimSettAcct2); + fimSettAcct1.setId(null); + assertThat(fimSettAcct1).isNotEqualTo(fimSettAcct2); + } +} diff --git a/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java b/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java new file mode 100644 index 0000000..83b7d42 --- /dev/null +++ b/src/test/java/com/scb/fimob/domain/FimSettAcctWqTest.java @@ -0,0 +1,23 @@ +package com.scb.fimob.domain; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctWqTest { + + @Test + void equalsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcctWq.class); + FimSettAcctWq fimSettAcctWq1 = new FimSettAcctWq(); + fimSettAcctWq1.setId(1L); + FimSettAcctWq fimSettAcctWq2 = new FimSettAcctWq(); + fimSettAcctWq2.setId(fimSettAcctWq1.getId()); + assertThat(fimSettAcctWq1).isEqualTo(fimSettAcctWq2); + fimSettAcctWq2.setId(2L); + assertThat(fimSettAcctWq1).isNotEqualTo(fimSettAcctWq2); + fimSettAcctWq1.setId(null); + assertThat(fimSettAcctWq1).isNotEqualTo(fimSettAcctWq2); + } +} diff --git a/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java b/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java new file mode 100644 index 0000000..cd73c97 --- /dev/null +++ b/src/test/java/com/scb/fimob/management/SecurityMetersServiceTests.java @@ -0,0 +1,70 @@ +package com.scb.fimob.management; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.util.Collection; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class SecurityMetersServiceTests { + + private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens"; + + private MeterRegistry meterRegistry; + + private SecurityMetersService securityMetersService; + + @BeforeEach + public void setup() { + meterRegistry = new SimpleMeterRegistry(); + + securityMetersService = new SecurityMetersService(meterRegistry); + } + + @Test + void testInvalidTokensCountersByCauseAreCreated() { + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter(); + + Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters(); + + assertThat(counters).hasSize(4); + } + + @Test + void testCountMethodsShouldBeBoundToCorrectCounters() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isZero(); + + securityMetersService.trackTokenExpired(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isZero(); + + securityMetersService.trackTokenUnsupported(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isZero(); + + securityMetersService.trackTokenInvalidSignature(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isZero(); + + securityMetersService.trackTokenMalformed(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(1); + } +} diff --git a/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java new file mode 100644 index 0000000..9e15d9c --- /dev/null +++ b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapper.java @@ -0,0 +1,133 @@ +package com.scb.fimob.repository.timezone; + +import java.io.Serializable; +import java.time.*; +import java.util.Objects; +import javax.persistence.*; + +@Entity +@Table(name = "jhi_date_time_wrapper") +public class DateTimeWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") + @SequenceGenerator(name = "sequenceGenerator") + private Long id; + + @Column(name = "instant") + private Instant instant; + + @Column(name = "local_date_time") + private LocalDateTime localDateTime; + + @Column(name = "offset_date_time") + private OffsetDateTime offsetDateTime; + + @Column(name = "zoned_date_time") + private ZonedDateTime zonedDateTime; + + @Column(name = "local_time") + private LocalTime localTime; + + @Column(name = "offset_time") + private OffsetTime offsetTime; + + @Column(name = "local_date") + private LocalDate localDate; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Instant getInstant() { + return instant; + } + + public void setInstant(Instant instant) { + this.instant = instant; + } + + public LocalDateTime getLocalDateTime() { + return localDateTime; + } + + public void setLocalDateTime(LocalDateTime localDateTime) { + this.localDateTime = localDateTime; + } + + public OffsetDateTime getOffsetDateTime() { + return offsetDateTime; + } + + public void setOffsetDateTime(OffsetDateTime offsetDateTime) { + this.offsetDateTime = offsetDateTime; + } + + public ZonedDateTime getZonedDateTime() { + return zonedDateTime; + } + + public void setZonedDateTime(ZonedDateTime zonedDateTime) { + this.zonedDateTime = zonedDateTime; + } + + public LocalTime getLocalTime() { + return localTime; + } + + public void setLocalTime(LocalTime localTime) { + this.localTime = localTime; + } + + public OffsetTime getOffsetTime() { + return offsetTime; + } + + public void setOffsetTime(OffsetTime offsetTime) { + this.offsetTime = offsetTime; + } + + public LocalDate getLocalDate() { + return localDate; + } + + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + DateTimeWrapper dateTimeWrapper = (DateTimeWrapper) o; + return !(dateTimeWrapper.getId() == null || getId() == null) && Objects.equals(getId(), dateTimeWrapper.getId()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } + + // prettier-ignore + @Override + public String toString() { + return "TimeZoneTest{" + + "id=" + id + + ", instant=" + instant + + ", localDateTime=" + localDateTime + + ", offsetDateTime=" + offsetDateTime + + ", zonedDateTime=" + zonedDateTime + + '}'; + } +} diff --git a/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java new file mode 100644 index 0000000..291120d --- /dev/null +++ b/src/test/java/com/scb/fimob/repository/timezone/DateTimeWrapperRepository.java @@ -0,0 +1,10 @@ +package com.scb.fimob.repository.timezone; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Spring Data JPA repository for the {@link DateTimeWrapper} entity. + */ +@Repository +public interface DateTimeWrapperRepository extends JpaRepository {} diff --git a/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java b/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java new file mode 100644 index 0000000..f430f3c --- /dev/null +++ b/src/test/java/com/scb/fimob/security/SecurityUtilsUnitTest.java @@ -0,0 +1,101 @@ +package com.scb.fimob.security; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; + +/** + * Test class for the {@link SecurityUtils} utility class. + */ +class SecurityUtilsUnitTest { + + @BeforeEach + @AfterEach + void cleanup() { + SecurityContextHolder.clearContext(); + } + + @Test + void testGetCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + Optional login = SecurityUtils.getCurrentUserLogin(); + assertThat(login).contains("admin"); + } + + @Test + void testGetCurrentUserJWT() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "token")); + SecurityContextHolder.setContext(securityContext); + Optional jwt = SecurityUtils.getCurrentUserJWT(); + assertThat(jwt).contains("token"); + } + + @Test + void testIsAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isTrue(); + } + + @Test + void testAnonymousIsNotAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities)); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isFalse(); + } + + @Test + void testHasCurrentUserThisAuthority() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.USER)).isTrue(); + assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.ADMIN)).isFalse(); + } + + @Test + void testHasCurrentUserAnyOfAuthorities() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isTrue(); + assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isFalse(); + } + + @Test + void testHasCurrentUserNoneOfAuthorities() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isFalse(); + assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isTrue(); + } +} diff --git a/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java b/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java new file mode 100644 index 0000000..fb04042 --- /dev/null +++ b/src/test/java/com/scb/fimob/security/jwt/JWTFilterTest.java @@ -0,0 +1,117 @@ +package com.scb.fimob.security.jwt; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.management.SecurityMetersService; +import com.scb.fimob.security.AuthoritiesConstants; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.util.Collections; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.http.HttpStatus; +import org.springframework.mock.web.MockFilterChain; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.test.util.ReflectionTestUtils; +import tech.jhipster.config.JHipsterProperties; + +class JWTFilterTest { + + private TokenProvider tokenProvider; + + private JWTFilter jwtFilter; + + @BeforeEach + public void setup() { + JHipsterProperties jHipsterProperties = new JHipsterProperties(); + String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"; + jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret); + + SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry()); + + tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService); + ReflectionTestUtils.setField(tokenProvider, "key", Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret))); + + ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", 60000); + jwtFilter = new JWTFilter(tokenProvider); + SecurityContextHolder.getContext().setAuthentication(null); + } + + @Test + void testJWTFilter() throws Exception { + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( + "test-user", + "test-password", + Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER)) + ); + String jwt = tokenProvider.createToken(authentication, false); + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); + request.setRequestURI("/api/test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockFilterChain filterChain = new MockFilterChain(); + jwtFilter.doFilter(request, response, filterChain); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(SecurityContextHolder.getContext().getAuthentication().getName()).isEqualTo("test-user"); + assertThat(SecurityContextHolder.getContext().getAuthentication().getCredentials()).hasToString(jwt); + } + + @Test + void testJWTFilterInvalidToken() throws Exception { + String jwt = "wrong_jwt"; + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt); + request.setRequestURI("/api/test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockFilterChain filterChain = new MockFilterChain(); + jwtFilter.doFilter(request, response, filterChain); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); + } + + @Test + void testJWTFilterMissingAuthorization() throws Exception { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setRequestURI("/api/test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockFilterChain filterChain = new MockFilterChain(); + jwtFilter.doFilter(request, response, filterChain); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); + } + + @Test + void testJWTFilterMissingToken() throws Exception { + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Bearer "); + request.setRequestURI("/api/test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockFilterChain filterChain = new MockFilterChain(); + jwtFilter.doFilter(request, response, filterChain); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); + } + + @Test + void testJWTFilterWrongScheme() throws Exception { + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( + "test-user", + "test-password", + Collections.singletonList(new SimpleGrantedAuthority(AuthoritiesConstants.USER)) + ); + String jwt = tokenProvider.createToken(authentication, false); + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addHeader(JWTFilter.AUTHORIZATION_HEADER, "Basic " + jwt); + request.setRequestURI("/api/test"); + MockHttpServletResponse response = new MockHttpServletResponse(); + MockFilterChain filterChain = new MockFilterChain(); + jwtFilter.doFilter(request, response, filterChain); + assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); + assertThat(SecurityContextHolder.getContext().getAuthentication()).isNull(); + } +} diff --git a/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java b/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java new file mode 100644 index 0000000..861803d --- /dev/null +++ b/src/test/java/com/scb/fimob/security/jwt/TokenProviderSecurityMetersTests.java @@ -0,0 +1,158 @@ +package com.scb.fimob.security.jwt; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.management.SecurityMetersService; +import com.scb.fimob.security.AuthoritiesConstants; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.security.Key; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.test.util.ReflectionTestUtils; +import tech.jhipster.config.JHipsterProperties; + +class TokenProviderSecurityMetersTests { + + private static final long ONE_MINUTE = 60000; + private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens"; + + private MeterRegistry meterRegistry; + + private TokenProvider tokenProvider; + + @BeforeEach + public void setup() { + JHipsterProperties jHipsterProperties = new JHipsterProperties(); + String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"; + jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret); + + meterRegistry = new SimpleMeterRegistry(); + + SecurityMetersService securityMetersService = new SecurityMetersService(meterRegistry); + + tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService); + Key key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret)); + + ReflectionTestUtils.setField(tokenProvider, "key", key); + ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE); + } + + @Test + void testValidTokenShouldNotCountAnything() { + Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters(); + + assertThat(aggregate(counters)).isZero(); + + String validToken = createValidToken(); + + tokenProvider.validateToken(validToken); + + assertThat(aggregate(counters)).isZero(); + } + + @Test + void testTokenExpiredCount() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isZero(); + + String expiredToken = createExpiredToken(); + + tokenProvider.validateToken(expiredToken); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(1); + } + + @Test + void testTokenUnsupportedCount() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isZero(); + + String unsupportedToken = createUnsupportedToken(); + + tokenProvider.validateToken(unsupportedToken); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isEqualTo(1); + } + + @Test + void testTokenSignatureInvalidCount() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isZero(); + + String tokenWithDifferentSignature = createTokenWithDifferentSignature(); + + tokenProvider.validateToken(tokenWithDifferentSignature); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isEqualTo(1); + } + + @Test + void testTokenMalformedCount() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isZero(); + + String malformedToken = createMalformedToken(); + + tokenProvider.validateToken(malformedToken); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(1); + } + + private String createValidToken() { + Authentication authentication = createAuthentication(); + + return tokenProvider.createToken(authentication, false); + } + + private String createExpiredToken() { + ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE); + + Authentication authentication = createAuthentication(); + + return tokenProvider.createToken(authentication, false); + } + + private Authentication createAuthentication() { + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + return new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities); + } + + private String createUnsupportedToken() { + Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key"); + + return Jwts.builder().setPayload("payload").signWith(key, SignatureAlgorithm.HS256).compact(); + } + + private String createMalformedToken() { + String validToken = createValidToken(); + + return "X" + validToken; + } + + private String createTokenWithDifferentSignature() { + Key otherKey = Keys.hmacShaKeyFor( + Decoders.BASE64.decode("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8") + ); + + return Jwts + .builder() + .setSubject("anonymous") + .signWith(otherKey, SignatureAlgorithm.HS512) + .setExpiration(new Date(new Date().getTime() + ONE_MINUTE)) + .compact(); + } + + private double aggregate(Collection counters) { + return counters.stream().mapToDouble(Counter::count).sum(); + } +} diff --git a/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java b/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java new file mode 100644 index 0000000..c69f0fa --- /dev/null +++ b/src/test/java/com/scb/fimob/security/jwt/TokenProviderTest.java @@ -0,0 +1,141 @@ +package com.scb.fimob.security.jwt; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.management.SecurityMetersService; +import com.scb.fimob.security.AuthoritiesConstants; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.nio.charset.StandardCharsets; +import java.security.Key; +import java.util.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.test.util.ReflectionTestUtils; +import tech.jhipster.config.JHipsterProperties; + +class TokenProviderTest { + + private static final long ONE_MINUTE = 60000; + + private Key key; + private TokenProvider tokenProvider; + + @BeforeEach + public void setup() { + JHipsterProperties jHipsterProperties = new JHipsterProperties(); + String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"; + jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret); + + SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry()); + + tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService); + key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret)); + + ReflectionTestUtils.setField(tokenProvider, "key", key); + ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", ONE_MINUTE); + } + + @Test + void testReturnFalseWhenJWThasInvalidSignature() { + boolean isTokenValid = tokenProvider.validateToken(createTokenWithDifferentSignature()); + + assertThat(isTokenValid).isFalse(); + } + + @Test + void testReturnFalseWhenJWTisMalformed() { + Authentication authentication = createAuthentication(); + String token = tokenProvider.createToken(authentication, false); + String invalidToken = token.substring(1); + boolean isTokenValid = tokenProvider.validateToken(invalidToken); + + assertThat(isTokenValid).isFalse(); + } + + @Test + void testReturnFalseWhenJWTisExpired() { + ReflectionTestUtils.setField(tokenProvider, "tokenValidityInMilliseconds", -ONE_MINUTE); + + Authentication authentication = createAuthentication(); + String token = tokenProvider.createToken(authentication, false); + + boolean isTokenValid = tokenProvider.validateToken(token); + + assertThat(isTokenValid).isFalse(); + } + + @Test + void testReturnFalseWhenJWTisUnsupported() { + String unsupportedToken = createUnsupportedToken(); + + boolean isTokenValid = tokenProvider.validateToken(unsupportedToken); + + assertThat(isTokenValid).isFalse(); + } + + @Test + void testReturnFalseWhenJWTisInvalid() { + boolean isTokenValid = tokenProvider.validateToken(""); + + assertThat(isTokenValid).isFalse(); + } + + @Test + void testKeyIsSetFromSecretWhenSecretIsNotEmpty() { + final String secret = "NwskoUmKHZtzGRKJKVjsJF7BtQMMxNWi"; + JHipsterProperties jHipsterProperties = new JHipsterProperties(); + jHipsterProperties.getSecurity().getAuthentication().getJwt().setSecret(secret); + + SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry()); + + TokenProvider tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService); + + Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key"); + assertThat(key).isNotNull().isEqualTo(Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8))); + } + + @Test + void testKeyIsSetFromBase64SecretWhenSecretIsEmpty() { + final String base64Secret = "fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"; + JHipsterProperties jHipsterProperties = new JHipsterProperties(); + jHipsterProperties.getSecurity().getAuthentication().getJwt().setBase64Secret(base64Secret); + + SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry()); + + TokenProvider tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService); + + Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key"); + assertThat(key).isNotNull().isEqualTo(Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64Secret))); + } + + private Authentication createAuthentication() { + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + return new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities); + } + + private String createUnsupportedToken() { + return Jwts.builder().setPayload("payload").signWith(key, SignatureAlgorithm.HS512).compact(); + } + + private String createTokenWithDifferentSignature() { + Key otherKey = Keys.hmacShaKeyFor( + Decoders.BASE64.decode("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8") + ); + + return Jwts + .builder() + .setSubject("anonymous") + .signWith(otherKey, SignatureAlgorithm.HS512) + .setExpiration(new Date(new Date().getTime() + ONE_MINUTE)) + .compact(); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java b/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java new file mode 100644 index 0000000..726f976 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/EthnicityDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class EthnicityDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(EthnicityDTO.class); + EthnicityDTO ethnicityDTO1 = new EthnicityDTO(); + ethnicityDTO1.setId(1L); + EthnicityDTO ethnicityDTO2 = new EthnicityDTO(); + assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2); + ethnicityDTO2.setId(ethnicityDTO1.getId()); + assertThat(ethnicityDTO1).isEqualTo(ethnicityDTO2); + ethnicityDTO2.setId(2L); + assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2); + ethnicityDTO1.setId(null); + assertThat(ethnicityDTO1).isNotEqualTo(ethnicityDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java new file mode 100644 index 0000000..eda8a6b --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccountsDTO.class); + FimAccountsDTO fimAccountsDTO1 = new FimAccountsDTO(); + fimAccountsDTO1.setId(1L); + FimAccountsDTO fimAccountsDTO2 = new FimAccountsDTO(); + assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2); + fimAccountsDTO2.setId(fimAccountsDTO1.getId()); + assertThat(fimAccountsDTO1).isEqualTo(fimAccountsDTO2); + fimAccountsDTO2.setId(2L); + assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2); + fimAccountsDTO1.setId(null); + assertThat(fimAccountsDTO1).isNotEqualTo(fimAccountsDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java new file mode 100644 index 0000000..502ac38 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsHistoryDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsHistoryDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccountsHistoryDTO.class); + FimAccountsHistoryDTO fimAccountsHistoryDTO1 = new FimAccountsHistoryDTO(); + fimAccountsHistoryDTO1.setId(1L); + FimAccountsHistoryDTO fimAccountsHistoryDTO2 = new FimAccountsHistoryDTO(); + assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2); + fimAccountsHistoryDTO2.setId(fimAccountsHistoryDTO1.getId()); + assertThat(fimAccountsHistoryDTO1).isEqualTo(fimAccountsHistoryDTO2); + fimAccountsHistoryDTO2.setId(2L); + assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2); + fimAccountsHistoryDTO1.setId(null); + assertThat(fimAccountsHistoryDTO1).isNotEqualTo(fimAccountsHistoryDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java new file mode 100644 index 0000000..507b153 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimAccountsWqDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimAccountsWqDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimAccountsWqDTO.class); + FimAccountsWqDTO fimAccountsWqDTO1 = new FimAccountsWqDTO(); + fimAccountsWqDTO1.setId(1L); + FimAccountsWqDTO fimAccountsWqDTO2 = new FimAccountsWqDTO(); + assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2); + fimAccountsWqDTO2.setId(fimAccountsWqDTO1.getId()); + assertThat(fimAccountsWqDTO1).isEqualTo(fimAccountsWqDTO2); + fimAccountsWqDTO2.setId(2L); + assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2); + fimAccountsWqDTO1.setId(null); + assertThat(fimAccountsWqDTO1).isNotEqualTo(fimAccountsWqDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java new file mode 100644 index 0000000..8c1adb6 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimCustDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCustDTO.class); + FimCustDTO fimCustDTO1 = new FimCustDTO(); + fimCustDTO1.setId(1L); + FimCustDTO fimCustDTO2 = new FimCustDTO(); + assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2); + fimCustDTO2.setId(fimCustDTO1.getId()); + assertThat(fimCustDTO1).isEqualTo(fimCustDTO2); + fimCustDTO2.setId(2L); + assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2); + fimCustDTO1.setId(null); + assertThat(fimCustDTO1).isNotEqualTo(fimCustDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java new file mode 100644 index 0000000..05c1bd6 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimCustHistoryDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustHistoryDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCustHistoryDTO.class); + FimCustHistoryDTO fimCustHistoryDTO1 = new FimCustHistoryDTO(); + fimCustHistoryDTO1.setId(1L); + FimCustHistoryDTO fimCustHistoryDTO2 = new FimCustHistoryDTO(); + assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2); + fimCustHistoryDTO2.setId(fimCustHistoryDTO1.getId()); + assertThat(fimCustHistoryDTO1).isEqualTo(fimCustHistoryDTO2); + fimCustHistoryDTO2.setId(2L); + assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2); + fimCustHistoryDTO1.setId(null); + assertThat(fimCustHistoryDTO1).isNotEqualTo(fimCustHistoryDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java new file mode 100644 index 0000000..4150392 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimCustWqDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimCustWqDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimCustWqDTO.class); + FimCustWqDTO fimCustWqDTO1 = new FimCustWqDTO(); + fimCustWqDTO1.setId(1L); + FimCustWqDTO fimCustWqDTO2 = new FimCustWqDTO(); + assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2); + fimCustWqDTO2.setId(fimCustWqDTO1.getId()); + assertThat(fimCustWqDTO1).isEqualTo(fimCustWqDTO2); + fimCustWqDTO2.setId(2L); + assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2); + fimCustWqDTO1.setId(null); + assertThat(fimCustWqDTO1).isNotEqualTo(fimCustWqDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java new file mode 100644 index 0000000..5dc4c4d --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcctDTO.class); + FimSettAcctDTO fimSettAcctDTO1 = new FimSettAcctDTO(); + fimSettAcctDTO1.setId(1L); + FimSettAcctDTO fimSettAcctDTO2 = new FimSettAcctDTO(); + assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2); + fimSettAcctDTO2.setId(fimSettAcctDTO1.getId()); + assertThat(fimSettAcctDTO1).isEqualTo(fimSettAcctDTO2); + fimSettAcctDTO2.setId(2L); + assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2); + fimSettAcctDTO1.setId(null); + assertThat(fimSettAcctDTO1).isNotEqualTo(fimSettAcctDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java new file mode 100644 index 0000000..e4a91b6 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctHistoryDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctHistoryDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcctHistoryDTO.class); + FimSettAcctHistoryDTO fimSettAcctHistoryDTO1 = new FimSettAcctHistoryDTO(); + fimSettAcctHistoryDTO1.setId(1L); + FimSettAcctHistoryDTO fimSettAcctHistoryDTO2 = new FimSettAcctHistoryDTO(); + assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2); + fimSettAcctHistoryDTO2.setId(fimSettAcctHistoryDTO1.getId()); + assertThat(fimSettAcctHistoryDTO1).isEqualTo(fimSettAcctHistoryDTO2); + fimSettAcctHistoryDTO2.setId(2L); + assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2); + fimSettAcctHistoryDTO1.setId(null); + assertThat(fimSettAcctHistoryDTO1).isNotEqualTo(fimSettAcctHistoryDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java b/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java new file mode 100644 index 0000000..cccab5f --- /dev/null +++ b/src/test/java/com/scb/fimob/service/dto/FimSettAcctWqDTOTest.java @@ -0,0 +1,24 @@ +package com.scb.fimob.service.dto; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.scb.fimob.web.rest.TestUtil; +import org.junit.jupiter.api.Test; + +class FimSettAcctWqDTOTest { + + @Test + void dtoEqualsVerifier() throws Exception { + TestUtil.equalsVerifier(FimSettAcctWqDTO.class); + FimSettAcctWqDTO fimSettAcctWqDTO1 = new FimSettAcctWqDTO(); + fimSettAcctWqDTO1.setId(1L); + FimSettAcctWqDTO fimSettAcctWqDTO2 = new FimSettAcctWqDTO(); + assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2); + fimSettAcctWqDTO2.setId(fimSettAcctWqDTO1.getId()); + assertThat(fimSettAcctWqDTO1).isEqualTo(fimSettAcctWqDTO2); + fimSettAcctWqDTO2.setId(2L); + assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2); + fimSettAcctWqDTO1.setId(null); + assertThat(fimSettAcctWqDTO1).isNotEqualTo(fimSettAcctWqDTO2); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java new file mode 100644 index 0000000..c33e504 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/EthnicityMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class EthnicityMapperTest { + + private EthnicityMapper ethnicityMapper; + + @BeforeEach + public void setUp() { + ethnicityMapper = new EthnicityMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java new file mode 100644 index 0000000..ce50f0c --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsHistoryMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimAccountsHistoryMapperTest { + + private FimAccountsHistoryMapper fimAccountsHistoryMapper; + + @BeforeEach + public void setUp() { + fimAccountsHistoryMapper = new FimAccountsHistoryMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java new file mode 100644 index 0000000..b378bf4 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimAccountsMapperTest { + + private FimAccountsMapper fimAccountsMapper; + + @BeforeEach + public void setUp() { + fimAccountsMapper = new FimAccountsMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java new file mode 100644 index 0000000..00b5bbf --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimAccountsWqMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimAccountsWqMapperTest { + + private FimAccountsWqMapper fimAccountsWqMapper; + + @BeforeEach + public void setUp() { + fimAccountsWqMapper = new FimAccountsWqMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java new file mode 100644 index 0000000..df2da04 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimCustHistoryMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimCustHistoryMapperTest { + + private FimCustHistoryMapper fimCustHistoryMapper; + + @BeforeEach + public void setUp() { + fimCustHistoryMapper = new FimCustHistoryMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java new file mode 100644 index 0000000..4fb346e --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimCustMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimCustMapperTest { + + private FimCustMapper fimCustMapper; + + @BeforeEach + public void setUp() { + fimCustMapper = new FimCustMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java new file mode 100644 index 0000000..4459405 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimCustWqMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimCustWqMapperTest { + + private FimCustWqMapper fimCustWqMapper; + + @BeforeEach + public void setUp() { + fimCustWqMapper = new FimCustWqMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java new file mode 100644 index 0000000..7da3208 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctHistoryMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimSettAcctHistoryMapperTest { + + private FimSettAcctHistoryMapper fimSettAcctHistoryMapper; + + @BeforeEach + public void setUp() { + fimSettAcctHistoryMapper = new FimSettAcctHistoryMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java new file mode 100644 index 0000000..4b700e2 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimSettAcctMapperTest { + + private FimSettAcctMapper fimSettAcctMapper; + + @BeforeEach + public void setUp() { + fimSettAcctMapper = new FimSettAcctMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java new file mode 100644 index 0000000..b6aa039 --- /dev/null +++ b/src/test/java/com/scb/fimob/service/mapper/FimSettAcctWqMapperTest.java @@ -0,0 +1,16 @@ +package com.scb.fimob.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class FimSettAcctWqMapperTest { + + private FimSettAcctWqMapper fimSettAcctWqMapper; + + @BeforeEach + public void setUp() { + fimSettAcctWqMapper = new FimSettAcctWqMapperImpl(); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java b/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java new file mode 100644 index 0000000..76398fd --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/EthnicityResourceIT.java @@ -0,0 +1,421 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.Ethnicity; +import com.scb.fimob.repository.EthnicityRepository; +import com.scb.fimob.service.dto.EthnicityDTO; +import com.scb.fimob.service.mapper.EthnicityMapper; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link EthnicityResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class EthnicityResourceIT { + + private static final String DEFAULT_NAME = "AAAAAAAAAA"; + private static final String UPDATED_NAME = "BBBBBBBBBB"; + + private static final String DEFAULT_URDU_NAME = "AAAAAAAAAA"; + private static final String UPDATED_URDU_NAME = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/ethnicities"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private EthnicityRepository ethnicityRepository; + + @Autowired + private EthnicityMapper ethnicityMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restEthnicityMockMvc; + + private Ethnicity ethnicity; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Ethnicity createEntity(EntityManager em) { + Ethnicity ethnicity = new Ethnicity().name(DEFAULT_NAME).urduName(DEFAULT_URDU_NAME); + return ethnicity; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static Ethnicity createUpdatedEntity(EntityManager em) { + Ethnicity ethnicity = new Ethnicity().name(UPDATED_NAME).urduName(UPDATED_URDU_NAME); + return ethnicity; + } + + @BeforeEach + public void initTest() { + ethnicity = createEntity(em); + } + + @Test + @Transactional + void createEthnicity() throws Exception { + int databaseSizeBeforeCreate = ethnicityRepository.findAll().size(); + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + restEthnicityMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))) + .andExpect(status().isCreated()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeCreate + 1); + Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1); + assertThat(testEthnicity.getName()).isEqualTo(DEFAULT_NAME); + assertThat(testEthnicity.getUrduName()).isEqualTo(DEFAULT_URDU_NAME); + } + + @Test + @Transactional + void createEthnicityWithExistingId() throws Exception { + // Create the Ethnicity with an existing ID + ethnicity.setId(1L); + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + int databaseSizeBeforeCreate = ethnicityRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restEthnicityMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))) + .andExpect(status().isBadRequest()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkNameIsRequired() throws Exception { + int databaseSizeBeforeTest = ethnicityRepository.findAll().size(); + // set the field null + ethnicity.setName(null); + + // Create the Ethnicity, which fails. + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + restEthnicityMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))) + .andExpect(status().isBadRequest()); + + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllEthnicities() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + // Get all the ethnicityList + restEthnicityMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(ethnicity.getId().intValue()))) + .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME))) + .andExpect(jsonPath("$.[*].urduName").value(hasItem(DEFAULT_URDU_NAME))); + } + + @Test + @Transactional + void getEthnicity() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + // Get the ethnicity + restEthnicityMockMvc + .perform(get(ENTITY_API_URL_ID, ethnicity.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(ethnicity.getId().intValue())) + .andExpect(jsonPath("$.name").value(DEFAULT_NAME)) + .andExpect(jsonPath("$.urduName").value(DEFAULT_URDU_NAME)); + } + + @Test + @Transactional + void getNonExistingEthnicity() throws Exception { + // Get the ethnicity + restEthnicityMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewEthnicity() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + + // Update the ethnicity + Ethnicity updatedEthnicity = ethnicityRepository.findById(ethnicity.getId()).get(); + // Disconnect from session so that the updates on updatedEthnicity are not directly saved in db + em.detach(updatedEthnicity); + updatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME); + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(updatedEthnicity); + + restEthnicityMockMvc + .perform( + put(ENTITY_API_URL_ID, ethnicityDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isOk()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1); + assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME); + assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME); + } + + @Test + @Transactional + void putNonExistingEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform( + put(ENTITY_API_URL_ID, ethnicityDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(ethnicityDTO))) + .andExpect(status().isMethodNotAllowed()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateEthnicityWithPatch() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + + // Update the ethnicity using partial update + Ethnicity partialUpdatedEthnicity = new Ethnicity(); + partialUpdatedEthnicity.setId(ethnicity.getId()); + + partialUpdatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME); + + restEthnicityMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedEthnicity.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedEthnicity)) + ) + .andExpect(status().isOk()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1); + assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME); + assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME); + } + + @Test + @Transactional + void fullUpdateEthnicityWithPatch() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + + // Update the ethnicity using partial update + Ethnicity partialUpdatedEthnicity = new Ethnicity(); + partialUpdatedEthnicity.setId(ethnicity.getId()); + + partialUpdatedEthnicity.name(UPDATED_NAME).urduName(UPDATED_URDU_NAME); + + restEthnicityMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedEthnicity.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedEthnicity)) + ) + .andExpect(status().isOk()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + Ethnicity testEthnicity = ethnicityList.get(ethnicityList.size() - 1); + assertThat(testEthnicity.getName()).isEqualTo(UPDATED_NAME); + assertThat(testEthnicity.getUrduName()).isEqualTo(UPDATED_URDU_NAME); + } + + @Test + @Transactional + void patchNonExistingEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform( + patch(ENTITY_API_URL_ID, ethnicityDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamEthnicity() throws Exception { + int databaseSizeBeforeUpdate = ethnicityRepository.findAll().size(); + ethnicity.setId(count.incrementAndGet()); + + // Create the Ethnicity + EthnicityDTO ethnicityDTO = ethnicityMapper.toDto(ethnicity); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restEthnicityMockMvc + .perform( + patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(ethnicityDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the Ethnicity in the database + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteEthnicity() throws Exception { + // Initialize the database + ethnicityRepository.saveAndFlush(ethnicity); + + int databaseSizeBeforeDelete = ethnicityRepository.findAll().size(); + + // Delete the ethnicity + restEthnicityMockMvc + .perform(delete(ENTITY_API_URL_ID, ethnicity.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List ethnicityList = ethnicityRepository.findAll(); + assertThat(ethnicityList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java new file mode 100644 index 0000000..8a73f07 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsHistoryResourceIT.java @@ -0,0 +1,807 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimAccountsHistory; +import com.scb.fimob.repository.FimAccountsHistoryRepository; +import com.scb.fimob.service.dto.FimAccountsHistoryDTO; +import com.scb.fimob.service.mapper.FimAccountsHistoryMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimAccountsHistoryResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimAccountsHistoryResourceIT { + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_ID = "AAAAAAAAAA"; + private static final String UPDATED_RELN_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_TYPE = "AAAAA"; + private static final String UPDATED_RELN_TYPE = "BBBBB"; + + private static final String DEFAULT_OPER_INST = "AAAAAAAAAA"; + private static final String UPDATED_OPER_INST = "BBBBBBBBBB"; + + private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA"; + private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB"; + + private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA"; + private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB"; + + private static final String DEFAULT_REMARKS = "AAAAAAAAAA"; + private static final String UPDATED_REMARKS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-accounts-histories"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimAccountsHistoryRepository fimAccountsHistoryRepository; + + @Autowired + private FimAccountsHistoryMapper fimAccountsHistoryMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimAccountsHistoryMockMvc; + + private FimAccountsHistory fimAccountsHistory; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccountsHistory createEntity(EntityManager em) { + FimAccountsHistory fimAccountsHistory = new FimAccountsHistory() + .accountId(DEFAULT_ACCOUNT_ID) + .historyTs(DEFAULT_HISTORY_TS) + .custId(DEFAULT_CUST_ID) + .relnId(DEFAULT_RELN_ID) + .relnType(DEFAULT_RELN_TYPE) + .operInst(DEFAULT_OPER_INST) + .isAcctNbr(DEFAULT_IS_ACCT_NBR) + .bndAcctNbr(DEFAULT_BND_ACCT_NBR) + .closingId(DEFAULT_CLOSING_ID) + .subSegment(DEFAULT_SUB_SEGMENT) + .branchCode(DEFAULT_BRANCH_CODE) + .acctStatus(DEFAULT_ACCT_STATUS) + .ctryCode(DEFAULT_CTRY_CODE) + .acctOwners(DEFAULT_ACCT_OWNERS) + .remarks(DEFAULT_REMARKS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS); + return fimAccountsHistory; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccountsHistory createUpdatedEntity(EntityManager em) { + FimAccountsHistory fimAccountsHistory = new FimAccountsHistory() + .accountId(UPDATED_ACCOUNT_ID) + .historyTs(UPDATED_HISTORY_TS) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + return fimAccountsHistory; + } + + @BeforeEach + public void initTest() { + fimAccountsHistory = createEntity(em); + } + + @Test + @Transactional + void createFimAccountsHistory() throws Exception { + int databaseSizeBeforeCreate = fimAccountsHistoryRepository.findAll().size(); + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeCreate + 1); + FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1); + assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS); + assertThat(testFimAccountsHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(DEFAULT_RELN_ID); + assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE); + assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(DEFAULT_OPER_INST); + assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR); + assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR); + assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID); + assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT); + assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE); + assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS); + assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS); + assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void createFimAccountsHistoryWithExistingId() throws Exception { + // Create the FimAccountsHistory with an existing ID + fimAccountsHistory.setId(1L); + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + int databaseSizeBeforeCreate = fimAccountsHistoryRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkCustIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setCustId(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setRelnId(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setRelnType(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIsAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setIsAcctNbr(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkBndAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setBndAcctNbr(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsHistoryRepository.findAll().size(); + // set the field null + fimAccountsHistory.setAcctStatus(null); + + // Create the FimAccountsHistory, which fails. + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimAccountsHistories() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + // Get all the fimAccountsHistoryList + restFimAccountsHistoryMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccountsHistory.getId().intValue()))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString()))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID))) + .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE))) + .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST))) + .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR))) + .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR))) + .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID))) + .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT))) + .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE))) + .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS))) + .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))); + } + + @Test + @Transactional + void getFimAccountsHistory() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + // Get the fimAccountsHistory + restFimAccountsHistoryMockMvc + .perform(get(ENTITY_API_URL_ID, fimAccountsHistory.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimAccountsHistory.getId().intValue())) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString())) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID)) + .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE)) + .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST)) + .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR)) + .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR)) + .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID)) + .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT)) + .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE)) + .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS)) + .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)); + } + + @Test + @Transactional + void getNonExistingFimAccountsHistory() throws Exception { + // Get the fimAccountsHistory + restFimAccountsHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimAccountsHistory() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + + // Update the fimAccountsHistory + FimAccountsHistory updatedFimAccountsHistory = fimAccountsHistoryRepository.findById(fimAccountsHistory.getId()).get(); + // Disconnect from session so that the updates on updatedFimAccountsHistory are not directly saved in db + em.detach(updatedFimAccountsHistory); + updatedFimAccountsHistory + .accountId(UPDATED_ACCOUNT_ID) + .historyTs(UPDATED_HISTORY_TS) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(updatedFimAccountsHistory); + + restFimAccountsHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1); + assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void putNonExistingFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + put(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimAccountsHistoryWithPatch() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + + // Update the fimAccountsHistory using partial update + FimAccountsHistory partialUpdatedFimAccountsHistory = new FimAccountsHistory(); + partialUpdatedFimAccountsHistory.setId(fimAccountsHistory.getId()); + + partialUpdatedFimAccountsHistory + .accountId(UPDATED_ACCOUNT_ID) + .historyTs(UPDATED_HISTORY_TS) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS); + + restFimAccountsHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1); + assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(DEFAULT_OPER_INST); + assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE); + assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void fullUpdateFimAccountsHistoryWithPatch() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + + // Update the fimAccountsHistory using partial update + FimAccountsHistory partialUpdatedFimAccountsHistory = new FimAccountsHistory(); + partialUpdatedFimAccountsHistory.setId(fimAccountsHistory.getId()); + + partialUpdatedFimAccountsHistory + .accountId(UPDATED_ACCOUNT_ID) + .historyTs(UPDATED_HISTORY_TS) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimAccountsHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + FimAccountsHistory testFimAccountsHistory = fimAccountsHistoryList.get(fimAccountsHistoryList.size() - 1); + assertThat(testFimAccountsHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccountsHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimAccountsHistory.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccountsHistory.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsHistory.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccountsHistory.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccountsHistory.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsHistory.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccountsHistory.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsHistory.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccountsHistory.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccountsHistory.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccountsHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsHistory.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccountsHistory.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccountsHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccountsHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccountsHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void patchNonExistingFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimAccountsHistoryDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimAccountsHistory() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsHistoryRepository.findAll().size(); + fimAccountsHistory.setId(count.incrementAndGet()); + + // Create the FimAccountsHistory + FimAccountsHistoryDTO fimAccountsHistoryDTO = fimAccountsHistoryMapper.toDto(fimAccountsHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsHistoryMockMvc + .perform( + patch(ENTITY_API_URL) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccountsHistory in the database + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimAccountsHistory() throws Exception { + // Initialize the database + fimAccountsHistoryRepository.saveAndFlush(fimAccountsHistory); + + int databaseSizeBeforeDelete = fimAccountsHistoryRepository.findAll().size(); + + // Delete the fimAccountsHistory + restFimAccountsHistoryMockMvc + .perform(delete(ENTITY_API_URL_ID, fimAccountsHistory.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimAccountsHistoryList = fimAccountsHistoryRepository.findAll(); + assertThat(fimAccountsHistoryList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java new file mode 100644 index 0000000..84954b8 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsResourceIT.java @@ -0,0 +1,768 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimAccounts; +import com.scb.fimob.repository.FimAccountsRepository; +import com.scb.fimob.service.dto.FimAccountsDTO; +import com.scb.fimob.service.mapper.FimAccountsMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimAccountsResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimAccountsResourceIT { + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_ID = "AAAAAAAAAA"; + private static final String UPDATED_RELN_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_TYPE = "AAAAA"; + private static final String UPDATED_RELN_TYPE = "BBBBB"; + + private static final String DEFAULT_OPER_INST = "AAAAAAAAAA"; + private static final String UPDATED_OPER_INST = "BBBBBBBBBB"; + + private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA"; + private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB"; + + private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA"; + private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB"; + + private static final String DEFAULT_REMARKS = "AAAAAAAAAA"; + private static final String UPDATED_REMARKS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-accounts"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimAccountsRepository fimAccountsRepository; + + @Autowired + private FimAccountsMapper fimAccountsMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimAccountsMockMvc; + + private FimAccounts fimAccounts; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccounts createEntity(EntityManager em) { + FimAccounts fimAccounts = new FimAccounts() + .accountId(DEFAULT_ACCOUNT_ID) + .custId(DEFAULT_CUST_ID) + .relnId(DEFAULT_RELN_ID) + .relnType(DEFAULT_RELN_TYPE) + .operInst(DEFAULT_OPER_INST) + .isAcctNbr(DEFAULT_IS_ACCT_NBR) + .bndAcctNbr(DEFAULT_BND_ACCT_NBR) + .closingId(DEFAULT_CLOSING_ID) + .subSegment(DEFAULT_SUB_SEGMENT) + .branchCode(DEFAULT_BRANCH_CODE) + .acctStatus(DEFAULT_ACCT_STATUS) + .ctryCode(DEFAULT_CTRY_CODE) + .acctOwners(DEFAULT_ACCT_OWNERS) + .remarks(DEFAULT_REMARKS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS); + return fimAccounts; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccounts createUpdatedEntity(EntityManager em) { + FimAccounts fimAccounts = new FimAccounts() + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + return fimAccounts; + } + + @BeforeEach + public void initTest() { + fimAccounts = createEntity(em); + } + + @Test + @Transactional + void createFimAccounts() throws Exception { + int databaseSizeBeforeCreate = fimAccountsRepository.findAll().size(); + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeCreate + 1); + FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1); + assertThat(testFimAccounts.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimAccounts.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimAccounts.getRelnId()).isEqualTo(DEFAULT_RELN_ID); + assertThat(testFimAccounts.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE); + assertThat(testFimAccounts.getOperInst()).isEqualTo(DEFAULT_OPER_INST); + assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR); + assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR); + assertThat(testFimAccounts.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID); + assertThat(testFimAccounts.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT); + assertThat(testFimAccounts.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE); + assertThat(testFimAccounts.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS); + assertThat(testFimAccounts.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimAccounts.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS); + assertThat(testFimAccounts.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccounts.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimAccounts.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccounts.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void createFimAccountsWithExistingId() throws Exception { + // Create the FimAccounts with an existing ID + fimAccounts.setId(1L); + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + int databaseSizeBeforeCreate = fimAccountsRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkCustIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setCustId(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setRelnId(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setRelnType(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIsAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setIsAcctNbr(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkBndAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setBndAcctNbr(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsRepository.findAll().size(); + // set the field null + fimAccounts.setAcctStatus(null); + + // Create the FimAccounts, which fails. + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + restFimAccountsMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimAccounts() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + // Get all the fimAccountsList + restFimAccountsMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccounts.getId().intValue()))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID))) + .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE))) + .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST))) + .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR))) + .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR))) + .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID))) + .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT))) + .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE))) + .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS))) + .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))); + } + + @Test + @Transactional + void getFimAccounts() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + // Get the fimAccounts + restFimAccountsMockMvc + .perform(get(ENTITY_API_URL_ID, fimAccounts.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimAccounts.getId().intValue())) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID)) + .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE)) + .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST)) + .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR)) + .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR)) + .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID)) + .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT)) + .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE)) + .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS)) + .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)); + } + + @Test + @Transactional + void getNonExistingFimAccounts() throws Exception { + // Get the fimAccounts + restFimAccountsMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimAccounts() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + + // Update the fimAccounts + FimAccounts updatedFimAccounts = fimAccountsRepository.findById(fimAccounts.getId()).get(); + // Disconnect from session so that the updates on updatedFimAccounts are not directly saved in db + em.detach(updatedFimAccounts); + updatedFimAccounts + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(updatedFimAccounts); + + restFimAccountsMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1); + assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccounts.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccounts.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccounts.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccounts.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccounts.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccounts.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void putNonExistingFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO))) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimAccountsWithPatch() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + + // Update the fimAccounts using partial update + FimAccounts partialUpdatedFimAccounts = new FimAccounts(); + partialUpdatedFimAccounts.setId(fimAccounts.getId()); + + partialUpdatedFimAccounts + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .acctStatus(UPDATED_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimAccountsMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccounts.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccounts)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1); + assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccounts.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE); + assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR); + assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccounts.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE); + assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccounts.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimAccounts.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS); + assertThat(testFimAccounts.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccounts.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void fullUpdateFimAccountsWithPatch() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + + // Update the fimAccounts using partial update + FimAccounts partialUpdatedFimAccounts = new FimAccounts(); + partialUpdatedFimAccounts.setId(fimAccounts.getId()); + + partialUpdatedFimAccounts + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimAccountsMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccounts.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccounts)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + FimAccounts testFimAccounts = fimAccountsList.get(fimAccountsList.size() - 1); + assertThat(testFimAccounts.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccounts.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccounts.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccounts.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccounts.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccounts.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccounts.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccounts.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccounts.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccounts.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccounts.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccounts.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccounts.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccounts.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccounts.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccounts.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccounts.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccounts.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccounts.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void patchNonExistingFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimAccountsDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimAccounts() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsRepository.findAll().size(); + fimAccounts.setId(count.incrementAndGet()); + + // Create the FimAccounts + FimAccountsDTO fimAccountsDTO = fimAccountsMapper.toDto(fimAccounts); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsMockMvc + .perform( + patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimAccountsDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccounts in the database + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimAccounts() throws Exception { + // Initialize the database + fimAccountsRepository.saveAndFlush(fimAccounts); + + int databaseSizeBeforeDelete = fimAccountsRepository.findAll().size(); + + // Delete the fimAccounts + restFimAccountsMockMvc + .perform(delete(ENTITY_API_URL_ID, fimAccounts.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimAccountsList = fimAccountsRepository.findAll(); + assertThat(fimAccountsList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java new file mode 100644 index 0000000..4d0e6d8 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimAccountsWqResourceIT.java @@ -0,0 +1,783 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimAccountsWq; +import com.scb.fimob.repository.FimAccountsWqRepository; +import com.scb.fimob.service.dto.FimAccountsWqDTO; +import com.scb.fimob.service.mapper.FimAccountsWqMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimAccountsWqResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimAccountsWqResourceIT { + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_ID = "AAAAAAAAAA"; + private static final String UPDATED_RELN_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_RELN_TYPE = "AAAAA"; + private static final String UPDATED_RELN_TYPE = "BBBBB"; + + private static final String DEFAULT_OPER_INST = "AAAAAAAAAA"; + private static final String UPDATED_OPER_INST = "BBBBBBBBBB"; + + private static final String DEFAULT_IS_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_IS_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_BND_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_BND_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_CLOSING_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLOSING_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SUB_SEGMENT = "AAAAAAAAAA"; + private static final String UPDATED_SUB_SEGMENT = "BBBBBBBBBB"; + + private static final String DEFAULT_BRANCH_CODE = "AAAAAAAAAA"; + private static final String UPDATED_BRANCH_CODE = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_ACCT_OWNERS = "AAAAAAAAAA"; + private static final String UPDATED_ACCT_OWNERS = "BBBBBBBBBB"; + + private static final String DEFAULT_REMARKS = "AAAAAAAAAA"; + private static final String UPDATED_REMARKS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA"; + private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-accounts-wqs"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimAccountsWqRepository fimAccountsWqRepository; + + @Autowired + private FimAccountsWqMapper fimAccountsWqMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimAccountsWqMockMvc; + + private FimAccountsWq fimAccountsWq; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccountsWq createEntity(EntityManager em) { + FimAccountsWq fimAccountsWq = new FimAccountsWq() + .accountId(DEFAULT_ACCOUNT_ID) + .custId(DEFAULT_CUST_ID) + .relnId(DEFAULT_RELN_ID) + .relnType(DEFAULT_RELN_TYPE) + .operInst(DEFAULT_OPER_INST) + .isAcctNbr(DEFAULT_IS_ACCT_NBR) + .bndAcctNbr(DEFAULT_BND_ACCT_NBR) + .closingId(DEFAULT_CLOSING_ID) + .subSegment(DEFAULT_SUB_SEGMENT) + .branchCode(DEFAULT_BRANCH_CODE) + .acctStatus(DEFAULT_ACCT_STATUS) + .ctryCode(DEFAULT_CTRY_CODE) + .acctOwners(DEFAULT_ACCT_OWNERS) + .remarks(DEFAULT_REMARKS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS) + .uploadRemark(DEFAULT_UPLOAD_REMARK); + return fimAccountsWq; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimAccountsWq createUpdatedEntity(EntityManager em) { + FimAccountsWq fimAccountsWq = new FimAccountsWq() + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + return fimAccountsWq; + } + + @BeforeEach + public void initTest() { + fimAccountsWq = createEntity(em); + } + + @Test + @Transactional + void createFimAccountsWq() throws Exception { + int databaseSizeBeforeCreate = fimAccountsWqRepository.findAll().size(); + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeCreate + 1); + FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1); + assertThat(testFimAccountsWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimAccountsWq.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimAccountsWq.getRelnId()).isEqualTo(DEFAULT_RELN_ID); + assertThat(testFimAccountsWq.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE); + assertThat(testFimAccountsWq.getOperInst()).isEqualTo(DEFAULT_OPER_INST); + assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(DEFAULT_IS_ACCT_NBR); + assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR); + assertThat(testFimAccountsWq.getClosingId()).isEqualTo(DEFAULT_CLOSING_ID); + assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT); + assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(DEFAULT_BRANCH_CODE); + assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS); + assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS); + assertThat(testFimAccountsWq.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void createFimAccountsWqWithExistingId() throws Exception { + // Create the FimAccountsWq with an existing ID + fimAccountsWq.setId(1L); + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + int databaseSizeBeforeCreate = fimAccountsWqRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkCustIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setCustId(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setRelnId(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkRelnTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setRelnType(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIsAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setIsAcctNbr(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkBndAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setBndAcctNbr(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimAccountsWqRepository.findAll().size(); + // set the field null + fimAccountsWq.setAcctStatus(null); + + // Create the FimAccountsWq, which fails. + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimAccountsWqs() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + // Get all the fimAccountsWqList + restFimAccountsWqMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimAccountsWq.getId().intValue()))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].relnId").value(hasItem(DEFAULT_RELN_ID))) + .andExpect(jsonPath("$.[*].relnType").value(hasItem(DEFAULT_RELN_TYPE))) + .andExpect(jsonPath("$.[*].operInst").value(hasItem(DEFAULT_OPER_INST))) + .andExpect(jsonPath("$.[*].isAcctNbr").value(hasItem(DEFAULT_IS_ACCT_NBR))) + .andExpect(jsonPath("$.[*].bndAcctNbr").value(hasItem(DEFAULT_BND_ACCT_NBR))) + .andExpect(jsonPath("$.[*].closingId").value(hasItem(DEFAULT_CLOSING_ID))) + .andExpect(jsonPath("$.[*].subSegment").value(hasItem(DEFAULT_SUB_SEGMENT))) + .andExpect(jsonPath("$.[*].branchCode").value(hasItem(DEFAULT_BRANCH_CODE))) + .andExpect(jsonPath("$.[*].acctStatus").value(hasItem(DEFAULT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].acctOwners").value(hasItem(DEFAULT_ACCT_OWNERS))) + .andExpect(jsonPath("$.[*].remarks").value(hasItem(DEFAULT_REMARKS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))) + .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK))); + } + + @Test + @Transactional + void getFimAccountsWq() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + // Get the fimAccountsWq + restFimAccountsWqMockMvc + .perform(get(ENTITY_API_URL_ID, fimAccountsWq.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimAccountsWq.getId().intValue())) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.relnId").value(DEFAULT_RELN_ID)) + .andExpect(jsonPath("$.relnType").value(DEFAULT_RELN_TYPE)) + .andExpect(jsonPath("$.operInst").value(DEFAULT_OPER_INST)) + .andExpect(jsonPath("$.isAcctNbr").value(DEFAULT_IS_ACCT_NBR)) + .andExpect(jsonPath("$.bndAcctNbr").value(DEFAULT_BND_ACCT_NBR)) + .andExpect(jsonPath("$.closingId").value(DEFAULT_CLOSING_ID)) + .andExpect(jsonPath("$.subSegment").value(DEFAULT_SUB_SEGMENT)) + .andExpect(jsonPath("$.branchCode").value(DEFAULT_BRANCH_CODE)) + .andExpect(jsonPath("$.acctStatus").value(DEFAULT_ACCT_STATUS)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.acctOwners").value(DEFAULT_ACCT_OWNERS)) + .andExpect(jsonPath("$.remarks").value(DEFAULT_REMARKS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)) + .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK)); + } + + @Test + @Transactional + void getNonExistingFimAccountsWq() throws Exception { + // Get the fimAccountsWq + restFimAccountsWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimAccountsWq() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + + // Update the fimAccountsWq + FimAccountsWq updatedFimAccountsWq = fimAccountsWqRepository.findById(fimAccountsWq.getId()).get(); + // Disconnect from session so that the updates on updatedFimAccountsWq are not directly saved in db + em.detach(updatedFimAccountsWq); + updatedFimAccountsWq + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(updatedFimAccountsWq); + + restFimAccountsWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1); + assertThat(testFimAccountsWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccountsWq.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsWq.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccountsWq.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccountsWq.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void putNonExistingFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimAccountsWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimAccountsWqWithPatch() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + + // Update the fimAccountsWq using partial update + FimAccountsWq partialUpdatedFimAccountsWq = new FimAccountsWq(); + partialUpdatedFimAccountsWq.setId(fimAccountsWq.getId()); + + partialUpdatedFimAccountsWq + .relnId(UPDATED_RELN_ID) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .branchCode(UPDATED_BRANCH_CODE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimAccountsWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1); + assertThat(testFimAccountsWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimAccountsWq.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsWq.getRelnType()).isEqualTo(DEFAULT_RELN_TYPE); + assertThat(testFimAccountsWq.getOperInst()).isEqualTo(DEFAULT_OPER_INST); + assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(DEFAULT_BND_ACCT_NBR); + assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(DEFAULT_SUB_SEGMENT); + assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(DEFAULT_ACCT_STATUS); + assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(DEFAULT_ACCT_OWNERS); + assertThat(testFimAccountsWq.getRemarks()).isEqualTo(DEFAULT_REMARKS); + assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void fullUpdateFimAccountsWqWithPatch() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + + // Update the fimAccountsWq using partial update + FimAccountsWq partialUpdatedFimAccountsWq = new FimAccountsWq(); + partialUpdatedFimAccountsWq.setId(fimAccountsWq.getId()); + + partialUpdatedFimAccountsWq + .accountId(UPDATED_ACCOUNT_ID) + .custId(UPDATED_CUST_ID) + .relnId(UPDATED_RELN_ID) + .relnType(UPDATED_RELN_TYPE) + .operInst(UPDATED_OPER_INST) + .isAcctNbr(UPDATED_IS_ACCT_NBR) + .bndAcctNbr(UPDATED_BND_ACCT_NBR) + .closingId(UPDATED_CLOSING_ID) + .subSegment(UPDATED_SUB_SEGMENT) + .branchCode(UPDATED_BRANCH_CODE) + .acctStatus(UPDATED_ACCT_STATUS) + .ctryCode(UPDATED_CTRY_CODE) + .acctOwners(UPDATED_ACCT_OWNERS) + .remarks(UPDATED_REMARKS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimAccountsWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimAccountsWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimAccountsWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + FimAccountsWq testFimAccountsWq = fimAccountsWqList.get(fimAccountsWqList.size() - 1); + assertThat(testFimAccountsWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimAccountsWq.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimAccountsWq.getRelnId()).isEqualTo(UPDATED_RELN_ID); + assertThat(testFimAccountsWq.getRelnType()).isEqualTo(UPDATED_RELN_TYPE); + assertThat(testFimAccountsWq.getOperInst()).isEqualTo(UPDATED_OPER_INST); + assertThat(testFimAccountsWq.getIsAcctNbr()).isEqualTo(UPDATED_IS_ACCT_NBR); + assertThat(testFimAccountsWq.getBndAcctNbr()).isEqualTo(UPDATED_BND_ACCT_NBR); + assertThat(testFimAccountsWq.getClosingId()).isEqualTo(UPDATED_CLOSING_ID); + assertThat(testFimAccountsWq.getSubSegment()).isEqualTo(UPDATED_SUB_SEGMENT); + assertThat(testFimAccountsWq.getBranchCode()).isEqualTo(UPDATED_BRANCH_CODE); + assertThat(testFimAccountsWq.getAcctStatus()).isEqualTo(UPDATED_ACCT_STATUS); + assertThat(testFimAccountsWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimAccountsWq.getAcctOwners()).isEqualTo(UPDATED_ACCT_OWNERS); + assertThat(testFimAccountsWq.getRemarks()).isEqualTo(UPDATED_REMARKS); + assertThat(testFimAccountsWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimAccountsWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimAccountsWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimAccountsWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimAccountsWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimAccountsWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void patchNonExistingFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimAccountsWqDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimAccountsWq() throws Exception { + int databaseSizeBeforeUpdate = fimAccountsWqRepository.findAll().size(); + fimAccountsWq.setId(count.incrementAndGet()); + + // Create the FimAccountsWq + FimAccountsWqDTO fimAccountsWqDTO = fimAccountsWqMapper.toDto(fimAccountsWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimAccountsWqMockMvc + .perform( + patch(ENTITY_API_URL) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimAccountsWqDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimAccountsWq in the database + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimAccountsWq() throws Exception { + // Initialize the database + fimAccountsWqRepository.saveAndFlush(fimAccountsWq); + + int databaseSizeBeforeDelete = fimAccountsWqRepository.findAll().size(); + + // Delete the fimAccountsWq + restFimAccountsWqMockMvc + .perform(delete(ENTITY_API_URL_ID, fimAccountsWq.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimAccountsWqList = fimAccountsWqRepository.findAll(); + assertThat(fimAccountsWqList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java new file mode 100644 index 0000000..030ae76 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimCustHistoryResourceIT.java @@ -0,0 +1,605 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimCustHistory; +import com.scb.fimob.repository.FimCustHistoryRepository; +import com.scb.fimob.service.dto.FimCustHistoryDTO; +import com.scb.fimob.service.mapper.FimCustHistoryMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimCustHistoryResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimCustHistoryResourceIT { + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA"; + private static final String UPDATED_ID_TYPE = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-cust-histories"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimCustHistoryRepository fimCustHistoryRepository; + + @Autowired + private FimCustHistoryMapper fimCustHistoryMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimCustHistoryMockMvc; + + private FimCustHistory fimCustHistory; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCustHistory createEntity(EntityManager em) { + FimCustHistory fimCustHistory = new FimCustHistory() + .custId(DEFAULT_CUST_ID) + .historyTs(DEFAULT_HISTORY_TS) + .clientId(DEFAULT_CLIENT_ID) + .idType(DEFAULT_ID_TYPE) + .ctryCode(DEFAULT_CTRY_CODE) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS); + return fimCustHistory; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCustHistory createUpdatedEntity(EntityManager em) { + FimCustHistory fimCustHistory = new FimCustHistory() + .custId(UPDATED_CUST_ID) + .historyTs(UPDATED_HISTORY_TS) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + return fimCustHistory; + } + + @BeforeEach + public void initTest() { + fimCustHistory = createEntity(em); + } + + @Test + @Transactional + void createFimCustHistory() throws Exception { + int databaseSizeBeforeCreate = fimCustHistoryRepository.findAll().size(); + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeCreate + 1); + FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1); + assertThat(testFimCustHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS); + assertThat(testFimCustHistory.getClientId()).isEqualTo(DEFAULT_CLIENT_ID); + assertThat(testFimCustHistory.getIdType()).isEqualTo(DEFAULT_ID_TYPE); + assertThat(testFimCustHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void createFimCustHistoryWithExistingId() throws Exception { + // Create the FimCustHistory with an existing ID + fimCustHistory.setId(1L); + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + int databaseSizeBeforeCreate = fimCustHistoryRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkClientIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size(); + // set the field null + fimCustHistory.setClientId(null); + + // Create the FimCustHistory, which fails. + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIdTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size(); + // set the field null + fimCustHistory.setIdType(null); + + // Create the FimCustHistory, which fails. + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCtryCodeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size(); + // set the field null + fimCustHistory.setCtryCode(null); + + // Create the FimCustHistory, which fails. + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCreatedByIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustHistoryRepository.findAll().size(); + // set the field null + fimCustHistory.setCreatedBy(null); + + // Create the FimCustHistory, which fails. + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + restFimCustHistoryMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimCustHistories() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + // Get all the fimCustHistoryList + restFimCustHistoryMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimCustHistory.getId().intValue()))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString()))) + .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID))) + .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))); + } + + @Test + @Transactional + void getFimCustHistory() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + // Get the fimCustHistory + restFimCustHistoryMockMvc + .perform(get(ENTITY_API_URL_ID, fimCustHistory.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimCustHistory.getId().intValue())) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString())) + .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID)) + .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)); + } + + @Test + @Transactional + void getNonExistingFimCustHistory() throws Exception { + // Get the fimCustHistory + restFimCustHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimCustHistory() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + + // Update the fimCustHistory + FimCustHistory updatedFimCustHistory = fimCustHistoryRepository.findById(fimCustHistory.getId()).get(); + // Disconnect from session so that the updates on updatedFimCustHistory are not directly saved in db + em.detach(updatedFimCustHistory); + updatedFimCustHistory + .custId(UPDATED_CUST_ID) + .historyTs(UPDATED_HISTORY_TS) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(updatedFimCustHistory); + + restFimCustHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1); + assertThat(testFimCustHistory.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimCustHistory.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCustHistory.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCustHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void putNonExistingFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimCustHistoryWithPatch() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + + // Update the fimCustHistory using partial update + FimCustHistory partialUpdatedFimCustHistory = new FimCustHistory(); + partialUpdatedFimCustHistory.setId(fimCustHistory.getId()); + + partialUpdatedFimCustHistory.createdBy(UPDATED_CREATED_BY).updatedTs(UPDATED_UPDATED_TS); + + restFimCustHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCustHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1); + assertThat(testFimCustHistory.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS); + assertThat(testFimCustHistory.getClientId()).isEqualTo(DEFAULT_CLIENT_ID); + assertThat(testFimCustHistory.getIdType()).isEqualTo(DEFAULT_ID_TYPE); + assertThat(testFimCustHistory.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void fullUpdateFimCustHistoryWithPatch() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + + // Update the fimCustHistory using partial update + FimCustHistory partialUpdatedFimCustHistory = new FimCustHistory(); + partialUpdatedFimCustHistory.setId(fimCustHistory.getId()); + + partialUpdatedFimCustHistory + .custId(UPDATED_CUST_ID) + .historyTs(UPDATED_HISTORY_TS) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimCustHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCustHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + FimCustHistory testFimCustHistory = fimCustHistoryList.get(fimCustHistoryList.size() - 1); + assertThat(testFimCustHistory.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCustHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimCustHistory.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCustHistory.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCustHistory.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCustHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCustHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCustHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void patchNonExistingFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimCustHistoryDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimCustHistory() throws Exception { + int databaseSizeBeforeUpdate = fimCustHistoryRepository.findAll().size(); + fimCustHistory.setId(count.incrementAndGet()); + + // Create the FimCustHistory + FimCustHistoryDTO fimCustHistoryDTO = fimCustHistoryMapper.toDto(fimCustHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustHistoryMockMvc + .perform( + patch(ENTITY_API_URL) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCustHistory in the database + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimCustHistory() throws Exception { + // Initialize the database + fimCustHistoryRepository.saveAndFlush(fimCustHistory); + + int databaseSizeBeforeDelete = fimCustHistoryRepository.findAll().size(); + + // Delete the fimCustHistory + restFimCustHistoryMockMvc + .perform(delete(ENTITY_API_URL_ID, fimCustHistory.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimCustHistoryList = fimCustHistoryRepository.findAll(); + assertThat(fimCustHistoryList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java new file mode 100644 index 0000000..46386d6 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimCustResourceIT.java @@ -0,0 +1,593 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimCust; +import com.scb.fimob.repository.FimCustRepository; +import com.scb.fimob.service.dto.FimCustDTO; +import com.scb.fimob.service.mapper.FimCustMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimCustResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimCustResourceIT { + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA"; + private static final String UPDATED_ID_TYPE = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA"; + private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-custs"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimCustRepository fimCustRepository; + + @Autowired + private FimCustMapper fimCustMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimCustMockMvc; + + private FimCust fimCust; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCust createEntity(EntityManager em) { + FimCust fimCust = new FimCust() + .custId(DEFAULT_CUST_ID) + .clientId(DEFAULT_CLIENT_ID) + .idType(DEFAULT_ID_TYPE) + .ctryCode(DEFAULT_CTRY_CODE) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS) + .uploadRemark(DEFAULT_UPLOAD_REMARK); + return fimCust; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCust createUpdatedEntity(EntityManager em) { + FimCust fimCust = new FimCust() + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + return fimCust; + } + + @BeforeEach + public void initTest() { + fimCust = createEntity(em); + } + + @Test + @Transactional + void createFimCust() throws Exception { + int databaseSizeBeforeCreate = fimCustRepository.findAll().size(); + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isCreated()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeCreate + 1); + FimCust testFimCust = fimCustList.get(fimCustList.size() - 1); + assertThat(testFimCust.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimCust.getClientId()).isEqualTo(DEFAULT_CLIENT_ID); + assertThat(testFimCust.getIdType()).isEqualTo(DEFAULT_ID_TYPE); + assertThat(testFimCust.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCust.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimCust.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimCust.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimCust.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimCust.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimCust.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void createFimCustWithExistingId() throws Exception { + // Create the FimCust with an existing ID + fimCust.setId(1L); + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + int databaseSizeBeforeCreate = fimCustRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isBadRequest()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkClientIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustRepository.findAll().size(); + // set the field null + fimCust.setClientId(null); + + // Create the FimCust, which fails. + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isBadRequest()); + + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIdTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustRepository.findAll().size(); + // set the field null + fimCust.setIdType(null); + + // Create the FimCust, which fails. + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isBadRequest()); + + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCtryCodeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustRepository.findAll().size(); + // set the field null + fimCust.setCtryCode(null); + + // Create the FimCust, which fails. + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isBadRequest()); + + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCreatedByIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustRepository.findAll().size(); + // set the field null + fimCust.setCreatedBy(null); + + // Create the FimCust, which fails. + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + restFimCustMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isBadRequest()); + + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimCusts() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + // Get all the fimCustList + restFimCustMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimCust.getId().intValue()))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID))) + .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))) + .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK))); + } + + @Test + @Transactional + void getFimCust() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + // Get the fimCust + restFimCustMockMvc + .perform(get(ENTITY_API_URL_ID, fimCust.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimCust.getId().intValue())) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID)) + .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)) + .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK)); + } + + @Test + @Transactional + void getNonExistingFimCust() throws Exception { + // Get the fimCust + restFimCustMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimCust() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + + // Update the fimCust + FimCust updatedFimCust = fimCustRepository.findById(fimCust.getId()).get(); + // Disconnect from session so that the updates on updatedFimCust are not directly saved in db + em.detach(updatedFimCust); + updatedFimCust + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + FimCustDTO fimCustDTO = fimCustMapper.toDto(updatedFimCust); + + restFimCustMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + FimCust testFimCust = fimCustList.get(fimCustList.size() - 1); + assertThat(testFimCust.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCust.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCust.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCust.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCust.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimCust.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void putNonExistingFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustDTO))) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimCustWithPatch() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + + // Update the fimCust using partial update + FimCust partialUpdatedFimCust = new FimCust(); + partialUpdatedFimCust.setId(fimCust.getId()); + + partialUpdatedFimCust + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .createdTs(UPDATED_CREATED_TS) + .updatedTs(UPDATED_UPDATED_TS); + + restFimCustMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCust.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCust)) + ) + .andExpect(status().isOk()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + FimCust testFimCust = fimCustList.get(fimCustList.size() - 1); + assertThat(testFimCust.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCust.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCust.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCust.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCust.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimCust.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void fullUpdateFimCustWithPatch() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + + // Update the fimCust using partial update + FimCust partialUpdatedFimCust = new FimCust(); + partialUpdatedFimCust.setId(fimCust.getId()); + + partialUpdatedFimCust + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimCustMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCust.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCust)) + ) + .andExpect(status().isOk()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + FimCust testFimCust = fimCustList.get(fimCustList.size() - 1); + assertThat(testFimCust.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCust.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCust.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCust.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCust.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCust.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCust.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCust.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCust.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimCust.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void patchNonExistingFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimCustDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimCust() throws Exception { + int databaseSizeBeforeUpdate = fimCustRepository.findAll().size(); + fimCust.setId(count.incrementAndGet()); + + // Create the FimCust + FimCustDTO fimCustDTO = fimCustMapper.toDto(fimCust); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustMockMvc + .perform( + patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimCustDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCust in the database + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimCust() throws Exception { + // Initialize the database + fimCustRepository.saveAndFlush(fimCust); + + int databaseSizeBeforeDelete = fimCustRepository.findAll().size(); + + // Delete the fimCust + restFimCustMockMvc + .perform(delete(ENTITY_API_URL_ID, fimCust.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimCustList = fimCustRepository.findAll(); + assertThat(fimCustList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java new file mode 100644 index 0000000..8e46cd1 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimCustWqResourceIT.java @@ -0,0 +1,594 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimCustWq; +import com.scb.fimob.repository.FimCustWqRepository; +import com.scb.fimob.service.dto.FimCustWqDTO; +import com.scb.fimob.service.mapper.FimCustWqMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimCustWqResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimCustWqResourceIT { + + private static final String DEFAULT_CUST_ID = "AAAAAAAAAA"; + private static final String UPDATED_CUST_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_CLIENT_ID = "AAAAAAAAAA"; + private static final String UPDATED_CLIENT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ID_TYPE = "AAAAAAAAAA"; + private static final String UPDATED_ID_TYPE = "BBBBBBBBBB"; + + private static final String DEFAULT_CTRY_CODE = "AAA"; + private static final String UPDATED_CTRY_CODE = "BBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA"; + private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-cust-wqs"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimCustWqRepository fimCustWqRepository; + + @Autowired + private FimCustWqMapper fimCustWqMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimCustWqMockMvc; + + private FimCustWq fimCustWq; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCustWq createEntity(EntityManager em) { + FimCustWq fimCustWq = new FimCustWq() + .custId(DEFAULT_CUST_ID) + .clientId(DEFAULT_CLIENT_ID) + .idType(DEFAULT_ID_TYPE) + .ctryCode(DEFAULT_CTRY_CODE) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS) + .uploadRemark(DEFAULT_UPLOAD_REMARK); + return fimCustWq; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimCustWq createUpdatedEntity(EntityManager em) { + FimCustWq fimCustWq = new FimCustWq() + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + return fimCustWq; + } + + @BeforeEach + public void initTest() { + fimCustWq = createEntity(em); + } + + @Test + @Transactional + void createFimCustWq() throws Exception { + int databaseSizeBeforeCreate = fimCustWqRepository.findAll().size(); + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isCreated()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeCreate + 1); + FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1); + assertThat(testFimCustWq.getCustId()).isEqualTo(DEFAULT_CUST_ID); + assertThat(testFimCustWq.getClientId()).isEqualTo(DEFAULT_CLIENT_ID); + assertThat(testFimCustWq.getIdType()).isEqualTo(DEFAULT_ID_TYPE); + assertThat(testFimCustWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCustWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimCustWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimCustWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimCustWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void createFimCustWqWithExistingId() throws Exception { + // Create the FimCustWq with an existing ID + fimCustWq.setId(1L); + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + int databaseSizeBeforeCreate = fimCustWqRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isBadRequest()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkClientIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustWqRepository.findAll().size(); + // set the field null + fimCustWq.setClientId(null); + + // Create the FimCustWq, which fails. + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isBadRequest()); + + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkIdTypeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustWqRepository.findAll().size(); + // set the field null + fimCustWq.setIdType(null); + + // Create the FimCustWq, which fails. + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isBadRequest()); + + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCtryCodeIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustWqRepository.findAll().size(); + // set the field null + fimCustWq.setCtryCode(null); + + // Create the FimCustWq, which fails. + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isBadRequest()); + + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkCreatedByIsRequired() throws Exception { + int databaseSizeBeforeTest = fimCustWqRepository.findAll().size(); + // set the field null + fimCustWq.setCreatedBy(null); + + // Create the FimCustWq, which fails. + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + restFimCustWqMockMvc + .perform(post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isBadRequest()); + + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimCustWqs() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + // Get all the fimCustWqList + restFimCustWqMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimCustWq.getId().intValue()))) + .andExpect(jsonPath("$.[*].custId").value(hasItem(DEFAULT_CUST_ID))) + .andExpect(jsonPath("$.[*].clientId").value(hasItem(DEFAULT_CLIENT_ID))) + .andExpect(jsonPath("$.[*].idType").value(hasItem(DEFAULT_ID_TYPE))) + .andExpect(jsonPath("$.[*].ctryCode").value(hasItem(DEFAULT_CTRY_CODE))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))) + .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK))); + } + + @Test + @Transactional + void getFimCustWq() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + // Get the fimCustWq + restFimCustWqMockMvc + .perform(get(ENTITY_API_URL_ID, fimCustWq.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimCustWq.getId().intValue())) + .andExpect(jsonPath("$.custId").value(DEFAULT_CUST_ID)) + .andExpect(jsonPath("$.clientId").value(DEFAULT_CLIENT_ID)) + .andExpect(jsonPath("$.idType").value(DEFAULT_ID_TYPE)) + .andExpect(jsonPath("$.ctryCode").value(DEFAULT_CTRY_CODE)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)) + .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK)); + } + + @Test + @Transactional + void getNonExistingFimCustWq() throws Exception { + // Get the fimCustWq + restFimCustWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimCustWq() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + + // Update the fimCustWq + FimCustWq updatedFimCustWq = fimCustWqRepository.findById(fimCustWq.getId()).get(); + // Disconnect from session so that the updates on updatedFimCustWq are not directly saved in db + em.detach(updatedFimCustWq); + updatedFimCustWq + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(updatedFimCustWq); + + restFimCustWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1); + assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCustWq.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCustWq.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCustWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimCustWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void putNonExistingFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimCustWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO))) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimCustWqWithPatch() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + + // Update the fimCustWq using partial update + FimCustWq partialUpdatedFimCustWq = new FimCustWq(); + partialUpdatedFimCustWq.setId(fimCustWq.getId()); + + partialUpdatedFimCustWq + .custId(UPDATED_CUST_ID) + .createdBy(UPDATED_CREATED_BY) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimCustWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCustWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1); + assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCustWq.getClientId()).isEqualTo(DEFAULT_CLIENT_ID); + assertThat(testFimCustWq.getIdType()).isEqualTo(DEFAULT_ID_TYPE); + assertThat(testFimCustWq.getCtryCode()).isEqualTo(DEFAULT_CTRY_CODE); + assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimCustWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void fullUpdateFimCustWqWithPatch() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + + // Update the fimCustWq using partial update + FimCustWq partialUpdatedFimCustWq = new FimCustWq(); + partialUpdatedFimCustWq.setId(fimCustWq.getId()); + + partialUpdatedFimCustWq + .custId(UPDATED_CUST_ID) + .clientId(UPDATED_CLIENT_ID) + .idType(UPDATED_ID_TYPE) + .ctryCode(UPDATED_CTRY_CODE) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimCustWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimCustWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimCustWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + FimCustWq testFimCustWq = fimCustWqList.get(fimCustWqList.size() - 1); + assertThat(testFimCustWq.getCustId()).isEqualTo(UPDATED_CUST_ID); + assertThat(testFimCustWq.getClientId()).isEqualTo(UPDATED_CLIENT_ID); + assertThat(testFimCustWq.getIdType()).isEqualTo(UPDATED_ID_TYPE); + assertThat(testFimCustWq.getCtryCode()).isEqualTo(UPDATED_CTRY_CODE); + assertThat(testFimCustWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimCustWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimCustWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimCustWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimCustWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimCustWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void patchNonExistingFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimCustWqDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimCustWq() throws Exception { + int databaseSizeBeforeUpdate = fimCustWqRepository.findAll().size(); + fimCustWq.setId(count.incrementAndGet()); + + // Create the FimCustWq + FimCustWqDTO fimCustWqDTO = fimCustWqMapper.toDto(fimCustWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimCustWqMockMvc + .perform( + patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimCustWqDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimCustWq in the database + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimCustWq() throws Exception { + // Initialize the database + fimCustWqRepository.saveAndFlush(fimCustWq); + + int databaseSizeBeforeDelete = fimCustWqRepository.findAll().size(); + + // Delete the fimCustWq + restFimCustWqMockMvc + .perform(delete(ENTITY_API_URL_ID, fimCustWq.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimCustWqList = fimCustWqRepository.findAll(); + assertThat(fimCustWqList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java new file mode 100644 index 0000000..df21b7b --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctHistoryResourceIT.java @@ -0,0 +1,636 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimSettAcctHistory; +import com.scb.fimob.repository.FimSettAcctHistoryRepository; +import com.scb.fimob.service.dto.FimSettAcctHistoryDTO; +import com.scb.fimob.service.mapper.FimSettAcctHistoryMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimSettAcctHistoryResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimSettAcctHistoryResourceIT { + + private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA"; + private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB"; + + private static final Instant DEFAULT_HISTORY_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_HISTORY_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_CCY = "AAA"; + private static final String UPDATED_SETT_CCY = "BBB"; + + private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-sett-acct-histories"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimSettAcctHistoryRepository fimSettAcctHistoryRepository; + + @Autowired + private FimSettAcctHistoryMapper fimSettAcctHistoryMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimSettAcctHistoryMockMvc; + + private FimSettAcctHistory fimSettAcctHistory; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcctHistory createEntity(EntityManager em) { + FimSettAcctHistory fimSettAcctHistory = new FimSettAcctHistory() + .settaccId(DEFAULT_SETTACC_ID) + .historyTs(DEFAULT_HISTORY_TS) + .accountId(DEFAULT_ACCOUNT_ID) + .settAcctNbr(DEFAULT_SETT_ACCT_NBR) + .settCcy(DEFAULT_SETT_CCY) + .settAcctStatus(DEFAULT_SETT_ACCT_STATUS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS); + return fimSettAcctHistory; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcctHistory createUpdatedEntity(EntityManager em) { + FimSettAcctHistory fimSettAcctHistory = new FimSettAcctHistory() + .settaccId(UPDATED_SETTACC_ID) + .historyTs(UPDATED_HISTORY_TS) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + return fimSettAcctHistory; + } + + @BeforeEach + public void initTest() { + fimSettAcctHistory = createEntity(em); + } + + @Test + @Transactional + void createFimSettAcctHistory() throws Exception { + int databaseSizeBeforeCreate = fimSettAcctHistoryRepository.findAll().size(); + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeCreate + 1); + FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1); + assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID); + assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS); + assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR); + assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY); + assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void createFimSettAcctHistoryWithExistingId() throws Exception { + // Create the FimSettAcctHistory with an existing ID + fimSettAcctHistory.setId(1L); + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + int databaseSizeBeforeCreate = fimSettAcctHistoryRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkAccountIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size(); + // set the field null + fimSettAcctHistory.setAccountId(null); + + // Create the FimSettAcctHistory, which fails. + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size(); + // set the field null + fimSettAcctHistory.setSettAcctNbr(null); + + // Create the FimSettAcctHistory, which fails. + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettCcyIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size(); + // set the field null + fimSettAcctHistory.setSettCcy(null); + + // Create the FimSettAcctHistory, which fails. + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctHistoryRepository.findAll().size(); + // set the field null + fimSettAcctHistory.setSettAcctStatus(null); + + // Create the FimSettAcctHistory, which fails. + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + restFimSettAcctHistoryMockMvc + .perform( + post(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimSettAcctHistories() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + // Get all the fimSettAcctHistoryList + restFimSettAcctHistoryMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcctHistory.getId().intValue()))) + .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID))) + .andExpect(jsonPath("$.[*].historyTs").value(hasItem(DEFAULT_HISTORY_TS.toString()))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR))) + .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY))) + .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))); + } + + @Test + @Transactional + void getFimSettAcctHistory() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + // Get the fimSettAcctHistory + restFimSettAcctHistoryMockMvc + .perform(get(ENTITY_API_URL_ID, fimSettAcctHistory.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimSettAcctHistory.getId().intValue())) + .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID)) + .andExpect(jsonPath("$.historyTs").value(DEFAULT_HISTORY_TS.toString())) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR)) + .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY)) + .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)); + } + + @Test + @Transactional + void getNonExistingFimSettAcctHistory() throws Exception { + // Get the fimSettAcctHistory + restFimSettAcctHistoryMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimSettAcctHistory() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + + // Update the fimSettAcctHistory + FimSettAcctHistory updatedFimSettAcctHistory = fimSettAcctHistoryRepository.findById(fimSettAcctHistory.getId()).get(); + // Disconnect from session so that the updates on updatedFimSettAcctHistory are not directly saved in db + em.detach(updatedFimSettAcctHistory); + updatedFimSettAcctHistory + .settaccId(UPDATED_SETTACC_ID) + .historyTs(UPDATED_HISTORY_TS) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(updatedFimSettAcctHistory); + + restFimSettAcctHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1); + assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void putNonExistingFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + put(ENTITY_API_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimSettAcctHistoryWithPatch() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + + // Update the fimSettAcctHistory using partial update + FimSettAcctHistory partialUpdatedFimSettAcctHistory = new FimSettAcctHistory(); + partialUpdatedFimSettAcctHistory.setId(fimSettAcctHistory.getId()); + + partialUpdatedFimSettAcctHistory + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .createdBy(UPDATED_CREATED_BY) + .updatedTs(UPDATED_UPDATED_TS); + + restFimSettAcctHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1); + assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID); + assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(DEFAULT_HISTORY_TS); + assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY); + assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void fullUpdateFimSettAcctHistoryWithPatch() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + + // Update the fimSettAcctHistory using partial update + FimSettAcctHistory partialUpdatedFimSettAcctHistory = new FimSettAcctHistory(); + partialUpdatedFimSettAcctHistory.setId(fimSettAcctHistory.getId()); + + partialUpdatedFimSettAcctHistory + .settaccId(UPDATED_SETTACC_ID) + .historyTs(UPDATED_HISTORY_TS) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimSettAcctHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctHistory.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctHistory)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctHistory testFimSettAcctHistory = fimSettAcctHistoryList.get(fimSettAcctHistoryList.size() - 1); + assertThat(testFimSettAcctHistory.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcctHistory.getHistoryTs()).isEqualTo(UPDATED_HISTORY_TS); + assertThat(testFimSettAcctHistory.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcctHistory.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcctHistory.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcctHistory.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcctHistory.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctHistory.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcctHistory.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcctHistory.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctHistory.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void patchNonExistingFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimSettAcctHistoryDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimSettAcctHistory() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctHistoryRepository.findAll().size(); + fimSettAcctHistory.setId(count.incrementAndGet()); + + // Create the FimSettAcctHistory + FimSettAcctHistoryDTO fimSettAcctHistoryDTO = fimSettAcctHistoryMapper.toDto(fimSettAcctHistory); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctHistoryMockMvc + .perform( + patch(ENTITY_API_URL) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctHistoryDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcctHistory in the database + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimSettAcctHistory() throws Exception { + // Initialize the database + fimSettAcctHistoryRepository.saveAndFlush(fimSettAcctHistory); + + int databaseSizeBeforeDelete = fimSettAcctHistoryRepository.findAll().size(); + + // Delete the fimSettAcctHistory + restFimSettAcctHistoryMockMvc + .perform(delete(ENTITY_API_URL_ID, fimSettAcctHistory.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimSettAcctHistoryList = fimSettAcctHistoryRepository.findAll(); + assertThat(fimSettAcctHistoryList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java new file mode 100644 index 0000000..d91ae1f --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctResourceIT.java @@ -0,0 +1,606 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimSettAcct; +import com.scb.fimob.repository.FimSettAcctRepository; +import com.scb.fimob.service.dto.FimSettAcctDTO; +import com.scb.fimob.service.mapper.FimSettAcctMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimSettAcctResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimSettAcctResourceIT { + + private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA"; + private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_CCY = "AAA"; + private static final String UPDATED_SETT_CCY = "BBB"; + + private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-sett-accts"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimSettAcctRepository fimSettAcctRepository; + + @Autowired + private FimSettAcctMapper fimSettAcctMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimSettAcctMockMvc; + + private FimSettAcct fimSettAcct; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcct createEntity(EntityManager em) { + FimSettAcct fimSettAcct = new FimSettAcct() + .settaccId(DEFAULT_SETTACC_ID) + .accountId(DEFAULT_ACCOUNT_ID) + .settAcctNbr(DEFAULT_SETT_ACCT_NBR) + .settCcy(DEFAULT_SETT_CCY) + .settAcctStatus(DEFAULT_SETT_ACCT_STATUS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS); + return fimSettAcct; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcct createUpdatedEntity(EntityManager em) { + FimSettAcct fimSettAcct = new FimSettAcct() + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + return fimSettAcct; + } + + @BeforeEach + public void initTest() { + fimSettAcct = createEntity(em); + } + + @Test + @Transactional + void createFimSettAcct() throws Exception { + int databaseSizeBeforeCreate = fimSettAcctRepository.findAll().size(); + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeCreate + 1); + FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1); + assertThat(testFimSettAcct.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID); + assertThat(testFimSettAcct.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR); + assertThat(testFimSettAcct.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY); + assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void createFimSettAcctWithExistingId() throws Exception { + // Create the FimSettAcct with an existing ID + fimSettAcct.setId(1L); + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + int databaseSizeBeforeCreate = fimSettAcctRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkAccountIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size(); + // set the field null + fimSettAcct.setAccountId(null); + + // Create the FimSettAcct, which fails. + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size(); + // set the field null + fimSettAcct.setSettAcctNbr(null); + + // Create the FimSettAcct, which fails. + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettCcyIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size(); + // set the field null + fimSettAcct.setSettCcy(null); + + // Create the FimSettAcct, which fails. + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctRepository.findAll().size(); + // set the field null + fimSettAcct.setSettAcctStatus(null); + + // Create the FimSettAcct, which fails. + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + restFimSettAcctMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimSettAccts() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + // Get all the fimSettAcctList + restFimSettAcctMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcct.getId().intValue()))) + .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR))) + .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY))) + .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))); + } + + @Test + @Transactional + void getFimSettAcct() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + // Get the fimSettAcct + restFimSettAcctMockMvc + .perform(get(ENTITY_API_URL_ID, fimSettAcct.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimSettAcct.getId().intValue())) + .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID)) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR)) + .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY)) + .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)); + } + + @Test + @Transactional + void getNonExistingFimSettAcct() throws Exception { + // Get the fimSettAcct + restFimSettAcctMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimSettAcct() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + + // Update the fimSettAcct + FimSettAcct updatedFimSettAcct = fimSettAcctRepository.findById(fimSettAcct.getId()).get(); + // Disconnect from session so that the updates on updatedFimSettAcct are not directly saved in db + em.detach(updatedFimSettAcct); + updatedFimSettAcct + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(updatedFimSettAcct); + + restFimSettAcctMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1); + assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcct.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void putNonExistingFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform(put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO))) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimSettAcctWithPatch() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + + // Update the fimSettAcct using partial update + FimSettAcct partialUpdatedFimSettAcct = new FimSettAcct(); + partialUpdatedFimSettAcct.setId(fimSettAcct.getId()); + + partialUpdatedFimSettAcct + .settaccId(UPDATED_SETTACC_ID) + .settCcy(UPDATED_SETT_CCY) + .createdBy(UPDATED_CREATED_BY) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS); + + restFimSettAcctMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcct.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcct)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1); + assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcct.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR); + assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + } + + @Test + @Transactional + void fullUpdateFimSettAcctWithPatch() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + + // Update the fimSettAcct using partial update + FimSettAcct partialUpdatedFimSettAcct = new FimSettAcct(); + partialUpdatedFimSettAcct.setId(fimSettAcct.getId()); + + partialUpdatedFimSettAcct + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS); + + restFimSettAcctMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcct.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcct)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + FimSettAcct testFimSettAcct = fimSettAcctList.get(fimSettAcctList.size() - 1); + assertThat(testFimSettAcct.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcct.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcct.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcct.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcct.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcct.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcct.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcct.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcct.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcct.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + } + + @Test + @Transactional + void patchNonExistingFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimSettAcctDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimSettAcct() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctRepository.findAll().size(); + fimSettAcct.setId(count.incrementAndGet()); + + // Create the FimSettAcct + FimSettAcctDTO fimSettAcctDTO = fimSettAcctMapper.toDto(fimSettAcct); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctMockMvc + .perform( + patch(ENTITY_API_URL).contentType("application/merge-patch+json").content(TestUtil.convertObjectToJsonBytes(fimSettAcctDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcct in the database + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimSettAcct() throws Exception { + // Initialize the database + fimSettAcctRepository.saveAndFlush(fimSettAcct); + + int databaseSizeBeforeDelete = fimSettAcctRepository.findAll().size(); + + // Delete the fimSettAcct + restFimSettAcctMockMvc + .perform(delete(ENTITY_API_URL_ID, fimSettAcct.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimSettAcctList = fimSettAcctRepository.findAll(); + assertThat(fimSettAcctList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java b/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java new file mode 100644 index 0000000..573a072 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/FimSettAcctWqResourceIT.java @@ -0,0 +1,622 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.scb.fimob.IntegrationTest; +import com.scb.fimob.domain.FimSettAcctWq; +import com.scb.fimob.repository.FimSettAcctWqRepository; +import com.scb.fimob.service.dto.FimSettAcctWqDTO; +import com.scb.fimob.service.mapper.FimSettAcctWqMapper; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; +import javax.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link FimSettAcctWqResource} REST controller. + */ +@IntegrationTest +@AutoConfigureMockMvc +@WithMockUser +class FimSettAcctWqResourceIT { + + private static final String DEFAULT_SETTACC_ID = "AAAAAAAAAA"; + private static final String UPDATED_SETTACC_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_ACCOUNT_ID = "AAAAAAAAAA"; + private static final String UPDATED_ACCOUNT_ID = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_ACCT_NBR = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_NBR = "BBBBBBBBBB"; + + private static final String DEFAULT_SETT_CCY = "AAA"; + private static final String UPDATED_SETT_CCY = "BBB"; + + private static final String DEFAULT_SETT_ACCT_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_SETT_ACCT_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_CREATED_BY = "AAAAAAAA"; + private static final String UPDATED_CREATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_CREATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_CREATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_UPDATED_BY = "AAAAAAAA"; + private static final String UPDATED_UPDATED_BY = "BBBBBBBB"; + + private static final Instant DEFAULT_UPDATED_TS = Instant.ofEpochMilli(0L); + private static final Instant UPDATED_UPDATED_TS = Instant.now().truncatedTo(ChronoUnit.MILLIS); + + private static final String DEFAULT_RECORD_STATUS = "AAAAAAAAAA"; + private static final String UPDATED_RECORD_STATUS = "BBBBBBBBBB"; + + private static final String DEFAULT_UPLOAD_REMARK = "AAAAAAAAAA"; + private static final String UPDATED_UPLOAD_REMARK = "BBBBBBBBBB"; + + private static final String ENTITY_API_URL = "/api/fim-sett-acct-wqs"; + private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{id}"; + + private static Random random = new Random(); + private static AtomicLong count = new AtomicLong(random.nextInt() + (2 * Integer.MAX_VALUE)); + + @Autowired + private FimSettAcctWqRepository fimSettAcctWqRepository; + + @Autowired + private FimSettAcctWqMapper fimSettAcctWqMapper; + + @Autowired + private EntityManager em; + + @Autowired + private MockMvc restFimSettAcctWqMockMvc; + + private FimSettAcctWq fimSettAcctWq; + + /** + * Create an entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcctWq createEntity(EntityManager em) { + FimSettAcctWq fimSettAcctWq = new FimSettAcctWq() + .settaccId(DEFAULT_SETTACC_ID) + .accountId(DEFAULT_ACCOUNT_ID) + .settAcctNbr(DEFAULT_SETT_ACCT_NBR) + .settCcy(DEFAULT_SETT_CCY) + .settAcctStatus(DEFAULT_SETT_ACCT_STATUS) + .createdBy(DEFAULT_CREATED_BY) + .createdTs(DEFAULT_CREATED_TS) + .updatedBy(DEFAULT_UPDATED_BY) + .updatedTs(DEFAULT_UPDATED_TS) + .recordStatus(DEFAULT_RECORD_STATUS) + .uploadRemark(DEFAULT_UPLOAD_REMARK); + return fimSettAcctWq; + } + + /** + * Create an updated entity for this test. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which requires the current entity. + */ + public static FimSettAcctWq createUpdatedEntity(EntityManager em) { + FimSettAcctWq fimSettAcctWq = new FimSettAcctWq() + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + return fimSettAcctWq; + } + + @BeforeEach + public void initTest() { + fimSettAcctWq = createEntity(em); + } + + @Test + @Transactional + void createFimSettAcctWq() throws Exception { + int databaseSizeBeforeCreate = fimSettAcctWqRepository.findAll().size(); + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isCreated()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeCreate + 1); + FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1); + assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID); + assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR); + assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(DEFAULT_SETT_CCY); + assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(DEFAULT_CREATED_BY); + assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(DEFAULT_UPDATED_TS); + assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(DEFAULT_UPLOAD_REMARK); + } + + @Test + @Transactional + void createFimSettAcctWqWithExistingId() throws Exception { + // Create the FimSettAcctWq with an existing ID + fimSettAcctWq.setId(1L); + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + int databaseSizeBeforeCreate = fimSettAcctWqRepository.findAll().size(); + + // An entity with an existing ID cannot be created, so this API call must fail + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeCreate); + } + + @Test + @Transactional + void checkAccountIdIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size(); + // set the field null + fimSettAcctWq.setAccountId(null); + + // Create the FimSettAcctWq, which fails. + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctNbrIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size(); + // set the field null + fimSettAcctWq.setSettAcctNbr(null); + + // Create the FimSettAcctWq, which fails. + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettCcyIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size(); + // set the field null + fimSettAcctWq.setSettCcy(null); + + // Create the FimSettAcctWq, which fails. + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void checkSettAcctStatusIsRequired() throws Exception { + int databaseSizeBeforeTest = fimSettAcctWqRepository.findAll().size(); + // set the field null + fimSettAcctWq.setSettAcctStatus(null); + + // Create the FimSettAcctWq, which fails. + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + restFimSettAcctWqMockMvc + .perform( + post(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + void getAllFimSettAcctWqs() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + // Get all the fimSettAcctWqList + restFimSettAcctWqMockMvc + .perform(get(ENTITY_API_URL + "?sort=id,desc")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].id").value(hasItem(fimSettAcctWq.getId().intValue()))) + .andExpect(jsonPath("$.[*].settaccId").value(hasItem(DEFAULT_SETTACC_ID))) + .andExpect(jsonPath("$.[*].accountId").value(hasItem(DEFAULT_ACCOUNT_ID))) + .andExpect(jsonPath("$.[*].settAcctNbr").value(hasItem(DEFAULT_SETT_ACCT_NBR))) + .andExpect(jsonPath("$.[*].settCcy").value(hasItem(DEFAULT_SETT_CCY))) + .andExpect(jsonPath("$.[*].settAcctStatus").value(hasItem(DEFAULT_SETT_ACCT_STATUS))) + .andExpect(jsonPath("$.[*].createdBy").value(hasItem(DEFAULT_CREATED_BY))) + .andExpect(jsonPath("$.[*].createdTs").value(hasItem(DEFAULT_CREATED_TS.toString()))) + .andExpect(jsonPath("$.[*].updatedBy").value(hasItem(DEFAULT_UPDATED_BY))) + .andExpect(jsonPath("$.[*].updatedTs").value(hasItem(DEFAULT_UPDATED_TS.toString()))) + .andExpect(jsonPath("$.[*].recordStatus").value(hasItem(DEFAULT_RECORD_STATUS))) + .andExpect(jsonPath("$.[*].uploadRemark").value(hasItem(DEFAULT_UPLOAD_REMARK))); + } + + @Test + @Transactional + void getFimSettAcctWq() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + // Get the fimSettAcctWq + restFimSettAcctWqMockMvc + .perform(get(ENTITY_API_URL_ID, fimSettAcctWq.getId())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.id").value(fimSettAcctWq.getId().intValue())) + .andExpect(jsonPath("$.settaccId").value(DEFAULT_SETTACC_ID)) + .andExpect(jsonPath("$.accountId").value(DEFAULT_ACCOUNT_ID)) + .andExpect(jsonPath("$.settAcctNbr").value(DEFAULT_SETT_ACCT_NBR)) + .andExpect(jsonPath("$.settCcy").value(DEFAULT_SETT_CCY)) + .andExpect(jsonPath("$.settAcctStatus").value(DEFAULT_SETT_ACCT_STATUS)) + .andExpect(jsonPath("$.createdBy").value(DEFAULT_CREATED_BY)) + .andExpect(jsonPath("$.createdTs").value(DEFAULT_CREATED_TS.toString())) + .andExpect(jsonPath("$.updatedBy").value(DEFAULT_UPDATED_BY)) + .andExpect(jsonPath("$.updatedTs").value(DEFAULT_UPDATED_TS.toString())) + .andExpect(jsonPath("$.recordStatus").value(DEFAULT_RECORD_STATUS)) + .andExpect(jsonPath("$.uploadRemark").value(DEFAULT_UPLOAD_REMARK)); + } + + @Test + @Transactional + void getNonExistingFimSettAcctWq() throws Exception { + // Get the fimSettAcctWq + restFimSettAcctWqMockMvc.perform(get(ENTITY_API_URL_ID, Long.MAX_VALUE)).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void putNewFimSettAcctWq() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + + // Update the fimSettAcctWq + FimSettAcctWq updatedFimSettAcctWq = fimSettAcctWqRepository.findById(fimSettAcctWq.getId()).get(); + // Disconnect from session so that the updates on updatedFimSettAcctWq are not directly saved in db + em.detach(updatedFimSettAcctWq); + updatedFimSettAcctWq + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(updatedFimSettAcctWq); + + restFimSettAcctWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1); + assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void putNonExistingFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + put(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithIdMismatchFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + put(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void putWithMissingIdPathParamFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + put(ENTITY_API_URL).contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void partialUpdateFimSettAcctWqWithPatch() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + + // Update the fimSettAcctWq using partial update + FimSettAcctWq partialUpdatedFimSettAcctWq = new FimSettAcctWq(); + partialUpdatedFimSettAcctWq.setId(fimSettAcctWq.getId()); + + partialUpdatedFimSettAcctWq + .settCcy(UPDATED_SETT_CCY) + .createdBy(UPDATED_CREATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimSettAcctWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1); + assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(DEFAULT_SETTACC_ID); + assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(DEFAULT_ACCOUNT_ID); + assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(DEFAULT_SETT_ACCT_NBR); + assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(DEFAULT_SETT_ACCT_STATUS); + assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(DEFAULT_CREATED_TS); + assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(DEFAULT_UPDATED_BY); + assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(DEFAULT_RECORD_STATUS); + assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void fullUpdateFimSettAcctWqWithPatch() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + + // Update the fimSettAcctWq using partial update + FimSettAcctWq partialUpdatedFimSettAcctWq = new FimSettAcctWq(); + partialUpdatedFimSettAcctWq.setId(fimSettAcctWq.getId()); + + partialUpdatedFimSettAcctWq + .settaccId(UPDATED_SETTACC_ID) + .accountId(UPDATED_ACCOUNT_ID) + .settAcctNbr(UPDATED_SETT_ACCT_NBR) + .settCcy(UPDATED_SETT_CCY) + .settAcctStatus(UPDATED_SETT_ACCT_STATUS) + .createdBy(UPDATED_CREATED_BY) + .createdTs(UPDATED_CREATED_TS) + .updatedBy(UPDATED_UPDATED_BY) + .updatedTs(UPDATED_UPDATED_TS) + .recordStatus(UPDATED_RECORD_STATUS) + .uploadRemark(UPDATED_UPLOAD_REMARK); + + restFimSettAcctWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, partialUpdatedFimSettAcctWq.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(partialUpdatedFimSettAcctWq)) + ) + .andExpect(status().isOk()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + FimSettAcctWq testFimSettAcctWq = fimSettAcctWqList.get(fimSettAcctWqList.size() - 1); + assertThat(testFimSettAcctWq.getSettaccId()).isEqualTo(UPDATED_SETTACC_ID); + assertThat(testFimSettAcctWq.getAccountId()).isEqualTo(UPDATED_ACCOUNT_ID); + assertThat(testFimSettAcctWq.getSettAcctNbr()).isEqualTo(UPDATED_SETT_ACCT_NBR); + assertThat(testFimSettAcctWq.getSettCcy()).isEqualTo(UPDATED_SETT_CCY); + assertThat(testFimSettAcctWq.getSettAcctStatus()).isEqualTo(UPDATED_SETT_ACCT_STATUS); + assertThat(testFimSettAcctWq.getCreatedBy()).isEqualTo(UPDATED_CREATED_BY); + assertThat(testFimSettAcctWq.getCreatedTs()).isEqualTo(UPDATED_CREATED_TS); + assertThat(testFimSettAcctWq.getUpdatedBy()).isEqualTo(UPDATED_UPDATED_BY); + assertThat(testFimSettAcctWq.getUpdatedTs()).isEqualTo(UPDATED_UPDATED_TS); + assertThat(testFimSettAcctWq.getRecordStatus()).isEqualTo(UPDATED_RECORD_STATUS); + assertThat(testFimSettAcctWq.getUploadRemark()).isEqualTo(UPDATED_UPLOAD_REMARK); + } + + @Test + @Transactional + void patchNonExistingFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If the entity doesn't have an ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, fimSettAcctWqDTO.getId()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithIdMismatchFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + patch(ENTITY_API_URL_ID, count.incrementAndGet()) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isBadRequest()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void patchWithMissingIdPathParamFimSettAcctWq() throws Exception { + int databaseSizeBeforeUpdate = fimSettAcctWqRepository.findAll().size(); + fimSettAcctWq.setId(count.incrementAndGet()); + + // Create the FimSettAcctWq + FimSettAcctWqDTO fimSettAcctWqDTO = fimSettAcctWqMapper.toDto(fimSettAcctWq); + + // If url ID doesn't match entity ID, it will throw BadRequestAlertException + restFimSettAcctWqMockMvc + .perform( + patch(ENTITY_API_URL) + .contentType("application/merge-patch+json") + .content(TestUtil.convertObjectToJsonBytes(fimSettAcctWqDTO)) + ) + .andExpect(status().isMethodNotAllowed()); + + // Validate the FimSettAcctWq in the database + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeUpdate); + } + + @Test + @Transactional + void deleteFimSettAcctWq() throws Exception { + // Initialize the database + fimSettAcctWqRepository.saveAndFlush(fimSettAcctWq); + + int databaseSizeBeforeDelete = fimSettAcctWqRepository.findAll().size(); + + // Delete the fimSettAcctWq + restFimSettAcctWqMockMvc + .perform(delete(ENTITY_API_URL_ID, fimSettAcctWq.getId()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // Validate the database contains one less item + List fimSettAcctWqList = fimSettAcctWqRepository.findAll(); + assertThat(fimSettAcctWqList).hasSize(databaseSizeBeforeDelete - 1); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/TestUtil.java b/src/test/java/com/scb/fimob/web/rest/TestUtil.java new file mode 100644 index 0000000..6670739 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/TestUtil.java @@ -0,0 +1,206 @@ +package com.scb.fimob.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.TypeSafeMatcher; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; + +/** + * Utility class for testing REST controllers. + */ +public final class TestUtil { + + private static final ObjectMapper mapper = createObjectMapper(); + + private static ObjectMapper createObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + mapper.registerModule(new JavaTimeModule()); + return mapper; + } + + /** + * Convert an object to JSON byte array. + * + * @param object the object to convert. + * @return the JSON byte array. + * @throws IOException + */ + public static byte[] convertObjectToJsonBytes(Object object) throws IOException { + return mapper.writeValueAsBytes(object); + } + + /** + * Create a byte array with a specific size filled with specified data. + * + * @param size the size of the byte array. + * @param data the data to put in the byte array. + * @return the JSON byte array. + */ + public static byte[] createByteArray(int size, String data) { + byte[] byteArray = new byte[size]; + for (int i = 0; i < size; i++) { + byteArray[i] = Byte.parseByte(data, 2); + } + return byteArray; + } + + /** + * A matcher that tests that the examined string represents the same instant as the reference datetime. + */ + public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher { + + private final ZonedDateTime date; + + public ZonedDateTimeMatcher(ZonedDateTime date) { + this.date = date; + } + + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + try { + if (!date.isEqual(ZonedDateTime.parse(item))) { + mismatchDescription.appendText("was ").appendValue(item); + return false; + } + return true; + } catch (DateTimeParseException e) { + mismatchDescription.appendText("was ").appendValue(item).appendText(", which could not be parsed as a ZonedDateTime"); + return false; + } + } + + @Override + public void describeTo(Description description) { + description.appendText("a String representing the same Instant as ").appendValue(date); + } + } + + /** + * Creates a matcher that matches when the examined string represents the same instant as the reference datetime. + * + * @param date the reference datetime against which the examined string is checked. + */ + public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { + return new ZonedDateTimeMatcher(date); + } + + /** + * A matcher that tests that the examined number represents the same value - it can be Long, Double, etc - as the reference BigDecimal. + */ + public static class NumberMatcher extends TypeSafeMatcher { + + final BigDecimal value; + + public NumberMatcher(BigDecimal value) { + this.value = value; + } + + @Override + public void describeTo(Description description) { + description.appendText("a numeric value is ").appendValue(value); + } + + @Override + protected boolean matchesSafely(Number item) { + BigDecimal bigDecimal = asDecimal(item); + return bigDecimal != null && value.compareTo(bigDecimal) == 0; + } + + private static BigDecimal asDecimal(Number item) { + if (item == null) { + return null; + } + if (item instanceof BigDecimal) { + return (BigDecimal) item; + } else if (item instanceof Long) { + return BigDecimal.valueOf((Long) item); + } else if (item instanceof Integer) { + return BigDecimal.valueOf((Integer) item); + } else if (item instanceof Double) { + return BigDecimal.valueOf((Double) item); + } else if (item instanceof Float) { + return BigDecimal.valueOf((Float) item); + } else { + return BigDecimal.valueOf(item.doubleValue()); + } + } + } + + /** + * Creates a matcher that matches when the examined number represents the same value as the reference BigDecimal. + * + * @param number the reference BigDecimal against which the examined number is checked. + */ + public static NumberMatcher sameNumber(BigDecimal number) { + return new NumberMatcher(number); + } + + /** + * Verifies the equals/hashcode contract on the domain object. + */ + public static void equalsVerifier(Class clazz) throws Exception { + T domainObject1 = clazz.getConstructor().newInstance(); + assertThat(domainObject1.toString()).isNotNull(); + assertThat(domainObject1).isEqualTo(domainObject1); + assertThat(domainObject1).hasSameHashCodeAs(domainObject1); + // Test with an instance of another class + Object testOtherObject = new Object(); + assertThat(domainObject1).isNotEqualTo(testOtherObject); + assertThat(domainObject1).isNotEqualTo(null); + // Test with an instance of the same class + T domainObject2 = clazz.getConstructor().newInstance(); + assertThat(domainObject1).isNotEqualTo(domainObject2); + // HashCodes are equals because the objects are not persisted yet + assertThat(domainObject1).hasSameHashCodeAs(domainObject2); + } + + /** + * Create a {@link FormattingConversionService} which use ISO date format, instead of the localized one. + * @return the {@link FormattingConversionService}. + */ + public static FormattingConversionService createFormattingConversionService() { + DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService(); + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(dfcs); + return dfcs; + } + + /** + * Makes a an executes a query to the EntityManager finding all stored objects. + * @param The type of objects to be searched + * @param em The instance of the EntityManager + * @param clss The class type to be searched + * @return A list of all found objects + */ + public static List findAll(EntityManager em, Class clss) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(clss); + Root rootEntry = cq.from(clss); + CriteriaQuery all = cq.select(rootEntry); + TypedQuery allQuery = em.createQuery(all); + return allQuery.getResultList(); + } + + private TestUtil() {} +} diff --git a/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java b/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java new file mode 100644 index 0000000..b425361 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/WithUnauthenticatedMockUser.java @@ -0,0 +1,23 @@ +package com.scb.fimob.web.rest; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.test.context.support.WithSecurityContext; +import org.springframework.security.test.context.support.WithSecurityContextFactory; + +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@WithSecurityContext(factory = WithUnauthenticatedMockUser.Factory.class) +public @interface WithUnauthenticatedMockUser { + class Factory implements WithSecurityContextFactory { + + @Override + public SecurityContext createSecurityContext(WithUnauthenticatedMockUser annotation) { + return SecurityContextHolder.createEmptyContext(); + } + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java new file mode 100644 index 0000000..9b8bf32 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorIT.java @@ -0,0 +1,118 @@ +package com.scb.fimob.web.rest.errors; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.scb.fimob.IntegrationTest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; + +/** + * Integration tests {@link ExceptionTranslator} controller advice. + */ +@WithMockUser +@AutoConfigureMockMvc +@IntegrationTest +class ExceptionTranslatorIT { + + @Autowired + private MockMvc mockMvc; + + @Test + void testConcurrencyFailure() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/concurrency-failure")) + .andExpect(status().isConflict()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); + } + + @Test + void testMethodArgumentNotValid() throws Exception { + mockMvc + .perform(post("/api/exception-translator-test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) + .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].message").value("must not be null")); + } + + @Test + void testMissingServletRequestPartException() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/missing-servlet-request-part")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + void testMissingServletRequestParameterException() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/missing-servlet-request-parameter")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + void testAccessDenied() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/access-denied")) + .andExpect(status().isForbidden()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.403")) + .andExpect(jsonPath("$.detail").value("test access denied!")); + } + + @Test + void testUnauthorized() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/unauthorized")) + .andExpect(status().isUnauthorized()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.401")) + .andExpect(jsonPath("$.path").value("/api/exception-translator-test/unauthorized")) + .andExpect(jsonPath("$.detail").value("test authentication failed!")); + } + + @Test + void testMethodNotSupported() throws Exception { + mockMvc + .perform(post("/api/exception-translator-test/access-denied")) + .andExpect(status().isMethodNotAllowed()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.405")) + .andExpect(jsonPath("$.detail").value("Request method 'POST' not supported")); + } + + @Test + void testExceptionWithResponseStatus() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/response-status")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")) + .andExpect(jsonPath("$.title").value("test response status")); + } + + @Test + void testInternalServerError() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/internal-server-error")) + .andExpect(status().isInternalServerError()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.500")) + .andExpect(jsonPath("$.title").value("Internal Server Error")); + } +} diff --git a/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java new file mode 100644 index 0000000..2060727 --- /dev/null +++ b/src/test/java/com/scb/fimob/web/rest/errors/ExceptionTranslatorTestController.java @@ -0,0 +1,66 @@ +package com.scb.fimob.web.rest.errors; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/exception-translator-test") +public class ExceptionTranslatorTestController { + + @GetMapping("/concurrency-failure") + public void concurrencyFailure() { + throw new ConcurrencyFailureException("test concurrency failure"); + } + + @PostMapping("/method-argument") + public void methodArgument(@Valid @RequestBody TestDTO testDTO) {} + + @GetMapping("/missing-servlet-request-part") + public void missingServletRequestPartException(@RequestPart String part) {} + + @GetMapping("/missing-servlet-request-parameter") + public void missingServletRequestParameterException(@RequestParam String param) {} + + @GetMapping("/access-denied") + public void accessdenied() { + throw new AccessDeniedException("test access denied!"); + } + + @GetMapping("/unauthorized") + public void unauthorized() { + throw new BadCredentialsException("test authentication failed!"); + } + + @GetMapping("/response-status") + public void exceptionWithResponseStatus() { + throw new TestResponseStatusException(); + } + + @GetMapping("/internal-server-error") + public void internalServerError() { + throw new RuntimeException(); + } + + public static class TestDTO { + + @NotNull + private String test; + + public String getTest() { + return test; + } + + public void setTest(String test) { + this.test = test; + } + } + + @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") + @SuppressWarnings("serial") + public static class TestResponseStatusException extends RuntimeException {} +} diff --git a/src/test/resources/config/application-testcontainers.yml b/src/test/resources/config/application-testcontainers.yml index 4c616c6..4464917 100644 --- a/src/test/resources/config/application-testcontainers.yml +++ b/src/test/resources/config/application-testcontainers.yml @@ -15,7 +15,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver - url: jdbc:tc:sqlserver:2019-CU15-ubuntu-20.04://;database=Springboot?TC_TMPFS=/testtmpfs:rw + url: jdbc:tc:sqlserver:2019-CU15-ubuntu-20.04://;database=FIM?TC_TMPFS=/testtmpfs:rw username: SA password: yourStrong(!)Password hikari: diff --git a/src/test/resources/config/application.yml b/src/test/resources/config/application.yml index 1341636..eedd8fd 100644 --- a/src/test/resources/config/application.yml +++ b/src/test/resources/config/application.yml @@ -17,21 +17,21 @@ eureka: client: enabled: false instance: - appname: Springboot - instanceId: Springboot:${spring.application.instance-id:${random.value}} + appname: FIM + instanceId: FIM:${spring.application.instance-id:${random.value}} spring: profiles: # Uncomment the following line to enable tests against production database type rather than H2, using Testcontainers #active: testcontainers application: - name: Springboot + name: FIM cloud: config: enabled: false datasource: type: com.zaxxer.hikari.HikariDataSource - url: jdbc:h2:mem:springboot;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:fim;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE name: username: password: @@ -71,13 +71,13 @@ spring: basename: i18n/messages task: execution: - thread-name-prefix: springboot-task- + thread-name-prefix: fim-task- pool: core-size: 1 max-size: 50 queue-capacity: 10000 scheduling: - thread-name-prefix: springboot-scheduling- + thread-name-prefix: fim-scheduling- pool: size: 1 thymeleaf: @@ -95,7 +95,7 @@ server: jhipster: clientApp: - name: 'springbootApp' + name: 'fimApp' logging: # To test json console appender use-json-format: false diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index 2f75d2d..7b12e20 100644 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -4,7 +4,7 @@ - + @@ -25,6 +25,7 @@ + diff --git a/test_fim.jh b/test_fim.jh new file mode 100644 index 0000000..9019601 --- /dev/null +++ b/test_fim.jh @@ -0,0 +1,167 @@ +application { + config { + baseName FIM, + applicationType microservice, + packageName com.scb.fimob, + authenticationType jwt, + prodDatabaseType mssql, + buildTool maven + } + entities * +} +entity FimAccounts{ + AccountId String + CustId String maxlength(30) required + RelnId String maxlength(30) required + RelnType String maxlength(5) required + OperInst String maxlength(10) + IsAcctNbr String maxlength(30) required + BndAcctNbr String maxlength(30) required + ClosingId String maxlength(10) + SubSegment String maxlength(10) + BranchCode String maxlength(10) + AcctStatus String maxlength(10) required + CtryCode String maxlength(3) + AcctOwners String maxlength(100) + Remarks String maxlength(200) + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) +} +entity FimAccountsWq{ + AccountId String + CustId String maxlength(30) required + RelnId String maxlength(30) required + RelnType String maxlength(5) required + OperInst String maxlength(10) + IsAcctNbr String maxlength(30) required + BndAcctNbr String maxlength(30) required + ClosingId String maxlength(10) + SubSegment String maxlength(10) + BranchCode String maxlength(10) + AcctStatus String maxlength(10) required + CtryCode String maxlength(3) + AcctOwners String maxlength(100) + Remarks String maxlength(200) + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) + UploadRemark String +} + +entity FimAccountsHistory{ + AccountId String + HistoryTs Instant + CustId String maxlength(30) required + RelnId String maxlength(30) required + RelnType String maxlength(5) required + OperInst String maxlength(10) + IsAcctNbr String maxlength(30) required + BndAcctNbr String maxlength(30) required + ClosingId String maxlength(10) + SubSegment String maxlength(10) + BranchCode String maxlength(10) + AcctStatus String maxlength(10) required + CtryCode String maxlength(3) + AcctOwners String maxlength(100) + Remarks String maxlength(200) + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) +} +entity FimSettAcct{ + SettaccId String + AccountId String maxlength(15) required + SettAcctNbr String maxlength(30) required + SettCcy String maxlength(3) required + SettAcctStatus String maxlength(10) required + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) +} + +entity FimSettAcctWq{ + SettaccId String + AccountId String maxlength(15) required + SettAcctNbr String maxlength(30) required + SettCcy String maxlength(3) required + SettAcctStatus String maxlength(10) required + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) + UploadRemark String +} + +entity FimSettAcctHistory{ + SettaccId String + HistoryTs Instant + AccountId String maxlength(15) required + SettAcctNbr String maxlength(30) required + SettCcy String maxlength(3) required + SettAcctStatus String maxlength(10) required + CreatedBy String maxlength(8) + CreatedTs Instant + UpdatedBy String maxlength(8) + UpdatedTs Instant + RecordStatus String maxlength(10) +} +entity FimCust{ +CustId String +ClientId String maxlength(30) required +IdType String maxlength(10) required +CtryCode String maxlength(3) required +CreatedBy String maxlength(8) required +CreatedTs Instant +UpdatedBy String maxlength(8) +UpdatedTs Instant +RecordStatus String +UploadRemark String +} + +entity FimCustWq{ +CustId String +ClientId String maxlength(30) required +IdType String maxlength(10) required +CtryCode String maxlength(3) required +CreatedBy String maxlength(8) required +CreatedTs Instant +UpdatedBy String maxlength(8) +UpdatedTs Instant +RecordStatus String +UploadRemark String +} +entity FimCustHistory{ +CustId String +HistoryTs Instant +ClientId String maxlength(30) required +IdType String maxlength(10) required +CtryCode String maxlength(3) required +CreatedBy String maxlength(8) required +CreatedTs Instant +UpdatedBy String maxlength(8) +UpdatedTs Instant +RecordStatus String +} +entity Ethnicity{ +Name String required +UrduName String +} + + + + +service * with serviceClass +dto all with mapstruct + +paginate FimCust,FimSettAcct with pagination + \ No newline at end of file