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 Evidence Management Store.
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.
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 build
To run this locally follow the steps below and configure application-aat.yml
.
Then run the service using ./gradlew clean bootRunAat
.
Integration tests
To run all integration tests locally (note the location of config files):
- Make a copy of
src/main/resources/example-application-aat.yml
assrc/main/resources/application-aat.yml
- Make a copy of
src/integrationTest/resources/example-application-local.properties
assrc/integrationTest/resources/application-local.properties
- Replace the
replace_me
secrets 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
- Then run functional tests
- Or 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
IMPORTANT: If you update content in templates,
you will most likely need to re-generate PDFs you changed by running the ignored test PDFGenerationTest.ignoreMe_updateGeneratedPdfs
.
The generated PDFs will need to be placed into src/integrationTest/resources/documentgenerator/documents/regenerated
.
These PDFs are used in integration tests, and you will use them to replace files in src/integrationTest/resources/documentgenerator/documents/pdfoutput
.
Pipeline uses pdfoutput
in its tests, so you will need to replace pdfoutput
PDFs with the newly regenerated
PDFs of the
templates you have changed. Make sure you have followed steps above, and are able to run functional tests.
(NOTE: In some of the latest IntelliJ versions, it is no longer enough to just remove the @Ignore
in PDFGenerationTest.ignoreMe_updateGeneratedPdfs
.
Maybe this will change in the future, but right now an additional step is required: each changed PDF needs to be specified in the
PDFGenerationTest.testData()
method as strings. Then remove @Ignore
and run the whole PDFGenerationTest
test in IntelliJ.)
Unit tests
To run all unit tests please execute following command:
./gradlew test
Coding style tests
To run all checks (including unit tests) please execute following command:
./gradlew check
Mutation tests
To run all mutation tests execute the following command:
./gradlew pitest
- Add one or more appropriate labels to your PR in GitHub. Valid labels are:
enable_fortify_scan
enable_full_functional_tests
- Trigger a build of your PR in Jenkins. Fortify scans will take place asynchronously as part of the Static Checks/Container Build step.
- Check the Blue Ocean view for live monitoring, and review the logs once complete for any issues.
- As Fortify scans execute during the Static Checks/Container Build step, you will need to ensure this is triggered by making a minor change to the PR, such as bumping the chart version.
Flow 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.