Skip to content

Commit

Permalink
set up project
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-britton-moj committed Feb 7, 2024
1 parent 56fad67 commit ef960dc
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 128 deletions.
6 changes: 0 additions & 6 deletions projects/manage-supervision-and-oasys/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import uk.gov.justice.digital.hmpps.extensions.ClassPathExtension
apply(plugin = "com.google.cloud.tools.jib")

dependencies {
implementation(project(":libs:audit"))
implementation(project(":libs:commons"))
implementation(project(":libs:oauth-client"))
implementation(project(":libs:oauth-server"))

implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-web")
Expand All @@ -19,10 +17,6 @@ dependencies {
implementation(libs.springdoc)

dev(project(":libs:dev-tools"))
dev("com.h2database:h2")
dev("org.testcontainers:oracle-xe")

runtimeOnly("com.oracle.database.jdbc:ojdbc11")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation(libs.bundles.mockito)
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions projects/manage-supervision-and-oasys/deploy/values-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ generic-service:

env:
SENTRY_ENVIRONMENT: dev
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: http://hmpps-auth.hmpps-auth-dev.svc.cluster.local/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-dev.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_URL: https://t2.oasys.service.justice.gov.uk/eor/oasys

LOGGING_LEVEL_UK_GOV_DIGITAL_JUSTICE_HMPPS: DEBUG

generic-prometheus-alerts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ generic-service:

env:
SENTRY_ENVIRONMENT: preprod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: http://hmpps-auth.hmpps-auth-preprod.svc.cluster.local/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in-preprod.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_URL: https://bridge-pp-oasys.az.justice.gov.uk/eor/oasys

generic-prometheus-alerts:
businessHoursOnly: true
6 changes: 4 additions & 2 deletions projects/manage-supervision-and-oasys/deploy/values-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ generic-service:

env:
SENTRY_ENVIRONMENT: prod
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_HMPPS-AUTH_TOKEN-URI: https://sign-in.hmpps.service.justice.gov.uk/auth/oauth/token
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: http://hmpps-auth.hmpps-auth-prod.svc.cluster.local/auth/.well-known/jwks.json
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: https://sign-in.hmpps.service.justice.gov.uk/auth/issuer

INTEGRATIONS_ORDS_URL: https://bridge-oasys.az.justice.gov.uk/eor/oasys

9 changes: 2 additions & 7 deletions projects/manage-supervision-and-oasys/deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ generic-service:
tlsSecretName: manage-supervision-and-oasys-cert

namespace_secrets:
common:
SPRING_DATASOURCE_URL: DB_URL
manage-supervision-and-oasys-client-credentials:
OAUTH2_CLIENT-ID: CLIENT_ID
OAUTH2_CLIENT-SECRET: CLIENT_SECRET
manage-supervision-and-oasys-database:
SPRING_DATASOURCE_USERNAME: DB_USERNAME
SPRING_DATASOURCE_PASSWORD: DB_PASSWORD
INTEGRATIONS_ORDS_CLIENT-ID: ORDS_CLIENT_ID
INTEGRATIONS_ORDS_CLIENT-SECRET: ORDS_CLIENT_SECRET
manage-supervision-and-oasys-sentry:
SENTRY_DSN: SENTRY_DSN

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.client.RestClient
import uk.gov.justice.digital.hmpps.config.security.createClient
import uk.gov.justice.digital.hmpps.integrations.example.ExampleClient
import uk.gov.justice.digital.hmpps.integrations.oasys.OrdsClient

@Configuration
class RestClientConfig(private val oauth2Client: RestClient) {

@Bean
fun exampleClient(@Value("\${integrations.example.url}") apiBaseUrl: String): ExampleClient {
return createClient(
oauth2Client.mutate()
.baseUrl(apiBaseUrl)
.build()
)
}
fun ordsClient(@Value("\${integrations.ords.url}") apiBaseUrl: String): OrdsClient =
createClient(oauth2Client.mutate().baseUrl(apiBaseUrl).build())
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package uk.gov.justice.digital.hmpps.integrations.oasys

import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.service.annotation.GetExchange

interface OrdsClient {
@GetExchange("/ass/allasslist/pris/{nomsId}/ALLOW")
fun getTimeline(@PathVariable nomsId: String): Timeline
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uk.gov.justice.digital.hmpps.integrations.oasys

import com.fasterxml.jackson.annotation.JsonAlias
import java.time.LocalDateTime

data class Timeline(
@JsonAlias("probNumber") val crn: String?,
@JsonAlias("prisNumber") val nomsId: String?,
val timeline: List<AssessmentSummary>
)

data class AssessmentSummary(
@JsonAlias("assessmentPk")
val id: Long,
@JsonAlias("completedDate")
val completedAt: LocalDateTime?,
@JsonAlias("assessmentType")
val type: String,
val status: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,20 @@ server.shutdown: graceful
spring:
jackson:
default-property-inclusion: non_null
jpa:
hibernate.ddl-auto: validate
database-platform: org.hibernate.dialect.OracleDialect
properties:
hibernate:
timezone.default_storage: NORMALIZE
query.mutation_strategy: org.hibernate.query.sqm.mutation.internal.inline.InlineMutationStrategy
query.mutation_strategy.persistent:
create_tables: false
drop_tables: false
query.mutation_strategy.global_temporary:
create_tables: false
drop_tables: false
security.oauth2.client:
registration:
default:
provider: hmpps-auth
provider: oasys-ords-auth
authorization-grant-type: client_credentials
client-id: ${oauth2.client-id}
client-secret: ${oauth2.client-secret}
client-id: ${integrations.ords.client-id}
client-secret: ${integrations.ords.client-secret}
provider:
hmpps-auth:
token-uri: http://localhost:${wiremock.port}/auth/oauth/token
oasys-ords-auth:
token-uri: ${integrations.ords.url}/oauth/token
threads.virtual.enabled: true

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

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

management:
endpoints.web:
base-path: /
Expand All @@ -43,45 +28,18 @@ management:
# Shared dev/test config
spring.config.activate.on-profile: [ "dev", "integration-test" ]

spring:
datasource.url: jdbc:h2:file:./dev;MODE=Oracle;DEFAULT_NULL_ORDERING=HIGH;AUTO_SERVER=true;AUTO_SERVER_PORT=9092
jpa.hibernate.ddl-auto: create-drop

seed.database: true
wiremock.enabled: true
context.initializer.classes: uk.gov.justice.digital.hmpps.wiremock.WireMockInitialiser

jwt.authorities:
- ROLE_EXAMPLE

oauth2:
client-id: manage-supervision-and-oasys
client-secret: manage-supervision-and-oasys

integrations:
example:
url: http://localhost:${wiremock.port}/example
ords:
url: http://localhost:${wiremock.port}/eor/oasys
client-id: manage-supervision-and-oasys
client-secret: manage-supervision-and-oasys

logging.level:
uk.gov.justice.digital.hmpps: DEBUG
org.hibernate.tool.schema: ERROR
org.apache.activemq: WARN

---
spring.config.activate.on-profile: integration-test
spring.datasource.url: jdbc:h2:mem:./test;MODE=Oracle;DEFAULT_NULL_ORDERING=HIGH

---
spring.config.activate.on-profile: oracle
spring.datasource.url: 'jdbc:tc:oracle:slim-faststart:///XEPDB1'

---
spring.config.activate.on-profile: delius-db
spring:
datasource:
url: 'jdbc:oracle:thin:@//localhost:1521/XEPDB1'
username: delius_pool
password: NDelius1
jpa.hibernate.ddl-auto: validate
seed.database: false
delius.db.username: NationalUser

0 comments on commit ef960dc

Please sign in to comment.