cache test: get tmpdir from a system property
This commit is contained in:
3
cache/pom.xml
vendored
3
cache/pom.xml
vendored
@@ -124,6 +124,9 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<enableAssertions>true</enableAssertions>
|
<enableAssertions>true</enableAssertions>
|
||||||
<argLine>-Xmx2048m</argLine>
|
<argLine>-Xmx2048m</argLine>
|
||||||
|
<systemProperties>
|
||||||
|
<cache.tmpdir>${cache.tmpdir}</cache.tmpdir>
|
||||||
|
</systemProperties>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.cache;
|
package net.runelite.cache;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Properties;
|
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -38,18 +38,17 @@ public class StoreLocation
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(StoreLocation.class);
|
private static final Logger logger = LoggerFactory.getLogger(StoreLocation.class);
|
||||||
|
|
||||||
private static final int NUM_INDEXES = 16;
|
private static final int NUM_INDEXES = 16;
|
||||||
private static final String TMP_DIR = "d:/temp";
|
|
||||||
|
|
||||||
public static File LOCATION;
|
public static File LOCATION;
|
||||||
private static File TMP;
|
private static File TMP;
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
File tmp = new File(TMP_DIR);
|
String cacheTmpDir = System.getProperty("cache.tmpdir");
|
||||||
if (tmp.exists() || tmp.mkdir())
|
if (!Strings.isNullOrEmpty(cacheTmpDir))
|
||||||
{
|
{
|
||||||
System.setProperty("java.io.tmpdir", TMP_DIR);
|
System.setProperty("java.io.tmpdir", cacheTmpDir);
|
||||||
TMP = tmp;
|
TMP = new File(cacheTmpDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -99,7 +98,7 @@ public class StoreLocation
|
|||||||
@Override
|
@Override
|
||||||
public void after()
|
public void after()
|
||||||
{
|
{
|
||||||
// don't cleanup if using local tmpdir
|
// don't cleanup if using cache tmpdir
|
||||||
if (TMP == null)
|
if (TMP == null)
|
||||||
{
|
{
|
||||||
super.after();
|
super.after();
|
||||||
|
|||||||
Reference in New Issue
Block a user