This repository contains a Java 21 multi-module Spring Boot backend designed to support API functional testing, GraphQL validation, black-box smoke tests, coverage collection with JaCoCo, and selective test execution based on changed modules.
shared-kernel: shared exceptions, enums, and API error handling.catalog-service: product catalog domain, REST endpoints, and GraphQL queries and mutations.ordering-service: customer and order workflows, REST endpoints, and GraphQL queries and mutations.backend-app: runnable Spring Boot application, Flyway migrations, demo seed data, JaCoCo agent packaging, and container assets.api-smoke-tests: black-box API tests intended to run against a live stack started with Docker Compose.
GET /api/v1/productsGET /api/v1/products/{sku}POST /api/v1/productsPATCH /api/v1/products/{sku}/inventoryGET /api/v1/customersPOST /api/v1/customersGET /api/v1/ordersGET /api/v1/orders/{orderNumber}POST /api/v1/ordersGET /actuator/health
GraphQL is exposed at POST /graphql.
- Queries:
products,productBySku,customers,orders,orderByNumber - Mutations:
createProduct,adjustInventory,createCustomer,placeOrder
Build the application artifacts:
./gradlew clean build :backend-app:copyJacocoAgentStart the stack:
./gradlew clean build :backend-app:copyJacocoAgent
docker compose up --buildRun smoke tests against the live stack:
./gradlew :api-smoke-tests:test -PbaseUrl=http://localhost:8180 -PbearerToken=local-api-tokenThe application container mounts .coverage/ and writes JaCoCo execution data to .coverage/jacoco.exec.
The packaged JaCoCo agent file is produced at backend-app/build/jacoco-agent/jacocoagent.jar.
All application REST and GraphQL endpoints require Authorization: Bearer <token>.
- Default local token:
local-api-token - Override token with
APP_BEARER_TOKEN - Public endpoint kept open for health checks:
GET /actuator/health
Example REST request:
curl http://localhost:8180/api/v1/products \
-H 'Authorization: Bearer local-api-token'Example GraphQL request:
curl http://localhost:8180/graphql \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer local-api-token' \
--data '{"query":"{ products { sku name } }"}'Use the helper script to determine impacted Gradle test tasks from git changes:
scripts/resolve-impacted-tasks.sh origin/main HEADThe GitHub workflow uses this script to run targeted unit tests before running the live-stack smoke suite and publishing an image to GHCR.