SOLR-17088: Fix custom solr.xml usage in tests with extra jettys (#2437)
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 0d90102..5e0461f 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -162,6 +162,7 @@
private final Path baseDir;
private CloudSolrClient solrClient;
private final JettyConfig jettyConfig;
+ private final String solrXml;
private final boolean trackJettyMetrics;
private final AtomicInteger nodeIds = new AtomicInteger();
@@ -276,6 +277,7 @@
Objects.requireNonNull(securityJson);
this.baseDir = Objects.requireNonNull(baseDir);
this.jettyConfig = Objects.requireNonNull(jettyConfig);
+ this.solrXml = solrXml == null ? DEFAULT_CLOUD_SOLR_XML : solrXml;
this.trackJettyMetrics = trackJettyMetrics;
log.info("Starting cluster of {} servers in {}", numServers, baseDir);
@@ -478,18 +480,18 @@
*
* @param name the instance name
* @param config a JettyConfig for the instance's {@link org.apache.solr.embedded.JettySolrRunner}
- * @param solrXml the string content of the solr.xml file to use, or null to just use default
+ * @param solrXml the string content of the solr.xml file to use, or null to just use the
+ * cluster's default
* @return a JettySolrRunner
*/
public JettySolrRunner startJettySolrRunner(String name, JettyConfig config, String solrXml)
throws Exception {
- // tell solr node to look in zookeeper for solr.xml
final Properties nodeProps = new Properties();
nodeProps.setProperty("zkHost", zkServer.getZkAddress());
Path runnerPath = createInstancePath(name);
if (solrXml == null) {
- solrXml = DEFAULT_CLOUD_SOLR_XML;
+ solrXml = this.solrXml;
}
Files.write(runnerPath.resolve("solr.xml"), solrXml.getBytes(StandardCharsets.UTF_8));
JettyConfig newConfig = JettyConfig.builder(config).build();