You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2014/04/05 11:24:19 UTC
svn commit: r1585029 - in /lucene/dev/trunk/lucene:
core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java
test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Author: dweiss
Date: Sat Apr 5 09:24:18 2014
New Revision: 1585029
URL: http://svn.apache.org/r1585029
Log:
LUCENE-5577: Added javadocs and minor renames.
Modified:
lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java?rev=1585029&r1=1585028&r2=1585029&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestLeaveFilesIfTestFails.java Sat Apr 5 09:24:18 2014
@@ -62,7 +62,7 @@ public class TestLeaveFilesIfTestFails e
file = new File(createTempDir("leftover"), "child.locked");
openFile = new RandomAccessFile(file, "rw");
- parent = LuceneTestCase.getTempDirBase();
+ parent = LuceneTestCase.getBaseTempDirForTestClass();
}
}
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1585029&r1=1585028&r2=1585029&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Sat Apr 5 09:24:18 2014
@@ -2209,7 +2209,7 @@ public abstract class LuceneTestCase ext
* or {@link #createTempDir(String)} or {@link #createTempFile(String, String)}.
*/
@Deprecated
- public static File getTempDirBase() {
+ public static File getBaseTempDirForTestClass() {
synchronized (LuceneTestCase.class) {
if (tempDirBase == null) {
File directory = new File(System.getProperty("tempDir", System.getProperty("java.io.tmpdir")));
@@ -2244,15 +2244,24 @@ public abstract class LuceneTestCase ext
/**
+ * Creates an empty, temporary folder (when the name of the folder is of no importance).
+ *
+ * @see #createTempDir(String)
*/
public static File createTempDir() {
return createTempDir("tempDir");
}
/**
+ * Creates an empty, temporary folder with the given name prefix under the
+ * test class's {@link #getBaseTempDirForTestClass()}.
+ *
+ * <p>The folder will be automatically removed after the
+ * test class completes successfully. The test should close any file handles that would prevent
+ * the folder from being removed.
*/
public static File createTempDir(String prefix) {
- File base = getTempDirBase();
+ File base = getBaseTempDirForTestClass();
int attempt = 0;
File f;
@@ -2270,9 +2279,15 @@ public abstract class LuceneTestCase ext
}
/**
+ * Creates an empty file with the given prefix and suffix under the
+ * test class's {@link #getBaseTempDirForTestClass()}.
+ *
+ * <p>The file will be automatically removed after the
+ * test class completes successfully. The test should close any file handles that would prevent
+ * the folder from being removed.
*/
public static File createTempFile(String prefix, String suffix) throws IOException {
- File base = getTempDirBase();
+ File base = getBaseTempDirForTestClass();
int attempt = 0;
File f;
@@ -2290,6 +2305,9 @@ public abstract class LuceneTestCase ext
}
/**
+ * Creates an empty temporary file.
+ *
+ * @see #createTempFile(String, String)
*/
public static File createTempFile() throws IOException {
return createTempFile("tempFile", ".tmp");