From 2d5ade9be8e5baa1d8562172e1e5ebab7575d052 Mon Sep 17 00:00:00 2001 From: slayerjain Date: Fri, 4 Dec 2026 21:16:50 +0530 Subject: [PATCH] docs(java-dedup): use keploy-sdk 2.4.0 and attach only keploy-sdk.jar The READMEs pinned 2.0.6 and attached a separate JaCoCo agent. keploy-sdk.jar carries its own. simple-java-dedup shows the four duplicates only with --keep 1. Signed-off-by: slayerjain --- dropwizard-dedup/README.md | 7 +++---- java-dedup/README.md | 12 ++++++------ simple-java-dedup/README.md | 12 +++++++----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dropwizard-dedup/README.md b/dropwizard-dedup/README.md index fb2b3faa..88c18d55 100644 --- a/dropwizard-dedup/README.md +++ b/dropwizard-dedup/README.md @@ -10,17 +10,16 @@ Build without Keploy on the compile classpath: mvn -B -DskipTests clean package ``` -Build with the runtime Java agent copied into `target/keploy-sdk.jar`: +Build with the runtime Java agent (`io.keploy:keploy-sdk >= 2.3.0`, current release `2.4.0`) copied into `target/keploy-sdk.jar`: ```bash -mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package +mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package ``` -Run with the agent: +Run with only `keploy-sdk.jar` attached (`keploy-sdk.jar` bundles the JaCoCo runtime agent automatically; do not attach a separate `jacocoagent.jar`): ```bash java \ -javaagent:target/keploy-sdk.jar \ - -javaagent:target/jacocoagent.jar=destfile=/tmp/jacoco.exec \ -jar target/dropwizard-dedup.jar server config.yml ``` diff --git a/java-dedup/README.md b/java-dedup/README.md index d3799491..c1841040 100644 --- a/java-dedup/README.md +++ b/java-dedup/README.md @@ -4,23 +4,23 @@ A Spring Boot application used by Keploy CI to validate Java dynamic deduplicati CI does not record this sample. The `keploy/` directory is checked in so the pipeline only builds the app and runs replay with `--dedup --skip-app-restart`. When the sample behavior changes, record the fixtures locally and push the updated `keploy/` files. -The Keploy Java SDK is attached as a Java agent at replay time. The sample does not compile against `io.keploy:keploy-sdk` and does not import Keploy classes in application code. +The Keploy Java SDK (`io.keploy:keploy-sdk >= 2.3.0`, current release `2.4.0`) is attached as a Java agent at replay time. The sample does not compile against `io.keploy:keploy-sdk` and does not import Keploy classes in application code. -The SDK reads JaCoCo coverage in-process via `org.jacoco.agent.rt.RT.getAgent().getExecutionData(...)`, so attach both agents when running dynamic deduplication: the Keploy agent for the control/data socket protocol, and the JaCoCo agent for runtime coverage. +`keploy-sdk.jar` bundles the JaCoCo runtime agent and starts it automatically scoped to your application classes. Attach **only** `-javaagent:target/keploy-sdk.jar`; do **not** attach a separate `-javaagent:target/jacocoagent.jar` alongside it. ## Setup ```bash -mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package +mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package ``` -This builds the runnable application jar, copies `target/keploy-sdk.jar`, and copies `target/jacocoagent.jar` next to it. +This builds the runnable application jar and copies `target/keploy-sdk.jar` next to it. ## Run dedup natively ```bash keploy test \ - -c "java -javaagent:target/keploy-sdk.jar -javaagent:target/jacocoagent.jar -jar target/java-dedup.jar" \ + -c "java -javaagent:target/keploy-sdk.jar -jar target/java-dedup.jar" \ --dedup --skip-app-restart --language java --delay 1 \ --health-url "http://127.0.0.1:8080/healthz" \ --health-poll-timeout 30s \ @@ -46,7 +46,7 @@ keploy dedup --path . ``` During `keploy test`, Enterprise rewrites the Compose file and injects its own shared `/tmp` volume for the dedup control/data sockets. The base sample Compose file does not need a host `/tmp` bind mount. -Re-run `docker compose build` whenever the jar, JaCoCo agent, or Dockerfile changes so replay uses the current image. +Re-run `docker compose build` whenever the jar, `keploy-sdk.jar`, or Dockerfile changes so replay uses the current image. ## Run dedup with direct Docker diff --git a/simple-java-dedup/README.md b/simple-java-dedup/README.md index 3a27c8af..3cf8e519 100644 --- a/simple-java-dedup/README.md +++ b/simple-java-dedup/README.md @@ -21,21 +21,23 @@ The checked-in fixtures exercise `/healthz`, `/grade`, `/shipping`, `/inventory` ## Build +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`. + ```bash -mvn -B -DskipTests -Dkeploy.agent.version=2.0.6 clean package +mvn -B -DskipTests -Dkeploy.agent.version=2.4.0 clean package ``` ## Native Dedup ```bash keploy test \ - -c "java -javaagent:target/keploy-sdk.jar -javaagent:target/jacocoagent.jar -jar target/simple-java-dedup.jar" \ + -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 . +keploy dedup --path . --keep 1 ``` ## Docker Dedup @@ -50,11 +52,11 @@ keploy test \ --health-poll-timeout 30s \ --disableMockUpload --disableReportUpload -keploy dedup --path . +keploy dedup --path . --keep 1 ``` 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. +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.