diff --git a/Dockerfile b/Dockerfile
index b6102e759..e4958db95 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,10 +1,10 @@
-ARG APP_INSIGHTS_AGENT_VERSION=3.2.4
+ARG APP_INSIGHTS_AGENT_VERSION=3.4.9
ARG PLATFORM=""
# Application image
FROM hmctspublic.azurecr.io/base/java${PLATFORM}:17-distroless
-COPY lib/AI-Agent.xml /opt/app/
+COPY lib/applicationinsights.json /opt/app/
COPY build/libs/rd-caseworker-ref-api.jar /opt/app/
EXPOSE 8095
diff --git a/build.gradle b/build.gradle
index 05cca8541..5f79b28aa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,9 +16,9 @@ plugins {
id 'pmd'
id 'com.github.ben-manes.versions' version '0.43.0'
id "info.solidsoft.pitest" version '1.7.0'
- id 'io.spring.dependency-management' version '1.0.11.RELEASE'
+ id 'io.spring.dependency-management' version '1.1.0'
id 'org.sonarqube' version '3.3'
- id 'org.springframework.boot' version '2.4.9'
+ id 'org.springframework.boot' version '2.7.7'
id "org.flywaydb.flyway" version '8.5.4'
id 'au.com.dius.pact' version '4.1.7' // do not change, otherwise serenity report fails
id 'org.owasp.dependencycheck' version '8.0.1'
@@ -34,11 +34,10 @@ def versions = [
gradlePitest : '1.5.1',
pitest : '1.7.0',
reformHealthStarter: '0.0.5',
- reformLogging : '5.1.9',
+ reformLogging : '6.0.1',
serenity : '2.0.76',
sonarPitest : '0.5',
- springBoot : '2.6.7',
- springfoxSwagger : '2.9.2',
+ springBoot : '2.7.7',
pact_version : '4.1.7',
launchDarklySdk : "5.10.2",
restAssured : '4.3.3',
@@ -47,7 +46,7 @@ def versions = [
springVersion : '5.3.20',
poi : '4.1.2',
logback : '1.2.11',
- testContainer_postgresql: '1.17.2'
+ testContainer_postgresql: '1.17.6'
]
mainClassName = 'uk.gov.hmcts.reform.cwrdapi.CaseWorkerRefApiApplication'
@@ -363,14 +362,11 @@ dependencies {
exclude group: "org.apache.sling"
}
implementation group: 'com.sun.xml.bind', name: 'jaxb-osgi', version: '2.3.3'
- implementation group: 'io.springfox', name: 'springfox-swagger2', version: versions.springfoxSwagger
- implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: versions.springfoxSwagger
-
implementation 'com.github.hmcts:service-auth-provider-java-client:4.0.3'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: versions.jackson
implementation group: 'io.jsonwebtoken', name: 'jjwt', version:'0.9.1'
- implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson
+ implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: versions.jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson
implementation group: 'com.fasterxml.jackson', name: 'jackson-bom', version: '2.13.2.20220324', ext: 'pom'
@@ -379,7 +375,7 @@ dependencies {
implementation 'com.github.hmcts:idam-java-client:2.0.1'
implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server"
- implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '8.20'
+ implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '9.25'
implementation 'org.springframework.boot:spring-boot-starter-validation'
@@ -387,6 +383,8 @@ dependencies {
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.1'
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
+ //Added org.glassfish to support javax.el
+ implementation group: 'org.glassfish', name: 'javax.el', version: '3.0.0'
implementation group: 'javax.el', name: 'javax.el-api', version: '3.0.0'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.33'
implementation group: 'com.launchdarkly', name: 'launchdarkly-java-server-sdk', version: '5.10.2'
@@ -408,10 +406,13 @@ dependencies {
implementation "io.github.openfeign:feign-httpclient:11.0"
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: versions.log4j
implementation "com.github.hmcts.java-logging:logging:${versions.reformLogging}"
- implementation "com.github.hmcts.java-logging:logging-appinsights:${versions.reformLogging}"
+ implementation "com.github.hmcts.java-logging:logging-appinsights:5.1.9"
implementation group: 'com.vladmihalcea', name: 'hibernate-types-52', version: '2.19.2'
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.13.4'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.33'
+
+ implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.8'
+ implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: '3.1.5'
// https://mvnrepository.com/artifact/net.minidev/json-smart
implementation group: 'net.minidev', name: 'json-smart', version: '2.4.8'
@@ -458,7 +459,7 @@ dependencies {
}
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.12.7'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.12.7'
- testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9'
+ testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.9'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.3.1'
testImplementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.1'
@@ -479,10 +480,6 @@ dependencies {
testImplementation 'org.springframework.cloud:spring-cloud-contract-wiremock:3.1.0'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: versions.springBoot
testImplementation('com.opentable.components:otj-pg-embedded:0.13.4')
- testImplementation group: 'org.codehaus.groovy', name: 'groovy', version: '3.0.10'
- testImplementation group: 'org.codehaus.groovy', name: 'groovy-xml', version: '2.5.14'
-// https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json
- implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: '3.0.15'
testImplementation group: 'org.springframework', name: 'spring-test', version: '5.3.17'
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.10'
testImplementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.10'
@@ -566,6 +563,12 @@ bootJar {
}
configurations.all {
resolutionStrategy.eachDependency { details ->
+// added netty-tcnative-boringssl-static because its required for
+// group: 'com.azure', name: 'azure-core', version: '1.13.0' in spring boot upgrade
+ if (details.requested.group == 'io.netty'
+ && details.requested.name == 'netty-tcnative-boringssl-static' ){
+ details.useVersion "2.0.35.Final"
+ }
if (details.requested.group == 'io.netty'
&& details.requested.name != 'netty-tcnative-boringssl-static' ) {
details.useVersion "4.1.86.Final"
diff --git a/charts/rd-caseworker-ref-api/Chart.yaml b/charts/rd-caseworker-ref-api/Chart.yaml
index bb41a689a..63dec8733 100644
--- a/charts/rd-caseworker-ref-api/Chart.yaml
+++ b/charts/rd-caseworker-ref-api/Chart.yaml
@@ -3,7 +3,7 @@ appVersion: "1.0"
description: A Helm chart for rd-caseworker-ref-api
name: rd-caseworker-ref-api
home: https://github.com/hmcts/rd-caseworker-ref-api
-version: 0.0.27
+version: 0.0.28
maintainers:
- name: Reference Data Team
dependencies:
diff --git a/charts/rd-caseworker-ref-api/values.yaml b/charts/rd-caseworker-ref-api/values.yaml
index c91f5afbc..b10596958 100644
--- a/charts/rd-caseworker-ref-api/values.yaml
+++ b/charts/rd-caseworker-ref-api/values.yaml
@@ -28,8 +28,8 @@ java:
secrets:
- name: caseworker-ref-api-POSTGRES-PASS
alias: POSTGRES_PASSWORD
- - name: ApplicationInsightsInstrumentationKey
- alias: azure.application-insights.instrumentation-key
+ - name: app-insights-connection-string
+ alias: app-insights-connection-string
- name: caseworker-topic-primary-send-listen-shared-access-key
alias: CASEWORKER_TOPIC_PRIMARY_SEND_LISTEN_SHARED_ACCESS_KEY
- name: caseworker-ref-api-s2s-secret
diff --git a/lib/AI-Agent.xml b/lib/AI-Agent.xml
deleted file mode 100644
index a5cdcfe38..000000000
--- a/lib/AI-Agent.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- INFO
-
-
-
-
-
-
-
diff --git a/lib/applicationinsights-agent-2.5.1-BETA.jar b/lib/applicationinsights-agent-2.5.1-BETA.jar
deleted file mode 100644
index 74dfa3ea5..000000000
Binary files a/lib/applicationinsights-agent-2.5.1-BETA.jar and /dev/null differ
diff --git a/lib/applicationinsights.json b/lib/applicationinsights.json
new file mode 100644
index 000000000..37fdbe959
--- /dev/null
+++ b/lib/applicationinsights.json
@@ -0,0 +1,6 @@
+{
+ "connectionString": "${file:/mnt/secrets/rd/app-insights-connection-string}",
+ "role": {
+ "name": "RD Caseworker Ref API"
+ }
+}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CaseWorkerCreateUserWithFileUploadTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CaseWorkerCreateUserWithFileUploadTest.java
index 6179ecfdf..db4608d9f 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CaseWorkerCreateUserWithFileUploadTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CaseWorkerCreateUserWithFileUploadTest.java
@@ -368,7 +368,6 @@ public void shouldCreateCaseWorkerAuditUpFailure() throws IOException {
+ "\"error_details\":[{\"row_id\":\"2\","
+ "\"error_description\":\"User creation is not possible at this moment. "
+ "Please try again later or check with administrator.\"}]}";
-
response = uploadCaseWorkerFile("Staff Data Upload.xlsx",
TYPE_XLSX, "200 OK", cwdAdmin);
String json = getJsonResponse(response);
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileBasicSearchTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileBasicSearchTest.java
index e0297abfe..a65d27c3d 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileBasicSearchTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileBasicSearchTest.java
@@ -35,6 +35,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.PAGE_NUMBER;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.PAGE_SIZE;
+import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.ROLE_CWD_ADMIN;
public class CreateStaffReferenceProfileBasicSearchTest extends AuthorizationEnabledIntegrationTest {
@@ -42,7 +43,6 @@ public class CreateStaffReferenceProfileBasicSearchTest extends AuthorizationEna
public static final String CASE_WORKER_PROFILE_URL = "/refdata/case-worker/profile";
public static final String EMAIL_TEMPLATE = "CWR-func-test-user-%s@justice.gov.uk";
- public static final String ROLE_CWD_ADMIN = "cwd-admin";
public static final String ROLE_STAFF_ADMIN = "staff-admin";
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileIntegrationTest.java
index b8edd70eb..b4bc0c1ae 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileIntegrationTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateStaffReferenceProfileIntegrationTest.java
@@ -38,11 +38,10 @@
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.INVALID_EMAIL;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.NO_PRIMARY_LOCATION_PRESENT_PROFILE;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.NO_PRIMARY_ROLE_PRESENT_PROFILE;
+import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.ROLE_STAFF_ADMIN;
public class CreateStaffReferenceProfileIntegrationTest extends AuthorizationEnabledIntegrationTest {
- public static final String ROLE_STAFF_ADMIN = "staff-admin";
-
@Autowired
CaseWorkerProfileRepository caseWorkerProfileRepository;
@Autowired
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateUpdateStaffRefDataProfilesIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateUpdateStaffRefDataProfilesIntegrationTest.java
index bed93a053..18b6fdcb5 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateUpdateStaffRefDataProfilesIntegrationTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/CreateUpdateStaffRefDataProfilesIntegrationTest.java
@@ -56,17 +56,18 @@ public void setUpClient() {
//Set up Case worker data
Set roles = ImmutableSet.of(" tribunal_case_worker ");
List caseWorkerRoleRequests =
- ImmutableList.of(CaseWorkerRoleRequest.caseWorkerRoleRequest().role(" role ").isPrimaryFlag(true).build());
+ ImmutableList.of(CaseWorkerRoleRequest.caseWorkerRoleRequest()
+ .role(" role ").isPrimaryFlag(true).build());
List caseWorkerLocationRequests = ImmutableList.of(CaseWorkerLocationRequest
- .caseWorkersLocationRequest()
- .isPrimaryFlag(true).locationId(1)
- .location(" location ").build());
+ .caseWorkersLocationRequest()
+ .isPrimaryFlag(true).locationId(1)
+ .location(" location ").build());
List caseWorkerAreaRequests = ImmutableList.of(CaseWorkerWorkAreaRequest
- .caseWorkerWorkAreaRequest()
- .areaOfWork(" areaOfWork ").serviceCode(" serviceCode ")
- .build());
+ .caseWorkerWorkAreaRequest()
+ .areaOfWork(" areaOfWork ").serviceCode(" serviceCode ")
+ .build());
caseWorkersProfileCreationRequests = ImmutableList.of(CaseWorkersProfileCreationRequest
.caseWorkersProfileCreationRequest()
@@ -153,18 +154,18 @@ void shouldCreateCaseworkerWithNewRoles() {
List caseWorkerRoleRequests = ImmutableList
- .of(cwRoleRequest,cwRoleRequest1,cwRoleRequest2,cwRoleRequest3);
+ .of(cwRoleRequest, cwRoleRequest1, cwRoleRequest2, cwRoleRequest3);
caseWorkersProfileCreationRequests.get(0).setRoles(caseWorkerRoleRequests);
caseWorkersProfileCreationRequests.get(0).setUserType("Other Government Department");
Map response = caseworkerReferenceDataClient
- .createCaseWorkerProfile(caseWorkersProfileCreationRequests, "cwd-admin");
+ .createCaseWorkerProfile(caseWorkersProfileCreationRequests, "cwd-admin");
assertThat(response).containsEntry("http_status", "201 CREATED");
List caseWorkerRoles = caseWorkerRoleRepository.findAll();
assertEquals(13, (long) caseWorkerRoles.get(0).getRoleId());
- assertEquals(14,(long)caseWorkerRoles.get(2).getRoleId());
- assertEquals(16,(long)caseWorkerRoles.get(3).getRoleId());
+ assertEquals(14, (long) caseWorkerRoles.get(2).getRoleId());
+ assertEquals(16, (long) caseWorkerRoles.get(3).getRoleId());
var caseWorkerProfile = caseWorkerProfileRepository.findAll();
- assertEquals(5,caseWorkerProfile.get(0).getUserTypeId());
+ assertEquals(5, caseWorkerProfile.get(0).getUserTypeId());
}
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/FetchStaffProfileByIdIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/FetchStaffProfileByIdIntegrationTest.java
index 84f74f350..f4b29e399 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/FetchStaffProfileByIdIntegrationTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/FetchStaffProfileByIdIntegrationTest.java
@@ -25,8 +25,8 @@
import static org.apache.logging.log4j.util.Strings.EMPTY;
import static org.assertj.core.api.Assertions.assertThat;
-import static uk.gov.hmcts.reform.cwrdapi.CreateStaffReferenceProfileBasicSearchTest.ROLE_CWD_ADMIN;
-import static uk.gov.hmcts.reform.cwrdapi.UpdateStaffReferenceProfileTest.ROLE_STAFF_ADMIN;
+import static uk.gov.hmcts.reform.cwrdapi.StaffReferenceProfileAdvanceIntegrationSearchTest.ROLE_STAFF_ADMIN;
+import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.ROLE_CWD_ADMIN;
public class FetchStaffProfileByIdIntegrationTest extends AuthorizationEnabledIntegrationTest {
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/StaffReferenceProfileAdvanceIntegrationSearchTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/StaffReferenceProfileAdvanceIntegrationSearchTest.java
index a3fe82f91..d88131f38 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/StaffReferenceProfileAdvanceIntegrationSearchTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/StaffReferenceProfileAdvanceIntegrationSearchTest.java
@@ -142,7 +142,7 @@ void should_return_staff_user_with_status_code_200_when_flag_enabled_with_pagina
.role("task supervisor,case allocator,staff administrator")
.skill("9")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@@ -167,7 +167,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_serviceCode(
searchReq = SearchRequest.builder()
.serviceCode("ABA1")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@Test
@@ -191,7 +191,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_list_of_serv
searchReq = SearchRequest.builder()
.serviceCode("ABA1,serviceCode2")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@Test
@@ -214,7 +214,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_location() {
searchReq = SearchRequest.builder()
.location("12345")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@@ -240,7 +240,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_list_of_loca
searchReq = SearchRequest.builder()
.location("12345,6789")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@Test
@@ -265,7 +265,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_userType() {
searchReq = SearchRequest.builder()
.userType("1")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@Test
@@ -290,7 +290,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_Jobtitle() {
searchReq = SearchRequest.builder()
.jobTitle("2")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@@ -316,7 +316,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_role() {
searchReq = SearchRequest.builder()
.role("task supervisor")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@Test
@@ -341,7 +341,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_skill() {
searchReq = SearchRequest.builder()
.skill("9")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@@ -355,7 +355,7 @@ void should_return_staff_user_with_status_code_200_when_skill_are_empty() {
.createStaffProfileCreationRequest();
staffProfileCreationRequest.setSkills(null);
Map staffProfileResponse = caseworkerReferenceDataClient
- .createStaffProfile(staffProfileCreationRequest,ROLE_STAFF_ADMIN);
+ .createStaffProfile(staffProfileCreationRequest, ROLE_STAFF_ADMIN);
assertThat(staffProfileResponse).containsEntry("http_status", "201 CREATED");
@@ -380,8 +380,8 @@ void should_return_staff_user_with_status_code_200_when_skill_are_empty() {
@ParameterizedTest
- @ValueSource(strings = {"serviceCode=sddd","location=127494","userType=12","jobTitle=4224",
- "role=staff administrator","skill=132"})
+ @ValueSource(strings = {"serviceCode=sddd", "location=127494", "userType=12", "jobTitle=4224",
+ "role=staff administrator", "skill=132"})
void should_return_staff_user_with_status_code_200_with_empty_search_response(String searchString) {
createCaseWorkerProfiles();
@@ -419,7 +419,7 @@ void should_return_staff_user_with_status_code_200_when_search_with_list_of_role
searchReq = SearchRequest.builder()
.role("task supervisor,case allocator,staff administrator")
.build();
- assertTrue(validateSearchUserProfileResponse(response,searchReq));
+ assertTrue(validateSearchUserProfileResponse(response, searchReq));
}
@@ -450,8 +450,8 @@ void should_return_status_code_400_when_page_num_is_zero() {
}
@ParameterizedTest
- @ValueSource(strings = {"","serviceCode=*_sd","location=1adf*_","userType=1sdfs*__","jobTitle=asdfs",
- "role=task_supervisor","skill=asdfd"})
+ @ValueSource(strings = {"", "serviceCode=*_sd", "location=1adf*_", "userType=1sdfs*__", "jobTitle=asdfs",
+ "role=task_supervisor", "skill=asdfd"})
void should_return_status_code_400(String searchString) {
String path = "/profile/search?";
@@ -468,14 +468,14 @@ public void createCaseWorkerTestData() {
StaffProfileCreationRequest staffProfileCreationRequest = caseworkerReferenceDataClient
.createStaffProfileCreationRequest();
Map response = caseworkerReferenceDataClient
- .createStaffProfile(staffProfileCreationRequest,ROLE_STAFF_ADMIN);
+ .createStaffProfile(staffProfileCreationRequest, ROLE_STAFF_ADMIN);
assertThat(response).containsEntry("http_status", "201 CREATED");
}
private void createCaseWorkerProfiles() {
- IntStream.range(0,5).forEach(i -> createCaseWorkerTestData());
+ IntStream.range(0, 5).forEach(i -> createCaseWorkerTestData());
}
}
\ No newline at end of file
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/UpdateStaffReferenceProfileTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/UpdateStaffReferenceProfileTest.java
index 10eb75cd1..dbf9a6a87 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/UpdateStaffReferenceProfileTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/UpdateStaffReferenceProfileTest.java
@@ -41,10 +41,10 @@
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.INVALID_PROFILE;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.NO_PRIMARY_LOCATION_PRESENT_PROFILE;
import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.NO_PRIMARY_ROLE_PRESENT_PROFILE;
+import static uk.gov.hmcts.reform.cwrdapi.util.CaseWorkerConstants.ROLE_STAFF_ADMIN;
public class UpdateStaffReferenceProfileTest extends AuthorizationEnabledIntegrationTest {
- public static final String ROLE_STAFF_ADMIN = "staff-admin";
@Autowired
CaseWorkerProfileRepository caseWorkerProfileRepository;
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/docs/SwaggerPublisherTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/docs/SwaggerPublisherTest.java
index 20a4e66be..3d94f1abe 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/docs/SwaggerPublisherTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/docs/SwaggerPublisherTest.java
@@ -1,15 +1,14 @@
package uk.gov.hmcts.reform.cwrdapi.docs;
+import net.thucydides.core.annotations.WithTag;
+import net.thucydides.core.annotations.WithTags;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
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.autoconfigure.web.servlet.WebMvcTest;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
-import uk.gov.hmcts.reform.cwrdapi.config.SwaggerConfiguration;
+import uk.gov.hmcts.reform.cwrdapi.util.AuthorizationEnabledIntegrationTest;
import java.io.OutputStream;
import java.nio.file.Files;
@@ -23,10 +22,8 @@
* Built-in feature which saves service's swagger specs in temporary directory.
* Each travis run on master should automatically save and upload (if updated) documentation.
*/
-@WebMvcTest
-@ContextConfiguration(classes = SwaggerConfiguration.class)
-@AutoConfigureMockMvc
-class SwaggerPublisherTest {
+@WithTags({@WithTag("testType:Integration")})
+class SwaggerPublisherTest extends AuthorizationEnabledIntegrationTest {
private MockMvc mvc;
@@ -42,7 +39,7 @@ public void setUp() {
@Test
@SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert")
void generateDocs() throws Exception {
- byte[] specs = mvc.perform(get("/v2/api-docs"))
+ byte[] specs = mvc.perform(get("/v3/api-docs"))
.andExpect(status().isOk())
.andReturn()
.getResponse()
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/AuthorizationEnabledIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/AuthorizationEnabledIntegrationTest.java
index 042276715..de8d6de39 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/AuthorizationEnabledIntegrationTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/AuthorizationEnabledIntegrationTest.java
@@ -18,6 +18,7 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
+import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator;
@@ -80,7 +81,7 @@ public abstract class AuthorizationEnabledIntegrationTest extends SpringBootInte
public static WireMockExtension userProfileService = new WireMockExtension(8091);
@RegisterExtension
- public static WireMockExtension sidamService = new WireMockExtension(5000,new CaseWorkerTransformer());
+ public static WireMockExtension sidamService = new WireMockExtension(5000, new CaseWorkerTransformer());
@RegisterExtension
public static WireMockExtension mockHttpServerForOidc = new WireMockExtension(7000);
@@ -106,6 +107,9 @@ public abstract class AuthorizationEnabledIntegrationTest extends SpringBootInte
@Autowired
Flyway flyway;
+ @MockBean
+ protected static JwtDecoder jwtDecoder;
+
@BeforeEach
public void setUpClient() {
when(featureToggleServiceImpl.isFlagEnabled(anyString(), anyString())).thenReturn(true);
@@ -245,6 +249,7 @@ public void userProfilePostUserWireMock() {
@AfterEach
public void cleanupTestData() {
+ JwtDecoderMockBuilder.resetJwtDecoder();
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/CaseWorkerReferenceDataClient.java b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/CaseWorkerReferenceDataClient.java
index f74f82982..b339bb59e 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/CaseWorkerReferenceDataClient.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/cwrdapi/util/CaseWorkerReferenceDataClient.java
@@ -3,6 +3,8 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
+import com.nimbusds.jwt.JWT;
+import com.nimbusds.jwt.JWTParser;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.impl.TextCodec;
@@ -21,6 +23,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
+import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestClientResponseException;
@@ -35,14 +38,18 @@
import uk.gov.hmcts.reform.cwrdapi.controllers.request.StaffProfileRoleRequest;
import uk.gov.hmcts.reform.cwrdapi.controllers.response.SearchStaffUserResponse;
+import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import static java.lang.String.format;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.when;
import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static uk.gov.hmcts.reform.cwrdapi.util.JwtTokenUtil.generateToken;
@@ -79,6 +86,9 @@ public CaseWorkerReferenceDataClient(int port) {
this.baseInternalUrl = "http://localhost:" + port + APP_INTERNAL_BASE_PATH;
}
+ public CaseWorkerReferenceDataClient() {
+ }
+
public Map createCaseWorkerProfile(CaseWorkersProfileCreationRequest request, String role) {
return postRequest(baseUrl + "/users/", request, role, null);
}
@@ -150,7 +160,6 @@ private ResponseEntity