Skip to content

Commit

Permalink
Find correct file root when testing against embedded distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-tchad committed Jan 16, 2024
1 parent 5f74a29 commit 276e2ea
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/org/labkey/test/TestFileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public abstract class TestFileUtils
private static File _labkeyRoot = null;
private static File _buildDir = null;
private static File _testRoot = null;
private static File _baseFileRoot = null;
private static Set<File> _sampledataDirs = null;

public static String getFileContents(String rootRelativePath)
Expand Down Expand Up @@ -186,6 +187,20 @@ public static File getTestBuildDir()
return _buildDir;
}

private static File getBaseFileRoot()
{
if (_baseFileRoot == null)
{
_baseFileRoot = new File(getDefaultDeployDir(), "files");
if (TestProperties.isEmbeddedTomcat() && !_baseFileRoot.isDirectory())
{
// File root when deploying from embedded distribution
_baseFileRoot = new File(getDefaultDeployDir(), "server/files");
}
}
return _baseFileRoot;
}

public static File getGradleReportDir()
{
return new File(getTestBuildDir(), "test/logs/reports");
Expand All @@ -198,12 +213,12 @@ public static File getDefaultDeployDir()

public static File getDefaultFileRoot(String containerPath)
{
return new File(getLabKeyRoot(), "build/deploy/files/" + containerPath + "/@files");
return new File(getBaseFileRoot(), containerPath + "/@files");
}

public static String getDefaultWebAppRoot()
{
File path = new File(getLabKeyRoot(), "build/deploy/labkeyWebapp");
File path = new File(getDefaultDeployDir(), "labkeyWebapp");
return path.toString();
}

Expand Down

0 comments on commit 276e2ea

Please sign in to comment.