Skip to content

hmcts/wa-task-management-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wa-task-management-api

Build Status

What does this app do?

Provides API endpoints that enable clients manage Tasks in the Camunda Task Database.

task-management

Access Management Process

The general approach and interaction with Access Management is depicted below. The search endpoints has some slight differences but are similar.

task-management

Since Spring Boot 2.1 bean overriding is disabled. If you want to enable it you will need to set spring.main.allow-bean-definition-overriding to true.

JUnit 5 is now enabled by default in the project. Please refrain from using JUnit4 and use the next generation

Building and deploying the application

Building the application

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

This will do compilation, checkstyle, PMD checks , run tests , but not integration or functional tests.

Running the application

  • Prerequisite:

    • Check if services are running in minikube, if not follow the README in https://github.com/hmcts/wa-kube-environment
    • Check if minikube IP is set as environment variable.
      echo $OPEN_ID_IDAM_URL
      
      You should see the ip and port as output, eg: http://192.168.64.14:30196. If you do not see, then from your wa-kube-enviroment map environment variables
      source .env
      
  • You can either run as Java Application from run configurations or

      ./gradlew clean bootRun
    • Before running the wa-task-management-application with the above command, If you want to run the application with profile replication make sure to set the spring-profile with the below command
      export SPRING_PROFILES_ACTIVE=replica;
      
      And if you are running minikube with mac m1, m2 chips with ARM Architecture make sure to set the environment with the below command
      export environment=local-arm-arch
      
  • In order to test if the application is up, you can call its health endpoint:

      curl http://localhost:8087/health

    You should get a response similar to this:

      {"status":"UP","diskSpace":{"status":"UP","total":249644974080,"free":137188298752,"threshold":10485760}}
    
  • To access any service endpoint, you must set headers Service Authorization, Authorization

    • To set Service Authorization header, from wa-kube-environment Goto wa-kube-environment/scripts/actions and execute command
       ./idam-service-token.sh wa_task_management_api
      
      The command will generate a long token prefixed with your name. Copy the token till the name and set in Service Authorization header Service Authorization: Bearer 'your token'
    • To set Authorization header, from the same path execute command
       ./idam-user-token.sh "${TEST_CASEOFFICER_USERNAME}" "${TEST_CASEOFFICER_PASSWORD}"
      
      The command should generate a long token, copy the whole token and set in Authoirization header Authorization: Bearer 'your token' Note: if the command returns null, then make sure the environment variable is set and you have sourced the environment variables.
  • To run all functional tests or single test you can run as Junit, make sure the env is set

        OPEN_ID_IDAM_URL=http://'minikubeIP:port'
        Using simulator: OPEN_ID_IDAM_URL=http://sidam-simulator
    

    Note: Make sure the BPMN and DMN are deployed onto Camunda locally.

  • BPMN project is wa-standalone-task-bpmn
    DMN project is wa-task-configuration-template
    Services wa_workflow_api should be running.
    And WA Case Type CCD definition from wa-ccd-definitions is uploaded as well.
    
  • To run integration tests docker should be running.

  • To run all tests including junit, integration and functional. You can run the command

        ./gradlew test integration functional
    

    or

    ./gradlew tests
    

Running contract or pact tests:

You can run contract or pact tests as follows:

./gradlew contract

You can then publish your pact tests locally by first running the pact docker-compose:

docker-compose -f docker-pactbroker-compose.yml up

and then using it to publish your tests:

./gradlew pactPublish

Database replication

To trigger the replication code you will have to run the code with the following env var

export SPRING_PROFILES_ACTIVE=replica

License

This project is licensed under the MIT License - see the LICENSE file for details