-
Notifications
You must be signed in to change notification settings - Fork 3
DTSRD-4329. flyway script to add skills into skill table #1081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0891f54
a8a9456
6ddf15d
7005a0f
cf2b8e6
680fce1
858953b
4bf8d2f
0346978
8f38a0d
31573b5
e677923
e4dea92
2f3477b
6876bb7
a726b8e
2435e96
54a43da
f7da628
113755c
a55b99a
1a80a7e
b8dfbd9
453991e
9b417de
fb1acea
97926f7
7f735ac
441f9d0
1bc903a
27164c6
52aa83e
6ad3216
6e27401
b5ac167
b592b5a
8a46d9e
84051ef
d0c35e3
abe6c4e
aa4d7df
7818962
8fb7d74
089d6bf
447338f
560313f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,16 @@ | |
| import org.springframework.context.annotation.ComponentScan; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.test.context.ActiveProfiles; | ||
| import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException; | ||
| import uk.gov.hmcts.reform.cwrdapi.controllers.response.StaffWorkerSkillResponse; | ||
| import uk.gov.hmcts.reform.cwrdapi.domain.ServiceSkill; | ||
| import uk.gov.hmcts.reform.cwrdapi.domain.SkillDTO; | ||
| import uk.gov.hmcts.reform.cwrdapi.util.FeatureToggleConditionExtension; | ||
| import uk.gov.hmcts.reform.cwrdapi.util.ToggleEnable; | ||
| import uk.gov.hmcts.reform.lib.util.serenity5.SerenityTest; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static uk.gov.hmcts.reform.cwrdapi.util.FeatureToggleConditionExtension.getToggledOffMessage; | ||
|
|
||
|
|
@@ -32,30 +36,87 @@ public class StaffRefDataSkillsFunctionalTest extends AuthorizationFunctionalTes | |
| public static final String STAFF_REF_DATA_SKILL_URL = "/refdata/case-worker/skill"; | ||
| public static final String STAFF_REF_DATA_RD_STAFF_UI_KEY = | ||
| "StaffRefDataController.retrieveAllServiceSkills"; | ||
| public static final int SKILL_COUNT = 5; | ||
| public static final int AAA7_SKILL_COUNT = 2; | ||
| public static final int HRS1_SKILL_COUNT = 15; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this variable name to HRS_SKILL_COUNT from HRS1_SKILL_COUNT |
||
| public static final int BHA1_SKILL_COUNT = 1; | ||
| public static final int AAA6_SKILL_COUNT = 2; | ||
| public static final int ABA5_SKILL_COUNT = 13; | ||
|
|
||
|
|
||
| @Test | ||
| @ToggleEnable(mapKey = STAFF_REF_DATA_RD_STAFF_UI_KEY, withFeature = true) | ||
| @ExtendWith(FeatureToggleConditionExtension.class) | ||
| void should_return_service_skills_with_status_code_200_when_flag_true() { | ||
| void should_return_service_skills_with_status_code_200_when_flag_true() throws JsonProcessingException { | ||
|
|
||
| StaffWorkerSkillResponse staffWorkerSkillResponse = fetchResponse(null); | ||
| assertThat(staffWorkerSkillResponse).isNotNull(); | ||
| assertThat(staffWorkerSkillResponse.getServiceSkills()).isNotNull(); | ||
|
|
||
| List<ServiceSkill> serviceSkills = staffWorkerSkillResponse.getServiceSkills(); | ||
| assertThat(serviceSkills.size()).isEqualTo(SKILL_COUNT); | ||
|
|
||
| for (ServiceSkill ss: serviceSkills) { | ||
| log.info(":::: skill fetched is " + ss.getId()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. double space between is and " |
||
| List<SkillDTO> listOfSkillsForSsid = fetchListOfSkills(ss.getId()); | ||
| assertThat(ss.getSkills().size()).isEqualTo(listOfSkillsForSsid.size()); | ||
| for (int i = 0; i < ss.getSkills().size(); i++) { | ||
| SkillDTO skillDto = ss.getSkills().get(i); | ||
| assertThat(skillDto.getSkillId()).isEqualTo(listOfSkillsForSsid.get(i).getSkillId()); | ||
| assertThat(skillDto.getSkillCode()).isEqualTo(listOfSkillsForSsid.get(i).getSkillCode()); | ||
| assertThat(skillDto.getDescription()).isEqualTo(listOfSkillsForSsid.get(i).getDescription()); | ||
| assertThat(skillDto.getUserType()).isEqualTo(listOfSkillsForSsid.get(i).getUserType()); | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| List<SkillDTO> fetchListOfSkills(String code) throws JsonProcessingException { | ||
| StaffWorkerSkillResponse swResponse = fetchResponse(code); | ||
| assertThat(swResponse).isNotNull(); | ||
| List<ServiceSkill> serviceSkills = swResponse.getServiceSkills(); | ||
| assertThat(swResponse.getServiceSkills().size()).isEqualTo(1); | ||
| return serviceSkills.get(0).getSkills(); | ||
| } | ||
|
|
||
| StaffWorkerSkillResponse fetchResponse(String code) throws JsonProcessingException { | ||
| String url = (code != null && !code.trim().isEmpty()) | ||
| ? STAFF_REF_DATA_SKILL_URL + "?service_codes=" + code | ||
| : STAFF_REF_DATA_SKILL_URL; | ||
| Response fetchResponse = caseWorkerApiClient | ||
| .getMultipleAuthHeadersWithoutContentType(ROLE_STAFF_ADMIN) | ||
| .get(STAFF_REF_DATA_SKILL_URL) | ||
| .andReturn(); | ||
| .getMultipleAuthHeadersWithoutContentType(ROLE_STAFF_ADMIN) | ||
| .get(url) | ||
| .andReturn(); | ||
| fetchResponse.then() | ||
| .assertThat() | ||
| .statusCode(200); | ||
| .assertThat() | ||
| .statusCode(200); | ||
|
|
||
| return fetchResponse.getBody().as(StaffWorkerSkillResponse.class); | ||
| } | ||
|
|
||
| StaffWorkerSkillResponse staffWorkerSkillResponse = | ||
| fetchResponse.getBody().as(StaffWorkerSkillResponse.class); | ||
| @Test | ||
| @ToggleEnable(mapKey = STAFF_REF_DATA_RD_STAFF_UI_KEY, withFeature = true) | ||
| @ExtendWith(FeatureToggleConditionExtension.class) | ||
| void should_return_service_skills_with_status_code_200_verify_head_count() throws JsonProcessingException { | ||
|
|
||
| StaffWorkerSkillResponse staffWorkerSkillResponse = fetchResponse(null); | ||
| assertThat(staffWorkerSkillResponse).isNotNull(); | ||
| assertThat(staffWorkerSkillResponse.getServiceSkills()).isNotNull(); | ||
| assertThat(staffWorkerSkillResponse.getServiceSkills().size()).isGreaterThan(0); | ||
|
|
||
| ServiceSkill serviceSkill = staffWorkerSkillResponse.getServiceSkills().get(0); | ||
| assertThat(serviceSkill.getId()).isEqualTo("AAA7"); | ||
| assertThat(serviceSkill.getSkills().size()).isGreaterThanOrEqualTo(1); | ||
| assertThat(staffWorkerSkillResponse.getServiceSkills().size()).isEqualTo(SKILL_COUNT); | ||
|
|
||
| for (ServiceSkill serviceSkill: staffWorkerSkillResponse.getServiceSkills()) { | ||
| if (serviceSkill.getId().equalsIgnoreCase("AAA7")) { | ||
| assertThat(serviceSkill.getSkills().size()).isEqualTo(AAA7_SKILL_COUNT); | ||
| } else if (serviceSkill.getId().equalsIgnoreCase("HRS")) { | ||
| assertThat(serviceSkill.getSkills().size()).isEqualTo(HRS1_SKILL_COUNT); | ||
| } else if (serviceSkill.getId().equalsIgnoreCase("BHA1")) { | ||
| assertThat(serviceSkill.getSkills().size()).isEqualTo(BHA1_SKILL_COUNT); | ||
| } else if (serviceSkill.getId().equalsIgnoreCase("AAA6")) { | ||
| assertThat(serviceSkill.getSkills().size()).isEqualTo(AAA6_SKILL_COUNT); | ||
| } else if (serviceSkill.getId().equalsIgnoreCase("ABA5")) { | ||
| assertThat(serviceSkill.getSkills().size()).isEqualTo(ABA5_SKILL_COUNT); | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,6 +162,7 @@ private Object mapServiceSkillsIdResponse(ResponseEntity<Object> responseEntity, | |
|
|
||
| } | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary newline |
||
| @SuppressWarnings({"rawtypes", "unchecked"}) | ||
| private ResponseEntity<Object> getRequest(String uriPath, Class clasz, String role) { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (46,'SKILL:HRS:AA','HRS Civil','HRS','Future Operations',timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (47,'SKILL:HRS:AB','HRS Family','HRS','Future Operations',timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (48,'SKILL:HRS:BA','HRS General Regulatory Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (49,'SKILL:HRS:BB','HRS Social Entitlement Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (50,'SKILL:HRS:BC','HRS Health, Education and Social Care Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (51,'SKILL:HRS:BD','HRS Tax Chamber','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (52,'SKILL:HRS:BE','HRS War Pensions and Armed Forces Compensation Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (53,'SKILL:HRS:BF','HRS Immigration and Asylum Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (54,'SKILL:HRS:BG','HRS Property Chamber','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (55,'SKILL:HRS:BH','HRS Employment Tribunals','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (56,'SKILL:HRS:BT','HRS Upper Tribunal Tax and Chancery Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (57,'SKILL:HRS:BL','HRS Upper Tribunal Lands Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (58,'SKILL:HRS:BI','HRS Upper Tribunal Immigration and Asylum Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (59,'SKILL:HRS:BK','HRS Upper Tribunal Administrative Appeals Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (60,'SKILL:HRS:BM','HRS Employment Appeals Tribunal','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
|
|
||
| commit; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (46,'SKILL:HRS:AA','HRS Civil','HRS','Future Operations',timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (47,'SKILL:HRS:AB','HRS Family','HRS','Future Operations',timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (48,'SKILL:HRS:BA','HRS General Regulatory Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (49,'SKILL:HRS:BB','HRS Social Entitlement Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (50,'SKILL:HRS:BC','HRS Health, Education and Social Care Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (51,'SKILL:HRS:BD','HRS Tax Chamber','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (52,'SKILL:HRS:BE','HRS War Pensions and Armed Forces Compensation Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (53,'SKILL:HRS:BF','HRS Immigration and Asylum Chamber','HRS','Future Operations',timezone('utc', now()), | ||
| timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (54,'SKILL:HRS:BG','HRS Property Chamber','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (55,'SKILL:HRS:BH','HRS Employment Tribunals','HRS','Future Operations',timezone('utc', now()),timezone('utc', | ||
| now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (56,'SKILL:HRS:BT','HRS Upper Tribunal Tax and Chancery Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (57,'SKILL:HRS:BL','HRS Upper Tribunal Lands Chamber','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (58,'SKILL:HRS:BI','HRS Upper Tribunal Immigration and Asylum Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (59,'SKILL:HRS:BK','HRS Upper Tribunal Administrative Appeals Chamber','HRS','Future Operations', | ||
| timezone('utc', now()),timezone('utc', now())); | ||
| INSERT INTO SKILL(skill_id,skill_code,description,service_id,user_type,created_date,last_update) VALUES | ||
| (60,'SKILL:HRS:BM','HRS Employment Appeals Tribunal','HRS','Future Operations',timezone('utc', | ||
| now()),timezone('utc', now())); | ||
|
|
||
| commit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its not skill count, its a service ids count, rename to reflect the same