GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — samples-java/simple-java-dedup at main · keploy/samples-java

Expand file tree

/

simple-java-dedup

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

simple-java-dedup

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
keploy
keploy
 
 
src/main/java/io/keploy/samples/simplededup
src/main/java/io/keploy/samples/simplededup
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
dedupData.yaml
dedupData.yaml
 
 
docker-compose.yml
docker-compose.yml
 
 
duplicates.yaml
duplicates.yaml
 
 
keploy.yml
keploy.yml
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Simple Java Dynamic Deduplication Sample

This is a small plain-Java HTTP service used to smoke-test Keploy Enterprise Java dynamic deduplication on Java 8 and Java 17. It uses only JDK APIs (com.sun.net.httpserver.HttpServer) and does not compile against the Keploy SDK.

The checked-in fixtures exercise /healthz, /grade, /shipping, /inventory, and /invoice. They intentionally contain duplicate coverage paths:

  • /grade?score=95 and /grade?score=98 execute the same high-score branch.
  • /shipping?country=US&total=150 and /shipping?country=US&total=175 execute the same free-shipping branch.
  • /inventory?sku=BOOK-1&quantity=3 and /inventory?sku=BOOK-2&quantity=4 execute the same priority-reservation branch.
  • /invoice?customer=vip&subtotal=200 and /invoice?customer=vip&subtotal=250 execute the same VIP-large discount branch.

Build

mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package

Native Dedup

keploy test \
  -c "java -javaagent:target/keploy-sdk.jar -javaagent:target/jacocoagent.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 .

Docker Dedup

JAVA_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 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.

Expected Result

All 14 replayed fixtures should pass. Dedup should retain 10 test cases and mark 4 as duplicate, with exactly one duplicate from each intentional pair listed above.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.