Skip to content

Commit f549ee3

Browse files
committed
SOLR-13794: Replace redundent test only copy of '_default' configset with SolrTestCase logic to correctly set 'solr.default.confdir' system property
This change allows us to remove kludgy test only code from ZkController
1 parent ebec456 commit f549ee3

50 files changed

Lines changed: 81 additions & 10012 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

solr/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ Other Changes
180180

181181
* SOLR-13996: Refactor HttpShardHandler.prepDistributed method. (shalin)
182182

183+
* SOLR-13794: Replace redundent test only copy of '_default' configset with SolrTestCase logic to correctly
184+
set 'solr.default.confdir' system property (hossman)
185+
183186
================== 8.4.1 ==================
184187

185188
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

solr/core/src/java/org/apache/solr/cloud/ZkController.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import java.lang.invoke.MethodHandles;
2424
import java.net.InetAddress;
2525
import java.net.NetworkInterface;
26-
import java.net.URISyntaxException;
27-
import java.net.URL;
2826
import java.net.URLEncoder;
2927
import java.net.UnknownHostException;
3028
import java.nio.charset.StandardCharsets;
@@ -877,10 +875,12 @@ private static void bootstrapDefaultConfigSet(SolrZkClient zkClient) throws Keep
877875
* Gets the absolute filesystem path of the _default configset to bootstrap from.
878876
* First tries the sysprop "solr.default.confdir". If not found, tries to find
879877
* the _default dir relative to the sysprop "solr.install.dir".
880-
* If that fails as well (usually for unit tests), tries to get the _default from the
881-
* classpath. Returns null if not found anywhere.
878+
* Returns null if not found anywhere.
879+
*
880+
* @lucene.internal
881+
* @see SolrDispatchFilter#SOLR_DEFAULT_CONFDIR_ATTRIBUTE
882882
*/
883-
private static String getDefaultConfigDirPath() {
883+
public static String getDefaultConfigDirPath() {
884884
String configDirPath = null;
885885
String serverSubPath = "solr" + File.separator +
886886
"configsets" + File.separator + "_default" +
@@ -891,22 +891,10 @@ private static String getDefaultConfigDirPath() {
891891
} else if (System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE) != null &&
892892
new File(System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE) + subPath).exists()) {
893893
configDirPath = new File(System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE) + subPath).getAbsolutePath();
894-
} else { // find "_default" in the classpath. This one is used for tests
895-
configDirPath = getDefaultConfigDirFromClasspath(serverSubPath);
896894
}
897895
return configDirPath;
898896
}
899897

900-
private static String getDefaultConfigDirFromClasspath(String serverSubPath) {
901-
URL classpathUrl = ZkController.class.getClassLoader().getResource(serverSubPath);
902-
try {
903-
if (classpathUrl != null && new File(classpathUrl.toURI()).exists()) {
904-
return new File(classpathUrl.toURI()).getAbsolutePath();
905-
}
906-
} catch (URISyntaxException ex) {}
907-
return null;
908-
}
909-
910898
private void init(CurrentCoreDescriptorProvider registerOnReconnect) {
911899

912900
try {

solr/core/src/test-files/solr/configsets/_default/conf/lang/contractions_ca.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

solr/core/src/test-files/solr/configsets/_default/conf/lang/contractions_fr.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

solr/core/src/test-files/solr/configsets/_default/conf/lang/contractions_ga.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

solr/core/src/test-files/solr/configsets/_default/conf/lang/contractions_it.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.

solr/core/src/test-files/solr/configsets/_default/conf/lang/hyphenations_ga.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

solr/core/src/test-files/solr/configsets/_default/conf/lang/stemdict_nl.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)