mirror of https://github.com/apache/lucene.git
SOLR-7688: JettyConfig cannot be used with extra filters
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1685923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
faa80ae324
commit
5a0c012250
|
@ -20,6 +20,7 @@ package org.apache.solr.client.solrj.embedded;
|
|||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class JettyConfig {
|
|||
boolean stopAtShutdown = true;
|
||||
Long waitForLoadingCoresToFinishMs = 300000L;
|
||||
Map<ServletHolder, String> extraServlets = new TreeMap<>();
|
||||
Map<Class<? extends Filter>, String> extraFilters = new TreeMap<>();
|
||||
Map<Class<? extends Filter>, String> extraFilters = new LinkedHashMap<>();
|
||||
SSLConfig sslConfig = null;
|
||||
|
||||
public Builder setPort(int port) {
|
||||
|
@ -95,8 +96,8 @@ public class JettyConfig {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder withServlet(ServletHolder servlet, String servletName) {
|
||||
extraServlets.put(servlet, servletName);
|
||||
public Builder withServlet(ServletHolder servlet, String pathSpec) {
|
||||
extraServlets.put(servlet, pathSpec);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -106,8 +107,8 @@ public class JettyConfig {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder withFilter(Class<? extends Filter> filterClass, String filterName) {
|
||||
extraFilters.put(filterClass, filterName);
|
||||
public Builder withFilter(Class<? extends Filter> filterClass, String pathSpec) {
|
||||
extraFilters.put(filterClass, pathSpec);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class TestMiniSolrCloudCluster extends LuceneTestCase {
|
|||
assertEquals(NUM_SERVERS - 1, miniCluster.getJettySolrRunners().size());
|
||||
|
||||
// create a server
|
||||
JettySolrRunner startedServer = miniCluster.startJettySolrRunner(null, null, null);
|
||||
JettySolrRunner startedServer = miniCluster.startJettySolrRunner();
|
||||
assertTrue(startedServer.isRunning());
|
||||
assertEquals(NUM_SERVERS, miniCluster.getJettySolrRunners().size());
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class TestMiniSolrCloudCluster extends LuceneTestCase {
|
|||
// now restore the original state so that this function could be called multiple times
|
||||
|
||||
// re-create a server (to restore original NUM_SERVERS count)
|
||||
startedServer = miniCluster.startJettySolrRunner(null, null, null);
|
||||
startedServer = miniCluster.startJettySolrRunner();
|
||||
assertTrue(startedServer.isRunning());
|
||||
assertEquals(NUM_SERVERS, miniCluster.getJettySolrRunners().size());
|
||||
Thread.sleep(15000);
|
||||
|
@ -257,4 +257,14 @@ public class TestMiniSolrCloudCluster extends LuceneTestCase {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExraFilters() throws Exception {
|
||||
File solrXml = new File(SolrTestCaseJ4.TEST_HOME(), "solr-no-core.xml");
|
||||
Builder jettyConfig = JettyConfig.builder();
|
||||
jettyConfig.waitForLoadingCoresToFinish(null);
|
||||
jettyConfig.withFilter(JettySolrRunner.DebugFilter.class, "*");
|
||||
MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir().toFile(), solrXml, jettyConfig.build());
|
||||
cluster.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue