mirror of https://github.com/apache/lucene.git
SOLR-4817 Solr should not fall back to the back compat built in solr.xml in SolrCloud mode.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1517398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
278d690bad
commit
84063af19a
|
@ -149,6 +149,9 @@ Bug Fixes
|
||||||
* SOLR-5174: Admin UI - Query View doesn't highlight (json) Result if it
|
* SOLR-5174: Admin UI - Query View doesn't highlight (json) Result if it
|
||||||
contains HTML Tags (steffkes)
|
contains HTML Tags (steffkes)
|
||||||
|
|
||||||
|
* SOLR-4817 Solr should not fall back to the back compat built in solr.xml in SolrCloud
|
||||||
|
mode (Erick Erickson)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
solr.xml mimicking the old default solr.xml
|
||||||
|
-->
|
||||||
|
|
||||||
|
<solr persistent="false">
|
||||||
|
<cores adminPath="/admin/cores" defaultCoreName="collection1"
|
||||||
|
host="${host:}" hostPort="${hostPort:}" hostContext="${hostContext:}"
|
||||||
|
zkClientTimeout="${zkClientTimeout:15000}">
|
||||||
|
<core name="collection1" shard="${shard:}" collection="${collection:collection1}" instanceDir="collection1"/>
|
||||||
|
</cores>
|
||||||
|
</solr>
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!--
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
solr.xml mimicking the old default solr.xml
|
||||||
|
-->
|
||||||
|
|
||||||
|
<solr persistent="false">
|
||||||
|
<cores adminPath="/admin/cores" defaultCoreName="collection1"
|
||||||
|
host="${host:}" hostPort="${hostPort:}" hostContext="${hostContext:}"
|
||||||
|
zkClientTimeout="${zkClientTimeout:15000}">
|
||||||
|
<core name="collection1" shard="${shard:}" collection="${collection:collection1}" instanceDir="collection1"/>
|
||||||
|
</cores>
|
||||||
|
</solr>
|
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCase {
|
public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCase {
|
||||||
private static final String CONF_DIR = "dih/solr/collection1/conf/";
|
private static final String CONF_DIR = "dih/solr/collection1/conf/";
|
||||||
|
private static final String ROOT_DIR = "dih/solr/";
|
||||||
SolrInstance instance = null;
|
SolrInstance instance = null;
|
||||||
JettySolrRunner jetty;
|
JettySolrRunner jetty;
|
||||||
|
|
||||||
|
@ -144,6 +145,11 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa
|
||||||
return CONF_DIR + "contentstream-solrconfig.xml";
|
return CONF_DIR + "contentstream-solrconfig.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSolrXmlFile() {
|
||||||
|
return ROOT_DIR + "solr.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
File home = new File(TEMP_DIR,
|
File home = new File(TEMP_DIR,
|
||||||
|
@ -158,6 +164,7 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
FileUtils.copyFile(getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
|
||||||
File f = new File(confDir, "solrconfig.xml");
|
File f = new File(confDir, "solrconfig.xml");
|
||||||
FileUtils.copyFile(getFile(getSolrConfigFile()), f);
|
FileUtils.copyFile(getFile(getSolrConfigFile()), f);
|
||||||
f = new File(confDir, "schema.xml");
|
f = new File(confDir, "schema.xml");
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
|
||||||
private static final String SOLR_CONFIG = "dataimport-solrconfig.xml";
|
private static final String SOLR_CONFIG = "dataimport-solrconfig.xml";
|
||||||
private static final String SOLR_SCHEMA = "dataimport-schema.xml";
|
private static final String SOLR_SCHEMA = "dataimport-schema.xml";
|
||||||
private static final String SOURCE_CONF_DIR = "dih" + File.separator + "solr" + File.separator + "collection1" + File.separator + "conf" + File.separator;
|
private static final String SOURCE_CONF_DIR = "dih" + File.separator + "solr" + File.separator + "collection1" + File.separator + "conf" + File.separator;
|
||||||
|
private static final String ROOT_DIR = "dih" + File.separator + "solr" + File.separator;
|
||||||
|
|
||||||
private static final String DEAD_SOLR_SERVER = "http://[ff01::114]:33332/solr";
|
private static final String DEAD_SOLR_SERVER = "http://[ff01::114]:33332/solr";
|
||||||
|
|
||||||
|
@ -294,6 +295,10 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
|
||||||
return SOURCE_CONF_DIR + "dataimport-solrconfig.xml";
|
return SOURCE_CONF_DIR + "dataimport-solrconfig.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSolrXmlFile() {
|
||||||
|
return ROOT_DIR + "solr.xml";
|
||||||
|
}
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
File home = new File(TEMP_DIR, getClass().getName() + "-"
|
File home = new File(TEMP_DIR, getClass().getName() + "-"
|
||||||
|
@ -307,6 +312,7 @@ public class TestSolrEntityProcessorEndToEnd extends AbstractDataImportHandlerTe
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
FileUtils.copyFile(getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
|
||||||
File f = new File(confDir, "solrconfig.xml");
|
File f = new File(confDir, "solrconfig.xml");
|
||||||
FileUtils.copyFile(getFile(getSolrConfigFile()), f);
|
FileUtils.copyFile(getFile(getSolrConfigFile()), f);
|
||||||
f = new File(confDir, "schema.xml");
|
f = new File(confDir, "schema.xml");
|
||||||
|
|
|
@ -55,8 +55,8 @@ public abstract class ConfigSolr {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
log.info("{} does not exist, using default configuration", configFile.getAbsolutePath());
|
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||||
inputStream = new ByteArrayInputStream(ConfigSolrXmlOld.DEF_SOLR_XML.getBytes(Charsets.UTF_8));
|
"solr.xml does not exist in " + configFile.getAbsolutePath() + " cannot start Solr");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inputStream = new FileInputStream(configFile);
|
inputStream = new FileInputStream(configFile);
|
||||||
|
|
|
@ -50,6 +50,8 @@ public class ConfigSolrXmlOld extends ConfigSolr {
|
||||||
|
|
||||||
private final CoresLocator persistor;
|
private final CoresLocator persistor;
|
||||||
|
|
||||||
|
public static final String DEFAULT_DEFAULT_CORE_NAME = "collection1";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getShardHandlerFactoryConfigPath() {
|
protected String getShardHandlerFactoryConfigPath() {
|
||||||
return "solr/cores/shardHandlerFactory";
|
return "solr/cores/shardHandlerFactory";
|
||||||
|
@ -273,19 +275,4 @@ public class ConfigSolrXmlOld extends ConfigSolr {
|
||||||
}
|
}
|
||||||
return new Properties();
|
return new Properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String DEFAULT_DEFAULT_CORE_NAME = "collection1";
|
|
||||||
|
|
||||||
public static final String DEF_SOLR_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
|
|
||||||
+ "<solr persistent=\"false\">\n"
|
|
||||||
+ " <cores adminPath=\"/admin/cores\" defaultCoreName=\""
|
|
||||||
+ DEFAULT_DEFAULT_CORE_NAME
|
|
||||||
+ "\""
|
|
||||||
+ " host=\"${host:}\" hostPort=\"${hostPort:}\" hostContext=\"${hostContext:}\" zkClientTimeout=\"${zkClientTimeout:15000}\""
|
|
||||||
+ ">\n"
|
|
||||||
+ " <core name=\""
|
|
||||||
+ DEFAULT_DEFAULT_CORE_NAME
|
|
||||||
+ "\" shard=\"${shard:}\" collection=\"${collection:collection1}\" instanceDir=\"collection1\" />\n"
|
|
||||||
+ " </cores>\n" + "</solr>";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class SolrDispatchFilter implements Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.cores == null) {
|
if (this.cores == null) {
|
||||||
((HttpServletResponse)response).sendError( 503, "Server is shutting down" );
|
((HttpServletResponse)response).sendError( 503, "Server is shutting down or failed to initialize" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CoreContainer cores = this.cores;
|
CoreContainer cores = this.cores;
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class TestSolrCoreProperties extends SolrJettyTestBase {
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(homeDir, "solr.xml"));
|
||||||
String src_dir = TEST_HOME() + "/collection1/conf";
|
String src_dir = TEST_HOME() + "/collection1/conf";
|
||||||
FileUtils.copyFile(new File(src_dir, "schema-tiny.xml"),
|
FileUtils.copyFile(new File(src_dir, "schema-tiny.xml"),
|
||||||
new File(confDir, "schema.xml"));
|
new File(confDir, "schema.xml"));
|
||||||
|
|
|
@ -17,6 +17,7 @@ package org.apache.solr.cloud;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.cloud.ClusterState;
|
import org.apache.solr.common.cloud.ClusterState;
|
||||||
|
@ -36,6 +37,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -65,17 +67,29 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private File dataDir4;
|
private File dataDir4;
|
||||||
|
|
||||||
|
|
||||||
|
private static final File solrHomeDirectory = new File(TEMP_DIR, "ZkControllerTest");
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() {
|
public static void beforeClass() throws IOException {
|
||||||
System.setProperty("solrcloud.skip.autorecovery", "true");
|
System.setProperty("solrcloud.skip.autorecovery", "true");
|
||||||
System.setProperty("genericCoreNodeNames", "false");
|
System.setProperty("genericCoreNodeNames", "false");
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
copyMinFullSetup(solrHomeDirectory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws InterruptedException {
|
public static void afterClass() throws InterruptedException, IOException {
|
||||||
System.clearProperty("solrcloud.skip.autorecovery");
|
System.clearProperty("solrcloud.skip.autorecovery");
|
||||||
System.clearProperty("genericCoreNodeNames");
|
System.clearProperty("genericCoreNodeNames");
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -111,19 +125,19 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
System.setProperty("solr.solr.home", TEST_HOME());
|
System.setProperty("solr.solr.home", TEST_HOME());
|
||||||
System.setProperty("hostPort", "1661");
|
System.setProperty("hostPort", "1661");
|
||||||
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir1.getAbsolutePath());
|
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir1.getAbsolutePath());
|
||||||
container1 = new CoreContainer();
|
container1 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
container1.load();
|
container1.load();
|
||||||
System.clearProperty("hostPort");
|
System.clearProperty("hostPort");
|
||||||
|
|
||||||
System.setProperty("hostPort", "1662");
|
System.setProperty("hostPort", "1662");
|
||||||
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath());
|
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath());
|
||||||
container2 = new CoreContainer();
|
container2 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
container2.load();
|
container2.load();
|
||||||
System.clearProperty("hostPort");
|
System.clearProperty("hostPort");
|
||||||
|
|
||||||
System.setProperty("hostPort", "1663");
|
System.setProperty("hostPort", "1663");
|
||||||
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir3.getAbsolutePath());
|
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir3.getAbsolutePath());
|
||||||
container3 = new CoreContainer();
|
container3 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
container3.load();
|
container3.load();
|
||||||
System.clearProperty("hostPort");
|
System.clearProperty("hostPort");
|
||||||
System.clearProperty("solr.solr.home");
|
System.clearProperty("solr.solr.home");
|
||||||
|
@ -222,7 +236,7 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
System.setProperty("hostPort", "1662");
|
System.setProperty("hostPort", "1662");
|
||||||
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath());
|
System.setProperty("solr.data.dir", ClusterStateUpdateTest.this.dataDir2.getAbsolutePath());
|
||||||
container2 = new CoreContainer();
|
container2 = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
container2.load();
|
container2.load();
|
||||||
System.clearProperty("hostPort");
|
System.clearProperty("hostPort");
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.junit.rules.RuleChain;
|
||||||
import org.junit.rules.TestRule;
|
import org.junit.rules.TestRule;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
@ -145,23 +146,23 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
setUpZkAndDiskXml(false, true);
|
setUpZkAndDiskXml(false, true);
|
||||||
fail("Should have gotten an exception here!");
|
fail("Should have gotten an exception here!");
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (InvocationTargetException ite) {
|
||||||
SolrException se = (SolrException) ite.getTargetException();
|
|
||||||
assertEquals("Should have an exception here, file not in ZK.",
|
assertEquals("Should have an exception here, file not in ZK.",
|
||||||
"Could not load solr.xml from zookeeper", se.getMessage());
|
"Could not load solr.xml from zookeeper", ite.getTargetException().getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
closeZK();
|
closeZK();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Solr 5.0. when we remove the default solr.xml from configSolrXmlOld this should start failing.
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotInZkOrOnDisk() throws Exception {
|
public void testNotInZkOrOnDisk() throws Exception {
|
||||||
try {
|
try {
|
||||||
System.clearProperty("solr.solrxml.location");
|
System.clearProperty("solr.solrxml.location");
|
||||||
System.setProperty("hostPort", "8787");
|
System.setProperty("hostPort", "8787");
|
||||||
setUpZkAndDiskXml(false, false); // solr.xml not on disk either
|
setUpZkAndDiskXml(false, false); // solr.xml not on disk either
|
||||||
assertEquals("Should have gotten the default port from the hard-coded default solr.xml file via sys prop.",
|
fail("Should have thrown an exception here");
|
||||||
cfg.getZkHostPort(), "8787");
|
} catch (InvocationTargetException ite) {
|
||||||
|
assertTrue("Should be failing to create default solr.xml in code",
|
||||||
|
ite.getTargetException().getCause().getMessage().indexOf("solr.xml does not exist") != -1);
|
||||||
} finally {
|
} finally {
|
||||||
closeZK();
|
closeZK();
|
||||||
}
|
}
|
||||||
|
@ -185,9 +186,8 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
setUpZkAndDiskXml(false, true);
|
setUpZkAndDiskXml(false, true);
|
||||||
fail("Should have thrown exception in SolrXmlInZkTest.testBadSysProp");
|
fail("Should have thrown exception in SolrXmlInZkTest.testBadSysProp");
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (InvocationTargetException ite) {
|
||||||
SolrException se = (SolrException) ite.getTargetException();
|
|
||||||
assertEquals("Should have an exception in SolrXmlInZkTest.testBadSysProp, sysprop set to bogus value.",
|
assertEquals("Should have an exception in SolrXmlInZkTest.testBadSysProp, sysprop set to bogus value.",
|
||||||
se.getMessage(), "Bad solr.solrxml.location set: solrHomeDir - should be 'solrhome' or 'zookeeper'");
|
ite.getTargetException().getMessage(), "Bad solr.solrxml.location set: solrHomeDir - should be 'solrhome' or 'zookeeper'");
|
||||||
} finally {
|
} finally {
|
||||||
closeZK();
|
closeZK();
|
||||||
}
|
}
|
||||||
|
@ -208,9 +208,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
|
||||||
fail("Should have thrown an exception");
|
fail("Should have thrown an exception");
|
||||||
} catch (InvocationTargetException ite) {
|
} catch (InvocationTargetException ite) {
|
||||||
assertTrue("Should be catching a SolrException", ite.getTargetException() instanceof SolrException);
|
assertTrue("Should be catching a SolrException", ite.getTargetException() instanceof SolrException);
|
||||||
String cause = ((SolrException) ite.getTargetException()).getMessage();
|
assertEquals("Caught Solr exception", ite.getTargetException().getMessage(),
|
||||||
|
|
||||||
assertEquals("Caught Solr exception", cause,
|
|
||||||
"Could not load solr.xml from zookeeper: zkHost system property not set");
|
"Could not load solr.xml from zookeeper: zkHost system property not set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ package org.apache.solr.cloud;
|
||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.common.cloud.SolrZkClient;
|
import org.apache.solr.common.cloud.SolrZkClient;
|
||||||
|
@ -26,6 +27,7 @@ import org.apache.solr.core.CoreContainer;
|
||||||
import org.apache.solr.core.CoreDescriptor;
|
import org.apache.solr.core.CoreDescriptor;
|
||||||
import org.apache.solr.util.ExternalPaths;
|
import org.apache.solr.util.ExternalPaths;
|
||||||
import org.apache.zookeeper.CreateMode;
|
import org.apache.zookeeper.CreateMode;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -43,11 +45,25 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
|
|
||||||
|
private static final File solrHomeDirectory = new File(TEMP_DIR, "ZkControllerTest");
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void beforeClass() throws Exception {
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
copyMinFullSetup(solrHomeDirectory);
|
||||||
initCore();
|
initCore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void afterClass() throws Exception {
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testNodeNameUrlConversion() throws Exception {
|
public void testNodeNameUrlConversion() throws Exception {
|
||||||
|
|
||||||
// nodeName from parts
|
// nodeName from parts
|
||||||
|
@ -240,7 +256,7 @@ public class ZkControllerTest extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CoreContainer getCoreContainer() {
|
private CoreContainer getCoreContainer() {
|
||||||
CoreContainer cc = new CoreContainer(TEMP_DIR.getAbsolutePath());
|
CoreContainer cc = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
cc.load();
|
cc.load();
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,10 @@ public class TestSolrXmlPersistence extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testPersist() throws Exception {
|
public void testPersist() throws Exception {
|
||||||
|
|
||||||
final CoreContainer cores = init(ConfigSolrXmlOld.DEF_SOLR_XML, "collection1");
|
String defXml = FileUtils.readFileToString(
|
||||||
|
new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"),
|
||||||
|
Charsets.UTF_8.toString());
|
||||||
|
final CoreContainer cores = init(defXml, "collection1");
|
||||||
SolrXMLCoresLocator.NonPersistingLocator locator
|
SolrXMLCoresLocator.NonPersistingLocator locator
|
||||||
= (SolrXMLCoresLocator.NonPersistingLocator) cores.getCoresLocator();
|
= (SolrXMLCoresLocator.NonPersistingLocator) cores.getCoresLocator();
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,18 @@ package org.apache.solr.core;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class TestSolrXmlPersistor {
|
public class TestSolrXmlPersistor extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static final List<CoreDescriptor> EMPTY_CD_LIST = ImmutableList.<CoreDescriptor>builder().build();
|
private static final List<CoreDescriptor> EMPTY_CD_LIST = ImmutableList.<CoreDescriptor>builder().build();
|
||||||
|
|
||||||
|
@ -58,12 +61,18 @@ public class TestSolrXmlPersistor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void simpleCoreDescriptorIsPersisted() {
|
public void simpleCoreDescriptorIsPersisted() throws IOException {
|
||||||
|
|
||||||
final String solrxml = "<solr><cores></cores></solr>";
|
final String solrxml = "<solr><cores></cores></solr>";
|
||||||
|
|
||||||
SolrResourceLoader loader = new SolrResourceLoader("solr/example/solr");
|
final File solrHomeDirectory = new File(TEMP_DIR, "ZkControllerTest");
|
||||||
CoreContainer cc = new CoreContainer(loader);
|
try {
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
copyMinFullSetup(solrHomeDirectory);
|
||||||
|
|
||||||
|
CoreContainer cc = new CoreContainer(solrHomeDirectory.getAbsolutePath());
|
||||||
|
|
||||||
final CoreDescriptor cd = new CoreDescriptor(cc, "testcore", "instance/dir/");
|
final CoreDescriptor cd = new CoreDescriptor(cc, "testcore", "instance/dir/");
|
||||||
List<CoreDescriptor> cds = ImmutableList.of(cd);
|
List<CoreDescriptor> cds = ImmutableList.of(cd);
|
||||||
|
@ -73,6 +82,12 @@ public class TestSolrXmlPersistor {
|
||||||
"<solr><cores>" + SolrXMLCoresLocator.NEWLINE
|
"<solr><cores>" + SolrXMLCoresLocator.NEWLINE
|
||||||
+ " <core name=\"testcore\" instanceDir=\"instance/dir/\"/>" + SolrXMLCoresLocator.NEWLINE
|
+ " <core name=\"testcore\" instanceDir=\"instance/dir/\"/>" + SolrXMLCoresLocator.NEWLINE
|
||||||
+ "</cores></solr>");
|
+ "</cores></solr>");
|
||||||
|
} finally {
|
||||||
|
if (solrHomeDirectory.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -69,6 +69,7 @@ import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.core.StandardDirectoryFactory;
|
import org.apache.solr.core.StandardDirectoryFactory;
|
||||||
import org.apache.solr.servlet.SolrDispatchFilter;
|
import org.apache.solr.servlet.SolrDispatchFilter;
|
||||||
import org.apache.solr.util.AbstractSolrTestCase;
|
import org.apache.solr.util.AbstractSolrTestCase;
|
||||||
|
import org.apache.solr.util.FileUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -139,7 +140,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
private static JettySolrRunner createJetty(SolrInstance instance) throws Exception {
|
private static JettySolrRunner createJetty(SolrInstance instance) throws Exception {
|
||||||
System.setProperty("solr.data.dir", instance.getDataDir());
|
System.setProperty("solr.data.dir", instance.getDataDir());
|
||||||
|
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(instance.getHomeDir(), "solr.xml"));
|
||||||
JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), "/solr", 0);
|
JettySolrRunner jetty = new JettySolrRunner(instance.getHomeDir(), "/solr", 0);
|
||||||
|
|
||||||
jetty.start();
|
jetty.start();
|
||||||
|
|
|
@ -27,10 +27,12 @@ import org.apache.solr.client.solrj.request.QueryRequest;
|
||||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.SolrInputDocument;
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -44,10 +46,18 @@ import java.net.URLEncoder;
|
||||||
*/
|
*/
|
||||||
public class TestRemoteStreaming extends SolrJettyTestBase {
|
public class TestRemoteStreaming extends SolrJettyTestBase {
|
||||||
|
|
||||||
|
private static final File solrHomeDirectory = new File(TEMP_DIR, "TestRemoteStreaming");
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTest() throws Exception {
|
public static void beforeTest() throws Exception {
|
||||||
//this one has handleSelect=true which a test here needs
|
//this one has handleSelect=true which a test here needs
|
||||||
createJetty("solr/", null, null);
|
setupJettyTestHome(solrHomeDirectory, "collection1");
|
||||||
|
createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void afterTest() throws Exception {
|
||||||
|
cleanUpJettyHome(solrHomeDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -17,20 +17,17 @@
|
||||||
package org.apache.solr.schema;
|
package org.apache.solr.schema;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.SolrQuery;
|
import org.apache.solr.client.solrj.SolrQuery;
|
||||||
import org.apache.solr.client.solrj.beans.Field;
|
import org.apache.solr.client.solrj.beans.Field;
|
||||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
|
||||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||||
import org.apache.solr.common.*;
|
import org.apache.solr.common.*;
|
||||||
import org.apache.solr.core.SolrResourceLoader;
|
|
||||||
import org.apache.solr.SolrJettyTestBase;
|
import org.apache.solr.SolrJettyTestBase;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
|
@ -49,6 +46,8 @@ public class TestBinaryField extends SolrJettyTestBase {
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(homeDir, "solr.xml"));
|
||||||
|
|
||||||
String src_dir = TEST_HOME() + "/collection1/conf";
|
String src_dir = TEST_HOME() + "/collection1/conf";
|
||||||
FileUtils.copyFile(new File(src_dir, "schema-binaryfield.xml"),
|
FileUtils.copyFile(new File(src_dir, "schema-binaryfield.xml"),
|
||||||
new File(confDir, "schema.xml"));
|
new File(confDir, "schema.xml"));
|
||||||
|
|
|
@ -23,11 +23,13 @@ import java.io.Writer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpRequestBase;
|
import org.apache.http.client.methods.HttpRequestBase;
|
||||||
import org.apache.http.impl.cookie.DateUtils;
|
import org.apache.http.impl.cookie.DateUtils;
|
||||||
import org.apache.solr.common.params.CommonParams;
|
import org.apache.solr.common.params.CommonParams;
|
||||||
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -37,13 +39,18 @@ import org.apache.lucene.util._TestUtil;
|
||||||
* A test case for the several HTTP cache headers emitted by Solr
|
* A test case for the several HTTP cache headers emitted by Solr
|
||||||
*/
|
*/
|
||||||
public class CacheHeaderTest extends CacheHeaderTestBase {
|
public class CacheHeaderTest extends CacheHeaderTestBase {
|
||||||
|
private static final File solrHomeDirectory = new File(TEMP_DIR, "CacheHeaderTest");
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeTest() throws Exception {
|
public static void beforeTest() throws Exception {
|
||||||
createJetty("solr/", null, null);
|
setupJettyTestHome(solrHomeDirectory, "collection1");
|
||||||
|
createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final String CHARSET = "UTF-8";
|
@AfterClass
|
||||||
|
public static void afterTest() throws Exception {
|
||||||
|
cleanUpJettyHome(solrHomeDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
protected static final String CONTENTS = "id\n100\n101\n102";
|
protected static final String CONTENTS = "id\n100\n101\n102";
|
||||||
|
|
||||||
|
@ -241,7 +248,7 @@ public class CacheHeaderTest extends CacheHeaderTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected File makeFile(String contents) {
|
protected File makeFile(String contents) {
|
||||||
return makeFile(contents, CHARSET);
|
return makeFile(contents, Charsets.UTF_8.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected File makeFile(String contents, String charset) {
|
protected File makeFile(String contents, String charset) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
If 'null' (or absent), cores will not be manageable via request handler
|
If 'null' (or absent), cores will not be manageable via request handler
|
||||||
-->
|
-->
|
||||||
<cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
|
<cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
|
||||||
<core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/>
|
<core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" />
|
||||||
|
<!--config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/-->
|
||||||
</cores>
|
</cores>
|
||||||
</solr>
|
</solr>
|
||||||
|
|
|
@ -273,6 +273,11 @@ public class TestLBHttpSolrServer extends LuceneTestCase {
|
||||||
return "solrj/solr/collection1/conf/solrconfig-slave1.xml";
|
return "solrj/solr/collection1/conf/solrconfig-slave1.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSolrXmlFile() {
|
||||||
|
return "solrj/solr/solr.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
File home = new File(LuceneTestCase.TEMP_DIR,
|
File home = new File(LuceneTestCase.TEMP_DIR,
|
||||||
getClass().getName() + "-" + System.currentTimeMillis());
|
getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
|
@ -286,6 +291,8 @@ public class TestLBHttpSolrServer extends LuceneTestCase {
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
confDir.mkdirs();
|
confDir.mkdirs();
|
||||||
|
|
||||||
|
FileUtils.copyFile(SolrTestCaseJ4.getFile(getSolrXmlFile()), new File(homeDir, "solr.xml"));
|
||||||
|
|
||||||
File f = new File(confDir, "solrconfig.xml");
|
File f = new File(confDir, "solrconfig.xml");
|
||||||
FileUtils.copyFile(SolrTestCaseJ4.getFile(getSolrConfigFile()), f);
|
FileUtils.copyFile(SolrTestCaseJ4.getFile(getSolrConfigFile()), f);
|
||||||
f = new File(confDir, "schema.xml");
|
f = new File(confDir, "schema.xml");
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
|
||||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||||
|
@ -188,4 +189,21 @@ abstract public class SolrJettyTestBase extends SolrTestCaseJ4
|
||||||
return new EmbeddedSolrServer( h.getCoreContainer(), "" );
|
return new EmbeddedSolrServer( h.getCoreContainer(), "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets up the necessary config files for Jetty. At least some tests require that the solrconfig from the test
|
||||||
|
// file directory are used, but some also require that the solr.xml file be explicitly there as of SOLR-4817
|
||||||
|
public static void setupJettyTestHome(File solrHome, String collection) throws Exception {
|
||||||
|
if (solrHome.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHome);
|
||||||
|
}
|
||||||
|
copySolrHomeToTemp(solrHome, collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cleanUpJettyHome(File solrHome) throws Exception {
|
||||||
|
if (solrHome.exists()) {
|
||||||
|
FileUtils.deleteDirectory(solrHome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1599,16 +1599,53 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Creates a mininmal conf dir.
|
// Creates a mininmal conf dir.
|
||||||
public void copyMinConf(File dstRoot) throws IOException {
|
public static void copyMinConf(File dstRoot) throws IOException {
|
||||||
|
|
||||||
File subHome = new File(dstRoot, "conf");
|
File subHome = new File(dstRoot, "conf");
|
||||||
|
if (! dstRoot.exists()) {
|
||||||
assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
|
assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
|
||||||
|
}
|
||||||
|
|
||||||
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
|
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
|
||||||
FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(subHome, "schema.xml"));
|
FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(subHome, "schema.xml"));
|
||||||
FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(subHome, "solrconfig.xml"));
|
FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(subHome, "solrconfig.xml"));
|
||||||
FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
|
FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creates minimal full setup, including the old solr.xml file that used to be hard coded in COnfigSolrXmlOld
|
||||||
|
public static void copyMinFullSetup(File dstRoot) throws IOException {
|
||||||
|
if (! dstRoot.exists()) {
|
||||||
|
assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
|
||||||
|
}
|
||||||
|
File xmlF = new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml");
|
||||||
|
FileUtils.copyFile(xmlF, new File(dstRoot, "solr.xml"));
|
||||||
|
copyMinConf(dstRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates a consistent configuration, _including_ solr.xml at dstRoot. Creates collection1/conf and copies
|
||||||
|
// the stock files in there. Seems to be indicated for some tests when we remove the default, hard-coded
|
||||||
|
// solr.xml from being automatically synthesized from SolrConfigXmlOld.DEFAULT_SOLR_XML.
|
||||||
|
public static void copySolrHomeToTemp(File dstRoot, String collection) throws IOException {
|
||||||
|
if (!dstRoot.exists()) {
|
||||||
|
assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr.xml"), new File(dstRoot, "solr.xml"));
|
||||||
|
|
||||||
|
File subHome = new File(dstRoot, collection + File.separator + "conf");
|
||||||
|
String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
|
||||||
|
FileUtils.copyFile(new File(top, "currency.xml"), new File(subHome, "currency.xml"));
|
||||||
|
FileUtils.copyFile(new File(top, "mapping-ISOLatin1Accent.txt"), new File(subHome, "mapping-ISOLatin1Accent.txt"));
|
||||||
|
FileUtils.copyFile(new File(top, "old_synonyms.txt"), new File(subHome, "old_synonyms.txt"));
|
||||||
|
FileUtils.copyFile(new File(top, "open-exchange-rates.json"), new File(subHome, "open-exchange-rates.json"));
|
||||||
|
FileUtils.copyFile(new File(top, "protwords.txt"), new File(subHome, "protwords.txt"));
|
||||||
|
FileUtils.copyFile(new File(top, "schema.xml"), new File(subHome, "schema.xml"));
|
||||||
|
FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
|
||||||
|
FileUtils.copyFile(new File(top, "solrconfig.xml"), new File(subHome, "solrconfig.xml"));
|
||||||
|
FileUtils.copyFile(new File(top, "stopwords.txt"), new File(subHome, "stopwords.txt"));
|
||||||
|
FileUtils.copyFile(new File(top, "synonyms.txt"), new File(subHome, "synonyms.txt"));
|
||||||
|
}
|
||||||
|
|
||||||
public static CoreDescriptorBuilder buildCoreDescriptor(CoreContainer container, String name, String instancedir) {
|
public static CoreDescriptorBuilder buildCoreDescriptor(CoreContainer container, String name, String instancedir) {
|
||||||
return new CoreDescriptorBuilder(container, name, instancedir);
|
return new CoreDescriptorBuilder(container, name, instancedir);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue