This service provides a calculation engine by which release dates of sentences are calculated. It also allows for an existing calculation result to be retrieved.
- The main client is the Calculate Release Dates UI service.
- It is built as docker image and deployed to the MOJ Cloud Platform.
This service requires a postgresql database.
Tools required:
- JDK v18+
- Kotlin
- docker
- docker-compose
$ ./gradlew
$ ./gradlew clean build
Start up the docker dependencies using the docker-compose file in the calculate-release-dates-api
service
There is a script to help, which sets local profiles, port and DB connection properties to the
values required.
If this is a HMPPS project then the project will be created as part of bootstrapping - see https://github.com/ministryofjustice/hmpps-project-bootstrap.
$ ./run-full.sh
+Or, to run with default properties set in the docker-compose file
$ docker-compose pull && docker-compose up
Or, to use default port and properties
$ SPRING_PROFILES_ACTIVE=dev ./gradlew bootRun
Unit tests mock all external dependencies and can be run with no dependent containers.
$ ./gradlew test
Integration tests use Wiremock to stub any API calls required, and use a local H2 database that is seeded with data specific to each test suite.
$ ./gradlew integrationTest
$ ./gradlew ktlintcheck
$ ./gradlew dependencyCheckAnalyze
N.B. This currently still requires Adjustments and Manage Offences to be configured to look at dev environment
This will run the service locally. It starts the database runs manage-offences-api via a bash script. It connects to the dev versions of prison-api and hmpps-auth Run the following commands from the root directory of the project:
- docker-compose -f docker-compose-test.yml pull
- docker-compose -f docker-compose-test.yml up --no-start
- docker-compose -f docker-compose-test.yml start hmpps-auth calculate-release-dates-db prison-api
- ./run-local.sh
How we use application profile files to configure calculation variables