/adoption-service

Animal adoption service for the rescued animals platform

Primary LanguageJavaGNU Affero General Public License v3.0AGPL-3.0

Animal adoption service

CircleCI Quality Gate Status Sponsored

Tech stack: Java 17, Gradle 7.6, SpringBoot 2.7.0, Flyway, Docker Engine v20.10.12, PostgresSQL 10.6, Heroku.

Setting up your development environment (Linux, macOS)

Follow the next steps in the order they appear. After completing them, you would be able to start contributing to the project. Good luck and thanks!

  • Make sure you have installed the following:

    • Java 17
    • Docker
  • Login to docker with your credentials. If you don't have an account, create one in the Docker Hub site

      docker login
    
  • Run: make test-all to run all tests and verify everything works as expected.

[Important] If you want to run integration tests from the IDE

Without these steps, you would be able to run all tests from a terminal. Only if you want to be able to run integration tests from your IDE, you can do the following:

  • Set up your preferred IDE to run tests with Gradle (instead of JUnit) and add the environment variable SPRING_PROFILE=local to it. For example, add the env variable to the Gradle Template in the running configurations of IntelliJ IDEA.

(Always, before running the integration tests)

  • Verify that the dependencies (wiremock and adoption-service-db) are running:

      docker ps -a    
    

    If they're not, run: make deploy-dependencies-only

[Important] If you want to run api tests from the IDE

Without these steps, you would be able to run all tests from a terminal. Only if you want to be able to run api tests from your IDE, you can do the following:

(Only for the first time)

  • Set up your preferred IDE to run tests with Gradle (instead of JUnit) and add the following environment variables to it. (e.g. add the env variable to the Gradle Template in the running configurations of IntelliJ IDEA):

      SPRING_PROFILE=local
      ADOPTION_SERVICE_URL=http://localhost:8080
      JWT_ACCESS_TOKEN=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgxMjMvIiwic3ViIjoiMTIzNDU2Nzg5MCIsImF1ZCI6Imh0dHBzOi8vZHVtbXkvZHVtbXkuZWMiLCJpYXQiOjE1ODY2MzcwNDIsImV4cCI6OTA4NjcyMzQ0MiwiaHR0cHM6Ly9kdW1teS9vcmdhbml6YXRpb25faWQiOiI1NjAwOTExOS00NGJkLTQ2OWEtYTU5Yi00MDFhYjIzZDE5Y2EiLCJwZXJtaXNzaW9ucyI6WyJtYW5hZ2U6YW5pbWFscyIsInJlYWQ6YW5pbWFscy1wdWJsaWMiXX0.he8-N6E2VHVbqxlKZNfUGPo1Tnl8WfXopB5G1KhB9F6j5L-9D59Vhas0ORd48Lw_c4dtra3mueR3l_VRZ5xwmQAtGAkDI2k4S-Zcs3x0Bf5yZG3kT0rw0cZGvRDmR8-qcW8Q0fgw99slzhN9UQOYSgxmEtleRlR2Kad_lAsbwn9Eu3t_gs5mddsSv5QTgI5OB1QbZspOkSZFXF3tUlTNLdVVpkBUqYLAtw4FV3UQ9Xb4vNjCVcMUSv9wLWeC3ivnU6zPID7l0gNZEJ6RJ3wUslK1elWHeX-xfPBs1nVYh6Xn_1TkBOBtEDhOIY875ynfuSQnboHtP29InvdvhjwecQ
    

(Always, before running the api tests)

  • Make sure dependencies are running: make deploy-dependencies-only
  • Run the application from your IDE setting up the VM option -Dspring.profiles.active=local

Useful commands

Execute make to get the list and documentation of the make targets available for this project

Postman collection with sample requests

Run in Postman