Skip to content

Commit 1f80e95

Browse files
committed
TS-38628 Broken mockito
1 parent 5579895 commit 1f80e95

File tree

4 files changed

+67
-69
lines changed

4 files changed

+67
-69
lines changed

impacted-test-engine/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ dependencies {
2121
compileOnly(libs.junit.platform.commons)
2222
testImplementation(libs.junit.platform.engine)
2323
testImplementation(libs.junit.jupiter.params)
24+
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
2425
}

impacted-test-engine/src/main/java/com/teamscale/test_impacted/engine/executor/TeamscaleAgentNotifier.java

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.teamscale.test_impacted.engine.executor
2+
3+
import com.teamscale.report.testwise.model.TestExecution
4+
import com.teamscale.test_impacted.commons.LoggerUtils.createLogger
5+
import com.teamscale.tia.client.ITestwiseCoverageAgentApi
6+
import com.teamscale.tia.client.UrlUtils.encodeUrl
7+
import java.io.IOException
8+
import java.util.logging.Level
9+
10+
/** Communicates test start and end to the agent and the end of the overall test execution. */
11+
open class TeamscaleAgentNotifier(
12+
/** A list of API services to signal test start and end to the agent. */
13+
private val testwiseCoverageAgentApis: List<ITestwiseCoverageAgentApi>,
14+
/**
15+
* Whether only a part of the tests is being executed (`true`) or whether all tests are executed
16+
* (`false`).
17+
*/
18+
private val partial: Boolean
19+
) {
20+
private val logger = createLogger()
21+
22+
/** Reports the start of a test to the Teamscale JaCoCo agent. */
23+
open fun startTest(testUniformPath: String) {
24+
try {
25+
testwiseCoverageAgentApis.forEach { apiService ->
26+
apiService.testStarted(testUniformPath.encodeUrl()).execute()
27+
}
28+
} catch (e: IOException) {
29+
logger.log(
30+
Level.SEVERE, e
31+
) { "Error while calling service api." }
32+
}
33+
}
34+
35+
/** Reports the end of a test to the Teamscale JaCoCo agent. */
36+
open fun endTest(testUniformPath: String, testExecution: TestExecution?) {
37+
try {
38+
testwiseCoverageAgentApis.forEach { apiService ->
39+
val url = testUniformPath.encodeUrl()
40+
if (testExecution == null) {
41+
apiService.testFinished(url).execute()
42+
} else {
43+
apiService.testFinished(url, testExecution).execute()
44+
}
45+
}
46+
} catch (e: IOException) {
47+
logger.log(
48+
Level.SEVERE, e
49+
) { "Error contacting test wise coverage agent." }
50+
}
51+
}
52+
53+
/** Reports the end of the test run to the Teamscale JaCoCo agent. */
54+
open fun testRunEnded() {
55+
try {
56+
testwiseCoverageAgentApis.forEach { apiService ->
57+
apiService.testRunFinished(partial).execute()
58+
}
59+
} catch (e: IOException) {
60+
logger.log(
61+
Level.SEVERE, e
62+
) { "Error contacting test wise coverage agent." }
63+
}
64+
}
65+
}

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ include(":sample-debugging-app")
2121
include(":teamscale-maven-plugin")
2222
include(":installer")
2323

24-
file("system-tests").listFiles { file: File -> !file.isHidden && file.isDirectory }?.forEach { folder ->
24+
file("system-tests").listFiles { file -> !file.isHidden && file.isDirectory }?.forEach { folder ->
2525
include(":system-tests:${folder.name}")
2626
}

0 commit comments

Comments
 (0)