diff --git a/solr/build.xml b/solr/build.xml
index e6b7f2bc5af..b1cd11d31be 100644
--- a/solr/build.xml
+++ b/solr/build.xml
@@ -361,6 +361,10 @@
classpathref="test.compile.classpath">
+
+
+
+
@@ -421,7 +425,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/test/test-files/"
+ dir="@{tempDir}/@{threadNum}"
tempdir="@{tempDir}/@{threadNum}"
forkmode="perBatch"
>
diff --git a/solr/contrib/analysis-extras/build.xml b/solr/contrib/analysis-extras/build.xml
index e882f5bdf5b..9a2e7d942c3 100644
--- a/solr/contrib/analysis-extras/build.xml
+++ b/solr/contrib/analysis-extras/build.xml
@@ -118,6 +118,10 @@
classpathref="test.classpath">
+
+
+
+
@@ -136,7 +140,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/test/test-files/"
+ dir="${junit.output.dir}"
tempdir="${junit.output.dir}"
forkmode="perBatch"
>
diff --git a/solr/contrib/clustering/build.xml b/solr/contrib/clustering/build.xml
index a9125177809..a8036428c9a 100644
--- a/solr/contrib/clustering/build.xml
+++ b/solr/contrib/clustering/build.xml
@@ -90,6 +90,10 @@
classpathref="test.classpath">
+
+
+
+
@@ -108,7 +112,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/test/resources/"
+ dir="${junit.output.dir}"
tempdir="${junit.output.dir}"
forkmode="perBatch"
>
diff --git a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/AbstractClusteringTestCase.java b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/AbstractClusteringTestCase.java
index cb6bb1ff8bd..c4fec5e0a53 100644
--- a/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/AbstractClusteringTestCase.java
+++ b/solr/contrib/clustering/src/test/java/org/apache/solr/handler/clustering/AbstractClusteringTestCase.java
@@ -28,7 +28,7 @@ public abstract class AbstractClusteringTestCase extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
- initCore("solrconfig.xml", "schema.xml");
+ initCore("solrconfig.xml", "schema.xml", "solr-clustering");
numberOfDocs = 0;
for (String[] doc : DOCUMENTS) {
assertNull(h.validateUpdate(adoc("id", Integer.toString(numberOfDocs), "url", doc[0], "title", doc[1], "snippet", doc[2])));
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/mapping-ISOLatin1Accent.txt b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/mapping-ISOLatin1Accent.txt
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/mapping-ISOLatin1Accent.txt
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/mapping-ISOLatin1Accent.txt
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/protwords.txt b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/protwords.txt
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/protwords.txt
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/protwords.txt
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/schema.xml b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/schema.xml
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/schema.xml
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/schema.xml
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/solrconfig.xml b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/solrconfig.xml
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/solrconfig.xml
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/solrconfig.xml
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/spellings.txt b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/spellings.txt
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/spellings.txt
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/spellings.txt
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/stopwords.txt b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/stopwords.txt
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/stopwords.txt
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/stopwords.txt
diff --git a/solr/contrib/clustering/src/test/resources/solr/conf/synonyms.txt b/solr/contrib/clustering/src/test/resources/solr-clustering/conf/synonyms.txt
similarity index 100%
rename from solr/contrib/clustering/src/test/resources/solr/conf/synonyms.txt
rename to solr/contrib/clustering/src/test/resources/solr-clustering/conf/synonyms.txt
diff --git a/solr/contrib/dataimporthandler/build.xml b/solr/contrib/dataimporthandler/build.xml
index cd0decfdc0d..c21c0f9a648 100644
--- a/solr/contrib/dataimporthandler/build.xml
+++ b/solr/contrib/dataimporthandler/build.xml
@@ -123,6 +123,10 @@
classpathref="test.classpath">
+
+
+
+
@@ -130,6 +134,10 @@
classpathref="test.classpath">
+
+
+
+
@@ -156,7 +164,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/test/resources/"
+ dir="${tempDir}"
tempdir="${tempDir}"
forkmode="perBatch"
>
@@ -217,7 +225,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/extras/test/resources/"
+ dir="${tempDir}"
tempdir="${tempDir}"
forkmode="perBatch"
>
diff --git a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java b/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
index eb468067623..0a09d45e7c5 100644
--- a/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
+++ b/solr/contrib/dataimporthandler/src/extras/test/java/org/apache/solr/handler/dataimport/TestTikaEntityProcessor.java
@@ -25,7 +25,7 @@ import org.junit.BeforeClass;
public class TestTikaEntityProcessor extends AbstractDataImportHandlerTestCase {
@BeforeClass
public static void beforeClass() throws Exception {
- initCore("dataimport-solrconfig.xml", "dataimport-schema-no-unique-key.xml");
+ initCore("dataimport-solrconfig.xml", "dataimport-schema-no-unique-key.xml", "solr-dihextras");
}
public void testIndexingWithTikaEntityProcessor() throws Exception {
@@ -33,7 +33,7 @@ public class TestTikaEntityProcessor extends AbstractDataImportHandlerTestCase {
"" +
" " +
" " +
- " " +
+ " " +
" " +
" " +
" " +
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-schema-no-unique-key.xml b/solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-schema-no-unique-key.xml
rename to solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-schema-no-unique-key.xml
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml b/solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/extras/test/resources/solr/conf/dataimport-solrconfig.xml
rename to solr/contrib/dataimporthandler/src/extras/test/resources/solr-dihextras/conf/dataimport-solrconfig.xml
diff --git a/solr/contrib/dataimporthandler/src/extras/test/resources/solr-word.pdf b/solr/contrib/dataimporthandler/src/extras/test/resources/solr-word.pdf
new file mode 100644
index 00000000000..bd8b865905f
Binary files /dev/null and b/solr/contrib/dataimporthandler/src/extras/test/resources/solr-word.pdf differ
diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java
index bd4b8322939..07f78d0b412 100644
--- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java
+++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/AbstractDataImportHandlerTestCase.java
@@ -52,6 +52,11 @@ import java.util.Map;
public abstract class AbstractDataImportHandlerTestCase extends
SolrTestCaseJ4 {
+ // note, a little twisted that we shadow this static method
+ public static void initCore(String config, String schema) throws Exception {
+ initCore(config, schema, "solr-dih");
+ }
+
@Override
@Before
public void setUp() throws Exception {
diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java
index 248e3e982f3..c49be006377 100644
--- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java
+++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestContentStreamDataSource.java
@@ -39,7 +39,7 @@ import java.util.List;
* @since solr 1.4
*/
public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCase {
- private static final String CONF_DIR = "." + File.separator + "solr" + File.separator + "conf" + File.separator;
+ private static final String CONF_DIR = "." + File.separator + "solr-dih" + File.separator + "conf" + File.separator;
SolrInstance instance = null;
JettySolrRunner jetty;
@@ -129,12 +129,12 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa
confDir.mkdirs();
File f = new File(confDir, "solrconfig.xml");
- FileUtils.copyFile(new File(getSolrConfigFile()), f);
+ FileUtils.copyFile(getFile(getSolrConfigFile()), f);
f = new File(confDir, "schema.xml");
- FileUtils.copyFile(new File(getSchemaFile()), f);
+ FileUtils.copyFile(getFile(getSchemaFile()), f);
f = new File(confDir, "data-config.xml");
- FileUtils.copyFile(new File(CONF_DIR + "dataconfig-contentstream.xml"), f);
+ FileUtils.copyFile(getFile(CONF_DIR + "dataconfig-contentstream.xml"), f);
}
public void tearDown() throws Exception {
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/contentstream-solrconfig.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/contentstream-solrconfig.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/contentstream-solrconfig.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/contentstream-solrconfig.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/data-config-with-datasource.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/data-config-with-datasource.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/data-config-with-datasource.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/data-config-with-datasource.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/data-config-with-transformer.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/data-config-with-transformer.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/data-config-with-transformer.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/data-config-with-transformer.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataconfig-contentstream.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataconfig-contentstream.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataconfig-contentstream.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataconfig-contentstream.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-nodatasource-solrconfig.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-nodatasource-solrconfig.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-nodatasource-solrconfig.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-nodatasource-solrconfig.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-schema.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-schema.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-schema.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-schema.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solr_id-schema.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-solr_id-schema.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solr_id-schema.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-solr_id-schema.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-solrconfig.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/dataimport-solrconfig.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/dataimport-solrconfig.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/protwords.txt b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/protwords.txt
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/protwords.txt
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/protwords.txt
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/single-entity-data-config.xml
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/single-entity-data-config.xml
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/single-entity-data-config.xml
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/stopwords.txt b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/stopwords.txt
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/stopwords.txt
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/stopwords.txt
diff --git a/solr/contrib/dataimporthandler/src/test/resources/solr/conf/synonyms.txt b/solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/synonyms.txt
similarity index 100%
rename from solr/contrib/dataimporthandler/src/test/resources/solr/conf/synonyms.txt
rename to solr/contrib/dataimporthandler/src/test/resources/solr-dih/conf/synonyms.txt
diff --git a/solr/contrib/extraction/build.xml b/solr/contrib/extraction/build.xml
index 86f2b2ab812..73182c45264 100644
--- a/solr/contrib/extraction/build.xml
+++ b/solr/contrib/extraction/build.xml
@@ -79,6 +79,10 @@
classpathref="test.classpath">
+
+
+
+
@@ -105,7 +109,7 @@
maxmemory="512M"
errorProperty="tests.failed"
failureProperty="tests.failed"
- dir="src/test/resources/"
+ dir="${tempDir}"
tempdir="${tempDir}"
forkmode="perBatch"
>
diff --git a/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java b/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java
index a4658f46a71..af1bcf88f7c 100644
--- a/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java
+++ b/solr/contrib/extraction/src/test/java/org/apache/solr/handler/ExtractingRequestHandlerTest.java
@@ -43,7 +43,7 @@ import java.io.File;
public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
- initCore("solrconfig.xml", "schema.xml");
+ initCore("solrconfig.xml", "schema.xml", "solr-extraction");
}
@Before
@@ -367,7 +367,7 @@ public class ExtractingRequestHandlerTest extends SolrTestCaseJ4 {
// TODO: stop using locally defined streams once stream.file and
// stream.body work everywhere
List cs = new ArrayList();
- cs.add(new ContentStreamBase.FileStream(new File(filename)));
+ cs.add(new ContentStreamBase.FileStream(getFile(filename)));
req.setContentStreams(cs);
return h.queryAndResponse("/update/extract", req);
} finally {
diff --git a/solr/contrib/extraction/src/test/resources/solr/conf/protwords.txt b/solr/contrib/extraction/src/test/resources/solr-extraction/conf/protwords.txt
similarity index 100%
rename from solr/contrib/extraction/src/test/resources/solr/conf/protwords.txt
rename to solr/contrib/extraction/src/test/resources/solr-extraction/conf/protwords.txt
diff --git a/solr/contrib/extraction/src/test/resources/solr/conf/schema.xml b/solr/contrib/extraction/src/test/resources/solr-extraction/conf/schema.xml
similarity index 100%
rename from solr/contrib/extraction/src/test/resources/solr/conf/schema.xml
rename to solr/contrib/extraction/src/test/resources/solr-extraction/conf/schema.xml
diff --git a/solr/contrib/extraction/src/test/resources/solr/conf/solrconfig.xml b/solr/contrib/extraction/src/test/resources/solr-extraction/conf/solrconfig.xml
similarity index 100%
rename from solr/contrib/extraction/src/test/resources/solr/conf/solrconfig.xml
rename to solr/contrib/extraction/src/test/resources/solr-extraction/conf/solrconfig.xml
diff --git a/solr/contrib/extraction/src/test/resources/solr/conf/stopwords.txt b/solr/contrib/extraction/src/test/resources/solr-extraction/conf/stopwords.txt
similarity index 100%
rename from solr/contrib/extraction/src/test/resources/solr/conf/stopwords.txt
rename to solr/contrib/extraction/src/test/resources/solr-extraction/conf/stopwords.txt
diff --git a/solr/contrib/extraction/src/test/resources/solr/conf/synonyms.txt b/solr/contrib/extraction/src/test/resources/solr-extraction/conf/synonyms.txt
similarity index 100%
rename from solr/contrib/extraction/src/test/resources/solr/conf/synonyms.txt
rename to solr/contrib/extraction/src/test/resources/solr-extraction/conf/synonyms.txt
diff --git a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
index d3d7fc92ff4..2906e46c630 100755
--- a/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
@@ -84,7 +84,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
* deleteCore will be called for you via SolrTestCaseJ4 @AfterClass */
public static void initCore(String config, String schema) throws Exception {
- initCore(config, schema, null);
+ initCore(config, schema, TEST_HOME);
}
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
@@ -1028,7 +1028,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
* if a real file is needed. To get a stream, code should prefer
* {@link Class#getResourceAsStream} using {@code this.getClass()}.
*/
- public static File getFile(String name) throws IOException {
+ public static File getFile(String name) {
try {
File file = new File(name);
if (!file.exists()) {
@@ -1036,7 +1036,26 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
}
return file;
} catch (Exception e) {
- throw new IOException("Cannot find resource: " + name);
+ /* more friendly than NPE */
+ throw new RuntimeException("Cannot find resource: " + name);
}
}
+
+ private static final String SOURCE_HOME = determineSourceHome();
+ public static String TEST_HOME = getFile("solr/conf").getParent();
+ public static String WEBAPP_HOME = new File(SOURCE_HOME, "src/webapp/web").getAbsolutePath();
+ public static String EXAMPLE_HOME = new File(SOURCE_HOME, "example/solr").getAbsolutePath();
+ public static String EXAMPLE_MULTICORE_HOME = new File(SOURCE_HOME, "example/multicore").getAbsolutePath();
+ public static String EXAMPLE_SCHEMA=EXAMPLE_HOME+"/conf/schema.xml";
+ public static String EXAMPLE_CONFIG=EXAMPLE_HOME+"/conf/solrconfig.xml";
+
+ static String determineSourceHome() {
+ // ugly, ugly hack to determine the example home without depending on the CWD
+ // this is needed for example/multicore tests which reside outside the classpath
+ File base = getFile("solr/conf/");
+ while (!new File(base, "solr/CHANGES.txt").exists()) {
+ base = base.getParentFile();
+ }
+ return new File(base, "solr/").getAbsolutePath();
+ }
}
diff --git a/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java b/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
index a4b5f19d535..145317efeae 100755
--- a/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
+++ b/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
@@ -15,13 +15,6 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
// using configs in the test directory allows more flexibility to change "example"
// without breaking configs.
- private static final String SOURCE_HOME = determineSourceHome();
- public static String WEBAPP_HOME = new File(SOURCE_HOME, "src/webapp/web").getAbsolutePath();
- public static String EXAMPLE_HOME = new File(SOURCE_HOME, "example/solr").getAbsolutePath();
- public static String EXAMPLE_MULTICORE_HOME = new File(SOURCE_HOME, "example/multicore").getAbsolutePath();
- public static String EXAMPLE_SCHEMA=EXAMPLE_HOME+"/conf/schema.xml";
- public static String EXAMPLE_CONFIG=EXAMPLE_HOME+"/conf/solrconfig.xml";
-
public String getSolrHome() { return EXAMPLE_HOME; }
public static JettySolrRunner jetty;
@@ -29,23 +22,6 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
public static SolrServer server;
public static String context;
- static String determineSourceHome() {
- // ugly, ugly hack to determine the example home without depending on the CWD
- try {
- File file = new File("../../../example/solr");
- if (file.exists())
- return new File("../../../").getAbsolutePath();
- // let the hacks begin
- File base = getFile("solr/conf/");
- while (!new File(base, "solr/CHANGES.txt").exists()) {
- base = base.getParentFile();
- }
- return new File(base, "solr/").getAbsolutePath();
- } catch (IOException e) {
- throw new RuntimeException("Cannot determine example home!");
- }
- }
-
public static JettySolrRunner createJetty(String solrHome, String configFile, String context) throws Exception {
// creates the data dir
initCore(null, null);
diff --git a/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
index ff27f9fc52a..fbcd378cf0e 100644
--- a/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
+++ b/solr/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
import java.net.MalformedURLException;
+import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.CloudSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
@@ -59,7 +60,7 @@ public class BasicDistributedZkTest extends AbstractDistributedZkTestCase {
@BeforeClass
public static void beforeClass() throws Exception {
-
+ System.setProperty("solr.solr.home", SolrTestCaseJ4.TEST_HOME);
}
@Override
diff --git a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java
index 8a3d85af2be..95b03bfb327 100644
--- a/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java
+++ b/solr/src/test/org/apache/solr/core/TestXIncludeConfig.java
@@ -1,5 +1,8 @@
package org.apache.solr.core;
+import java.io.File;
+
+import org.apache.commons.io.FileUtils;
import org.apache.solr.util.AbstractSolrTestCase;
import org.apache.solr.request.SolrRequestHandler;
@@ -24,7 +27,9 @@ public class TestXIncludeConfig extends AbstractSolrTestCase {
@Override
public void setUp() throws Exception {
-
+ File dest = new File("solrconfig-reqHandler.incl");
+ dest.deleteOnExit();
+ FileUtils.copyFile(getFile("solr/conf/solrconfig-reqHandler.incl"), dest);
supports = true;
javax.xml.parsers.DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
diff --git a/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java b/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
index 26c3e162200..b6bf2adaa3b 100644
--- a/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
+++ b/solr/src/test/org/apache/solr/servlet/NoCacheHeaderTest.java
@@ -31,7 +31,7 @@ import org.junit.Test;
public class NoCacheHeaderTest extends CacheHeaderTestBase {
@BeforeClass
public static void beforeTest() throws Exception {
- createJetty("solr/", "solr/conf/solrconfig-nocache.xml", null);
+ createJetty(TEST_HOME, "solr/conf/solrconfig-nocache.xml", null);
}
// The tests
diff --git a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
index a111f3a4b0d..fec67be17b0 100644
--- a/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
+++ b/solr/src/test/org/apache/solr/util/AbstractSolrTestCase.java
@@ -84,6 +84,14 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase {
*/
public abstract String getSolrConfigFile();
+ /**
+ * Subclasses can override this to change a test's solr home
+ * (default is in test-files)
+ */
+ public String getSolrHome() {
+ return SolrTestCaseJ4.TEST_HOME;
+ }
+
/**
* The directory used to story the index managed by the TestHarness h
*/
@@ -114,8 +122,8 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase {
dataDir = new File(TEMP_DIR,
getClass().getName() + "-" + System.currentTimeMillis());
dataDir.mkdirs();
-
String configFile = getSolrConfigFile();
+ System.setProperty("solr.solr.home", getSolrHome());
if (configFile != null) {
solrConfig = h.createConfig(getSolrConfigFile());
diff --git a/solr/src/test/test-files/solr/conf/solrconfig-xinclude.xml b/solr/src/test/test-files/solr/conf/solrconfig-xinclude.xml
index 63cd3d5cd37..b171a3002d7 100644
--- a/solr/src/test/test-files/solr/conf/solrconfig-xinclude.xml
+++ b/solr/src/test/test-files/solr/conf/solrconfig-xinclude.xml
@@ -19,5 +19,6 @@
${tests.luceneMatchVersion:LUCENE_CURRENT}
-
+
+