From 980c23f49800e7345afbac911b58cf7185e7ded7 Mon Sep 17 00:00:00 2001 From: Steven Rowe Date: Fri, 12 Dec 2014 19:05:02 +0000 Subject: [PATCH] SOLR-6844: Rename ConfigSolr.getZkHostPort(), which actually returns the Solr port, to .getSolrHostPort() git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1645034 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../core/src/java/org/apache/solr/core/ConfigSolr.java | 2 +- .../src/java/org/apache/solr/core/ZkContainer.java | 10 +++++----- .../test/org/apache/solr/cloud/SolrXmlInZkTest.java | 6 +++--- .../src/test/org/apache/solr/core/TestSolrXml.java | 6 ++---- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index d5d735b30f4..71e735f2047 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -486,6 +486,9 @@ Other Changes * SOLR-6843: JMX RMI connector should be disabled by default but can be activated by setting ENABLE_REMOTE_JMX_OPTS to true in solr.in.(sh|cmd). (Timothy Potter) + +* SOLR-6844: Rename ConfigSolr.getZkHostPort(), which actually returns the Solr port, + to .getSolrHostPort(). (Martijn Koster, Steve Rowe) ================== 4.10.3 ================== diff --git a/solr/core/src/java/org/apache/solr/core/ConfigSolr.java b/solr/core/src/java/org/apache/solr/core/ConfigSolr.java index 390ef8285ff..511c8f09ee2 100644 --- a/solr/core/src/java/org/apache/solr/core/ConfigSolr.java +++ b/solr/core/src/java/org/apache/solr/core/ConfigSolr.java @@ -141,7 +141,7 @@ public abstract class ConfigSolr { protected static final String DEFAULT_CORE_ADMIN_PATH = "/admin/cores"; - public String getZkHostPort() { + public String getSolrHostPort() { return get(CfgProp.SOLR_HOSTPORT, null); } diff --git a/solr/core/src/java/org/apache/solr/core/ZkContainer.java b/solr/core/src/java/org/apache/solr/core/ZkContainer.java index 5bedf3ed366..5f17910de64 100644 --- a/solr/core/src/java/org/apache/solr/core/ZkContainer.java +++ b/solr/core/src/java/org/apache/solr/core/ZkContainer.java @@ -62,11 +62,11 @@ public class ZkContainer { } initZooKeeper(cc, solrHome, - config.getZkHost(), config.getZkClientTimeout(), config.getZkHostPort(), config.getZkHostContext(), + config.getZkHost(), config.getZkClientTimeout(), config.getSolrHostPort(), config.getZkHostContext(), config.getHost(), config.getLeaderVoteWait(), config.getLeaderConflictResolveWait(), config.getGenericCoreNodeNames()); } - public void initZooKeeper(final CoreContainer cc, String solrHome, String zkHost, int zkClientTimeout, String hostPort, + public void initZooKeeper(final CoreContainer cc, String solrHome, String zkHost, int zkClientTimeout, String solrHostPort, String hostContext, String host, int leaderVoteWait, int leaderConflictResolveWait, boolean genericCoreNodeNames) { ZkController zkController = null; @@ -84,7 +84,7 @@ public class ZkContainer { if (zkRun == null && zookeeperHost == null) return; // not in zk mode - if (null == hostPort) { + if (null == solrHostPort) { throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR, "'hostPort' must be configured to run SolrCloud"); } @@ -101,7 +101,7 @@ public class ZkContainer { if (zkRun != null) { String zkDataHome = System.getProperty("zkServerDataDir", solrHome + "zoo_data"); String zkConfHome = System.getProperty("zkServerConfDir", solrHome); - zkServer = new SolrZkServer(stripChroot(zkRun), stripChroot(zookeeperHost), zkDataHome, zkConfHome, hostPort); + zkServer = new SolrZkServer(stripChroot(zkRun), stripChroot(zookeeperHost), zkDataHome, zkConfHome, solrHostPort); zkServer.parseConfig(); zkServer.start(); @@ -132,7 +132,7 @@ public class ZkContainer { "A chroot was specified in ZkHost but the znode doesn't exist. " + zookeeperHost); } zkController = new ZkController(cc, zookeeperHost, zkClientTimeout, - zkClientConnectTimeout, host, hostPort, hostContext, + zkClientConnectTimeout, host, solrHostPort, hostContext, leaderVoteWait, leaderConflictResolveWait, genericCoreNodeNames, new CurrentCoreDescriptorProvider() { diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java index 03d2b5ecd4b..ccde4bba17d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java @@ -119,7 +119,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 { try { setUpZkAndDiskXml(true, true); assertEquals("Should have gotten a new port the xml file sent to ZK, overrides the copy on disk", - cfg.getZkHostPort(), "9045"); + cfg.getSolrHostPort(), "9045"); } finally { closeZK(); } @@ -130,7 +130,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 { try { setUpZkAndDiskXml(true, false); assertEquals("Should have gotten a new port the xml file sent to ZK", - cfg.getZkHostPort(), "9045"); + cfg.getSolrHostPort(), "9045"); } finally { closeZK(); } @@ -169,7 +169,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 { try { System.clearProperty("solr.solrxml.location"); setUpZkAndDiskXml(false, true); - assertEquals("Should have gotten the default port", cfg.getZkHostPort(), "8983"); + assertEquals("Should have gotten the default port", cfg.getSolrHostPort(), "8983"); } finally { closeZK(); } diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java b/solr/core/src/test/org/apache/solr/core/TestSolrXml.java index ab6e9b33a2e..817b178b82d 100644 --- a/solr/core/src/test/org/apache/solr/core/TestSolrXml.java +++ b/solr/core/src/test/org/apache/solr/core/TestSolrXml.java @@ -19,11 +19,9 @@ package org.apache.solr.core; import java.io.File; import java.io.IOException; -import java.util.Random; import java.util.Locale; import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule; -import com.google.common.base.Charsets; import org.apache.commons.io.FileUtils; import org.apache.lucene.util.TestUtil; import org.apache.solr.SolrTestCaseJ4; @@ -76,7 +74,7 @@ public class TestSolrXml extends SolrTestCaseJ4 { assertEquals("max update conn/host", 37, cfg.getMaxUpdateConnectionsPerHost()); assertEquals("host", "testHost", cfg.getHost()); assertEquals("zk host context", "testHostContext", cfg.getZkHostContext()); - assertEquals("zk host port", "44", cfg.getZkHostPort()); + assertEquals("solr host port", "44", cfg.getSolrHostPort()); assertEquals("leader vote wait", 55, cfg.getLeaderVoteWait()); assertEquals("logging class", "testLoggingClass", cfg.getLogWatcherConfig().getLoggingClass()); assertEquals("log watcher", true, cfg.getLogWatcherConfig().isEnabled()); @@ -106,7 +104,7 @@ public class TestSolrXml extends SolrTestCaseJ4 { ConfigSolr cfg = ConfigSolr.fromSolrHome(loader, solrHome.getAbsolutePath()); assertEquals("core root dir", "myCoreRoot" + File.separator, cfg.getCoreRootDirectory()); - assertEquals("zk host port", "8888", cfg.getZkHostPort()); + assertEquals("solr host port", "8888", cfg.getSolrHostPort()); assertEquals("schema cache", false, cfg.hasSchemaCache()); }