diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2022-03-08 15:57:29 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-03-08 20:02:48 +0000 |
commit | 210a77151031f2820b4831dd87564fd374893c74 (patch) | |
tree | a36374cbb75834f0e5125308d38d2db5334f80b5 /sonar-scanner-engine/src | |
parent | a99506711dca5c5ba5ae64d76eb4341eb3f83265 (diff) | |
download | sonarqube-210a77151031f2820b4831dd87564fd374893c74.tar.gz sonarqube-210a77151031f2820b4831dd87564fd374893c74.zip |
NO-JIRA fixed some unit tests not passing on Windows when username is long
Diffstat (limited to 'sonar-scanner-engine/src')
2 files changed, 6 insertions, 4 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java index ea9fdd13113..c852d1735c4 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java @@ -24,6 +24,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.LinkOption; import java.nio.file.Path; import java.util.Random; import org.apache.commons.io.FileUtils; @@ -907,7 +908,7 @@ public class FileSystemMediumTest { " Excluded sources for coverage: **/coverage.exclusions", " Excluded sources for duplication: **/cpd.exclusions", "Indexing files of module 'moduleA'", - " Base dir: " + baseDirModuleA.getAbsolutePath(), + " Base dir: " + baseDirModuleA.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS), " Source paths: src", " Included sources: **/global.inclusions", " Excluded sources: **/global.exclusions, **/global.test.inclusions", @@ -916,7 +917,7 @@ public class FileSystemMediumTest { " Excluded sources for coverage: **/coverage.exclusions", " Excluded sources for duplication: **/cpd.exclusions", "Indexing files of module 'moduleB'", - " Base dir: " + baseDirModuleB.getAbsolutePath(), + " Base dir: " + baseDirModuleB.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS), " Source paths: src", " Included sources: **/global.inclusions", " Excluded sources: **/global.exclusions, **/global.test.inclusions", @@ -925,7 +926,7 @@ public class FileSystemMediumTest { " Excluded sources for coverage: **/coverage.exclusions", " Excluded sources for duplication: **/cpd.exclusions", "Indexing files of module 'com.foo.project'", - " Base dir: " + baseDir.getAbsolutePath(), + " Base dir: " + baseDir.toPath().toRealPath(LinkOption.NOFOLLOW_LINKS), " Included sources: **/global.inclusions", " Excluded sources: **/global.exclusions, **/global.test.inclusions", " Included tests: **/global.test.inclusions", diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java index 2f598485d2c..bdcfc67a464 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java @@ -21,6 +21,7 @@ package org.sonar.scanner.scan.filesystem; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.Paths; import org.apache.commons.io.FileUtils; @@ -127,7 +128,7 @@ public class MetadataGeneratorTest { @Test public void complete_input_file() throws Exception { // file system - Path baseDir = temp.newFolder().toPath(); + Path baseDir = temp.newFolder().toPath().toRealPath(LinkOption.NOFOLLOW_LINKS); Path srcFile = baseDir.resolve("src/main/java/foo/Bar.java"); FileUtils.touch(srcFile.toFile()); FileUtils.write(srcFile.toFile(), "single line"); |