Skip to content

Apache Lucene open-source search software

tests: set ramdir for junit4 based tests too

Yonik Seeleyb42b2d924170
diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
index 7b7cba230de..04dc444cfbf 100755
--- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
@@ -154,14 +154,26 @@ public class SolrTestCaseJ4 extends LuceneTestCaseJ4 {
public static Logger log = LoggerFactory.getLogger(SolrTestCaseJ4.class);
+ private static String factoryProp;
+
public static void initCore() throws Exception {
log.info("####initCore");
+ ignoreException("ignore_exception");
+ factoryProp = System.getProperty("solr.directoryFactory");
+ if (factoryProp == null) {
+ System.setProperty("solr.directoryFactory","solr.RAMDirectoryFactory");
+ }
+
dataDir = new File(System.getProperty("java.io.tmpdir")
+ System.getProperty("file.separator")
// + getClass().getName() + "-" + System.currentTimeMillis());
+ System.currentTimeMillis());
dataDir.mkdirs();
+ // other methods like starting a jetty instance need these too
+ System.setProperty("solr.test.sys.prop1", "propone");
+ System.setProperty("solr.test.sys.prop2", "proptwo");
+
String configFile = getSolrConfigFile();
if (configFile != null) {
@@ -211,6 +223,10 @@ public class SolrTestCaseJ4 extends LuceneTestCaseJ4 {
}
}
+ if (factoryProp == null) {
+ System.clearProperty("solr.directoryFactory");
+ }
+
dataDir = null;
solrConfig = null;
h = null;