Skip to content

Setup local database and add unit tests for landing controller

Kayouh Salaheddine a demandé de fusionner feat/database-integration-and-testing vers develop

This Merge Request completes the local environment integration and establishes automated testing for the darvest-landing-service.

Key Changes

  1. Local Infrastructure Setup
  • PostgreSQL Support: Added docker-compose.yml to spin up a local PostgreSQL 15 database, streamlining development and environment parity.
  • Configuration: Updated application-local.yml and application.yml with the necessary JDBC drivers, Hibernate dialect settings, and ddl-auto: update for automatic schema generation.
  1. Application Infrastructure
  • Caching: Added a ConcurrentMapCacheManager bean to Application.java to support the @Cacheable functionality implemented in previous steps.
  1. Testing Suite
  • Unit Testing: Created LandingControllerTest using MockitoExtension and MockMvc. This provides a fast, reliable, and isolated test for the LandingController without requiring a full Spring context or external dependencies.

Technical Notes

  • JPA/Hibernate: Hibernate is configured to automatically create/update the database schema based on your JPA entities.
  • Testing Approach: Switched to a lightweight Mockito-based unit test to avoid issues with Spring Context initialization (entityManagerFactory collisions) during test execution.

Checklist

  • Local PostgreSQL database configured and verified.
  • Application successfully connects to the local database.
  • Unit test LandingControllerTest passes.
  • Project builds successfully with mvn clean package.

Rapports de requête de fusion