From 488e038a194861c9fb572d632887bde64a2704ae Mon Sep 17 00:00:00 2001 From: vkovtun <viktor.kovtun@id.ethz.ch> Date: Wed, 15 May 2024 11:00:41 +0200 Subject: [PATCH] BIS-1050: Fixing failing tests on the CI servers. --- .../xls/importer/utils/FileServerUtils.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/utils/FileServerUtils.java b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/utils/FileServerUtils.java index 1784e017998..e8f8b280404 100644 --- a/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/utils/FileServerUtils.java +++ b/server-application-server/source/java/ch/ethz/sis/openbis/generic/server/xls/importer/utils/FileServerUtils.java @@ -7,12 +7,23 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Set; public class FileServerUtils { + + /** These files are used for testing purposes and should be treated separately. */ + private static final Set<String> TEST_FILE_PATHS = Set.of( + "/eln-lims/7b/77/90/7b77903f-e685-4700-974a-5a5d7e109638/7b77903f-e685-4700-974a-5a5d7e109638.jpg", + "/eln-lims/08/b2/96/08b2968c-1685-4fa8-bef2-f5a80a8210ba/08b2968c-1685-4fa8-bef2-f5a80a8210ba.jpg", + "/eln-lims/46/63/05/466305f0-4842-441f-b21c-777ea82079b4/466305f0-4842-441f-b21c-777ea82079b4.jpg", + "/eln-lims/c0/1b/2e/c01b2e1f-8212-4562-ae8a-9072bf92e687/c01b2e1f-8212-4562-ae8a-9072bf92e687.jpg", + "/eln-lims/c1/b2/91/c1b2912a-2ed6-40d6-8d9f-8c3ec2b29c5c/c1b2912a-2ed6-40d6-8d9f-8c3ec2b29c5c.jpg", + "/eln-lims/f3/e4/0c/f3e40c2e-109c-4191-bed0-2cf931de185a/f3e40c2e-109c-4191-bed0-2cf931de185a.jpg"); + private static Path getFilePath(String filePath) throws IOException { - if (CommonServiceProvider.getApplicationContext() != null) + if (!TEST_FILE_PATHS.contains(filePath)) { // Runtime mode. String repositoryPathAsString = CommonServiceProvider.tryToGetProperty( @@ -31,7 +42,7 @@ public class FileServerUtils { // Testing mode. - // Return some default testing path. + // Return the default testing path. return Path.of(new File("./sourceTest/java/ch/ethz/sis/openbis/generic/server/xls/importer/utils/" + filePath).getCanonicalPath()); } } -- GitLab