Skip to content

Commit

Permalink
Merge branch 'main' into PI-1668
Browse files Browse the repository at this point in the history
  • Loading branch information
stevomcallister authored Dec 5, 2023
2 parents c68802a + 395e2c3 commit bc2a10d
Show file tree
Hide file tree
Showing 68 changed files with 167 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/actions/analyse/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
- uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Sonar analysis
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- uses: actions/setup-java@v3
if: startsWith(steps.check_config.outputs.api_path, 'http')
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- uses: gradle/gradle-build-action@v2 # enables caching
if: startsWith(steps.check_config.outputs.api_path, 'http')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Setup GPG commit verification
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: temurin

- name: Build jars
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Render project template
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ allprojects {

tasks {
withType<JavaCompile> {
sourceCompatibility = "17"
sourceCompatibility = "21"
}

withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
jvmTarget = "21"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class JibConfigPlugin : Plugin<Project> {
user = "2000:2000"
}
from {
image = System.getenv("JIB_FROM_IMAGE") ?: "eclipse-temurin:17-jre-alpine"
image = System.getenv("JIB_FROM_IMAGE") ?: "eclipse-temurin:21-jre-alpine"
}
to {
image = "ghcr.io/ministryofjustice/hmpps-probation-integration-services/${project.name}"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.springframework.orm.ObjectOptimisticLockingFailureException
import org.springframework.stereotype.Component
import org.springframework.transaction.CannotCreateTransactionException
import org.springframework.transaction.UnexpectedRollbackException
import org.springframework.web.client.HttpStatusCodeException
import org.springframework.web.client.RestClientException
import uk.gov.justice.digital.hmpps.config.AwsCondition
import uk.gov.justice.digital.hmpps.messaging.NotificationHandler
import uk.gov.justice.digital.hmpps.retry.retry
Expand All @@ -35,7 +35,7 @@ class AwsNotificationListener(
retry(
3,
listOf(
HttpStatusCodeException::class,
RestClientException::class,
CannotAcquireLockException::class,
ObjectOptimisticLockingFailureException::class,
CannotCreateTransactionException::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class HmppsAuthClientConfig(
fun oauth2Client() = restClientBuilder
.requestFactory(withTimeouts(Duration.ofSeconds(1), Duration.ofSeconds(5)))
.requestInterceptor(HmppsAuthInterceptor(clientManager, "default"))
.requestInterceptor(RetryInterceptor())
.build()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package uk.gov.justice.digital.hmpps.config.security

import org.springframework.http.HttpRequest
import org.springframework.http.client.ClientHttpRequestExecution
import org.springframework.http.client.ClientHttpRequestInterceptor
import org.springframework.http.client.ClientHttpResponse
import org.springframework.web.client.RestClientException
import uk.gov.justice.digital.hmpps.retry.retry

class RetryInterceptor : ClientHttpRequestInterceptor {
override fun intercept(
request: HttpRequest,
body: ByteArray,
execution: ClientHttpRequestExecution
): ClientHttpResponse = retry(3, listOf(RestClientException::class)) {
execution.execute(request, body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spring:
provider:
ords-oasys-auth:
token-uri: http://localhost:${wiremock.port}/eor/oasys/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spring:
global_temporary:
create_tables: false
drop_tables: false
threads.virtual.enabled: true
springdoc.default-produces-media-type: application/json

delius.db.username: ArnsAndDelius # Should match value in [deploy/database/access.yml].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

delius.db.username: CustodyKeyDatesAndDelius # Should match value in [deploy/database/access.yml].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spring:
global_temporary:
create_tables: false
drop_tables: false
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json


Expand Down
1 change: 1 addition & 0 deletions projects/dps-and-delius/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spring:
create_tables: false
drop_tables: false
open-in-view: false # this prevents aborted streaming requests from leaving a DB connection in-use
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spring:
global_temporary:
create_tables: false
drop_tables: false
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spring:
global_temporary:
create_tables: false
drop_tables: false
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spring:
base: dc=moj,dc=com
base-environment:
java.naming.ldap.derefAliases: never
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spring:
base: dc=moj,dc=com
base-environment:
java.naming.ldap.derefAliases: never
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

springdoc.default-produces-media-type: application/json

delius.db.username: MakeRecallDecisionsAndDelius # Should match value in [deploy/database/access.yml].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spring:
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
threads.virtual.enabled: true

delius.db.username: ManageOffencesAndDelius # Should match value in [deploy/database/access.yml].

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"manager": {
"forename": "John",
"surname": "Smith"
"surname": "Smith",
"email": "[email protected]"
},
"prison": {
"code": "SWI"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"manager": {
"forename": "James",
"surname": "Brown"
"surname": "Brown",
"email": "[email protected]"
},
"prison": {
"code": "SWI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ internal class AllocationMessagingIntegrationTest {
assertThat(prisonManager?.allocationReason?.code, equalTo("AUT"))
assertThat(prisonManager?.staff?.forename, equalTo("John"))
assertThat(prisonManager?.staff?.surname, equalTo("Smith"))
assertThat(prisonManager?.emailAddress, equalTo("[email protected]"))

val contacts = contactRepository.findAll().filter { it.personId == PersonGenerator.DEFAULT.id }
assertThat(contacts.map { it.type.code }, hasItems(ContactType.Code.POM_AUTO_ALLOCATION.value))
Expand Down Expand Up @@ -137,6 +138,7 @@ internal class AllocationMessagingIntegrationTest {
assertThat(prisonManager?.allocationReason?.code, equalTo("INA"))
assertThat(prisonManager?.staff?.forename, equalTo("James"))
assertThat(prisonManager?.staff?.surname, equalTo("Brown"))
assertThat(prisonManager?.emailAddress, equalTo("[email protected]"))
assertNotNull(prisonManager?.responsibleOfficer())
assertNull(prisonManager?.responsibleOfficer()?.endDate)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class PrisonManager(
@Column(nullable = false)
var lastUpdatedDatetime: ZonedDateTime = ZonedDateTime.now()

var emailAddress: String? = null

fun isUnallocated() = staff.code.endsWith("U")

fun responsibleOfficer(): ResponsibleOfficer? = responsibleOfficers.firstOrNull { it.endDate == null }
Expand Down
Loading

0 comments on commit bc2a10d

Please sign in to comment.