From fbeac77ece24f3db0bffea77c56ecbeb831868c0 Mon Sep 17 00:00:00 2001 From: Thomas Mortagne Date: Wed, 17 Jul 2024 18:02:55 +0200 Subject: [PATCH] [Misc] Improve environment handling during tests --- .../org/xwiki/extension/test/RepositoryUtils.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/test/java/org/xwiki/extension/test/RepositoryUtils.java b/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/test/java/org/xwiki/extension/test/RepositoryUtils.java index c9d6241654..f5e854c8a1 100644 --- a/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/test/java/org/xwiki/extension/test/RepositoryUtils.java +++ b/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/test/java/org/xwiki/extension/test/RepositoryUtils.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.net.URL; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; @@ -68,15 +67,14 @@ public class RepositoryUtils */ protected void initializeDirectories(Environment environment) { - File testDirectory = new File("target/test-" + new Date().getTime()).getAbsoluteFile(); - this.extensionDirectory = new File(environment.getPermanentDirectory(), "extension/"); this.localRepositoryRoot = new File(this.extensionDirectory, "repository/"); - this.mavenRepositoryRoot = new File(testDirectory, "maven/"); - this.maven2RepositoryRoot = new File(testDirectory, "maven2/"); - this.mavenUnknownRepositoryRoot = new File(testDirectory, "mavenunknown/"); - this.remoteRepositoryRoot = new File(testDirectory, "remote/"); + File repositoriesRootFile = new File(environment.getPermanentDirectory(), "repositories/"); + this.mavenRepositoryRoot = new File(repositoriesRootFile, "maven/"); + this.maven2RepositoryRoot = new File(repositoriesRootFile, "maven2/"); + this.mavenUnknownRepositoryRoot = new File(repositoriesRootFile, "mavenunknown/"); + this.remoteRepositoryRoot = new File(repositoriesRootFile, "remote/"); Map repositories = new HashMap<>(); repositories.put(null, new DefaultRepositorySerializer(getRemoteRepository()));