Skip to content
Snippets Groups Projects
Commit ee417bc0 authored by jakubs's avatar jakubs
Browse files

SSDM-912 Allow to configure temp folder used by sanity check

SVN: 32523
parent bdd3793f
No related branches found
No related tags found
No related merge requests found
...@@ -2,3 +2,7 @@ ...@@ -2,3 +2,7 @@
/temp-testng-customsuite.xml /temp-testng-customsuite.xml
/test-output /test-output
/bin /bin
/build
.classpath
.project
.settings
...@@ -33,13 +33,16 @@ import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchical ...@@ -33,13 +33,16 @@ import ch.systemsx.cisd.openbis.common.io.hierarchical_content.api.IHierarchical
public class TarBasedHierarchicalContent extends AbstractHierarchicalContent public class TarBasedHierarchicalContent extends AbstractHierarchicalContent
{ {
private File packageFile; private final File packageFile;
private File extractTo; private File extractTo;
public TarBasedHierarchicalContent(File packageFile) private final File tempFolder;
public TarBasedHierarchicalContent(File packageFile, File tempFolder)
{ {
this.packageFile = packageFile; this.packageFile = packageFile;
this.tempFolder = tempFolder;
} }
@Override @Override
...@@ -87,6 +90,18 @@ public class TarBasedHierarchicalContent extends AbstractHierarchicalContent ...@@ -87,6 +90,18 @@ public class TarBasedHierarchicalContent extends AbstractHierarchicalContent
} }
} }
private File getTempFolder()
{
if (tempFolder != null)
{
return tempFolder;
} else
{
return new File(System.getProperty("java.io.tmpdir"));
}
}
private void maybeExtract() private void maybeExtract()
{ {
if (extractTo == null) if (extractTo == null)
...@@ -95,7 +110,7 @@ public class TarBasedHierarchicalContent extends AbstractHierarchicalContent ...@@ -95,7 +110,7 @@ public class TarBasedHierarchicalContent extends AbstractHierarchicalContent
try try
{ {
File temp = new File(System.getProperty("java.io.tmpdir")); File temp = getTempFolder();
extractTo = new File(temp, UUID.randomUUID().toString()); extractTo = new File(temp, UUID.randomUUID().toString());
extractTo.mkdirs(); extractTo.mkdirs();
......
...@@ -35,7 +35,7 @@ public class TarBasedHierarchicalContentTest extends AbstractPackageBasedHierarc ...@@ -35,7 +35,7 @@ public class TarBasedHierarchicalContentTest extends AbstractPackageBasedHierarc
{ {
tar = new Tar(packageFile); tar = new Tar(packageFile);
tar.add(dataDir, dataDir.getPath().length()); tar.add(dataDir, dataDir.getPath().length());
return new TarBasedHierarchicalContent(packageFile); return new TarBasedHierarchicalContent(packageFile, null);
} finally } finally
{ {
if (tar != null) if (tar != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment