You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2013/08/16 20:43:09 UTC
svn commit: r1514843 - in /lucene/dev/branches/branch_4x: ./ dev-tools/
lucene/ lucene/analysis/
lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/
lucene/benchmark/ lucene/classification/ lucene/classification/src/
lucene/code...
Author: erick
Date: Fri Aug 16 18:43:07 2013
New Revision: 1514843
URL: http://svn.apache.org/r1514843
Log:
SOLR-4718 Allow solr.xml to be stored in ZooKeeper
Added:
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
- copied unchanged from r1514800, lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/dev-tools/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/BUILD.txt (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (props changed)
lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt (props changed)
lucene/dev/branches/branch_4x/lucene/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/MIGRATE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/README.txt (props changed)
lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/ (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java (props changed)
lucene/dev/branches/branch_4x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_4x/lucene/benchmark/ (props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/ (props changed)
lucene/dev/branches/branch_4x/lucene/classification/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/ivy.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/src/ (props changed)
lucene/dev/branches/branch_4x/lucene/codecs/ (props changed)
lucene/dev/branches/branch_4x/lucene/common-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortDocValues.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortRandom.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTotalHitCountCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/demo/ (props changed)
lucene/dev/branches/branch_4x/lucene/facet/ (props changed)
lucene/dev/branches/branch_4x/lucene/grouping/ (props changed)
lucene/dev/branches/branch_4x/lucene/highlighter/ (props changed)
lucene/dev/branches/branch_4x/lucene/ivy-settings.xml (props changed)
lucene/dev/branches/branch_4x/lucene/join/ (props changed)
lucene/dev/branches/branch_4x/lucene/licenses/ (props changed)
lucene/dev/branches/branch_4x/lucene/memory/ (props changed)
lucene/dev/branches/branch_4x/lucene/misc/ (props changed)
lucene/dev/branches/branch_4x/lucene/module-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/queries/ (props changed)
lucene/dev/branches/branch_4x/lucene/queries/src/test/org/apache/lucene/queries/function/TestFunctionQuerySort.java (props changed)
lucene/dev/branches/branch_4x/lucene/queryparser/ (props changed)
lucene/dev/branches/branch_4x/lucene/replicator/ (props changed)
lucene/dev/branches/branch_4x/lucene/sandbox/ (props changed)
lucene/dev/branches/branch_4x/lucene/site/ (props changed)
lucene/dev/branches/branch_4x/lucene/spatial/ (props changed)
lucene/dev/branches/branch_4x/lucene/suggest/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/tools/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/solr/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/solr/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/README.txt (props changed)
lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/solr/build.xml (props changed)
lucene/dev/branches/branch_4x/solr/cloud-dev/ (props changed)
lucene/dev/branches/branch_4x/solr/common-build.xml (props changed)
lucene/dev/branches/branch_4x/solr/contrib/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestConfig.java (props changed)
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java
lucene/dev/branches/branch_4x/solr/example/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/scripts/ (props changed)
lucene/dev/branches/branch_4x/solr/site/ (props changed)
lucene/dev/branches/branch_4x/solr/solrj/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/webapp/ (props changed)
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Fri Aug 16 18:43:07 2013
@@ -65,7 +65,9 @@ New Features
* SOLR-5017: Allow sharding based on the value of a field (Noble Paul)
* SOLR-4222: create custom sharded collection via collections API (Noble Paul)
* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK.
-
+* SOLR-4718: Allow solr.xml to be stored in ZooKeeper
+* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK.
+err
Bug Fixes
----------------------
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolr.java Fri Aug 16 18:43:07 2013
@@ -61,10 +61,7 @@ public abstract class ConfigSolr {
else {
inputStream = new FileInputStream(configFile);
}
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ByteStreams.copy(inputStream, baos);
- String originalXml = IOUtils.toString(new ByteArrayInputStream(baos.toByteArray()), "UTF-8");
- return fromInputStream(loader, new ByteArrayInputStream(baos.toByteArray()), configFile, originalXml);
+ return fromInputStream(loader, inputStream);
}
catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
@@ -76,13 +73,17 @@ public abstract class ConfigSolr {
}
public static ConfigSolr fromString(String xml) {
- return fromInputStream(null, new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8)), null, xml);
+ return fromInputStream(null, new ByteArrayInputStream(xml.getBytes(Charsets.UTF_8)));
}
- public static ConfigSolr fromInputStream(SolrResourceLoader loader, InputStream is, File file, String originalXml) {
+ public static ConfigSolr fromInputStream(SolrResourceLoader loader, InputStream is) {
try {
- Config config = new Config(loader, null, new InputSource(is), null, false);
- return fromConfig(config, file, originalXml);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ByteStreams.copy(is, baos);
+ String originalXml = IOUtils.toString(new ByteArrayInputStream(baos.toByteArray()), "UTF-8");
+ ByteArrayInputStream dup = new ByteArrayInputStream(baos.toByteArray());
+ Config config = new Config(loader, null, new InputSource(dup), null, false);
+ return fromConfig(config, originalXml);
}
catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
@@ -93,9 +94,9 @@ public abstract class ConfigSolr {
return fromFile(loader, new File(solrHome, SOLR_XML_FILE));
}
- public static ConfigSolr fromConfig(Config config, File file, String originalXml) {
+ public static ConfigSolr fromConfig(Config config, String originalXml) {
boolean oldStyle = (config.getNode("solr/cores", false) != null);
- return oldStyle ? new ConfigSolrXmlOld(config, file, originalXml)
+ return oldStyle ? new ConfigSolrXmlOld(config, originalXml)
: new ConfigSolrXml(config);
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/ConfigSolrXmlOld.java Fri Aug 16 18:43:07 2013
@@ -55,15 +55,15 @@ public class ConfigSolrXmlOld extends Co
return "solr/cores/shardHandlerFactory";
}
- public ConfigSolrXmlOld(Config config, File configFile, String originalXML) {
+ public ConfigSolrXmlOld(Config config, String originalXML) {
super(config);
try {
checkForIllegalConfig();
fillPropMap();
config.substituteProperties();
initCoreList();
- this.persistor = isPersistent() ? new SolrXMLCoresLocator(configFile, originalXML, this)
- : new SolrXMLCoresLocator.NonPersistingLocator(configFile, originalXML, this);
+ this.persistor = isPersistent() ? new SolrXMLCoresLocator(originalXML, this)
+ : new SolrXMLCoresLocator.NonPersistingLocator(originalXML, this);
}
catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrXMLCoresLocator.java Fri Aug 16 18:43:07 2013
@@ -41,7 +41,6 @@ public class SolrXMLCoresLocator impleme
private static final Logger logger = LoggerFactory.getLogger(SolrXMLCoresLocator.class);
- private final File file;
private final String solrXmlTemplate;
private final ConfigSolrXmlOld cfg;
@@ -50,13 +49,11 @@ public class SolrXMLCoresLocator impleme
/**
* Create a new SolrXMLCoresLocator
- * @param file a File object representing the file to write out to
* @param originalXML the original content of the solr.xml file
* @param cfg the CoreContainer's config object
*/
- public SolrXMLCoresLocator(File file, String originalXML, ConfigSolrXmlOld cfg) {
+ public SolrXMLCoresLocator(String originalXML, ConfigSolrXmlOld cfg) {
this.solrXmlTemplate = buildTemplate(originalXML);
- this.file = file;
this.cfg = cfg;
}
@@ -147,6 +144,7 @@ public class SolrXMLCoresLocator impleme
}
protected void doPersist(String xml) {
+ File file = new File(cfg.config.getResourceLoader().getInstanceDir(), ConfigSolr.SOLR_XML_FILE);
try {
Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8);
writer.write(xml);
@@ -204,8 +202,8 @@ public class SolrXMLCoresLocator impleme
public static class NonPersistingLocator extends SolrXMLCoresLocator {
- public NonPersistingLocator(File file, String originalXML, ConfigSolrXmlOld cfg) {
- super(file, originalXML, cfg);
+ public NonPersistingLocator(String originalXML, ConfigSolrXmlOld cfg) {
+ super(originalXML, cfg);
this.xml = originalXML;
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java Fri Aug 16 18:43:07 2013
@@ -18,12 +18,14 @@
package org.apache.solr.servlet;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.Aliases;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
+import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
@@ -35,9 +37,11 @@ import org.apache.solr.common.util.Conte
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.StrUtils;
+import org.apache.solr.core.ConfigSolr;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrConfig;
import org.apache.solr.core.SolrCore;
+import org.apache.solr.core.SolrResourceLoader;
import org.apache.solr.handler.ContentStreamHandlerBase;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryRequestBase;
@@ -60,6 +64,7 @@ import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -131,12 +136,44 @@ public class SolrDispatchFilter implemen
log.info("SolrDispatchFilter.init() done");
}
+ private ConfigSolr loadConfigSolr(SolrResourceLoader loader) {
+
+ String solrxmlLocation = System.getProperty("solr.solrxml.location", "solrhome");
+
+ if (solrxmlLocation == null || "solrhome".equalsIgnoreCase(solrxmlLocation))
+ return ConfigSolr.fromSolrHome(loader, loader.getInstanceDir());
+
+ if ("zookeeper".equalsIgnoreCase(solrxmlLocation)) {
+ String zkHost = System.getProperty("zkHost");
+ log.info("Trying to read solr.xml from " + zkHost);
+ if (StringUtils.isEmpty(zkHost))
+ throw new SolrException(ErrorCode.SERVER_ERROR,
+ "Could not load solr.xml from zookeeper: zkHost system property not set");
+ SolrZkClient zkClient = new SolrZkClient(zkHost, 30000);
+ try {
+ if (!zkClient.exists("/solr.xml", true))
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Could not load solr.xml from zookeeper: node not found");
+ byte[] data = zkClient.getData("/solr.xml", null, null, true);
+ return ConfigSolr.fromInputStream(loader, new ByteArrayInputStream(data));
+ } catch (Exception e) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Could not load solr.xml from zookeeper", e);
+ } finally {
+ zkClient.close();
+ }
+ }
+
+ throw new SolrException(ErrorCode.SERVER_ERROR,
+ "Bad solr.solrxml.location set: " + solrxmlLocation + " - should be 'solrhome' or 'zookeeper'");
+ }
+
/**
* Override this to change CoreContainer initialization
* @return a CoreContainer to hold this server's cores
*/
protected CoreContainer createCoreContainer() {
- CoreContainer cores = new CoreContainer();
+ SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
+ ConfigSolr config = loadConfigSolr(loader);
+ CoreContainer cores = new CoreContainer(loader, config);
cores.load();
return cores;
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Fri Aug 16 18:43:07 2013
@@ -69,7 +69,7 @@ public class TestLazyCores extends SolrT
FileUtils.write(solrXml, LOTS_SOLR_XML, IOUtils.CHARSET_UTF_8.toString());
ConfigSolrXmlOld config = (ConfigSolrXmlOld) ConfigSolr.fromFile(loader, solrXml);
- CoresLocator locator = new SolrXMLCoresLocator.NonPersistingLocator(solrXml, LOTS_SOLR_XML, config);
+ CoresLocator locator = new SolrXMLCoresLocator.NonPersistingLocator(LOTS_SOLR_XML, config);
final CoreContainer cores = new CoreContainer(loader, config, locator);
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java?rev=1514843&r1=1514842&r2=1514843&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestSolrXmlPersistor.java Fri Aug 16 18:43:07 2013
@@ -35,7 +35,7 @@ public class TestSolrXmlPersistor {
final String solrxml = "<solr><cores adminHandler=\"/admin\"/></solr>";
- SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
assertEquals(persistor.buildSolrXML(EMPTY_CD_LIST),
"<solr><cores adminHandler=\"/admin\"></cores></solr>");
@@ -45,7 +45,7 @@ public class TestSolrXmlPersistor {
public void emptyCoresTagIsPersisted() {
final String solrxml = "<solr><cores adminHandler=\"/admin\"></cores></solr>";
- SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
assertEquals(persistor.buildSolrXML(EMPTY_CD_LIST), "<solr><cores adminHandler=\"/admin\"></cores></solr>");
}
@@ -53,7 +53,7 @@ public class TestSolrXmlPersistor {
public void emptySolrXmlIsPersisted() {
final String solrxml = "<solr></solr>";
- SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
assertEquals(persistor.buildSolrXML(EMPTY_CD_LIST), "<solr><cores></cores></solr>");
}
@@ -68,7 +68,7 @@ public class TestSolrXmlPersistor {
final CoreDescriptor cd = new CoreDescriptor(cc, "testcore", "instance/dir/");
List<CoreDescriptor> cds = ImmutableList.of(cd);
- SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator persistor = new SolrXMLCoresLocator(solrxml, null);
assertEquals(persistor.buildSolrXML(cds),
"<solr><cores>" + SolrXMLCoresLocator.NEWLINE
+ " <core name=\"testcore\" instanceDir=\"instance/dir/\"/>" + SolrXMLCoresLocator.NEWLINE
@@ -89,7 +89,7 @@ public class TestSolrXmlPersistor {
"</cores>" +
"</solr>";
- SolrXMLCoresLocator locator = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator locator = new SolrXMLCoresLocator(solrxml, null);
assertTrue(locator.getTemplate().contains("{{CORES_PLACEHOLDER}}"));
assertTrue(locator.getTemplate().contains("<shardHandlerFactory "));
assertTrue(locator.getTemplate().contains("${socketTimeout:500}"));
@@ -107,15 +107,14 @@ public class TestSolrXmlPersistor {
"</cores>" +
"</solr>";
- SolrXMLCoresLocator locator = new SolrXMLCoresLocator(new File("testfile.xml"), solrxml, null);
+ SolrXMLCoresLocator locator = new SolrXMLCoresLocator(solrxml, null);
assertTrue(locator.getTemplate().contains("{{CORES_PLACEHOLDER}}"));
assertTrue(locator.getTemplate().contains("<shardHandlerFactory "));
}
@Test
public void complexXmlIsParsed() {
- SolrXMLCoresLocator locator = new SolrXMLCoresLocator(new File("testfile.xml"),
- TestSolrXmlPersistence.SOLR_XML_LOTS_SYSVARS, null);
+ SolrXMLCoresLocator locator = new SolrXMLCoresLocator(TestSolrXmlPersistence.SOLR_XML_LOTS_SYSVARS, null);
assertTrue(locator.getTemplate().contains("{{CORES_PLACEHOLDER}}"));
}