Skip to content

Commit f5b7a6c

Browse files
authored
Remove unneeded clearing of system properties (#4010)
1 parent ec0c988 commit f5b7a6c

File tree

123 files changed

+267
-921
lines changed

Some content is hidden

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

123 files changed

+267
-921
lines changed

solr/core/src/test/org/apache/solr/AnalysisAfterCoreReloadTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.solr.client.solrj.request.UpdateRequest;
3333
import org.apache.solr.common.SolrInputDocument;
3434
import org.apache.solr.core.SolrCore;
35-
import org.junit.AfterClass;
3635
import org.junit.BeforeClass;
3736

3837
public class AnalysisAfterCoreReloadTest extends SolrTestCaseJ4 {
@@ -46,9 +45,6 @@ public static void beforeClass() throws Exception {
4645
initCore("solrconfig.xml", "schema.xml", tmpSolrHome);
4746
}
4847

49-
@AfterClass
50-
public static void AfterClass() {}
51-
5248
public void testStopwordsAfterCoreReload() throws Exception {
5349
SolrInputDocument doc = new SolrInputDocument();
5450
doc.setField("id", "42");

solr/core/src/test/org/apache/solr/SolrTestCaseJ4Test.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.nio.file.Path;
2121
import org.apache.commons.io.file.PathUtils;
2222
import org.apache.solr.common.params.ModifiableSolrParams;
23-
import org.junit.AfterClass;
2423
import org.junit.BeforeClass;
2524
import org.junit.Test;
2625

@@ -50,9 +49,6 @@ public static void beforeClass() throws Exception {
5049
initCore("solrconfig-minimal.xml", "schema-tiny.xml", tmpSolrHome, "core1");
5150
}
5251

53-
@AfterClass
54-
public static void AfterClass() {}
55-
5652
@Test
5753
public void testCorrectCore() {
5854
assertEquals("should be core1", "core1", h.getCore().getName());

solr/core/src/test/org/apache/solr/TestGroupingSearch.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.apache.solr.response.ResultContext;
4343
import org.apache.solr.response.SolrQueryResponse;
4444
import org.apache.solr.schema.IndexSchema;
45-
import org.junit.AfterClass;
4645
import org.junit.Before;
4746
import org.junit.BeforeClass;
4847
import org.junit.Test;
@@ -74,11 +73,6 @@ public static void beforeTests() throws Exception {
7473
initCore("solrconfig.xml", "schema12.xml");
7574
}
7675

77-
@AfterClass
78-
public static void afterTests() {
79-
systemClearPropertySolrTestsMergePolicyFactory();
80-
}
81-
8276
@Before
8377
public void cleanIndex() {
8478
assertU(delQ("*:*"));

solr/core/src/test/org/apache/solr/TestHighlightDedupGrouping.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.solr.client.solrj.SolrServerException;
2222
import org.apache.solr.client.solrj.response.QueryResponse;
2323
import org.apache.solr.common.SolrInputDocument;
24-
import org.junit.AfterClass;
2524
import org.junit.Test;
2625

2726
/**
@@ -34,9 +33,6 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase {
3433
private static final String group_ti1 = "group_ti1";
3534
private static final String shard_i1 = "shard_i1";
3635

37-
@AfterClass
38-
public static void afterClass() throws Exception {}
39-
4036
@Test
4137
@ShardsFixed(num = 2)
4238
public void test() throws Exception {
@@ -79,7 +75,7 @@ private void basicTest() throws Exception {
7975
id_s1));
8076

8177
// The number of highlighted documents should be the same as the de-duplicated docs
82-
assertEquals(1, rsp.getHighlighting().values().size());
78+
assertEquals(1, rsp.getHighlighting().size());
8379
}
8480

8581
private void randomizedTest() throws Exception {
@@ -142,7 +138,7 @@ private void randomizedTest() throws Exception {
142138
"true"));
143139
// The number of highlighted documents should be the same as the de-duplicated docs for this
144140
// group
145-
assertEquals(docsInGroup[group], rsp.getHighlighting().values().size());
141+
assertEquals(docsInGroup[group], rsp.getHighlighting().size());
146142
}
147143
}
148144

solr/core/src/test/org/apache/solr/cli/PackageToolTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ public static void setupClusterWithSecurityEnabled() throws Exception {
7878

7979
@AfterClass
8080
public static void teardown() throws Exception {
81-
try {
82-
if (repositoryServer != null) {
83-
repositoryServer.stop();
84-
}
85-
} finally {
86-
System.clearProperty("solr.packages.enabled");
81+
82+
if (repositoryServer != null) {
83+
repositoryServer.stop();
8784
}
8885
}
8986

solr/core/src/test/org/apache/solr/cli/SolrProcessManagerTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ public static void afterClass() throws Exception {
7171
processHttp.getValue().destroyForcibly();
7272
processHttps.getValue().destroyForcibly();
7373
SolrProcessManager.enableTestingMode = false;
74-
System.clearProperty("solr.port.listen");
75-
System.clearProperty("solr.pid.dir");
7674
}
7775

7876
private static int findAvailablePort() throws IOException {

solr/core/src/test/org/apache/solr/cli/TestSolrCLIRunExample.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import org.apache.solr.embedded.JettySolrRunner;
4848
import org.apache.solr.util.ExternalPaths;
4949
import org.junit.After;
50-
import org.junit.AfterClass;
5150
import org.junit.BeforeClass;
5251
import org.junit.Test;
5352
import org.slf4j.Logger;
@@ -68,14 +67,6 @@ public static void beforeClass() {
6867
System.setProperty("solr.directoryFactory", "solr.NRTCachingDirectoryFactory");
6968
}
7069

71-
@AfterClass
72-
public static void cleanup() {
73-
System.clearProperty("solr.directoryFactory");
74-
System.clearProperty("solr.host.advertise");
75-
System.clearProperty("solr.port.listen");
76-
System.clearProperty("solr.log.dir");
77-
}
78-
7970
/**
8071
* Overrides the call to exec bin/solr to start Solr nodes to start them using the Solr
8172
* test-framework instead of the script, since the script depends on a full build.

solr/core/src/test/org/apache/solr/cli/ZkSubcommandsTest.java

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.apache.solr.util.ExternalPaths;
4545
import org.apache.zookeeper.CreateMode;
4646
import org.apache.zookeeper.KeeperException;
47-
import org.junit.AfterClass;
4847
import org.junit.BeforeClass;
4948
import org.junit.Test;
5049
import org.slf4j.Logger;
@@ -72,11 +71,6 @@ public static void beforeClass() {
7271
System.setProperty("solrcloud.skip.autorecovery", "true");
7372
}
7473

75-
@AfterClass
76-
public static void afterClass() {
77-
System.clearProperty("solrcloud.skip.autorecovery");
78-
}
79-
8074
@Override
8175
public void setUp() throws Exception {
8276
super.setUp();
@@ -568,34 +562,25 @@ public void testSetClusterProperty() throws Exception {
568562

569563
@Test
570564
public void testUpdateAcls() throws Exception {
571-
try {
572-
System.setProperty(
573-
SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
574-
DigestZkACLProvider.class.getName());
575-
System.setProperty(
576-
VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, "user");
577-
System.setProperty(
578-
VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, "pass");
579-
System.setProperty(
580-
SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
581-
VMParamsAllAndReadonlyDigestZkACLProvider.class.getName());
582-
System.setProperty(
583-
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME,
584-
"user");
585-
System.setProperty(
586-
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME,
587-
"pass");
588-
589-
String[] args = new String[] {"updateacls", "/", "-z", zkServer.getZkAddress()};
590-
assertEquals(0, CLITestHelper.runTool(args, UpdateACLTool.class));
591-
} finally {
592-
// Need to clear these before we open the next SolrZkClient
593-
System.clearProperty(SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME);
594-
System.clearProperty(
595-
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME);
596-
System.clearProperty(
597-
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME);
598-
}
565+
566+
System.setProperty(
567+
SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME, DigestZkACLProvider.class.getName());
568+
System.setProperty(
569+
VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME, "user");
570+
System.setProperty(
571+
VMParamsZkCredentialsInjector.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME, "pass");
572+
System.setProperty(
573+
SolrZkClient.ZK_ACL_PROVIDER_CLASS_NAME_VM_PARAM_NAME,
574+
VMParamsAllAndReadonlyDigestZkACLProvider.class.getName());
575+
System.setProperty(
576+
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_USERNAME_VM_PARAM_NAME,
577+
"user");
578+
System.setProperty(
579+
VMParamsAllAndReadonlyDigestZkACLProvider.DEFAULT_DIGEST_READONLY_PASSWORD_VM_PARAM_NAME,
580+
"pass");
581+
582+
String[] args = new String[] {"updateacls", "/", "-z", zkServer.getZkAddress()};
583+
assertEquals(0, CLITestHelper.runTool(args, UpdateACLTool.class));
599584

600585
boolean excepted = false;
601586
try (SolrZkClient zkClient =
@@ -619,8 +604,6 @@ public void tearDown() throws Exception {
619604
if (zkServer != null) {
620605
zkServer.shutdown();
621606
}
622-
System.clearProperty("solr.home");
623-
System.clearProperty("minStateByteLenForCompression");
624607
System.setOut(originalSystemOut);
625608
super.tearDown();
626609
}

solr/core/src/test/org/apache/solr/client/solrj/embedded/TestEmbeddedSolrServerSchemaAPI.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public static void destroyClass() throws IOException {
6464
server.close();
6565
server = null;
6666
}
67-
System.clearProperty("managed.schema.mutable");
6867
}
6968

7069
@Before

solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public static void beforeSuperClass() {
5454

5555
@AfterClass
5656
public static void afterSuperClass() {
57-
System.clearProperty("solr.autoCommit.maxTime");
5857
clearErrorHook();
5958
}
6059

0 commit comments

Comments
 (0)