127.0.0.1
${hostPort:8983}
- ${hostContext:solr}
${solr.zkclienttimeout:30000}
${genericCoreNodeNames:true}
0
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java
index aa523e2f5e0..60e3cff52cd 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttp2SolrClient.java
@@ -271,7 +271,7 @@ public String getHomeDir() {
}
public String getUrl() {
- return buildUrl(port, "/solr/collection1");
+ return buildUrl(port) + "/collection1";
}
public String getSchemaFile() {
@@ -320,8 +320,7 @@ public void startJetty() throws Exception {
props.setProperty("solrconfig", "bad_solrconfig.xml");
props.setProperty("solr.data.dir", getDataDir());
- JettyConfig jettyConfig =
- JettyConfig.builder(buildJettyConfig("/solr")).setPort(port).build();
+ JettyConfig jettyConfig = JettyConfig.builder(buildJettyConfig()).setPort(port).build();
jetty = new JettySolrRunner(getHomeDir(), props, jettyConfig);
jetty.start();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java
index c251afdba91..f53139d53ba 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrClient.java
@@ -274,7 +274,7 @@ public String getHomeDir() {
}
public String getUrl() {
- return buildUrl(port, "/solr/collection1");
+ return buildUrl(port) + "/collection1";
}
public String getSchemaFile() {
@@ -323,8 +323,7 @@ public void startJetty() throws Exception {
props.setProperty("solrconfig", "bad_solrconfig.xml");
props.setProperty("solr.data.dir", getDataDir());
- JettyConfig jettyConfig =
- JettyConfig.builder(buildJettyConfig("/solr")).setPort(port).build();
+ JettyConfig jettyConfig = JettyConfig.builder(buildJettyConfig()).setPort(port).build();
jetty = new JettySolrRunner(getHomeDir(), props, jettyConfig);
jetty.start();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
index 20b651e4f9f..ec631da7081 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
@@ -43,7 +43,6 @@
*/
public class JettyWebappTest extends SolrTestCaseJ4 {
int port = 0;
- static final String context = "/test";
Server server;
@@ -64,7 +63,7 @@ public void setUp() throws Exception {
// insecure: only use for tests!!!!
server.setSessionIdManager(
new DefaultSessionIdManager(server, new Random(random().nextLong())));
- new WebAppContext(server, path, context);
+ new WebAppContext(server, path, "/solr");
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
connector.setIdleTimeout(1000 * 60 * 60);
@@ -89,10 +88,8 @@ public void tearDown() throws Exception {
}
public void testAdminUI() throws Exception {
- // Currently not an extensive test, but it does fire up the JSP pages and make
- // sure they compile ok
-
- String adminPath = "http://127.0.0.1:" + port + context + "/";
+ // Not an extensive test, but it does connect to Solr and verify the Admin ui shows up.
+ String adminPath = "http://127.0.0.1:" + port + "/solr/";
try (InputStream is = new URL(adminPath).openStream()) {
assertNotNull(is.readAllBytes()); // real error will be an exception
}
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
index 20853430218..d678106f873 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/TestCloudSolrClientConnections.java
@@ -32,8 +32,7 @@ public class TestCloudSolrClientConnections extends SolrTestCaseJ4 {
public void testCloudClientCanConnectAfterClusterComesUp() throws Exception {
// Start by creating a cluster with no jetties
- MiniSolrCloudCluster cluster =
- new MiniSolrCloudCluster(0, createTempDir(), buildJettyConfig("/solr"));
+ MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(0, createTempDir(), buildJettyConfig());
try {
CloudSolrClient client = cluster.getSolrClient();
@@ -61,8 +60,7 @@ public void testCloudClientUploads() throws Exception {
Path configPath = getFile("solrj").toPath().resolve("solr/configsets/configset-2/conf");
- MiniSolrCloudCluster cluster =
- new MiniSolrCloudCluster(0, createTempDir(), buildJettyConfig("/solr"));
+ MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(0, createTempDir(), buildJettyConfig());
try {
CloudSolrClient client = cluster.getSolrClient();
SolrException e =
@@ -94,9 +92,9 @@ public void testCloudClientUploads() throws Exception {
public void testAlreadyClosedClusterStateProvider() throws Exception {
final MiniSolrCloudCluster cluster =
- new MiniSolrCloudCluster(1, createTempDir(), buildJettyConfig("/solr"));
+ new MiniSolrCloudCluster(1, createTempDir(), buildJettyConfig());
// from a client perspective the behavior of ZkClientClusterStateProvider should be
- // consistent regardless of wether it's constructed with a zkhost or an existing ZkStateReader
+ // consistent regardless of whether it's constructed with a zkhost or an existing ZkStateReader
try {
final ZkClientClusterStateProvider zkHost_provider =
new ZkClientClusterStateProvider(cluster.getZkServer().getZkAddress());
diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
index ff3b8a17c8c..d466d993a48 100644
--- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -46,7 +46,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.Filter;
import org.apache.commons.io.FileUtils;
-import org.apache.lucene.tests.util.TestUtil;
import org.apache.lucene.util.Constants;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrResponse;
@@ -122,60 +121,6 @@ public static void initialize() {
r = new Random(random().nextLong());
}
- /**
- * Set's the value of the "hostContext" system property to a random path like string (which may or
- * may not contain sub-paths). This is used in the default constructor for this test to help
- * ensure no code paths have hardcoded assumptions about the servlet context used to run solr.
- *
- * Test configs may use the ${hostContext}
variable to access this system
- * property.
- *
- * @see #BaseDistributedSearchTestCase()
- * @see #clearHostContext
- */
- @BeforeClass
- public static void initHostContext() {
- // Can't use randomRealisticUnicodeString because unescaped unicode is
- // not allowed in URL paths
- // Can't use URLEncoder.encode(randomRealisticUnicodeString) because
- // Jetty freaks out and returns 404's when the context uses escapes
-
- StringBuilder hostContext = new StringBuilder("/");
- if (random().nextBoolean()) {
- // half the time we use the root context, the other half...
-
- // Remember: randomSimpleString might be the empty string
- hostContext.append(TestUtil.randomSimpleString(random(), 2));
- if (random().nextBoolean()) {
- hostContext.append("_");
- }
- hostContext.append(TestUtil.randomSimpleString(random(), 3));
- if (!"/".equals(hostContext.toString())) {
- // if our random string is empty, this might add a trailing slash,
- // but our code should be ok with that
- hostContext.append("/").append(TestUtil.randomSimpleString(random(), 2));
- } else {
- // we got 'lucky' and still just have the root context,
- // NOOP: don't try to add a subdir to nothing (ie "//" is bad)
- }
- }
- // paranoia, we *really* don't want to ever get "//" in a path...
- final String hc = hostContext.toString().replaceAll("/+", "/");
-
- log.info("Setting hostContext system property: {}", hc);
- System.setProperty("hostContext", hc);
- }
-
- /**
- * Clears the "hostContext" system property
- *
- * @see #initHostContext
- */
- @AfterClass
- public static void clearHostContext() throws Exception {
- System.clearProperty("hostContext");
- }
-
@SuppressWarnings("deprecation")
@BeforeClass
public static void setSolrDisableShardsWhitelist() throws Exception {
@@ -189,40 +134,17 @@ public static void clearSolrDisableShardsWhitelist() throws Exception {
}
private static String getHostContextSuitableForServletContext() {
- String ctx = System.getProperty("hostContext", "/solr");
- if (ctx == null || ctx.isEmpty()) ctx = "/solr";
- if (ctx.endsWith("/")) ctx = ctx.substring(0, ctx.length() - 1);
- if (!ctx.startsWith("/")) ctx = "/" + ctx;
- return ctx;
+ return "/solr";
}
- /**
- * Constructs a test in which the jetty+solr instances as well as the solr clients all use the
- * value of the "hostContext" system property.
- *
- *
If the system property is not set, or is set to the empty string (neither of which should
- * normally happen unless a subclass explicitly modifies the property set by {@link
- * #initHostContext} prior to calling this constructor) a servlet context of "/solr" is used.
- * (this is for consistency with the default behavior of solr.xml parsing when using
- * hostContext="${hostContext:}"
- *
- *
If the system property is set to a value which does not begin with a "/" (which should
- * normally happen unless a subclass explicitly modifies the property set by {@link
- * #initHostContext} prior to calling this constructor) a leading "/" will be prepended.
- *
- * @see #initHostContext
- */
protected BaseDistributedSearchTestCase() {
- this(getHostContextSuitableForServletContext());
- }
-
- /**
- * @param context explicit servlet context path to use (eg: "/solr")
- */
- protected BaseDistributedSearchTestCase(final String context) {
- this.context = context;
+ String solrHostContext = "/solr";
this.deadServers =
- new String[] {DEAD_HOST_1 + context, DEAD_HOST_2 + context, DEAD_HOST_3 + context};
+ new String[] {
+ DEAD_HOST_1 + solrHostContext,
+ DEAD_HOST_2 + solrHostContext,
+ DEAD_HOST_3 + solrHostContext
+ };
// Speed up the test cycle by only running a single configuration instead of the repeat rule
if (TEST_NIGHTLY == false) {
@@ -250,7 +172,6 @@ public void fixShardCount(int count) {
protected final List clients = Collections.synchronizedList(new ArrayList<>());
protected final List jettys = Collections.synchronizedList(new ArrayList<>());
- protected volatile String context;
protected volatile String[] deadServers;
protected volatile String shards;
protected volatile String[] shardsArr;
@@ -508,7 +429,6 @@ public JettySolrRunner createJetty(
props,
JettyConfig.builder()
.stopAtShutdown(true)
- .setContext(context)
.withFilters(getExtraRequestFilters())
.withServlets(getExtraServlets())
.withSSLConfig(sslConfig.buildServerSSLConfig())
@@ -546,10 +466,6 @@ protected String getServerUrl(int port) {
}
}
- protected String buildUrl(int port) {
- return buildUrl(port, context);
- }
-
protected static void addFields(SolrInputDocument doc, Object... fields) {
for (int i = 0; i < fields.length; i += 2) {
doc.addField((String) (fields[i]), fields[i + 1]);
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
index 3f946add592..2042b24a498 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
@@ -69,7 +69,6 @@ public static JettySolrRunner createAndStartJetty(
JettyConfig jettyConfig =
JettyConfig.builder()
- .setContext(context)
.stopAtShutdown(stopAtShutdown)
.withServlets(extraServlets)
.withSSLConfig(sslConfig.buildServerSSLConfig())
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
index 42dc8b3aeb7..26234b5e9f3 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseHS.java
@@ -510,7 +510,6 @@ public void start() throws Exception {
JettyConfig jettyConfig =
JettyConfig.builder()
.stopAtShutdown(true)
- .setContext("/solr")
.setPort(port)
.withSSLConfig(sslConfig.buildServerSSLConfig())
.build();
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
index 47e0b473fb9..ba96e729562 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -520,15 +520,12 @@ private static SSLTestConfig buildSSLConfig() {
return result;
}
- protected static JettyConfig buildJettyConfig(String context) {
- return JettyConfig.builder()
- .setContext(context)
- .withSSLConfig(sslConfig.buildServerSSLConfig())
- .build();
+ protected static JettyConfig buildJettyConfig() {
+ return JettyConfig.builder().withSSLConfig(sslConfig.buildServerSSLConfig()).build();
}
- protected static String buildUrl(final int port, final String context) {
- return (isSSLMode() ? "https" : "http") + "://127.0.0.1:" + port + context;
+ protected static String buildUrl(final int port) {
+ return (isSSLMode() ? "https" : "http") + "://127.0.0.1:" + port + "/solr";
}
protected static MockTokenizer whitespaceMockTokenizer(Reader input) throws IOException {
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
index b21aa73831a..e2f2074873d 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
@@ -729,7 +729,6 @@ public JettySolrRunner createJetty(
JettyConfig jettyconfig =
JettyConfig.builder()
- .setContext(context)
.stopAtShutdown(false)
.withServlets(getExtraServlets())
.withFilters(getExtraRequestFilters())
@@ -775,7 +774,6 @@ public JettySolrRunner createJetty(
JettyConfig jettyconfig =
JettyConfig.builder()
- .setContext(context)
.stopAtShutdown(false)
.withServlets(getExtraServlets())
.withFilters(getExtraRequestFilters())
@@ -814,7 +812,6 @@ public JettySolrRunner createProxiedJetty(
JettyConfig jettyconfig =
JettyConfig.builder()
- .setContext(context)
.stopAtShutdown(false)
.withServlets(getExtraServlets())
.withFilters(getExtraRequestFilters())
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 704cbfa8589..3a4d41d0420 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
@@ -121,7 +121,6 @@ public class MiniSolrCloudCluster {
+ " \n"
+ " 127.0.0.1\n"
+ " ${hostPort:8983}\n"
- + " ${hostContext:solr}\n"
+ " ${solr.zkclienttimeout:30000}\n"
+ " ${genericCoreNodeNames:true}\n"
+ " ${leaderVoteWait:10000}\n"
@@ -177,61 +176,6 @@ public MiniSolrCloudCluster(int numServers, Path baseDir, JettyConfig jettyConfi
this(numServers, baseDir, DEFAULT_CLOUD_SOLR_XML, jettyConfig, null, false);
}
- /**
- * Create a MiniSolrCloudCluster
- *
- * @param numServers number of Solr servers to start
- * @param hostContext context path of Solr servers used by Jetty
- * @param baseDir base directory that the mini cluster should be run from
- * @param solrXml solr.xml file to be uploaded to ZooKeeper
- * @param extraServlets Extra servlets to be started by Jetty
- * @param extraRequestFilters extra filters to be started by Jetty
- * @throws Exception if there was an error starting the cluster
- */
- public MiniSolrCloudCluster(
- int numServers,
- String hostContext,
- Path baseDir,
- String solrXml,
- SortedMap extraServlets,
- SortedMap, String> extraRequestFilters)
- throws Exception {
- this(numServers, hostContext, baseDir, solrXml, extraServlets, extraRequestFilters, null);
- }
-
- /**
- * Create a MiniSolrCloudCluster
- *
- * @param numServers number of Solr servers to start
- * @param hostContext context path of Solr servers used by Jetty
- * @param baseDir base directory that the mini cluster should be run from
- * @param solrXml solr.xml file to be uploaded to ZooKeeper
- * @param extraServlets Extra servlets to be started by Jetty
- * @param extraRequestFilters extra filters to be started by Jetty
- * @param sslConfig SSL configuration
- * @throws Exception if there was an error starting the cluster
- */
- public MiniSolrCloudCluster(
- int numServers,
- String hostContext,
- Path baseDir,
- String solrXml,
- SortedMap extraServlets,
- SortedMap, String> extraRequestFilters,
- SSLConfig sslConfig)
- throws Exception {
- this(
- numServers,
- baseDir,
- solrXml,
- JettyConfig.builder()
- .setContext(hostContext)
- .withSSLConfig(sslConfig)
- .withFilters(extraRequestFilters)
- .withServlets(extraServlets)
- .build());
- }
-
/**
* Create a MiniSolrCloudCluster
*
@@ -370,7 +314,7 @@ public MiniSolrCloudCluster(
List> startups = new ArrayList<>(numServers);
for (int i = 0; i < numServers; ++i) {
- startups.add(() -> startJettySolrRunner(newNodeName(), jettyConfig.context, jettyConfig));
+ startups.add(() -> startJettySolrRunner(newNodeName(), jettyConfig));
}
final ExecutorService executorLauncher =
@@ -510,13 +454,12 @@ public JettySolrRunner startJettySolrRunner(
SortedMap extraServlets,
SortedMap, String> extraRequestFilters)
throws Exception {
- return startJettySolrRunner(name, hostContext, extraServlets, extraRequestFilters, null);
+ return startJettySolrRunner(name, extraServlets, extraRequestFilters, null);
}
/**
* Start a new Solr instance
*
- * @param hostContext context path of Solr servers used by Jetty
* @param extraServlets Extra servlets to be started by Jetty
* @param extraRequestFilters extra filters to be started by Jetty
* @param sslConfig SSL configuration
@@ -524,14 +467,12 @@ public JettySolrRunner startJettySolrRunner(
*/
public JettySolrRunner startJettySolrRunner(
String name,
- String hostContext,
SortedMap extraServlets,
SortedMap, String> extraRequestFilters,
SSLConfig sslConfig)
throws Exception {
return startJettySolrRunner(
name,
- hostContext,
JettyConfig.builder()
.withServlets(extraServlets)
.withFilters(extraRequestFilters)
@@ -547,19 +488,16 @@ public JettySolrRunner getJettySolrRunner(int index) {
* Start a new Solr instance on a particular servlet context
*
* @param name the instance name
- * @param hostContext the context to run on
* @param config a JettyConfig for the instance's {@link org.apache.solr.embedded.JettySolrRunner}
* @return a JettySolrRunner
*/
- public JettySolrRunner startJettySolrRunner(String name, String hostContext, JettyConfig config)
- throws Exception {
+ public JettySolrRunner startJettySolrRunner(String name, JettyConfig config) 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);
- String context = getHostContextSuitableForServletContext(hostContext);
- JettyConfig newConfig = JettyConfig.builder(config).setContext(context).build();
+ JettyConfig newConfig = JettyConfig.builder(config).build();
JettySolrRunner jetty =
!trackJettyMetrics
? new JettySolrRunner(runnerPath.toString(), nodeProps, newConfig)
@@ -578,7 +516,7 @@ public JettySolrRunner startJettySolrRunner(String name, String hostContext, Jet
* @return a JettySolrRunner
*/
public JettySolrRunner startJettySolrRunner() throws Exception {
- return startJettySolrRunner(newNodeName(), jettyConfig.context, jettyConfig);
+ return startJettySolrRunner(newNodeName(), jettyConfig);
}
/**
@@ -1117,7 +1055,7 @@ public Builder(int nodeCount, Path baseDir) {
this.nodeCount = nodeCount;
this.baseDir = baseDir;
- jettyConfigBuilder = JettyConfig.builder().setContext("/solr");
+ jettyConfigBuilder = JettyConfig.builder();
if (SolrTestCaseJ4.sslConfig != null) {
jettyConfigBuilder =
jettyConfigBuilder.withSSLConfig(SolrTestCaseJ4.sslConfig.buildServerSSLConfig());
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
index 8bcd85077b7..70f1a38e18e 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/api/collections/AbstractInstallShardTest.java
@@ -224,7 +224,6 @@ public static String defaultSolrXmlTextWithBackupRepository(String backupReposit
+ " \n"
+ " 127.0.0.1\n"
+ " ${hostPort:8983}\n"
- + " ${hostContext:solr}\n"
+ " ${solr.zkclienttimeout:30000}\n"
+ " ${genericCoreNodeNames:true}\n"
+ " 10000\n"
diff --git a/solr/test-framework/src/java/org/apache/solr/embedded/JettyConfig.java b/solr/test-framework/src/java/org/apache/solr/embedded/JettyConfig.java
index b03b1c234db..cbaad484503 100644
--- a/solr/test-framework/src/java/org/apache/solr/embedded/JettyConfig.java
+++ b/solr/test-framework/src/java/org/apache/solr/embedded/JettyConfig.java
@@ -28,7 +28,6 @@ public class JettyConfig {
public final boolean onlyHttp1;
public final int port;
public final int portRetryTime;
- public final String context;
public final boolean stopAtShutdown;
public final Long waitForLoadingCoresToFinishMs;
public final Map extraServlets;
@@ -40,7 +39,6 @@ private JettyConfig(
boolean onlyHttp1,
int port,
int portRetryTime,
- String context,
boolean stopAtShutdown,
Long waitForLoadingCoresToFinishMs,
Map extraServlets,
@@ -50,7 +48,6 @@ private JettyConfig(
this.onlyHttp1 = onlyHttp1;
this.port = port;
this.portRetryTime = portRetryTime;
- this.context = context;
this.stopAtShutdown = stopAtShutdown;
this.waitForLoadingCoresToFinishMs = waitForLoadingCoresToFinishMs;
this.extraServlets = extraServlets;
@@ -69,7 +66,6 @@ public static Builder builder(JettyConfig other) {
builder.onlyHttp1 = other.onlyHttp1;
builder.port = other.port;
builder.portRetryTime = other.portRetryTime;
- builder.context = other.context;
builder.stopAtShutdown = other.stopAtShutdown;
builder.waitForLoadingCoresToFinishMs = other.waitForLoadingCoresToFinishMs;
builder.extraServlets = other.extraServlets;
@@ -83,7 +79,6 @@ public static class Builder {
boolean onlyHttp1 = false;
int port = 0;
- String context = "/solr";
boolean enableV2 = true;
boolean stopAtShutdown = true;
Long waitForLoadingCoresToFinishMs = 300000L;
@@ -107,11 +102,6 @@ public Builder setPort(int port) {
return this;
}
- public Builder setContext(String context) {
- this.context = context;
- return this;
- }
-
public Builder stopAtShutdown(boolean stopAtShutdown) {
this.stopAtShutdown = stopAtShutdown;
return this;
@@ -157,7 +147,6 @@ public JettyConfig build() {
onlyHttp1,
port,
portRetryTime,
- context,
stopAtShutdown,
waitForLoadingCoresToFinishMs,
extraServlets,
diff --git a/solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java b/solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
index 27d3052e74a..1130df5d7ce 100644
--- a/solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
+++ b/solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
@@ -217,11 +217,10 @@ private void executeDelay() {
* After construction, you must start the jetty with {@link #start()}
*
* @param solrHome the solr home directory to use
- * @param context the context to run in
* @param port the port to run on
*/
- public JettySolrRunner(String solrHome, String context, int port) {
- this(solrHome, JettyConfig.builder().setContext(context).setPort(port).build());
+ public JettySolrRunner(String solrHome, int port) {
+ this(solrHome, JettyConfig.builder().setPort(port).build());
}
/**
@@ -373,7 +372,7 @@ private void init(int port) {
{
// Initialize the servlets
final ServletContextHandler root =
- new ServletContextHandler(server, config.context, ServletContextHandler.SESSIONS);
+ new ServletContextHandler(server, "/solr", ServletContextHandler.SESSIONS);
root.setResourceBase(".");
server.addEventListener(
@@ -396,7 +395,6 @@ public synchronized void lifeCycleStarted(LifeCycle arg0) {
int port = jettyPort;
if (proxyPort != -1) port = proxyPort;
nodeProperties.setProperty("hostPort", Integer.toString(port));
- nodeProperties.setProperty("hostContext", config.context);
root.getServletContext()
.setAttribute(SolrDispatchFilter.PROPERTIES_ATTRIBUTE, nodeProperties);
@@ -840,7 +838,7 @@ public void setProxyPort(int proxyPort) {
*/
public URL getBaseUrl() {
try {
- return new URL(protocol, host, jettyPort, config.context);
+ return new URL(protocol, host, jettyPort, "/solr");
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
@@ -859,7 +857,7 @@ public URL getBaseURLV2() {
*/
public URL getProxyBaseUrl() {
try {
- return new URL(protocol, host, getLocalPort(), config.context);
+ return new URL(protocol, host, getLocalPort(), "/solr");
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
@@ -893,7 +891,7 @@ public void service(HttpServletRequest req, HttpServletResponse res) throws IOEx
/** A main class that starts jetty+solr This is useful for debugging */
public static void main(String[] args) throws Exception {
- JettySolrRunner jetty = new JettySolrRunner(".", "/solr", 8983);
+ JettySolrRunner jetty = new JettySolrRunner(".", 8983);
jetty.start();
}
diff --git a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
index 662b23f08ea..3384a03d0be 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
@@ -189,9 +189,7 @@ public static NodeConfig buildTestNodeConfig(Path solrHome) {
(null == System.getProperty("zkHost"))
? null
: new CloudConfig.CloudConfigBuilder(
- System.getProperty("host"),
- Integer.getInteger("hostPort", 8983),
- System.getProperty("hostContext", ""))
+ System.getProperty("host"), Integer.getInteger("hostPort", 8983))
.setZkClientTimeout(Integer.getInteger("zkClientTimeout", 30000))
.setZkHost(System.getProperty("zkHost"))
.build();
diff --git a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
index 26024ff548d..49b68a134fb 100644
--- a/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
+++ b/solr/test-framework/src/test/org/apache/solr/cloud/MiniSolrCloudClusterTest.java
@@ -56,10 +56,10 @@ public void testErrorsInStartup() throws Exception {
cluster =
new MiniSolrCloudCluster(3, createTempDir(), JettyConfig.builder().build()) {
@Override
- public JettySolrRunner startJettySolrRunner(
- String name, String context, JettyConfig config) throws Exception {
+ public JettySolrRunner startJettySolrRunner(String name, JettyConfig config)
+ throws Exception {
if (jettyIndex.incrementAndGet() != 2)
- return super.startJettySolrRunner(name, context, config);
+ return super.startJettySolrRunner(name, config);
throw new IOException("Fake exception on startup!");
}
};
@@ -199,15 +199,15 @@ public void testJettyUsingSysProp() throws Exception {
final MiniSolrCloudCluster x =
new MiniSolrCloudCluster(1, createTempDir(), JettyConfig.builder().build()) {
@Override
- public JettySolrRunner startJettySolrRunner(
- String name, String hostContext, JettyConfig config) throws Exception {
+ public JettySolrRunner startJettySolrRunner(String name, JettyConfig config)
+ throws Exception {
System.setProperty("zkHost", getZkServer().getZkAddress());
final Properties nodeProps = new Properties();
nodeProps.setProperty("test-from-sysprop", "yup");
Path runnerPath = createTempDir(name);
- JettyConfig newConfig = JettyConfig.builder(config).setContext("/blarfh").build();
+ JettyConfig newConfig = JettyConfig.builder(config).build();
JettySolrRunner jetty =
new JettySolrRunner(runnerPath.toString(), nodeProps, newConfig);
return super.startJettySolrRunner(jetty);
diff --git a/solr/test-framework/src/test/org/apache/solr/embedded/TestJettySolrRunner.java b/solr/test-framework/src/test/org/apache/solr/embedded/TestJettySolrRunner.java
index 2fc1299a734..34f48b79fe4 100644
--- a/solr/test-framework/src/test/org/apache/solr/embedded/TestJettySolrRunner.java
+++ b/solr/test-framework/src/test/org/apache/solr/embedded/TestJettySolrRunner.java
@@ -48,7 +48,7 @@ public void testPassSolrHomeToRunner() throws Exception {
.replace("COREROOT", coresDir.toString());
Files.write(solrHome.resolve("solr.xml"), solrxml.getBytes(StandardCharsets.UTF_8));
- JettyConfig jettyConfig = buildJettyConfig("/solr");
+ JettyConfig jettyConfig = buildJettyConfig();
JettySolrRunner runner =
new JettySolrRunner(solrHome.toString(), new Properties(), jettyConfig);