Please note that this microservice is also available within hmc-docker.
The project uses Gradle as a build tool. It already contains
./gradlew
wrapper script, so there's no need to install gradle.
To build the project execute the following command:
./gradlew build
The easiest way to run the application locally is to use the bootWithCCD
Gradle task.
This task requires:
- Access to the
hmc-demo
key vault - Two queues on the
hmc-servicesbus-demo
Azure Service Bus - One topic on the
hmc-servicebus-demo
Azure Service Bus
See Creating Azure Service Bus Resources for detailed instructions on creating ASB resources.
Set required environment variables
The following environment variables need to be set for the created Azure Service Bus resources:
Environment Variable | Description |
---|---|
HMC_OUTBOUND_SERVICE_BUS_QUEUE | Outbound queue name |
HMC_SERVICE_BUS_QUEUE | Inbound queue name |
HMC_SERVICE_BUS_TOPIC | Topic name for publishing updates |
Run the application
Run the application by executing the following command:
./gradlew bootWithCCD
This will start the application and its dependent services.
In order to test if the application is up, you can call its health endpoint:
curl http://localhost:4561/health
You should get a response similar to this:
{"status":"UP","diskSpace":{"status":"UP","total":249644974080,"free":137188298752,"threshold":10485760}}
Create the image of the application by executing the following command:
./gradlew assemble
Create docker image:
docker-compose build
Run the distribution (created in build/install/hmc-cft-hearing-service
directory)
by executing the following command:
docker-compose up
This will start the API container exposing the application's port
(set to 4561
in this template app).
In order to test if the application is up, you can call its health endpoint:
curl http://localhost:4561/health
You should get a response similar to this:
{"status":"UP","diskSpace":{"status":"UP","total":249644974080,"free":137188298752,"threshold":10485760}}
To run all unit tests execute the following command:
./gradlew test
To run all integration tests execute the following command:
./gradlew integration
You can run and publish your pact tests locally by first running the pact docker-compose:
docker-compose -f docker-pactbroker-compose.yml up
And then using gradle task:
./gradlew runAndPublishConsumerPactTests
Run below command for the provider pact verification:
./gradlew clean runProviderPactVerification
Alternatively you can run single command for both consumer tests and provider verifications
./gradlew clean contract
We use Checkstyle. To run all local checks execute the following command:
./gradlew check
This project is licensed under the MIT License - see the LICENSE file for details