This is the backend service for Civil Money Claims. The service provides a set of RESTful endpoints for the CMC frontend application. The two main responsibilities of this application are:
- data access layer for the CMC service,
- executing business logic of the CMC service e.g. calculating response deadline.
Internally state is persisted to a relational database. The service also delegates some responsibilities to other RESTful services e.g. idam-api or pdf-service.
cmc-citizen-frontend • cmc-legal-rep-frontend • cmc-claim-store
Some environment variables are mandatory.
- Ask one of the cmc-developers for latest vars
- Check the Helm chart values
- Check cmc-integration-tests repo for how the docker stack is setup: https://github.com/hmcts/cmc-integration-tests. We use this as the basis for our development environment.
The project uses Gradle as a build tool but you don't have install it locally since there is a
./gradlew
wrapper script.
To build project please execute the following command:
$ ./gradlew build
Before you run an application you have to define CLAIM_STORE_DB_USERNAME
and CLAIM_STORE_DB_PASSWORD
environment variables.
When environment variables has been defined, you need to create distribution by executing following command:
$ ./gradlew assemble
If you want your code to become available to other Docker projects (e.g. for local environment testing), you need to build the image:
$ docker-compose build claim-store-api
When the code has been compiled you can execute it by running the following command:
$ docker-compose up
As a result the following containers will get created and started:
- Database exposing port
5430
- API exposing ports
4400
The src/aat
source set contains automatic tests which are executed in the delivery pipeline. They are intended to run against real Claim Store instances after deployments to consecutive slots and environments.
They can be run against local instance of Claim Store as well, but need some environment variables exported:
SMOKE_TEST_CITIZEN_USERNAME
,SMOKE_TEST_SOLICITOR_USERNAME
,SMOKE_TEST_USER_PASSWORD
- credentials of the pre-created test users (you can create them manually yourself). It's assumed they both have the same password at the moment,GENERATED_USER_EMAIL_PATTERN
- this is used to generate names for users created by tests on the fly. It should resolve to a valid email address and can have up to oneprintf
string placeholder where a randomized value will be inserted. For example, if you were to export a value ofsome-user-%[email protected]
, it would resolve to something like[email protected]
at runtime. You don't have to use a placeholder if you don't want to, but it should be a valid email address as to avoid unnecessary errors in GOV.UK Notify,TEST_URL
- base URL of a running Claim Store instance.
To run smoke tests (non-destructive read operations):
$ ./gradlew smoke
To run functional tests (will create data in the system):
$ ./gradlew functional
Database will get initiated when you run docker-compose up
for the first time by execute all scripts from database
directory.
You don't need to migrate database manually since migrations are executed every time the application bootstraps.
API documentation is provided with Swagger:
https://localhost:4400/swagger-ui.html
- UI to interact with the API resources
NOTE: Swagger scans classes in the uk.gov.hmcts.cmc.claimstore.controllers
package.
To run all unit tests please execute the following command:
$ ./gradlew test
To run all checks (including unit tests) please execute the following command:
$ ./gradlew check
We use SemVer for versioning. For the versions available, see the tags on this repository.
We get a fully functional environment in Azure Kubernetes (AKS) per pull request. For more info see: https://tools.hmcts.net/confluence/display/ROC/AKS+-+Azure+Managed+Kubernetes
When building the project in your IDE (eclipse or IntelliJ), Lombok plugin will be required to compile. For IntelliJ IDEA, please add the Lombok IntelliJ plugin:
- Go to
File > Settings > Plugins
- Click on
Browse repositories...
- Search for
Lombok Plugin
- Click on
Install plugin
- Restart IntelliJ IDEA
Plugin setup for other IDE's are available on [https://projectlombok.org/setup/overview]
Add the -parameters
setting to your compiler arguments in your IDE (Make sure you recompile your code after).
This is because we use a feature of jackson for automatically deserialising based on the constructor.
For more info see: https://github.com/FasterXML/jackson-modules-java8/blob/a0d102fa0aea5c2fc327250868e1c1f6d523856d/parameter-names/README.md
This project is licensed under the MIT License - see the LICENSE file for details.