Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0891f54
DTSRD-4329. flyway script to add skills into skill table
SabinaHMCTS Sep 2, 2025
a8a9456
DTSRD-4329. fixing testcase
SabinaHMCTS Sep 2, 2025
6ddf15d
DTSRD-4329. fixing integrationtestcase
SabinaHMCTS Sep 3, 2025
7005a0f
DTSRD-4329. fixing functional testcase
SabinaHMCTS Sep 4, 2025
cf2b8e6
Update V1_26__insert_skill_table.sql
SabinaHMCTS Sep 4, 2025
680fce1
Update V1_31__insert_skill_table.sql
SabinaHMCTS Sep 4, 2025
858953b
DTSRD-4329. fixing functional testcase
SabinaHMCTS Sep 4, 2025
4bf8d2f
Update StaffRefDataSkillsFunctionalTest.java
SabinaHMCTS Sep 4, 2025
0346978
DTSRD-4329. fixing functional testcase
SabinaHMCTS Sep 4, 2025
8f38a0d
Update StaffRefDataSkillsFunctionalTest.java
SabinaHMCTS Sep 4, 2025
31573b5
DTSRD-4329. fixing functional testcase
SabinaHMCTS Sep 8, 2025
e677923
DTSRD-4329. fixing functional testcase
SabinaHMCTS Sep 8, 2025
e4dea92
Update StaffRefDataSkillsFunctionalTest.java
SabinaHMCTS Sep 8, 2025
2f3477b
Update StaffRefDataSkillsFunctionalTest.java
SabinaHMCTS Sep 9, 2025
6876bb7
Update CaseWorkerReferenceDataClient.java
SabinaHMCTS Sep 9, 2025
a726b8e
Branch was auto-updated.
github-actions[bot] Oct 6, 2025
2435e96
Branch was auto-updated.
github-actions[bot] Oct 6, 2025
54a43da
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
f7da628
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
113755c
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
a55b99a
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
1a80a7e
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
b8dfbd9
Branch was auto-updated.
github-actions[bot] Oct 8, 2025
453991e
Branch was auto-updated.
github-actions[bot] Oct 9, 2025
9b417de
Branch was auto-updated.
github-actions[bot] Oct 9, 2025
fb1acea
Branch was auto-updated.
github-actions[bot] Oct 9, 2025
97926f7
Branch was auto-updated.
github-actions[bot] Oct 9, 2025
7f735ac
Branch was auto-updated.
github-actions[bot] Oct 13, 2025
441f9d0
Branch was auto-updated.
github-actions[bot] Oct 15, 2025
1bc903a
Branch was auto-updated.
github-actions[bot] Oct 15, 2025
27164c6
Branch was auto-updated.
github-actions[bot] Oct 16, 2025
52aa83e
Branch was auto-updated.
github-actions[bot] Oct 16, 2025
6ad3216
Branch was auto-updated.
github-actions[bot] Oct 16, 2025
6e27401
Branch was auto-updated.
github-actions[bot] Oct 16, 2025
b5ac167
Branch was auto-updated.
github-actions[bot] Oct 16, 2025
b592b5a
Branch was auto-updated.
github-actions[bot] Oct 20, 2025
8a46d9e
Branch was auto-updated.
github-actions[bot] Nov 5, 2025
84051ef
Branch was auto-updated.
github-actions[bot] Jan 7, 2026
d0c35e3
Branch was auto-updated.
github-actions[bot] Jan 7, 2026
abe6c4e
Branch was auto-updated.
github-actions[bot] Jan 9, 2026
aa4d7df
Branch was auto-updated.
github-actions[bot] Jan 29, 2026
7818962
Branch was auto-updated.
github-actions[bot] Mar 5, 2026
8fb7d74
Branch was auto-updated.
github-actions[bot] Mar 5, 2026
089d6bf
Branch was auto-updated.
github-actions[bot] Mar 9, 2026
447338f
Branch was auto-updated.
github-actions[bot] Mar 10, 2026
560313f
Branch was auto-updated.
github-actions[bot] Mar 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Copy link
Contributor

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

public static final int AAA7_SKILL_COUNT = 2;
public static final int HRS1_SKILL_COUNT = 15;
Copy link
Contributor

Choose a reason for hiding this comment

The 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());
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
}
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,42 @@ public static void tearDown() {
void should_retrieveAllServiceSkills_return_status_code_200()
throws JsonProcessingException {
String path = "/skill";

String role = "staff-admin";


final var staffWorkerSkillResponse = (StaffWorkerSkillResponse) caseworkerReferenceDataClient
.retrieveAllServiceSkills(StaffWorkerSkillResponse.class, path, role);

assertThat(staffWorkerSkillResponse).isNotNull();

List<ServiceSkill> serviceSkills = staffWorkerSkillResponse.getServiceSkills();

assertThat(serviceSkills.size()).isEqualTo(3);
assertThat(serviceSkills.size()).isEqualTo(4);

ServiceSkill serviceSkill = serviceSkills.get(0);

assertThat(serviceSkill.getId()).isEqualTo("AAA7");
for (ServiceSkill ss: serviceSkills) {
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());
}
}

assertThat(serviceSkill.getSkills().size()).isEqualTo(4);

SkillDTO skillDTO = serviceSkill.getSkills().get(0);
}

assertThat(skillDTO.getSkillId()).isEqualTo(9L);
assertThat(skillDTO.getSkillCode()).isEqualTo("SKILL:AAA7:TEST1");
assertThat(skillDTO.getDescription()).isEqualTo("testskill1");
assertThat(skillDTO.getUserType()).isEqualTo("CTSC");
List<SkillDTO> fetchListOfSkills(String code) throws JsonProcessingException {
String path = "/skill?service_codes=" + code;
String role = "staff-admin";
final var staffWorkerSkillResponse = (StaffWorkerSkillResponse) caseworkerReferenceDataClient
.retrieveAllServiceSkills(StaffWorkerSkillResponse.class, path, role);
assertThat(staffWorkerSkillResponse).isNotNull();
List<ServiceSkill> serviceSkills = staffWorkerSkillResponse.getServiceSkills();
assertThat(serviceSkills.size()).isEqualTo(1);
return serviceSkills.get(0).getSkills();
}


@Test
void should_retrieveAllServiceSkills_return_status_code_200_when_empty_servicecode()
throws JsonProcessingException {
Expand All @@ -91,9 +100,9 @@ void should_retrieveAllServiceSkills_return_status_code_200_when_empty_serviceco
List<ServiceSkill> serviceSkills = staffWorkerSkillResponse.getServiceSkills();

assertThat(serviceSkills).isNotNull();
assertThat(serviceSkills.size()).isEqualTo(3);
assertThat(serviceSkills.size()).isEqualTo(4);

ServiceSkill serviceSkill = serviceSkills.get(0);
ServiceSkill serviceSkill = serviceSkills.get(1);

assertThat(serviceSkill.getId()).isEqualTo("AAA7");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ private Object mapServiceSkillsIdResponse(ResponseEntity<Object> responseEntity,

}


Copy link
Contributor

Choose a reason for hiding this comment

The 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) {

Expand Down
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;
45 changes: 45 additions & 0 deletions src/main/resources/db/migration/V1_31__insert_skill_table.sql
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;