You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: java-dedup/README.md
+9-36Lines changed: 9 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,10 @@
1
1
# Java Dynamic Deduplication Sample
2
2
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.
4
4
5
5
CI does not record this sample. The `keploy/` directory is checked in so the pipeline only builds the app and runs replay with `--dedup`.
6
6
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`.
18
8
19
9
## Build
20
10
@@ -24,39 +14,23 @@ mvn -B -DskipTests package
24
14
25
15
This produces `target/java-dedup-0.0.1-SNAPSHOT.jar` and copies `target/jacocoagent.jar` next to it.
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
49
26
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):
53
28
54
29
```bash
55
-
mvn -B -DskipTests package
56
30
docker compose build
57
31
```
58
32
59
-
Run with Keploy in dedup mode:
33
+
Replay with dedup:
60
34
61
35
```bash
62
36
keploy test \
@@ -65,16 +39,15 @@ keploy test \
65
39
--dedup --language java --delay 20
66
40
```
67
41
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`.
71
43
72
44
### Restricted Docker
73
45
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:
0 commit comments