Giter Club home page Giter Club logo

ia-case-api's Introduction

ia-case-api

Immigration & Asylum case API

Purpose

Immigration & Asylum case API is a Spring Boot based application to manage cases for Immigration & Asylum Appellants and Legal Representatives.

Prerequisites

To run the project you will need to have the following installed:

  • Java 17
  • Docker (optional)

For information about the software versions used to build this API and a complete list of it's dependencies see build.gradle

Running the application

To run the API quickly use the docker helper script as follows: (make sure to have the required environment variables set as under functional tests section)

./bin/run-in-docker.sh --clean --install

Alternatively, you can start the application from the current source files using Gradle as follows:

./gradlew clean bootRun

If required, to run with a low memory consumption, the following can be used:

./gradlew --no-daemon assemble && java -Xmx384m -jar build/libs/ia-case-*.jar

Using the application

To understand if the application is working, you can call it's health endpoint:

curl http://localhost:8090/health

If the API is running, you should see this response:

{"status":"UP"}

Running integration tests:

You can run the integration tests as follows:

./gradlew integration

Running functional tests:

If the API is running (either inside a Docker container or via gradle bootRun) you can run the functional tests as follows:

./gradlew functional

In order for these tests to run successfully you will need its dependencies to be running. Firstly, CCD will need to be running, a dockerised version of it and its dependencies along with instructions for running locally can be found at https://github.com/hmcts/ccd-docker

Secondly, the ia-case-documents-api needs to be running, this api along with instructions to run locally can be found at https://github.com/hmcts/ia-case-documents-api.

And lastly the ia-notifications-api needs to be running. This api along with instructions to run locally can be found at https://github.com/hmcts/ia-case-notifications-api.

To successfully interact with the above dependencies a few environment variables need to be set as below. The examples (the values below are not real, replace them with values matching those in the latest CCD Definition spreadsheet):

Environment Variable Example values
TEST_ADMINOFFICER_USERNAME [email protected]
TEST_ADMINOFFICER_PASSWORD password
TEST_HOMEOFFICE_APC_USERNAME [email protected]
TEST_HOMEOFFICE_APC_PASSWORD password
TEST_HOMEOFFICE_LART_USERNAME [email protected]
TEST_HOMEOFFICE_LART_PASSWORD password
TEST_HOMEOFFICE_POU_USERNAME [email protected]
TEST_HOMEOFFICE_POU_PASSWORD password
TEST_HOMEOFFICE_GENERIC_USERNAME [email protected]
TEST_HOMEOFFICE_GENERIC_PASSWORD password
TEST_CASEOFFICER_USERNAME [email protected]
TEST_CASEOFFICER_PASSWORD password
TEST_JUDICIARY_USERNAME [email protected]
TEST_JUDICIARY_PASSWORD password
TEST_LAW_FIRM_A_USERNAME [email protected]
TEST_LAW_FIRM_A_PASSWORD password
TEST_LAW_FIRM_B_USERNAME [email protected]
TEST_LAW_FIRM_B_PASSWORD password
IA_SYSTEM_USERNAME [email protected]
IA_SYSTEM_PASSWORD password
IA_IDAM_CLIENT_ID some-idam-client-id
IA_IDAM_SECRET some-idam-secret
IA_IDAM_REDIRECT_URI http://localhost:3451/oauth2redirect
IA_S2S_SECRET some-s2s-secret
IA_S2S_MICROSERVICE some-s2s-gateway
IA_CCD_DIR ../ia-ccd-definitions/
If you want to run a specific scenario use this command:
./gradlew functional --tests CcdScenarioRunnerTest --info -Dscenario=RIA-697

Running smoke tests:

If the API is running (either inside a Docker container or via gradle bootRun) you can run the smoke tests as follows:

./gradlew smoke

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

Running mutation tests tests:

If you have some time to spare, you can run the mutation tests as follows:

./gradlew pitest

As the project grows, these tests will take longer and longer to execute but are useful indicators of the quality of the test suite.

More information about mutation testing can be found here: http://pitest.org/

Validate CCD definitions and ia-case-api compatibility

There is a need to check compatibility of ia-case-api Pull Request code changes and existing CCD definitions imported to Production before every release. We can't release changes to ia-case-api where there is a writing to non-existing case data field. Depends on the event scope it could block case data progress for particular event or for all events.

Script has been prepared to identify approx. 95% potential issues by scanning local ia-case-api changes and existing CCD definitions. The script can't reduce the risk of eliminating braking change to none. If you do complex refactoring, it is always good to ask your colleagues for advice.

Before running the script make sure you setup correct branches on your local:

  • ia-ccd-definitions -> master branch
  • ia-case-api -> RIA-* feature branch

Run the script

yarn validate

Standard output will show INFOs, WARNs and ERRORs logs. There is a need to check all WARNs places, they are potential compatibility issues. Any ERROR tells that there is a need for intermediate CCD definitions which should include missing field definitions.

Intermediate CCD definitions must be imported to Production before any ia-case-api braking code changes is merged to master. Once it is done you can re-run validation script.

There is IGNORED array defined in validate_case_api.js script. If you think validation script gives you false positives, please add new entry to the array.

WA local env integration

This is only for WA devs or devs who work with the WA local env and this service.

To integrate this service with the WA local env we have to set the wa-local profile. To set the profile pick one of the options:

  1. From the terminal run:
./gradlew --no-daemon assemble && java -Xmx384m -jar -Dspring.profiles.active=wa-local build/libs/ia-case-api.jar
  1. From IntelliJ: Edit the Run/Debug configuration dialog and add the profile.

Adding Git Conventions

Include the git conventions.

  • Make sure your git version is at least 2.9 using the git --version command
  • Run the following command:
git config --local core.hooksPath .git-config/hooks

Once the above is done, you will be required to follow specific conventions for your commit messages and branch names.

If you violate a convention, the git error message will report clearly the convention you should follow and provide additional information where necessary.

Optional:

  • Install this plugin in Chrome: https://github.com/refined-github/refined-github

    It will automatically set the title for new PRs according to the first commit message, so you won't have to change it manually.

    Note that it will also alter other behaviours in GitHub. Hopefully these will also be improvements to you.

In case of problems

  1. Get in touch with your Technical Lead and inform them, so they can adjust the git hooks accordingly

  2. Instruct IntelliJ not to use Git Hooks for that commit or use git's --no-verify option if you are using the command-line

  3. If the rare eventuality that the above is not possible, you can disable enforcement of conventions using the following command

    git config --local --unset core.hooksPath

    Still, you shouldn't be doing it so make sure you get in touch with a Technical Lead soon afterwards.

ia-case-api's People

Contributors

alexbaeza avatar alivenichoppa avatar apereverzin1 avatar augustio avatar bradsorour avatar burale avatar chrisgrimble avatar colmlynch60 avatar dependabot-preview[bot] avatar divisathyan avatar fantasticjamieburns avatar filippo-possenti-version1 avatar iguannago avatar jakecohensol avatar javimarinc96 avatar jkumar-moj avatar kalachandrasekar1 avatar lee365 avatar ludo05 avatar makowalski avatar martin-bucinskas avatar mkayad avatar mokainos avatar nilay913 avatar raghera avatar rajeshthuraiyur avatar rob-doherty avatar sajjadh-v1 avatar srinivasuluputcha avatar tarun-palisetty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ia-case-api's Issues

Use of mutation testing in ia-case-api - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool Pit in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

We apologize if you have already received message multiple times or if you have already had the opportunity to complete the survey. If you have already shared your feedback, we want to convey our appreciation, kindly disregard this message, and please accept our apologies for any inconvenience.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • Update all non-major dependencies (azurerm, ccd, ccd-case-document-am-api, em-ccdorc, em-stitching, gradle, hashicorp/terraform, ia-aip-frontend, ia-bail-case-api, ia-case-documents-api, ia-case-notifications-api, ia-case-payments-api, ia-home-office-integration-api, java, microsoft/ApplicationInsights-Java, walk-sync, com.github.hmcts:fortify-client, org.springframework.cloud:spring-cloud-contract-wiremock, org.mockito:mockito-core, com.h2database:h2, net.minidev:json-smart, com.nimbusds:nimbus-jose-jwt, org.springframework.retry:spring-retry, org.bouncycastle:bcprov-jdk18on, org.springframework.cloud:spring-cloud-starter-bootstrap, org.springframework.cloud:spring-cloud-starter-openfeign, org.javamoney.moneta:moneta-core, ch.qos.logback:logback-core, ch.qos.logback:logback-classic, com.launchdarkly:launchdarkly-java-server-sdk, org.apache.tomcat.embed:tomcat-embed-websocket, org.apache.tomcat.embed:tomcat-embed-core, com.sun.xml.bind:jaxb-osgi, org.postgresql:postgresql, org.springdoc:springdoc-openapi-ui, commons-io:commons-io, com.fasterxml.jackson.module:jackson-module-parameter-names, com.fasterxml.jackson.datatype:jackson-datatype-jdk8, com.fasterxml.jackson.datatype:jackson-datatype-jsr310, com.fasterxml.jackson.dataformat:jackson-dataformat-yaml, com.fasterxml.jackson.dataformat:jackson-dataformat-csv, com.fasterxml.jackson.core:jackson-annotations, com.fasterxml.jackson.core:jackson-core, com.fasterxml.jackson.core:jackson-databind, org.yaml:snakeyaml, com.google.guava:guava, jacoco, org.springframework.cloud:spring-cloud-dependencies, pmd, checkstyle, io.rest-assured:rest-assured, io.rest-assured:rest-assured-all, info.solidsoft.gradle.pitest:gradle-pitest-plugin, org.pitest:pitest, org.junit.platform:junit-platform-engine, org.junit.platform:junit-platform-commons, org.junit.jupiter:junit-jupiter-params, org.junit.jupiter:junit-jupiter-engine, org.junit.jupiter:junit-jupiter-api, net.serenity-bdd:serenity-spring, net.serenity-bdd:serenity-rest-assured, net.serenity-bdd:serenity-junit, net.serenity-bdd:serenity-core, io.freefair.lombok, au.com.dius.pact, uk.gov.hmcts.java, org.sonarqube, org.owasp.dependencycheck, io.spring.dependency-management, info.solidsoft.pitest, com.github.ben-manes.versions)

Warning

Renovate failed to look up the following dependencies: Failed to look up maven package au.com.dius.pact:au.com.dius.pact.gradle.plugin.

Files affected: build.gradle


Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • hmctspublic.azurecr.io/base/java 17-distroless
github-actions
.github/workflows/pr-title-validation.yml
.github/workflows/swagger.yml
  • actions/checkout v1
  • actions/cache v1
  • actions/setup-java v1
gradle
build.gradle
  • net.serenity-bdd:serenity-gradle-plugin 3.6.22
  • au.com.dius.pact:au.com.dius.pact.gradle.plugin 4.4.0-beta.1
  • com.github.ben-manes.versions 0.42.0
  • info.solidsoft.pitest 1.9.0
  • io.spring.dependency-management 1.1.0
  • org.flywaydb.flyway 5.2.4
  • org.owasp.dependencycheck 9.0.4
  • org.sonarqube 3.0
  • org.springframework.boot 2.7.18
  • uk.gov.hmcts.java 0.12.43
  • au.com.dius.pact 4.2.14
  • io.freefair.lombok 6.2.0
  • org.junit.jupiter:junit-jupiter-api 5.8.2
  • org.junit.jupiter:junit-jupiter-engine 5.8.2
  • org.junit.jupiter:junit-jupiter-params 5.8.2
  • org.junit.platform:junit-platform-commons 1.7.2
  • org.junit.platform:junit-platform-engine 1.7.2
  • checkstyle 10.12.0
  • pmd 6.41.0
  • jacoco 0.8.10
  • org.springframework.cloud:spring-cloud-dependencies 2021.0.3
  • com.google.guava:guava 32.1.2-jre
  • org.yaml:snakeyaml 2.0
  • commons-fileupload:commons-fileupload 1.5
  • com.fasterxml.jackson.core:jackson-databind 2.16.0
  • com.fasterxml.jackson.core:jackson-core 2.16.0
  • com.fasterxml.jackson.core:jackson-annotations 2.16.0
  • com.fasterxml.jackson.dataformat:jackson-dataformat-csv 2.16.0
  • com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.16.0
  • com.fasterxml.jackson.datatype:jackson-datatype-jsr310 2.16.0
  • com.fasterxml.jackson.datatype:jackson-datatype-jdk8 2.16.0
  • com.fasterxml.jackson.module:jackson-module-parameter-names 2.16.0
  • com.nimbusds:nimbus-jose-jwt 9.22
  • net.minidev:json-smart 2.4.10
  • commons-io:commons-io 2.10.0
  • org.springdoc:springdoc-openapi-ui 1.6.8
  • org.postgresql:postgresql 42.4.4
  • com.sun.xml.bind:jaxb-osgi 2.3.3
  • org.apache.tomcat.embed:tomcat-embed-core 9.0.83
  • org.apache.tomcat.embed:tomcat-embed-websocket 9.0.83
  • com.launchdarkly:launchdarkly-java-server-sdk 6.2.1
  • ch.qos.logback:logback-classic 1.2.13
  • ch.qos.logback:logback-core 1.2.13
  • org.javamoney.moneta:moneta-core 1.4.2
  • uk.gov.hmcts.reform:logging 5.1.7
  • uk.gov.hmcts.reform:logging-appinsights 5.1.7
  • uk.gov.hmcts.reform:properties-volume-spring-boot-starter 0.1.0
  • uk.gov.hmcts.reform:service-auth-provider-client 4.0.0
  • org.springframework.cloud:spring-cloud-starter-openfeign 3.1.8
  • org.springframework.cloud:spring-cloud-starter-bootstrap 3.1.7
  • org.bouncycastle:bcprov-jdk18on 1.74
  • uk.gov.service.notify:notifications-java-client 3.19.2-RELEASE
  • org.springframework.retry:spring-retry 1.3.3
  • com.nimbusds:nimbus-jose-jwt 9.37.3
  • net.minidev:json-smart 2.5.0
  • org.pitest:pitest 1.9.0
  • info.solidsoft.gradle.pitest:gradle-pitest-plugin 1.9.0
  • org.codehaus.sonar-plugins:sonar-pitest-plugin 0.5
  • com.h2database:h2 1.4.197
  • org.mockito:mockito-core 3.5.0
  • org.springframework.cloud:spring-cloud-contract-wiremock 3.1.6
  • org.powermock:powermock-api-mockito2 2.0.9
  • io.rest-assured:rest-assured-all 5.3.1
  • io.rest-assured:rest-assured 5.3.1
  • net.serenity-bdd:serenity-core 3.6.22
  • net.serenity-bdd:serenity-junit 3.6.22
  • net.serenity-bdd:serenity-rest-assured 3.6.22
  • net.serenity-bdd:serenity-spring 3.6.22
  • com.github.hmcts:fortify-client 1.3.0
  • uk.gov.hmcts.reform:document-management-client 7.0.0
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 7.6
helm-values
charts/ia-case-api/values.yaml
helmv3
charts/ia-case-api/Chart.yaml
  • java 5.0.0
  • ccd ~9.0.22
  • xui-webapp ~1.0.16
  • idam-pr ~2.3.0
  • ia-case-payments-api 0.0.15
  • ia-case-documents-api 0.0.26
  • ia-case-notifications-api 0.0.37
  • ia-home-office-integration-api 0.0.20
  • ia-aip-frontend 0.0.43
  • ia-bail-case-api 0.0.17
  • ccd-case-document-am-api 1.7.11
  • em-ccdorc 2.0.10
  • em-stitching 1.0.31
  • aac-manage-case-assignment ~0.2.11
  • wa ~1.0.4
  • servicebus 1.0.4
  • ccd-message-publisher ~0.1.11
  • redis ~16.13.0
  • am-org-role-mapping-service ~0.0.48
  • postgresql 1.0.2
npm
package.json
  • request 2.88.2
  • walk-sync 2.0.2
  • process 0.11.10
regex
Dockerfile
  • microsoft/ApplicationInsights-Java 3.4.13
terraform
infrastructure/main.tf
infrastructure/state.tf
  • azuread 1.6.0
  • azurerm ~> 3.78.0
terraform-version
infrastructure/.terraform-version
  • hashicorp/terraform 1.3.7

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.