This is a small plain-Java HTTP service used to smoke-test Keploy Enterprise Java dynamic deduplication on Java 8 and Java 17. It runs on embedded Tomcat (tomcat-embed-core) and does not compile against the Keploy SDK.
Keploy's Java dynamic deduplication agent (keploy-sdk >= 2.3.x) counts HTTP request windows at the server's request entry point so background threads or post-response work cannot leak coverage between test cases. Supported Java HTTP servers are:
- Apache Tomcat (8.5–11, including Spring Boot's default embedded Tomcat)
- Eclipse Jetty (9.4–12)
- Undertow
Uncounted servers (such as com.sun.net.httpserver.HttpServer, Netty, Reactor Netty, gRPC, Vert.x, and Micronaut) fail closed with unverified:no-server-entry in Kubernetes dynamic dedup (k8s-proxy), which keeps all test cases and reports 0 duplicates rather than risking unsafe drops. This sample uses embedded Tomcat so it works out of the box with both Kubernetes (k8s-proxy) and CLI dynamic deduplication.
The checked-in fixtures exercise /healthz, /grade, /shipping, /inventory, and /invoice. They intentionally contain duplicate coverage paths:
/grade?score=95and/grade?score=98execute the same high-score branch./shipping?country=US&total=150and/shipping?country=US&total=175execute the same free-shipping branch./inventory?sku=BOOK-1&quantity=3and/inventory?sku=BOOK-2&quantity=4execute the same priority-reservation branch./invoice?customer=vip&subtotal=200and/invoice?customer=vip&subtotal=250execute the same VIP-large discount branch.
Requires io.keploy:keploy-sdk >= 2.3.0 (current release: 2.4.0). keploy-sdk.jar bundles the JaCoCo runtime agent automatically — attach only -javaagent:target/keploy-sdk.jar and do not attach a separate jacocoagent.jar.
mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean packagekeploy test \
-c "java -javaagent:target/keploy-sdk.jar -jar target/simple-java-dedup.jar" \
--path . --dedup --language java --delay 1 \
--health-url "http://127.0.0.1:8080/healthz" \
--health-poll-timeout 30s \
--disableMockUpload --disableReportUpload
keploy dedup --path . --keep 1JAVA_VERSION=17 docker compose build
keploy test \
-c "docker compose up" \
--container-name simple-java-dedup \
--path . --dedup --language java --delay 10 \
--health-url "http://127.0.0.1:8080/healthz" \
--health-poll-timeout 30s \
--disableMockUpload --disableReportUpload
keploy dedup --path . --keep 1Keep the -c value as docker compose up so Keploy detects Docker Compose and mounts the shared /tmp socket volume used by Java dynamic deduplication. Pass JAVA_VERSION, JAVA_DEDUP_IMAGE, or port overrides in the shell environment instead of prefixing them inside the -c command.
All 14 replayed fixtures should pass. With --keep 1, dedup keeps 10 test cases and marks 4 as duplicates, one from each pair listed above. Without it, Keploy keeps up to 3 tests per group, so it marks none.