Skip to content

Commit

Permalink
finished rename-project, but now the tests fail...
Browse files Browse the repository at this point in the history
  • Loading branch information
JazJax committed Sep 17, 2024
1 parent 1bdc49c commit 688a661
Show file tree
Hide file tree
Showing 30 changed files with 62 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ workflows:
# pipeline_number: <<pipeline.number>>
# context:
# - hmpps-common-vars
# - hmpps-template-kotlin-preprod
# - hmpps-electronic-monitoring-datastore-api-preprod
# requires:
# - request-preprod-approval
# helm_timeout: 5m
Expand All @@ -100,7 +100,7 @@ workflows:
# slack_channel_name: << pipeline.parameters.releases-slack-channel >>
# context:
# - hmpps-common-vars
# - hmpps-template-kotlin-prod
# - hmpps-electronic-monitoring-datastore-api-prod
# requires:
# - request-prod-approval
# helm_timeout: 5m
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml-z
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ workflows:
# pipeline_number: <<pipeline.number>>
# context:
# - hmpps-common-vars
# - hmpps-template-kotlin-preprod
# - hmpps-electronic-monitoring-datastore-api-preprod
# requires:
# - request-preprod-approval
# helm_timeout: 5m
Expand All @@ -97,7 +97,7 @@ workflows:
# slack_channel_name: << pipeline.parameters.releases-slack-channel >>
# context:
# - hmpps-common-vars
# - hmpps-template-kotlin-prod
# - hmpps-electronic-monitoring-datastore-api-prod
# requires:
# - request-prod-approval
# helm_timeout: 5m
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN addgroup --gid 2000 --system appgroup && \
adduser --uid 2000 --system appuser --gid 2000

WORKDIR /app
COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-template-kotlin*.jar /app/app.jar
COPY --from=builder --chown=appuser:appgroup /app/build/libs/hmpps-electronic-monitoring-datastore-api*.jar /app/app.jar
COPY --from=builder --chown=appuser:appgroup /app/build/libs/applicationinsights-agent*.jar /app/agent.jar
COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.json /app
COPY --from=builder --chown=appuser:appgroup /app/applicationinsights.dev.json /app
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Electronic Monitoring Datastore API

[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-template-kotlin)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-template-kotlin "Link to report")
[![CircleCI](https://circleci.com/gh/ministryofjustice/hmpps-template-kotlin/tree/main.svg?style=svg)](https://circleci.com/gh/ministryofjustice/hmpps-template-kotlin)
[![Docker Repository on Quay](https://img.shields.io/badge/quay.io-repository-2496ED.svg?logo=docker)](https://quay.io/repository/hmpps/hmpps-template-kotlin)
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-template-kotlin-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)
[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-electronic-monitoring-datastore-api)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-electronic-monitoring-datastore-api "Link to report")
[![CircleCI](https://circleci.com/gh/ministryofjustice/hmpps-electronic-monitoring-datastore-api/tree/main.svg?style=svg)](https://circleci.com/gh/ministryofjustice/hmpps-electronic-monitoring-datastore-api)
[![Docker Repository on Quay](https://img.shields.io/badge/quay.io-repository-2496ED.svg?logo=docker)](https://quay.io/repository/hmpps/hmpps-electronic-monitoring-datastore-api)
[![API docs](https://img.shields.io/badge/API_docs_-view-85EA2D.svg?logo=swagger)](https://hmpps-electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk/webjars/swagger-ui/index.html?configUrl=/v3/api-docs)

API to access the Electronic Monitoring datastore in the Modernisation Platform.

Expand Down Expand Up @@ -31,7 +31,7 @@ will build the application and run it and HMPPS Auth within a local docker insta
### Running the application in Intellij

```bash
docker compose pull && docker compose up --scale hmpps-template-kotlin=0
docker compose pull && docker compose up --scale hmpps-electronic-monitoring-datastore-api=0
```

will just start a docker instance of HMPPS Auth. The application should then be started with a `dev` active profile
Expand Down
2 changes: 1 addition & 1 deletion applicationinsights.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"role": {
"name": "hmpps-template-kotlin"
"name": "hmpps-electronic-monitoring-datastore-api"
},
"customDimensions": {
"service.version": "${BUILD_NUMBER}"
Expand Down
2 changes: 1 addition & 1 deletion applicationinsights.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"role": {
"name": "hmpps-template-kotlin"
"name": "hmpps-electronic-monitoring-datastore-api"
},
"customDimensions": {
"service.version": "${BUILD_NUMBER}"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "3"
services:
hmpps-template-kotlin:
hmpps-electronic-monitoring-datastore-api:
build:
context: .
networks:
- hmpps
container_name: hmpps-template-kotlin
container_name: hmpps-electronic-monitoring-datastore-api
ports:
- "8080:8080"
healthcheck:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
generic-service:
nameOverride: hmpps-template-kotlin
nameOverride: hmpps-electronic-monitoring-datastore-api
productId: "UNASSIGNED" # productId for the product that this belongs too, i.e. DPS001, see README.md for details

replicaCount: 4

image:
repository: quay.io/hmpps/hmpps-template-kotlin
repository: quay.io/hmpps/hmpps-electronic-monitoring-datastore-api
tag: app_version # override at deployment time
port: 8080

ingress:
enabled: true
host: app-hostname.local # override per environment
tlsSecretName: hmpps-template-kotlin-cert
tlsSecretName: hmpps-electronic-monitoring-datastore-api-cert

# Environment variables to load into the deployment
env:
Expand All @@ -27,7 +27,7 @@ generic-service:
# [name of environment variable as seen by app]: [key of kubernetes secret to load]

namespace_secrets:
hmpps-template-kotlin:
hmpps-electronic-monitoring-datastore-api:
APPINSIGHTS_INSTRUMENTATIONKEY: "APPINSIGHTS_INSTRUMENTATIONKEY"
# Example client registration secrets
EXAMPLE_API_CLIENT_ID: "TEMPLATE_KOTLIN_API_CLIENT_ID"
Expand All @@ -38,4 +38,4 @@ generic-service:
- internal

generic-prometheus-alerts:
targetApplication: hmpps-template-kotlin
targetApplication: hmpps-electronic-monitoring-datastore-api
2 changes: 1 addition & 1 deletion helm_deploy/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generic-service:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth"

# TODO: any external API URLS go here, e.g. "https://template-kotlin-dev.hmpps.service.justice.gov.uk"
# TODO: any external API URLS go here, e.g. "https://electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
6 changes: 3 additions & 3 deletions helm_deploy/values-dev.yaml-z
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-dev.hmpps.service.justice.gov.uk
host: electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk

env:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin-dev.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
2 changes: 1 addition & 1 deletion helm_deploy/values-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ generic-service:
env:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth"
# TODO: any external API URLS go here, e.g. "https://template-kotlin-preprod.hmpps.service.justice.gov.uk"
# TODO: any external API URLS go here, e.g. "https://electronic-monitoring-datastore-api-preprod.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
6 changes: 3 additions & 3 deletions helm_deploy/values-preprod.yaml-z
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
replicaCount: 2

ingress:
host: template-kotlin-preprod.hmpps.service.justice.gov.uk
host: electronic-monitoring-datastore-api-preprod.hmpps.service.justice.gov.uk

env:
APPLICATIONINSIGHTS_CONFIGURATION_FILE: "applicationinsights.dev.json"
HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin-preprod.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://electronic-monitoring-datastore-api-preprod.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
2 changes: 1 addition & 1 deletion helm_deploy/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ generic-service:
env:
HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth"

# TODO: any external API URLS go here, e.g. "https://template-kotlin.hmpps.service.justice.gov.uk"
# TODO: any external API URLS go here, e.g. "https://electronic-monitoring-datastore-api.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
6 changes: 3 additions & 3 deletions helm_deploy/values-prod.yaml-z
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
# Per environment values which override defaults in hmpps-template-kotlin/values.yaml
# Per environment values which override defaults in hmpps-electronic-monitoring-datastore-api/values.yaml

generic-service:
ingress:
host: template-kotlin.hmpps.service.justice.gov.uk
host: electronic-monitoring-datastore-api.hmpps.service.justice.gov.uk

env:
HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth"
# Template kotlin calls out to itself to provide an example of a service call
# TODO: This should be replaced by a call to a different service, or removed
EXAMPLE_API_URL: "https://template-kotlin.hmpps.service.justice.gov.uk"
EXAMPLE_API_URL: "https://electronic-monitoring-datastore-api.hmpps.service.justice.gov.uk"

# CloudPlatform AlertManager receiver to route prometheus alerts to slack
# See https://user-guide.cloud-platform.service.justice.gov.uk/documentation/monitoring-an-app/how-to-create-alarms.html#creating-your-own-custom-alerts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.config

import jakarta.validation.ValidationException
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.config

import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
Expand All @@ -20,9 +20,9 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
fun customOpenAPI(): OpenAPI = OpenAPI()
.servers(
listOf(
Server().url("https://template-kotlin-dev.hmpps.service.justice.gov.uk").description("Development"),
Server().url("https://template-kotlin-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"),
Server().url("https://template-kotlin.hmpps.service.justice.gov.uk").description("Production"),
Server().url("https://electronic-monitoring-datastore-api-dev.hmpps.service.justice.gov.uk").description("Development"),
Server().url("https://electronic-monitoring-datastore-api-preprod.hmpps.service.justice.gov.uk").description("Pre-Production"),
Server().url("https://electronic-monitoring-datastore-api.hmpps.service.justice.gov.uk").description("Production"),
Server().url("http://localhost:8080").description("Local"),
),
)
Expand All @@ -42,11 +42,11 @@ class OpenApiConfiguration(buildProperties: BuildProperties) {
// service authorisation requirements
.components(
Components().addSecuritySchemes(
"template-kotlin-ui-role",
"electronic-monitoring-datastore-api-ui-role",
SecurityScheme().addBearerJwtRequirement("ROLE_TEMPLATE_KOTLIN__UI"),
),
)
.addSecurityItem(SecurityRequirement().addList("template-kotlin-ui-role", listOf("read")))
.addSecurityItem(SecurityRequirement().addList("electronic-monitoring-datastore-api-ui-role", listOf("read")))
}

private fun SecurityScheme.addBearerJwtRequirement(role: String): SecurityScheme =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.config
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.config

import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.health
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.health

import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.resource
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.resource

import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
Expand All @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import uk.gov.justice.digital.hmpps.templatepackagename.service.ExampleApiService
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.service.ExampleApiService
import uk.gov.justice.hmpps.kotlin.common.ErrorResponse
import java.time.LocalDateTime

Expand All @@ -28,7 +28,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) {
@Operation(
summary = "Retrieve today's date and time",
description = "This is an example endpoint that calls a service to return the current date and time. Requires role ROLE_TEMPLATE_KOTLIN__UI",
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "electronic-monitoring-datastore-api-ui-role")],
responses = [
ApiResponse(responseCode = "200", description = "today's date and time"),
ApiResponse(
Expand All @@ -53,7 +53,7 @@ class ExampleResource(private val exampleApiService: ExampleApiService) {
It will return a 404 response as the /example-external-api endpoint hasn't been implemented, so we use wiremock
in integration tests to simulate other responses.
Requires role ROLE_TEMPLATE_KOTLIN__UI""",
security = [SecurityRequirement(name = "template-kotlin-ui-role")],
security = [SecurityRequirement(name = "electronic-monitoring-datastore-api-ui-role")],
responses = [
ApiResponse(responseCode = "200", description = "a message with a parameter"),
ApiResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.service
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.service

import org.springframework.stereotype.Service
import org.springframework.web.reactive.function.client.WebClient
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</encoder>
</appender>

<logger name="uk.gov.justice.digital.hmpps.templatepackagename.HmppsTemplateKotlinKt" additivity="false" level="DEBUG">
<logger name="uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.HmppsElectronicMonitoringDatastoreApiKt" additivity="false" level="DEBUG">
<appender-ref ref="consoleAppender"/>
</logger>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.integration
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration

import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
Expand All @@ -7,10 +7,10 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDO
import org.springframework.http.HttpHeaders
import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.reactive.server.WebTestClient
import uk.gov.justice.digital.hmpps.templatepackagename.integration.wiremock.ExampleApiExtension
import uk.gov.justice.digital.hmpps.templatepackagename.integration.wiremock.ExampleApiExtension.Companion.exampleApi
import uk.gov.justice.digital.hmpps.templatepackagename.integration.wiremock.HmppsAuthApiExtension
import uk.gov.justice.digital.hmpps.templatepackagename.integration.wiremock.HmppsAuthApiExtension.Companion.hmppsAuth
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration.wiremock.ExampleApiExtension
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration.wiremock.ExampleApiExtension.Companion.exampleApi
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration.wiremock.HmppsAuthApiExtension
import uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration.wiremock.HmppsAuthApiExtension.Companion.hmppsAuth
import uk.gov.justice.hmpps.test.kotlin.auth.JwtAuthorisationHelper

@ExtendWith(HmppsAuthApiExtension::class, ExampleApiExtension::class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.integration
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration

import org.junit.jupiter.api.Test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.integration
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration

import io.swagger.v3.parser.OpenAPIV3Parser
import net.minidev.json.JSONArray
Expand Down Expand Up @@ -75,7 +75,7 @@ class OpenApiDocsTest : IntegrationTestBase() {
}

@ParameterizedTest
@CsvSource(value = ["template-kotlin-ui-role, ROLE_TEMPLATE_KOTLIN__UI"])
@CsvSource(value = ["electronic-monitoring-datastore-api-ui-role, ROLE_TEMPLATE_KOTLIN__UI"])
fun `the security scheme is setup for bearer tokens`(key: String, role: String) {
webTestClient.get()
.uri("/v3/api-docs")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.digital.hmpps.templatepackagename.integration
package uk.gov.justice.digital.hmpps.electronicmonitoringdatastoreapi.integration

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
Expand Down
Loading

0 comments on commit 688a661

Please sign in to comment.