SOLR-2659: Fix ExternalPaths.determineSourceHome() and SolrJettyTestBase.createJetty() to allow Solrj tests to pass.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1149682 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2011-07-22 18:26:28 +00:00
parent 74e3b8b304
commit 270dee6521
2 changed files with 12 additions and 2 deletions

View File

@ -39,7 +39,7 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
public static JettySolrRunner createJetty(String solrHome, String configFile, String context) throws Exception { public static JettySolrRunner createJetty(String solrHome, String configFile, String context) throws Exception {
// creates the data dir // creates the data dir
initCore(null, null); initCore(null, null, solrHome);
ignoreException("maxWarmingSearchers"); ignoreException("maxWarmingSearchers");

View File

@ -37,7 +37,17 @@ public class ExternalPaths {
static String determineSourceHome() { static String determineSourceHome() {
// ugly, ugly hack to determine the example home without depending on the CWD // 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 // this is needed for example/multicore tests which reside outside the classpath
File base = SolrTestCaseJ4.getFile("solr/conf").getAbsoluteFile(); File file;
try {
file = new File("solr/conf");
if (!file.exists()) {
file = new File(Thread.currentThread().getContextClassLoader().getResource("solr/conf").toURI());
}
} catch (Exception e) {
// If there is no "solr/conf" in the classpath, fall back to searching from the current directory.
file = new File(".");
}
File base = file.getAbsoluteFile();
while (!new File(base, "solr/CHANGES.txt").exists()) { while (!new File(base, "solr/CHANGES.txt").exists()) {
base = base.getParentFile(); base = base.getParentFile();
} }