mirror of https://github.com/apache/lucene.git
Use preferably sysprop "temptDir" also in backwards tests.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@927996 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ab93f2fcc
commit
6e4c79b219
|
@ -384,9 +384,9 @@ public class TestFieldsReader extends LuceneTestCase {
|
||||||
|
|
||||||
// LUCENE-1262
|
// LUCENE-1262
|
||||||
public void testExceptions() throws Throwable {
|
public void testExceptions() throws Throwable {
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
if (tempDir == null)
|
if (tempDir == null)
|
||||||
throw new IOException("java.io.tmpdir undefined, cannot run test");
|
throw new IOException("System property tempDir undefined, cannot run test");
|
||||||
File indexDir = new File(tempDir, "testfieldswriterexceptions");
|
File indexDir = new File(tempDir, "testfieldswriterexceptions");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -81,10 +81,9 @@ public class TestIndexReaderCloneNorms extends LuceneTestCase {
|
||||||
*/
|
*/
|
||||||
public void testNorms() throws IOException {
|
public void testNorms() throws IOException {
|
||||||
// tmp dir
|
// tmp dir
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
if (tempDir == null) {
|
if (tempDir == null)
|
||||||
throw new IOException("java.io.tmpdir undefined, cannot run test");
|
throw new IOException("System property tempDir undefined, cannot run test");
|
||||||
}
|
|
||||||
|
|
||||||
// test with a single index: index1
|
// test with a single index: index1
|
||||||
File indexDir1 = new File(tempDir, "lucenetestindex1");
|
File indexDir1 = new File(tempDir, "lucenetestindex1");
|
||||||
|
|
|
@ -1095,9 +1095,9 @@ public class TestIndexReaderReopen extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
if (tempDir == null)
|
if (tempDir == null)
|
||||||
throw new IOException("java.io.tmpdir undefined, cannot run test");
|
throw new IOException("System property tempDir undefined, cannot run test");
|
||||||
indexDir = new File(tempDir, "IndexReaderReopen");
|
indexDir = new File(tempDir, "IndexReaderReopen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,10 @@ public class TestIndexWriterLockRelease extends LuceneTestCase {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (this.__test_dir == null) {
|
if (this.__test_dir == null) {
|
||||||
String tmp_dir = System.getProperty("java.io.tmpdir", "tmp");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
this.__test_dir = new File(tmp_dir, "testIndexWriter");
|
if (tempDir == null)
|
||||||
|
throw new IOException("System property tempDir undefined, cannot run test");
|
||||||
|
this.__test_dir = new File(tempDir, "testIndexWriter");
|
||||||
|
|
||||||
if (this.__test_dir.exists()) {
|
if (this.__test_dir.exists()) {
|
||||||
throw new IOException("test directory \"" + this.__test_dir.getPath() + "\" already exists (please remove by hand)");
|
throw new IOException("test directory \"" + this.__test_dir.getPath() + "\" already exists (please remove by hand)");
|
||||||
|
|
|
@ -49,9 +49,9 @@ public class TestRAMDirectory extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
public void setUp () throws Exception {
|
public void setUp () throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
if (tempDir == null)
|
if (tempDir == null)
|
||||||
throw new IOException("java.io.tmpdir undefined, cannot run test");
|
throw new IOException("System property tempDir undefined, cannot run test");
|
||||||
indexDir = new File(tempDir, "RAMDirIndex");
|
indexDir = new File(tempDir, "RAMDirIndex");
|
||||||
|
|
||||||
Directory dir = FSDirectory.open(indexDir);
|
Directory dir = FSDirectory.open(indexDir);
|
||||||
|
|
|
@ -33,9 +33,9 @@ public class _TestUtil {
|
||||||
/** Returns temp dir, containing String arg in its name;
|
/** Returns temp dir, containing String arg in its name;
|
||||||
* does not create the directory. */
|
* does not create the directory. */
|
||||||
public static File getTempDir(String desc) {
|
public static File getTempDir(String desc) {
|
||||||
String tempDir = System.getProperty("java.io.tmpdir");
|
String tempDir = System.getProperty("tempDir", System.getProperty("java.io.tmpdir"));
|
||||||
if (tempDir == null)
|
if (tempDir == null)
|
||||||
throw new RuntimeException("java.io.tmpdir undefined, cannot run test");
|
throw new RuntimeException("System property tempDir undefined, cannot run test");
|
||||||
return new File(tempDir, desc + "." + new Random().nextLong());
|
return new File(tempDir, desc + "." + new Random().nextLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue