From 707617ee029e289551051c46b9180ed7cca38744 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 23 Aug 2010 19:15:42 +0000 Subject: [PATCH] LUCENE-2598: use the specified -Dtests.directory when tests copy from an existing one too git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@988259 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/src/test/org/apache/lucene/util/LuceneTestCase.java | 6 +++++- .../src/test/org/apache/lucene/util/LuceneTestCaseJ4.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java index ec6f2c8c8e5..6a23ced275a 100644 --- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java +++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java @@ -343,7 +343,11 @@ public abstract class LuceneTestCase extends TestCase { public MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); - MockDirectoryWrapper dir = new MockDirectoryWrapper(new RAMDirectory(d)); + Directory impl = LuceneTestCaseJ4.newDirectoryImpl(TEST_DIRECTORY); + for (String file : d.listAll()) { + d.copy(impl, file, file); + } + MockDirectoryWrapper dir = new MockDirectoryWrapper(impl); stores.put(dir, stack); return dir; } diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java index 4d797c4a903..3cdfe335e94 100644 --- a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java +++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java @@ -596,7 +596,11 @@ public class LuceneTestCaseJ4 { public static MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); - MockDirectoryWrapper dir = new MockDirectoryWrapper(new RAMDirectory(d)); + Directory impl = newDirectoryImpl(TEST_DIRECTORY); + for (String file : d.listAll()) { + d.copy(impl, file, file); + } + MockDirectoryWrapper dir = new MockDirectoryWrapper(impl); stores.put(dir, stack); return dir; }