Skip to content

Commit e313cc4

Browse files
docs(java-dedup): focus README on dedup-mode replay
- Trim the README to only cover running the sample in dedup mode for native, Docker, and restricted Docker. - Drop generic build/recording sections; the sample is replay-only and CI does not record. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent 48a8a61 commit e313cc4

1 file changed

Lines changed: 9 additions & 36 deletions

File tree

java-dedup/README.md

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
# Java Dynamic Deduplication Sample
22

3-
A Spring Boot application used by Keploy CI to validate Java dynamic deduplication in native and Docker runs. It mirrors the Go dedup sample by exposing a broad set of endpoints and committing 1000 replay fixtures across four testsets.
3+
A Spring Boot application used by Keploy CI to validate Java dynamic deduplication. It mirrors the Go dedup sample by exposing a broad set of endpoints and committing 1000 replay fixtures across four testsets.
44

55
CI does not record this sample. The `keploy/` directory is checked in so the pipeline only builds the app and runs replay with `--dedup`.
66

7-
## How dedup works for Java
8-
9-
Keploy's dynamic dedup engine asks the application for per-test code coverage between every replayed test, then skips future tests whose coverage signature it has already seen. The Java SDK (`io.keploy.dedup.KeployDedupAgent`, bundled in the app via the `keploy-sdk` dependency) handles that coverage exchange.
10-
11-
The SDK reads coverage **in-process** through JaCoCo's runtime API (`org.jacoco.agent.rt.RT.getAgent().getExecutionData(...)`). All you have to do is attach the JaCoCo Java agent — no TCP server, no port choice, no `--pass-through-ports`:
12-
13-
```
14-
-javaagent:target/jacocoagent.jar
15-
```
16-
17-
The SDK still falls back to JaCoCo's TCP server mode if the in-process API is unavailable for some reason, which is why the `KEPLOY_JACOCO_HOST` and `KEPLOY_JACOCO_PORT` environment variables are still honoured.
7+
The Java SDK reads JaCoCo coverage in-process via `org.jacoco.agent.rt.RT.getAgent().getExecutionData(...)`, so attaching the JaCoCo Java agent is enough — no TCP server, no port choice, no `--pass-through-ports`.
188

199
## Build
2010

@@ -24,39 +14,23 @@ mvn -B -DskipTests package
2414

2515
This produces `target/java-dedup-0.0.1-SNAPSHOT.jar` and copies `target/jacocoagent.jar` next to it.
2616

27-
## Native run
28-
29-
Start the app with the JaCoCo agent attached:
30-
31-
```bash
32-
java -javaagent:target/jacocoagent.jar \
33-
-jar target/java-dedup-0.0.1-SNAPSHOT.jar
34-
```
35-
36-
Replay with dynamic dedup:
17+
## Run dedup natively
3718

3819
```bash
3920
keploy test \
4021
-c "java -javaagent:target/jacocoagent.jar -jar target/java-dedup-0.0.1-SNAPSHOT.jar" \
4122
--dedup --language java --delay 20
4223
```
4324

44-
To regenerate the committed fixtures locally, record high-volume traffic against the running app:
45-
46-
```bash
47-
./run_random_1000.sh
48-
```
25+
## Run dedup with Docker
4926

50-
## Docker run
51-
52-
Build the JAR first, then build the image. The Dockerfile already wires the JaCoCo agent into the entrypoint:
27+
Build the image (the Dockerfile already attaches the JaCoCo agent):
5328

5429
```bash
55-
mvn -B -DskipTests package
5630
docker compose build
5731
```
5832

59-
Run with Keploy in dedup mode:
33+
Replay with dedup:
6034

6135
```bash
6236
keploy test \
@@ -65,16 +39,15 @@ keploy test \
6539
--dedup --language java --delay 20
6640
```
6741

68-
The Compose file supports `JAVA_DEDUP_IMAGE`, `JAVA_DEDUP_CONTAINER_NAME`, and `JAVA_DEDUP_HOST_PORT` so CI can isolate repeated replay runs without recording new tests.
69-
70-
The Compose app bind-mounts host `/tmp` into the container so Keploy and the Java SDK use the same Unix socket paths for `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`.
42+
The Compose file bind-mounts host `/tmp` into the container so Keploy and the Java SDK share `/tmp/coverage_control.sock` and `/tmp/coverage_data.sock`.
7143

7244
### Restricted Docker
7345

74-
For a more restricted container — read-only root filesystem, dropped capabilities, and `no-new-privileges` overlay the restricted compose file:
46+
For a read-only root filesystem with dropped capabilities and `no-new-privileges`, overlay the restricted compose file:
7547

7648
```bash
7749
docker compose -f docker-compose.yml -f docker-compose.restricted.yml build
50+
7851
keploy test \
7952
-c "docker compose -f docker-compose.yml -f docker-compose.restricted.yml up" \
8053
--container-name "dedup-java" \

0 commit comments

Comments
 (0)