Aller au contenu

Story AB-001: Dev Environment + Test Infrastructure

Module: absence-management Slice: VS-AB-001 from architecture Brand context: [BOTH] Papillon HR Suite + ALTARYS ENTERPRISE HR Suite Priority: 1 Depends on: None Can develop concurrently with: None (must ship first) Merge order: Before AB-002 Estimated complexity: S PRD User Stories: N/A - Technical Story


Objective

Set up the development environment and test infrastructure for the Absence Management module so that all subsequent stories have a working Docker Compose, TestContainers configuration, and test fixtures. This is a prerequisite for every other AB story — no business logic can be developed or tested without this foundation.


Backend Scope

Entities & Records

No domain entities in this slice. This is pure test infrastructure.

Test support classes to create:

  • AbsenceTestContainersConfiguration.java — Shared TestContainers configuration for the absence module. Starts PostgreSQL + Redis containers. Configures Spring DataSource properties for test context.
  • AbsenceTestFixtures.java — Factory methods for sample data:
  • createSampleLeaveRequest() — returns a valid LeaveRequest with realistic defaults
  • createSampleEmployeeProfile() — returns a valid LeaveEmployeeProfile with zero balances
  • createSampleLedgerEntry() — returns a valid LeaveBalanceLedger accrual entry
  • TestLeaveRequestFixture.java — Builder-pattern fixture for LeaveRequest with fluent API for overriding defaults (tenant, employee, dates, status, leave type)

Repository Layer

N/A — No repositories in this slice. Repositories are created in AB-002.

Service Layer

N/A — No services in this slice.

API Endpoints

N/A — No endpoints in this slice.

Validation Rules

  • Test fixtures must produce entities that pass all validation rules defined in AB-002
  • BigDecimal for all amount/day fields in fixtures (never float/double)
  • All date fields use LocalDate, all timestamp fields use Instant
  • tenant_id must be non-null in all generated fixtures

Multi-Tenant Considerations

  • Test fixtures must accept tenantId as a parameter to support all 4 DB profiles (shared, schema-per-tenant, DB-per-tenant, BYO-DB)
  • AbsenceTestContainersConfiguration defaults to shared profile for simplicity
  • Fixture methods must generate unique tenant_id values per test to prevent cross-test contamination
  • Docker Compose must support profile-specific overrides via environment variables

Frontend Scope

N/A — Backend infrastructure story.

Pages & Routes

N/A

Components

N/A

UI States (ALL REQUIRED)

N/A — Backend only.

Responsive Behavior

N/A

Interactions

N/A


Acceptance Criteria

AC-001: Docker Compose starts all dependencies
Given the developer runs docker-compose up -d
When the services start
Then PostgreSQL and Redis are accessible on their default ports

AC-002: TestContainers integration works
Given a test class extends AbsenceTestContainersConfiguration
When the test runs
Then a PostgreSQL container is automatically started and connected

AC-003: Test fixtures generate valid data
Given the AbsenceTestFixtures class is available
When a test calls createSampleLeaveRequest()
Then a valid LeaveRequest is created with all required fields populated and BigDecimal amounts

OHADA & Regulatory Rules

N/A — Infrastructure story with no business logic.


Standards & Conventions

  • docs/standards/java-spring-guidelines.md — §Testing, §TestContainers setup, §Records & sealed types
  • docs/standards/database-guidelines.md — §Multi-tenant repository pattern, §Connection pooling
  • docs/standards/multi-datasource-patterns.md — §TestContainers multi-datasource configuration

Testing Requirements

Unit Tests

  • AbsenceTestFixtures.createSampleLeaveRequest() returns entity with all required fields non-null
  • AbsenceTestFixtures.createSampleEmployeeProfile() returns entity with annual_balance_ouvrables = BigDecimal.ZERO
  • TestLeaveRequestFixture builder overrides default values correctly

Integration Tests

  • Docker Compose PostgreSQL + Redis containers start and accept connections
  • AbsenceTestContainersConfiguration injects a working DataSource into test context
  • Test fixture entities can be persisted and retrieved (validated after AB-002 migrations exist)

What QA Will Validate

  • N/A — No user-facing functionality. Developer self-validates that test infrastructure works.

Out of Scope

  • Actual business logic, services, or API endpoints
  • Flyway migrations and database schema (AB-002)
  • Frontend setup of any kind
  • Keycloak or authentication test configuration (uses existing platform test infra)
  • Redis cache logic (Redis container is started for future use)

Definition of Done

  • [ ] All backend endpoints implemented and returning correct responses — N/A (no endpoints)
  • [ ] All frontend pages render correctly at 360px, 768px, 1024px — N/A (backend only)
  • [ ] All 5 UI states implemented (loading, empty, error, offline, success) — N/A
  • [ ] French micro-copy matches design spec exactly — N/A
  • [ ] All acceptance criteria pass manually
  • [ ] Unit tests written and passing
  • [ ] Integration tests written and passing
  • [ ] Multi-tenant isolation verified — Test fixtures support tenant_id parameterization
  • [ ] Offline write+sync works (Papillon) / N/A (Enterprise) — N/A (backend only)
  • [ ] No TypeScript any — N/A
  • [ ] No Java raw types — all generics explicit
  • [ ] API responses follow standard envelope format — N/A (no endpoints)
  • [ ] Audit trail entries for every data mutation — N/A (no data mutations)