This is a document generation and template management service. This allows to generate documents based on a given template name and placeholder data in JSON format and will also store the generated document in the Document Management Store (via Case Document AM).
The service provides a single RESTful endpoint that will generate the document, store it in Evidence Management Store and return the link to the stored data.
Updated with master code base until 2.1
You must pass dynamic_fileName key in the placeholders map to get a dynamic file name
Prerequisites
Building
The project uses Gradle as a build tool but you don't have to install it locally since there is a
./gradlew wrapper script.
To build project please execute the following command:
./gradlew buildRunning
First you need to create distribution by executing following command:
./gradlew installDistTo begin download the azure client cli:
brew update && brew install azure-cliAfter it has finished downloaded run:
az loginThis should open a browser window for you to login, use your HMCTS account
After logging in run the following command:
az acr login --name hmcts --subscription <ask the team for the secret>Make sure you are connected to the VPN to before you run docker-compose up otherwise it won't be able to use the image.
When the distribution has been created in build/install/prl-dgs-api directory,
you can run the application by executing following command:
docker-compose upAs a result the following container(s) will get created and started:
- long living container for API application exposing port
4007
Make sure you have added the label 'enable_keep_helm' while creating the PR. Otherwise, add the label and re-trigger the build.
Integration tests
To run all integration tests locally:
- Make a copy of
src/main/resources/example-application-aat.ymlassrc/main/resources/application-aat.yml - Make a copy of
src/integrationTest/resources/example-application-local.propertiesassrc/integrationTest/resources/application-local.properties - Replace the
replace_mesecrets in the newly created files. You can get the values from SCM and Azure secrets key vault (the new files are in .gitignore and should not be committed to git) - Assuming you use IntelliJ, run your application
- And then run your gradle functional tests task
- Or if using command line:
- Start the app with AAT config using
./gradlew clean bootRunAat - Start the test with AAT config using
./gradlew clean functional
- Start the app with AAT config using
If you update content in templates, you can re-generate the PDFs by running the ignored test PDFGenerationTest.ignoreMe_updateGeneratedPdfs. The test
will output generated PDFs to the folder src/integrationTest/resources/documentgenerator/documents/regenerated
Unit tests
To run all unit tests please execute following command:
./gradlew testCoding style tests
To run all checks (including unit tests) please execute following command:
./gradlew checkMutation tests
To run all mutation tests execute the following command:
./gradlew pitestFlow Diagram
API documentation
API documentation is provided with Swagger:
http://localhost:4007/swagger-ui.html- UI to interact with the API resources
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Standard API
We follow RESTful API standards.
This project is licensed under the MIT License - see the LICENSE.md file for details.
