-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0eec59
commit 8519757
Showing
45 changed files
with
804 additions
and
737 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...visibility/src/main/java/datadog/trace/civisibility/coverage/ConcurrentCoverageStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package datadog.trace.civisibility.coverage; | ||
|
||
import datadog.trace.api.civisibility.coverage.CoverageProbes; | ||
import datadog.trace.api.civisibility.coverage.CoverageStore; | ||
import datadog.trace.api.civisibility.coverage.TestReport; | ||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.function.Supplier; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** A store that keeps track of coverage probes allocated for multiple threads. */ | ||
public abstract class ConcurrentCoverageStore<T extends CoverageProbes> implements CoverageStore { | ||
|
||
private final Supplier<T> probesFactory; | ||
private final Map<Thread, T> probes; | ||
|
||
private volatile TestReport report; | ||
|
||
protected ConcurrentCoverageStore(Supplier<T> probesFactory) { | ||
this.probesFactory = probesFactory; | ||
this.probes = new ConcurrentHashMap<>(); | ||
} | ||
|
||
@Override | ||
public CoverageProbes getProbes() { | ||
return probes.computeIfAbsent(Thread.currentThread(), this::create); | ||
} | ||
|
||
private T create(Thread thread) { | ||
return probesFactory.get(); | ||
} | ||
|
||
@Override | ||
public boolean report(Long testSessionId, Long testSuiteId, long testSpanId) { | ||
report = report(testSessionId, testSuiteId, testSpanId, probes.values()); | ||
return report != null && report.isNotEmpty(); | ||
} | ||
|
||
@Nullable | ||
protected abstract TestReport report( | ||
Long testSessionId, Long testSuiteId, long testSpanId, Collection<T> probes); | ||
|
||
@Nullable | ||
@Override | ||
public TestReport getReport() { | ||
return report; | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
...sibility/src/main/java/datadog/trace/civisibility/coverage/CoverageProbeStoreFactory.java
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
...ci-visibility/src/main/java/datadog/trace/civisibility/coverage/ExecutionDataAdapter.java
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
...-visibility/src/main/java/datadog/trace/civisibility/coverage/NoopCoverageProbeStore.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.