Skip to content

Commit

Permalink
Bump the minor group across 1 directory with 12 updates (#575)
Browse files Browse the repository at this point in the history
* Bump the minor group across 1 directory with 12 updates

Bumps the minor group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [org.springframework.boot:spring-boot-starter-webflux](https://github.com/spring-projects/spring-boot) | `3.4.0` | `3.4.1` |
| [org.jetbrains.kotlinx:kotlinx-serialization-json](https://github.com/Kotlin/kotlinx.serialization) | `1.7.3` | `1.8.0` |
| [io.sentry:sentry-spring-boot-starter-jakarta](https://github.com/getsentry/sentry-java) | `7.18.0` | `7.20.0` |
| [io.sentry:sentry-logback](https://github.com/getsentry/sentry-java) | `7.18.0` | `7.20.0` |
| [org.springframework.data:spring-data-commons](https://github.com/spring-projects/spring-data-commons) | `3.4.0` | `3.4.1` |
| [uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter](https://github.com/ministryofjustice/hmpps-spring-boot-sqs) | `5.2.0` | `5.2.2` |
| [org.springdoc:springdoc-openapi-starter-webmvc-ui](https://github.com/springdoc/springdoc-openapi) | `2.7.0` | `2.8.3` |
| [org.wiremock:wiremock-standalone](https://github.com/wiremock/wiremock) | `3.9.2` | `3.10.0` |
| [org.mockito:mockito-core](https://github.com/mockito/mockito) | `5.14.2` | `5.15.2` |
| [com.fasterxml.jackson.module:jackson-module-kotlin](https://github.com/FasterXML/jackson-module-kotlin) | `2.18.1` | `2.18.2` |
| uk.gov.justice.hmpps.gradle-spring-boot | `6.1.0` | `6.1.2` |
| [plugin.spring](https://github.com/JetBrains/kotlin) | `2.0.21` | `2.1.0` |



Updates `org.springframework.boot:spring-boot-starter-webflux` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v3.4.0...v3.4.1)

Updates `org.jetbrains.kotlinx:kotlinx-serialization-json` from 1.7.3 to 1.8.0
- [Release notes](https://github.com/Kotlin/kotlinx.serialization/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.serialization/blob/master/CHANGELOG.md)
- [Commits](Kotlin/kotlinx.serialization@v1.7.3...v1.8.0)

Updates `io.sentry:sentry-spring-boot-starter-jakarta` from 7.18.0 to 7.20.0
- [Release notes](https://github.com/getsentry/sentry-java/releases)
- [Changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md)
- [Commits](getsentry/sentry-java@7.18.0...7.20.0)

Updates `io.sentry:sentry-logback` from 7.18.0 to 7.20.0
- [Release notes](https://github.com/getsentry/sentry-java/releases)
- [Changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md)
- [Commits](getsentry/sentry-java@7.18.0...7.20.0)

Updates `org.springframework.data:spring-data-commons` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/spring-projects/spring-data-commons/releases)
- [Commits](spring-projects/spring-data-commons@3.4.0...3.4.1)

Updates `uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter` from 5.2.0 to 5.2.2
- [Commits](https://github.com/ministryofjustice/hmpps-spring-boot-sqs/commits)

Updates `org.springdoc:springdoc-openapi-starter-webmvc-ui` from 2.7.0 to 2.8.3
- [Release notes](https://github.com/springdoc/springdoc-openapi/releases)
- [Changelog](https://github.com/springdoc/springdoc-openapi/blob/main/CHANGELOG.md)
- [Commits](springdoc/springdoc-openapi@v2.7.0...v2.8.3)

Updates `org.wiremock:wiremock-standalone` from 3.9.2 to 3.10.0
- [Release notes](https://github.com/wiremock/wiremock/releases)
- [Commits](wiremock/wiremock@3.9.2...3.10.0)

Updates `org.mockito:mockito-core` from 5.14.2 to 5.15.2
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.14.2...v5.15.2)

Updates `com.fasterxml.jackson.module:jackson-module-kotlin` from 2.18.1 to 2.18.2
- [Commits](FasterXML/jackson-module-kotlin@jackson-module-kotlin-2.18.1...jackson-module-kotlin-2.18.2)

Updates `uk.gov.justice.hmpps.gradle-spring-boot` from 6.1.0 to 6.1.2

Updates `plugin.spring` from 2.0.21 to 2.1.0
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](JetBrains/kotlin@v2.0.21...v2.1.0)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-webflux
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: org.jetbrains.kotlinx:kotlinx-serialization-json
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: io.sentry:sentry-spring-boot-starter-jakarta
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: io.sentry:sentry-logback
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.springframework.data:spring-data-commons
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: org.springdoc:springdoc-openapi-starter-webmvc-ui
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.wiremock:wiremock-standalone
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: com.fasterxml.jackson.module:jackson-module-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: uk.gov.justice.hmpps.gradle-spring-boot
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: plugin.spring
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Hardcode version 1.5.0 of ktlint and format

This is to prevent the error with the default version JLLeitschuh/ktlint-gradle#809

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Madley <ben.madley@madetech.com>
  • Loading branch information
dependabot[bot] and ben-madley-mt authored Jan 15, 2025
1 parent 54b8baa commit 437cef4
Show file tree
Hide file tree
Showing 119 changed files with 3,906 additions and 3,137 deletions.
29 changes: 17 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("uk.gov.justice.hmpps.gradle-spring-boot") version "6.1.0"
kotlin("plugin.spring") version "2.0.21"
id("uk.gov.justice.hmpps.gradle-spring-boot") version "6.1.2"
kotlin("plugin.spring") version "2.1.0"
}

configurations {
Expand All @@ -9,25 +9,25 @@ configurations {

dependencies {
runtimeOnly("org.flywaydb:flyway-database-postgresql")
implementation("org.springframework.boot:spring-boot-starter-webflux:3.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("io.sentry:sentry-spring-boot-starter-jakarta:7.18.0")
implementation("io.sentry:sentry-logback:7.18.0")
implementation("org.springframework.data:spring-data-commons:3.4.0")
implementation("uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter:5.2.0") {
implementation("org.springframework.boot:spring-boot-starter-webflux:3.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("io.sentry:sentry-spring-boot-starter-jakarta:7.20.0")
implementation("io.sentry:sentry-logback:7.20.0")
implementation("org.springframework.data:spring-data-commons:3.4.1")
implementation("uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter:5.2.2") {
exclude("org.springframework.security", "spring-security-config")
exclude("org.springframework.security", "spring-security-core")
exclude("org.springframework.security", "spring-security-crypto")
exclude("org.springframework.security", "spring-security-web")
}
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.3")
testImplementation("io.kotest:kotest-assertions-json-jvm:5.9.1")
testImplementation("io.kotest:kotest-runner-junit5-jvm:5.9.1")
testImplementation("io.kotest:kotest-assertions-core-jvm:5.9.1")
testImplementation("org.wiremock:wiremock-standalone:3.9.2")
testImplementation("org.wiremock:wiremock-standalone:3.10.0")
testImplementation("io.kotest.extensions:kotest-extensions-spring:1.3.0")
testImplementation("org.mockito:mockito-core:5.14.2")
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.1")
testImplementation("org.mockito:mockito-core:5.15.2")
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.2")

annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
testImplementation(kotlin("test"))
Expand Down Expand Up @@ -70,3 +70,8 @@ tasks {
testlogger {
theme = com.adarshr.gradle.testlogger.theme.ThemeType.MOCHA
}

// this is to address JLLeitschuh/ktlint-gradle#809
ktlint {
version = "1.5.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class OpenAPIConfig {
"developerMessage" to Schema<String>().type("string").example("No query parameters specified."),
),
),
)
.addSchemas(
).addSchemas(
"PersonNotFound",
Schema<ErrorResponse>().description("Failed to find a person with the provided HMPPS ID.").properties(
mapOf(
Expand All @@ -69,8 +68,7 @@ class OpenAPIConfig {
"developerMessage" to Schema<String>().type("string").example("Could not find person with HMPPS id: 2003/0011991D."),
),
),
)
.addSchemas(
).addSchemas(
"InternalServerError",
Schema<ErrorResponse>().description("An upstream service was not responding, so we cannot verify the accuracy of any data we did get.").properties(
mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.stream.Collectors

// Intercepts incoming requests and logs them
@Component
class RequestLogger() : HandlerInterceptor {
class RequestLogger : HandlerInterceptor {
private val log: org.slf4j.Logger = LoggerFactory.getLogger(this::class.java)

override fun preHandle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import org.springframework.context.annotation.Configuration
@Configuration
class TomcatConfig {
@Bean
fun tomcatCustomizer(): WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
return WebServerFactoryCustomizer { factory: TomcatServletWebServerFactory ->
fun tomcatCustomizer(): WebServerFactoryCustomizer<TomcatServletWebServerFactory> =
WebServerFactoryCustomizer { factory: TomcatServletWebServerFactory ->
factory.addConnectorCustomizers(
TomcatConnectorCustomizer { connector: Connector ->
connector.encodedSolidusHandling = EncodedSolidusHandling.PASS_THROUGH.value
},
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
class ClientTrackingConfiguration(private val clientTrackingInterceptor: ClientTrackingInterceptor) : WebMvcConfigurer {
class ClientTrackingConfiguration(
private val clientTrackingInterceptor: ClientTrackingInterceptor,
) : WebMvcConfigurer {
override fun addInterceptors(registry: InterceptorRegistry) {
registry.addInterceptor(clientTrackingInterceptor).addPathPatterns("/**")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class ImageController(

auditService.createEvent("GET_PERSON_IMAGE", mapOf("imageId" to id.toString()))

return ResponseEntity.ok()
return ResponseEntity
.ok()
.header("content-type", "image/jpeg")
.body(response.data)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.ResponseStatus

@ResponseStatus(HttpStatus.FORBIDDEN)
class AuthenticationFailedException(message: String) : RuntimeException(message)
class AuthenticationFailedException(
message: String,
) : RuntimeException(message)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.exception

import java.lang.RuntimeException

class AuthorisationFailedException(message: String) : RuntimeException(message)
class AuthorisationFailedException(
message: String,
) : RuntimeException(message)
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.exception

class EntityNotFoundException(msg: String) : RuntimeException(msg)
class EntityNotFoundException(
msg: String,
) : RuntimeException(msg)
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ class WebClientWrapper(
.builder()
.baseUrl(baseUrl)
.exchangeStrategies(
ExchangeStrategies.builder()
ExchangeStrategies
.builder()
.codecs { configurer ->
configurer.defaultCodecs()
configurer
.defaultCodecs()
.maxInMemorySize(-1)
}
.build(),
)
.build()
}.build(),
).build()

sealed class WebClientWrapperResponse<out T> {
data class Success<T>(val data: T) : WebClientWrapperResponse<T>()
data class Success<T>(
val data: T,
) : WebClientWrapperResponse<T>()

data class Error(val errors: List<UpstreamApiError>) : WebClientWrapperResponse<Nothing>()
data class Error(
val errors: List<UpstreamApiError>,
) : WebClientWrapperResponse<Nothing>()
}

inline fun <reified T> request(
Expand All @@ -40,18 +44,18 @@ class WebClientWrapper(
upstreamApi: UpstreamApi,
requestBody: Map<String, Any?>? = null,
forbiddenAsError: Boolean = false,
): WebClientWrapperResponse<T> {
return try {
): WebClientWrapperResponse<T> =
try {
val responseData =
getResponseBodySpec(method, uri, headers, requestBody).retrieve()
getResponseBodySpec(method, uri, headers, requestBody)
.retrieve()
.bodyToMono(T::class.java)
.block()!!

WebClientWrapperResponse.Success(responseData)
} catch (exception: WebClientResponseException) {
getErrorType(exception, upstreamApi, forbiddenAsError)
}
}

inline fun <reified T> requestList(
method: HttpMethod,
Expand All @@ -60,10 +64,11 @@ class WebClientWrapper(
upstreamApi: UpstreamApi,
requestBody: Map<String, Any?>? = null,
forbiddenAsError: Boolean = false,
): WebClientWrapperResponse<List<T>> {
return try {
): WebClientWrapperResponse<List<T>> =
try {
val responseData =
getResponseBodySpec(method, uri, headers, requestBody).retrieve()
getResponseBodySpec(method, uri, headers, requestBody)
.retrieve()
.bodyToFlux(T::class.java)
.collectList()
.block() as List<T>
Expand All @@ -72,7 +77,6 @@ class WebClientWrapper(
} catch (exception: WebClientResponseException) {
getErrorType(exception, upstreamApi, forbiddenAsError)
}
}

fun getResponseBodySpec(
method: HttpMethod,
Expand All @@ -81,7 +85,8 @@ class WebClientWrapper(
requestBody: Map<String, Any?>? = null,
): WebClient.RequestBodySpec {
val responseBodySpec =
client.method(method)
client
.method(method)
.uri(uri)
.headers { header -> headers.forEach { requestHeader -> header.set(requestHeader.key, requestHeader.value) } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class ProbationOffenderSearchGateway(
"pncNumber" to pncNumber,
"dateOfBirth" to dateOfBirth,
"includeAliases" to searchWithinAliases,
)
.filterValues { it != null }
).filterValues { it != null }

val result =
webClient.requestList<Offender>(
Expand Down Expand Up @@ -131,7 +130,14 @@ class ProbationOffenderSearchGateway(

return when (result) {
is WebClientWrapperResponse.Success -> {
return Response(result.data.firstOrNull()?.contactDetails?.addresses.orEmpty().map { it.toAddress() })
return Response(
result.data
.firstOrNull()
?.contactDetails
?.addresses
.orEmpty()
.map { it.toAddress() },
)
}
is WebClientWrapperResponse.Error -> {
Response(
Expand All @@ -150,11 +156,7 @@ class ProbationOffenderSearchGateway(
)
}

private fun isPncNumber(id: String?): Boolean {
return id?.matches(Regex("^[0-9]+/[0-9A-Za-z]+$")) == true
}
private fun isPncNumber(id: String?): Boolean = id?.matches(Regex("^[0-9]+/[0-9A-Za-z]+$")) == true

private fun isNomsNumber(id: String?): Boolean {
return id?.matches(Regex("^[A-Z]\\d{4}[A-Z]{2}+$")) == true
}
private fun isNomsNumber(id: String?): Boolean = id?.matches(Regex("^[A-Z]\\d{4}[A-Z]{2}+$")) == true
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse

open class ExternalHealthIndicator(url: String) : HealthIndicator {
open class ExternalHealthIndicator(
url: String,
) : HealthIndicator {
private val healthUrl = url
private val log = LoggerFactory.getLogger(this::class.java)

Expand All @@ -17,12 +19,14 @@ open class ExternalHealthIndicator(url: String) : HealthIndicator {
// that specific component.
override fun health(): Health {
val healthStatus: Health.Builder =
Health.up()
Health
.up()
.withDetail("healthurl", healthUrl)

val client = HttpClient.newBuilder().build()
val request =
HttpRequest.newBuilder()
HttpRequest
.newBuilder()
.uri(URI.create(healthUrl))
.build()

Expand All @@ -31,14 +35,16 @@ open class ExternalHealthIndicator(url: String) : HealthIndicator {
client.send(request, HttpResponse.BodyHandlers.ofString())
} catch (e: Exception) {
log.error("Failed to connect to health endpoint $healthUrl are these services running?")
return healthStatus.up()
return healthStatus
.up()
.withDetail("status", "This component is down")
.withException(e)
.build()
}

if (response.statusCode() != 200) {
return healthStatus.up()
return healthStatus
.up()
.withDetail("httpStatusCode", response.statusCode())
.build()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import org.springframework.stereotype.Component
* Adds version data to the /health endpoint. This is called by the UI to display API details
*/
@Component
class HealthInfo(buildProperties: BuildProperties) : HealthIndicator {
class HealthInfo(
buildProperties: BuildProperties,
) : HealthIndicator {
private val version: String = buildProperties.version

override fun health(): Health = Health.up().withDetail("version", version).build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import org.springframework.context.annotation.Configuration
import org.springframework.context.event.EventListener

@Configuration
class VersionOutputter(buildProperties: BuildProperties) {
class VersionOutputter(
buildProperties: BuildProperties,
) {
private val version = buildProperties.version

@EventListener(ApplicationReadyEvent::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ data class ArnRiskSummary(
}

private fun toCamelCase(personGroup: String) =
personGroup.split(" ").map { it.replaceFirstChar(Char::uppercaseChar) }.joinToString("")
personGroup
.split(" ")
.map { it.replaceFirstChar(Char::uppercaseChar) }
.joinToString("")
.replaceFirstChar(Char::lowercaseChar)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ data class CrnRiskManagementPlans(
val limitedAccessOffender: String,
val riskManagementPlan: List<CrnRiskManagementPlan>,
) {
fun toRiskManagementPlans(): List<RiskManagementPlan> {
return this.riskManagementPlan.stream()
fun toRiskManagementPlans(): List<RiskManagementPlan> =
this.riskManagementPlan
.stream()
.map {
RiskManagementPlan(
assessmentId = it.assessmentId,
Expand All @@ -27,9 +28,7 @@ data class CrnRiskManagementPlans(
latestCompleteDate = it.latestCompleteDate,
latestSignLockDate = it.latestSignLockDate,
)
}
.collect(Collectors.toList())
}
}.collect(Collectors.toList())
}

data class CrnRiskManagementPlan(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps

import java.util.Base64

data class Credentials(val username: String, val password: String) {
data class Credentials(
val username: String,
val password: String,
) {
fun toBasicAuth(): String {
val encodedCredentials = Base64.getEncoder().encodeToString("$username:$password".toByteArray())
return "Basic $encodedCredentials"
Expand Down
Loading

0 comments on commit 437cef4

Please sign in to comment.