mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-10 14:11:25 +00:00
Revert "ACS-7921: Add a default property value for solr.shardsWhitelist to the test - this should apply the setting to all HandlerFactories"
This reverts commit 3e07921ce78fe3c9fe15cbede6fc249a4f245a56.
This commit is contained in:
@@ -100,8 +100,6 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
protected static final int DEFAULT_CONNECTION_TIMEOUT1 = DEFAULT_CONNECTION_TIMEOUT;
|
||||
protected static final int CLIENT_SO_TIMEOUT = 90000;
|
||||
protected final static int INDEX_TIMEOUT = 100000;
|
||||
protected static final String JETTY_CONTEXT = "/solr";
|
||||
protected static final String SHARD_NAME_PREFIX = "shard";
|
||||
|
||||
private static AtomicInteger nodeCnt;
|
||||
protected static boolean useExplicitNodeNames;
|
||||
@@ -109,7 +107,6 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
public static Properties DEFAULT_CORE_PROPS = new Properties();
|
||||
|
||||
protected static Map<String, JettySolrRunner> jettyContainers;
|
||||
protected static int jettyPort;
|
||||
protected static Map<String, SolrClient> solrCollectionNameToStandaloneClient;
|
||||
protected static List<JettySolrRunner> solrShards;
|
||||
protected static List<SolrClient> clientShards;
|
||||
@@ -153,9 +150,6 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
{
|
||||
testClassName = testClassName + "_" + System.currentTimeMillis();
|
||||
|
||||
if (numShards > 0) {
|
||||
jettyPort = getNextAvailablePort();
|
||||
}
|
||||
solrcoreProperties = addExplicitShardingProperty(solrcoreProperties);
|
||||
|
||||
clientShards = new ArrayList<>();
|
||||
@@ -170,7 +164,6 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
String[] coreNames = new String[]{DEFAULT_TEST_CORENAME};
|
||||
|
||||
distribSetUp(testClassName);
|
||||
distribShardsSetUp(numShards);
|
||||
|
||||
RandomSupplier.RandVal.uniqueValues = new HashSet<>(); // reset random values
|
||||
|
||||
@@ -249,30 +242,11 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
public static void distribSetUp(String serverName)
|
||||
{
|
||||
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with
|
||||
// ignore_exception in it
|
||||
// ignore_exception in it
|
||||
System.setProperty("solr.test.sys.prop1", "propone");
|
||||
System.setProperty("solr.test.sys.prop2", "proptwo");
|
||||
System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockDirectoryFactory");
|
||||
System.setProperty("solr.log.dir", testDir.toPath().resolve(serverName).toString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed to test fix for CVE-2017-3164
|
||||
* @param numShards
|
||||
*/
|
||||
private static void distribShardsSetUp(int numShards){
|
||||
if (numShards <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder shardWhitelistBuilder = new StringBuilder();
|
||||
for (int i = 0; i < numShards; i++)
|
||||
{
|
||||
shardWhitelistBuilder.append("127.0.0.1:").append(jettyPort).append(JETTY_CONTEXT).append("/" + SHARD_NAME_PREFIX + i).append(',');
|
||||
}
|
||||
shardWhitelistBuilder.deleteCharAt(shardWhitelistBuilder.length() - 1);
|
||||
System.setProperty("solr.shardsWhitelist", shardWhitelistBuilder.toString());
|
||||
}
|
||||
|
||||
public static void distribTearDown()
|
||||
@@ -302,7 +276,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
{
|
||||
Path jettySolrHome = testDir.toPath().resolve(jettyKey);
|
||||
seedSolrHome(jettySolrHome);
|
||||
return createJetty(jettySolrHome.toFile(), null, null, false, jettyPort, getSchemaFile(), basicAuth);
|
||||
return createJetty(jettySolrHome.toFile(), null, null, false, 0, getSchemaFile(), basicAuth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +365,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
Properties props = new Properties();
|
||||
props.putAll(additionalProperties);
|
||||
|
||||
final String shardname = SHARD_NAME_PREFIX + i;
|
||||
final String shardname = "shard" + i;
|
||||
props.put("shard.instance", Integer.toString(i));
|
||||
props.put("shard.count", Integer.toString(numShards));
|
||||
|
||||
@@ -495,10 +469,10 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
if(basicAuth)
|
||||
{
|
||||
LOGGER.info("###### adding basic auth ######");
|
||||
config = JettyConfig.builder().setContext(JETTY_CONTEXT).setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
config = JettyConfig.builder().setContext("/solr").setPort(port).withFilter(BasicAuthFilter.class, "/sql/*").stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
} else {
|
||||
LOGGER.info("###### no basic auth ######");
|
||||
config = JettyConfig.builder().setContext(JETTY_CONTEXT).setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
config = JettyConfig.builder().setContext("/solr").setPort(port).stopAtShutdown(true).withSSLConfig(sslConfig).build();
|
||||
}
|
||||
|
||||
return new JettySolrRunner(solrHome.getAbsolutePath(), props, config);
|
||||
@@ -540,7 +514,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
|
||||
protected static String buildUrl(int port)
|
||||
{
|
||||
return buildUrl(port, JETTY_CONTEXT);
|
||||
return buildUrl(port, "/solr");
|
||||
}
|
||||
|
||||
protected static String getSolrXml()
|
||||
@@ -603,7 +577,7 @@ public abstract class SolrITInitializer extends SolrTestCaseJ4
|
||||
}
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||
throws IOException, ServletException
|
||||
throws IOException, ServletException
|
||||
{
|
||||
//Parse the basic auth filter
|
||||
String auth = ((HttpServletRequest)request).getHeader("Authorization");
|
||||
|
Reference in New Issue
Block a user