| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Spring Boot 3 / Java 21 reference service that builds a Customer 360 view on the fly by fanning out to SAP S/4HANA Business Partner OData endpoints and merging the result with locally stored CRM annotations (tags + notes) from Postgres. Used inside the Keploy project as the canonical regression fixture for the SAP fan-out path and the v3 HTTPS + Postgres parsers.
This is a small "Customer 360" aggregator, the kind of service an internal CRM dashboard team would ship on SAP BTP. When a user hits GET /api/v1/customers/{id}/360, the service fans out: one synchronous SAP OData call for the BusinessPartner master record, then two more parallel SAP OData calls (addresses + roles), in parallel with two Postgres queries (tags + notes). The five results are merged into a single JSON response.
The real-world analog is an in-house CRM dashboard that needs a unified customer view by calling the system-of-record (SAP) plus a local CRM annotations DB (Postgres), without any surface area that hides how those downstream calls behave on the wire.
The service is deliberately structured to exercise the trickiest parts of Keploy's interception layer in a single flow.
cd sap-demo-java
# 1. Bring up Postgres in the background (or use ./deploy_kind.sh for k8s)
docker compose up -d postgres
# 2. Point the app at the SAP sandbox
export SAP_API_KEY=<your-sandbox-key>
export SAP_SANDBOX_BASE_URL=https://sandbox.api.sap.com/s4hanacloud
# 3. Build and run
mvn spring-boot:runThe service listens on :8080. Smoke-test it:
curl -s http://localhost:8080/actuator/health | jq .
curl -s http://localhost:8080/api/v1/customers/202/360 | jq .Run the service under keploy record, exercise it with run_flow.sh (which fires 20 distinct request shapes covering every endpoint and verb), then replay:
# terminal 1 — record
keploy record -c "java -jar target/customer360.jar"
# terminal 2 — drive traffic
bash run_flow.sh
# Ctrl+C the record command. Testcases land under ./keploy/
# then replay:
keploy test -c "java -jar target/customer360.jar"The same flow runs in-cluster through the Keploy k8s-proxy. Deploy the app to kind:
./deploy_kind.sh
kubectl -n sap-demo annotate deploy/customer360 keploy.io/record=enabled
# start recording
curl -k -X POST https://<k8s-proxy-svc>:8080/record/start \
-H "Authorization: Bearer $KEPLOY_SHARED_TOKEN_OVERRIDE" \
-d '{"namespace":"sap-demo","deployment":"customer360"}'
# drive traffic (e.g. run_flow.sh against the NodePort / Ingress host)
./run_flow.sh
# stop recording — auto-replay then fires on a standalone pod
curl -k -X POST https://<k8s-proxy-svc>:8080/record/stop \
-d '{"record_id":"sap-demo-customer360"}'Replay results land in the enterprise dashboard at app.keploy.io.
| Method | Path | Purpose | Downstream |
|---|---|---|---|
| GET | /actuator/health | Liveness / readiness probe | none |
| GET | /api/v1/customers/count | KPI tile — total partner count | Postgres only |
| GET | /api/v1/customers/{id} | Business partner detail | SAP only |
| GET | /api/v1/customers/{id}/tags | Customer tags | Postgres only |
| GET | /api/v1/customers/{id}/360 | Full aggregation | SAP × 3 + Postgres × 2 parallel |
| POST | /api/v1/customers/{id}/tags | Add a tag | Postgres only |
| POST | /api/v1/customers/{id}/notes | Add a note | Postgres only |
| DELETE | /api/v1/customers/{id}/tags/{tag} | Remove a tag | Postgres only |
| GET | /v3/api-docs | OpenAPI catalog | none |
keploy.yml marks three fields as global noise so replays stay deterministic across runs:
If your team adds more generated fields, extend test.globalNoise.global in keploy.yml.
Classic Spring Boot layering, with one custom wrinkle for the fan-out:
| Path | Purpose |
|---|---|
| pom.xml | Spring Boot 3, Java 21, Resilience4j, Flyway, HikariCP, SpringDoc |
| src/main/java/com/keploy/sapdemo/customer360/... | Application source (see Architecture above) |
| src/main/resources/application.yml | Externalised config |
| src/main/resources/db/migration/V1__init_schema.sql | Flyway schema: customer_tag, customer_note, audit_event |
| docker-compose.yml | Local Postgres 16 sidecar |
| Dockerfile | Multi-stage, non-root Spring Boot layered image |
| k8s/*.yaml | Namespace / ConfigMap / Secret / Deployment / Service / Ingress |
| deploy_kind.sh | One-shot kind cluster + build + load + apply |
| run_flow.sh | 20-request exerciser used during keploy record |
| demo_script.sh | Record / replay / offline-test harness |
| simulate_fiori_flow.sh | Narrated Fiori-style flow for two-terminal demos |
| keploy.yml | Recorded-mock metadata + global noise rules |
| Back | FazBrowse Home | New Git URL |