Skip to content

Commit 3e1191e

Browse files
committed
test: output work dir for DcmToolTests
1 parent 640ef12 commit 3e1191e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

tool/src/test/java/com/alibaba/dcm/tool/DcmToolTests.kt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class DcmToolTests : AnnotationSpec() {
2727

2828
@BeforeAll
2929
fun prepareAgentFilePath() {
30+
println("work dir: ${File("").absolutePath}")
31+
3032
agentFilePath = findAgentFileFromLibProject() ?: findAgentFileFromMavenLocal()
3133
?: fail("Not found agent file")
3234

@@ -61,30 +63,30 @@ class DcmToolTests : AnnotationSpec() {
6163

6264
private fun findAgentFileFromLibProject(): String? {
6365
val dcmLibProjectDir: File = listOf("library", "../library", "../../library")
64-
.asSequence()
65-
.map { File(it) }
66-
.filter { it.exists() }
67-
.firstOrNull()
68-
?: return null
66+
.asSequence()
67+
.map { File(it) }
68+
.filter { it.exists() }
69+
.firstOrNull()
70+
?: return null
6971

7072
val targetDir = File(dcmLibProjectDir, "target")
7173
if (!targetDir.exists()) return null
7274
println("Found target dir: ${targetDir.canonicalPath}")
7375

7476
return targetDir.walk()
75-
.filter { it.extension == "jar" && isAgentJar(it) }
76-
.map { it.canonicalPath }
77-
.firstOrNull()
77+
.filter { it.extension == "jar" && isAgentJar(it) }
78+
.map { it.canonicalPath }
79+
.firstOrNull()
7880
}
7981

8082
private fun findAgentFileFromMavenLocal(): String? {
8183
val home: String = System.getProperty("user.home")
8284
val m2DcmLibDependencyDir = File("$home/.m2/repository/com/alibaba/dns-cache-manipulator")
8385

8486
return m2DcmLibDependencyDir.walk()
85-
.filter { it.extension == "jar" && isAgentJar(it) }
86-
.map { it.canonicalPath }
87-
.maxWithOrNull(Comparator.comparing { ComparableVersion(it) })
87+
.filter { it.extension == "jar" && isAgentJar(it) }
88+
.map { it.canonicalPath }
89+
.maxWithOrNull(Comparator.comparing { ComparableVersion(it) })
8890
}
8991

9092
private fun isAgentJar(file: File): Boolean {

0 commit comments

Comments
 (0)