This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new e2f9a5057c7 SolrClientTestRule usage conformance (#4217)
e2f9a5057c7 is described below

commit e2f9a5057c7a0bd26bfa62a20696ea4c58c777b1
Author: David Smiley <[email protected]>
AuthorDate: Tue Mar 17 18:58:34 2026 -0400

    SolrClientTestRule usage conformance (#4217)
    
    * startSolr don't specify temp dir
    * newCollection don't specify collection1
    * getSolrClient don't specify collection1
    * withConfigSet use Path if possible
    
    org.apache.solr.SolrTestCaseJ4.getFile should return an absolute file to 
reduce ambiguity
---
 .../test/org/apache/solr/TestTolerantSearch.java   |  3 +-
 .../org/apache/solr/handler/TestHttpRequestId.java |  2 +-
 .../handler/admin/ShowFileRequestHandlerTest.java  |  7 +---
 .../solr/handler/admin/api/RenameCoreAPITest.java  |  7 +---
 .../component/DistributedDebugComponentTest.java   |  2 +-
 .../org/apache/solr/metrics/JvmMetricsTest.java    |  2 +-
 .../solr/response/TestErrorResponseStackTrace.java |  3 +-
 .../response/TestPrometheusResponseWriter.java     |  3 +-
 .../solr/search/TestDocValuesIteratorCache.java    |  2 +-
 .../json/TestJsonRequestWithEdismaxDefType.java    |  2 +-
 .../apache/solr/servlet/HideStackTraceTest.java    |  3 +-
 .../org/apache/solr/update/CustomTLogDirTest.java  |  2 +-
 .../test/org/apache/solr/update/RootFieldTest.java |  6 ++-
 .../AbstractAtomicUpdatesMultivalueTestBase.java   |  3 +-
 .../solr/handler/sql/TestSQLHandlerNonCloud.java   |  3 +-
 ...oncurrentUpdateJettySolrClientBadInputTest.java |  7 +---
 .../HttpJettySolrClientCompatibilityTest.java      | 15 ++------
 .../solrj/jetty/HttpJettySolrClientProxyTest.java  |  2 +-
 .../apache/solr/client/solrj/SolrExampleTests.java |  7 +---
 .../apache/solr/client/solrj/TestBatchUpdate.java  |  7 +---
 .../solr/client/solrj/TestSolrJErrorHandling.java  |  7 +---
 .../impl/ConcurrentUpdateSolrClientTestBase.java   |  5 +--
 .../solrj/impl/HttpSolrClientBadInputTest.java     |  7 +---
 .../client/solrj/impl/HttpSolrClientTestBase.java  |  5 +--
 .../solrj/impl/LBHttpSolrClientBadInputTest.java   |  7 +---
 .../solr/client/solrj/request/SolrPingTest.java    |  6 ++-
 ...DirectJsonQueryRequestFacetingEmbeddedTest.java | 45 ++++++++++------------
 .../response/InputStreamResponseParserTest.java    |  7 +---
 .../solrj/response/TestSuggesterResponse.java      |  7 +---
 .../src/java/org/apache/solr/SolrTestCaseJ4.java   |  6 ++-
 .../solrj/apache/BasicHttpSolrClientTest.java      |  5 +--
 .../ConcurrentUpdateSolrClientBadInputTest.java    |  7 +---
 .../apache/ConcurrentUpdateSolrClientTest.java     |  5 +--
 .../solrj/apache/HttpSolrClientConPoolTest.java    | 14 ++-----
 34 files changed, 81 insertions(+), 140 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java 
b/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
index 5c5b5b63470..1c3e23aa613 100644
--- a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
+++ b/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
@@ -70,8 +70,7 @@ public class TestTolerantSearch extends SolrTestCaseJ4 {
   @BeforeClass
   public static void createThings() throws Exception {
     systemSetPropertyEnableUrlAllowList(false);
-    Path solrHome = createSolrHome();
-    solrTestRule.startSolr(solrHome);
+    solrTestRule.startSolr(createSolrHome());
 
     collection1 = solrTestRule.getSolrClient("collection1");
 
diff --git a/solr/core/src/test/org/apache/solr/handler/TestHttpRequestId.java 
b/solr/core/src/test/org/apache/solr/handler/TestHttpRequestId.java
index fc560425209..ef0f486fa30 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestHttpRequestId.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestHttpRequestId.java
@@ -48,7 +48,7 @@ public class TestHttpRequestId extends SolrTestCaseJ4 {
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    solrTestRule.startSolr(createTempDir());
+    solrTestRule.startSolr();
   }
 
   @Test
diff --git 
a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
 
b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
index a22f7843137..69f3108ba8a 100644
--- 
a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
+++ 
b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
@@ -54,11 +54,8 @@ public class ShowFileRequestHandlerTest extends 
SolrTestCaseJ4 {
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection("collection1")
-        .withConfigSet(ExternalPaths.DEFAULT_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create();
   }
 
   private GenericSolrRequest createShowFileRequest(SolrParams params) {
diff --git 
a/solr/core/src/test/org/apache/solr/handler/admin/api/RenameCoreAPITest.java 
b/solr/core/src/test/org/apache/solr/handler/admin/api/RenameCoreAPITest.java
index b999e2b8cf5..d62d9bf4dd6 100644
--- 
a/solr/core/src/test/org/apache/solr/handler/admin/api/RenameCoreAPITest.java
+++ 
b/solr/core/src/test/org/apache/solr/handler/admin/api/RenameCoreAPITest.java
@@ -50,11 +50,8 @@ public class RenameCoreAPITest extends SolrTestCaseJ4 {
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_CORENAME)
-        .withConfigSet(ExternalPaths.DEFAULT_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
 
b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
index 0295bd6a5eb..5953a970cd0 100644
--- 
a/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
+++ 
b/solr/core/src/test/org/apache/solr/handler/component/DistributedDebugComponentTest.java
@@ -59,7 +59,7 @@ public class DistributedDebugComponentTest extends 
SolrTestCaseJ4 {
     systemSetPropertyEnableUrlAllowList(false);
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
+    solrTestRule.startSolr();
 
     solrTestRule
         .newCollection("collection1")
diff --git a/solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java 
b/solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java
index ca2a8f4b007..f099ba7d1d3 100644
--- a/solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java
+++ b/solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java
@@ -54,7 +54,7 @@ public class JvmMetricsTest extends SolrTestCaseJ4 {
   @BeforeClass
   public static void beforeTest() throws Exception {
     System.setProperty("solr.metrics.jvm.enabled", "true");
-    solrTestRule.startSolr(createTempDir());
+    solrTestRule.startSolr();
   }
 
   @Test
diff --git 
a/solr/core/src/test/org/apache/solr/response/TestErrorResponseStackTrace.java 
b/solr/core/src/test/org/apache/solr/response/TestErrorResponseStackTrace.java
index cda8bbf8130..21e08e162c3 100644
--- 
a/solr/core/src/test/org/apache/solr/response/TestErrorResponseStackTrace.java
+++ 
b/solr/core/src/test/org/apache/solr/response/TestErrorResponseStackTrace.java
@@ -24,7 +24,6 @@ import java.nio.file.Path;
 import org.apache.commons.codec.CharEncoding;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
-import org.apache.lucene.tests.util.LuceneTestCase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.RemoteSolrException;
@@ -67,7 +66,7 @@ public class TestErrorResponseStackTrace extends 
SolrTestCaseJ4 {
                     + "  </requestHandler>\n"
                     + "</config>"));
 
-    solrTestRule.startSolr(LuceneTestCase.createTempDir());
+    solrTestRule.startSolr();
     solrTestRule.newCollection().withConfigSet(configSet).create();
   }
 
diff --git 
a/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java 
b/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java
index a8250a1ba3a..f229b01ac67 100644
--- 
a/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java
+++ 
b/solr/core/src/test/org/apache/solr/response/TestPrometheusResponseWriter.java
@@ -26,7 +26,6 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import org.apache.lucene.tests.util.LuceneTestCase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.request.MetricsRequest;
@@ -51,7 +50,7 @@ public class TestPrometheusResponseWriter extends 
SolrTestCaseJ4 {
   public static void beforeClass() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(LuceneTestCase.createTempDir());
+    solrTestRule.startSolr();
     
solrTestRule.newCollection("core1").withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create();
     
solrTestRule.newCollection("core2").withConfigSet(ExternalPaths.DEFAULT_CONFIGSET).create();
 
diff --git 
a/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java 
b/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java
index 48016588de3..e71090e0efc 100644
--- a/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java
+++ b/solr/core/src/test/org/apache/solr/search/TestDocValuesIteratorCache.java
@@ -50,7 +50,7 @@ public class TestDocValuesIteratorCache extends 
SolrTestCaseJ4 {
           // existence of multiple segments; if the merge policy happens to 
combine into a single
           // segment, no OrdinalMap will be built, throwing off our tests
           
systemSetPropertySolrTestsMergePolicyFactory(NoMergePolicyFactory.class.getName());
-          startSolr(LuceneTestCase.createTempDir());
+          startSolr();
         }
       };
 
diff --git 
a/solr/core/src/test/org/apache/solr/search/json/TestJsonRequestWithEdismaxDefType.java
 
b/solr/core/src/test/org/apache/solr/search/json/TestJsonRequestWithEdismaxDefType.java
index 1339d1d64b2..806c57f72c8 100644
--- 
a/solr/core/src/test/org/apache/solr/search/json/TestJsonRequestWithEdismaxDefType.java
+++ 
b/solr/core/src/test/org/apache/solr/search/json/TestJsonRequestWithEdismaxDefType.java
@@ -32,7 +32,7 @@ public class TestJsonRequestWithEdismaxDefType extends 
SolrTestCaseJ4 {
   @ClassRule public static final SolrClientTestRule solrTestRule = new 
EmbeddedSolrServerTestRule();
 
   public void test() throws Exception {
-    solrTestRule.startSolr(LuceneTestCase.createTempDir());
+    solrTestRule.startSolr();
 
     Path configSet = LuceneTestCase.createTempDir();
     SolrTestCaseJ4.copyMinConf(configSet);
diff --git a/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java 
b/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java
index 2caca8ee68b..0a0986292be 100644
--- a/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java
+++ b/solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java
@@ -24,7 +24,6 @@ import java.nio.file.Path;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.util.EntityUtils;
-import org.apache.lucene.tests.util.LuceneTestCase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.apache.HttpClientUtil;
@@ -66,7 +65,7 @@ public class HideStackTraceTest extends SolrTestCaseJ4 {
                     + "  </requestHandler>\n"
                     + "</config>"));
 
-    solrTestRule.startSolr(LuceneTestCase.createTempDir());
+    solrTestRule.startSolr();
     solrTestRule.newCollection().withConfigSet(configSet).create();
   }
 
diff --git a/solr/core/src/test/org/apache/solr/update/CustomTLogDirTest.java 
b/solr/core/src/test/org/apache/solr/update/CustomTLogDirTest.java
index 03bc0503924..334b8c3525f 100644
--- a/solr/core/src/test/org/apache/solr/update/CustomTLogDirTest.java
+++ b/solr/core/src/test/org/apache/solr/update/CustomTLogDirTest.java
@@ -39,7 +39,7 @@ public class CustomTLogDirTest extends SolrTestCaseJ4 {
         @Override
         protected void before() {
           System.setProperty("solr.directoryFactory", 
"solr.NRTCachingDirectoryFactory");
-          solrTestRule.startSolr(LuceneTestCase.createTempDir());
+          solrTestRule.startSolr();
         }
       };
 
diff --git a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java 
b/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
index d5ca7c66076..1487e9ec9dd 100644
--- a/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
+++ b/solr/core/src/test/org/apache/solr/update/RootFieldTest.java
@@ -61,7 +61,11 @@ public class RootFieldTest extends SolrTestCase {
     String schema = useRootSchema ? "schema15.xml" : "schema-rest.xml";
     SolrTestCaseJ4.newRandomConfig();
 
-    
solrTestRule.newCollection().withConfigSet("../collection1").withSchemaFile(schema).create();
+    solrTestRule
+        .newCollection()
+        .withConfigSet(SolrTestCaseJ4.TEST_COLL1_CONF())
+        .withSchemaFile(schema)
+        .create();
   }
 
   @Test
diff --git 
a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
 
b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
index dfd1ac8980e..2852df097ec 100644
--- 
a/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
+++ 
b/solr/core/src/test/org/apache/solr/update/processor/AbstractAtomicUpdatesMultivalueTestBase.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.update.processor;
 
+import static org.apache.solr.SolrTestCaseJ4.TEST_COLL1_CONF;
 import static org.apache.solr.SolrTestCaseJ4.sdoc;
 import static org.hamcrest.CoreMatchers.hasItems;
 import static org.hamcrest.CoreMatchers.not;
@@ -55,7 +56,7 @@ public abstract class AbstractAtomicUpdatesMultivalueTestBase 
extends SolrTestCa
     System.setProperty("solr.index.updatelog.enabled", "true");
     SolrTestCaseJ4.newRandomConfig();
 
-    solrTestRule.newCollection().withConfigSet("../collection1").create();
+    solrTestRule.newCollection().withConfigSet(TEST_COLL1_CONF()).create();
   }
 
   @Before
diff --git 
a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandlerNonCloud.java
 
b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandlerNonCloud.java
index 8bb82fd41b0..cae84b3a3a9 100644
--- 
a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandlerNonCloud.java
+++ 
b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandlerNonCloud.java
@@ -47,8 +47,7 @@ public class TestSQLHandlerNonCloud extends SolrTestCaseJ4 {
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    Path solrHome = createSolrHome();
-    solrTestRule.startSolr(solrHome);
+    solrTestRule.startSolr(createSolrHome());
   }
 
   @Test
diff --git 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/ConcurrentUpdateJettySolrClientBadInputTest.java
 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/ConcurrentUpdateJettySolrClientBadInputTest.java
index 1c78cbc6463..a01a522f02c 100644
--- 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/ConcurrentUpdateJettySolrClientBadInputTest.java
+++ 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/ConcurrentUpdateJettySolrClientBadInputTest.java
@@ -43,11 +43,8 @@ public class ConcurrentUpdateJettySolrClientBadInputTest 
extends SolrTestCaseJ4
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientCompatibilityTest.java
 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientCompatibilityTest.java
index b5aafdee9ba..82b3fd8e83a 100644
--- 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientCompatibilityTest.java
+++ 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientCompatibilityTest.java
@@ -63,10 +63,7 @@ public class HttpJettySolrClientCompatibilityTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
     try (var client =
         new HttpJettySolrClient.Builder(solrTestRule.getBaseUrl() + 
"/debug/foo")
@@ -92,10 +89,7 @@ public class HttpJettySolrClientCompatibilityTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
     try (var client =
         new HttpJettySolrClient.Builder(solrTestRule.getBaseUrl() + 
"/debug/foo")
@@ -125,10 +119,7 @@ public class HttpJettySolrClientCompatibilityTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
     System.clearProperty("solr.http1");
     try (var client =
diff --git 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientProxyTest.java
 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientProxyTest.java
index 20d44bc107d..7b4f85ba7fe 100644
--- 
a/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientProxyTest.java
+++ 
b/solr/solrj-jetty/src/test/org/apache/solr/client/solrj/jetty/HttpJettySolrClientProxyTest.java
@@ -51,7 +51,7 @@ public class HttpJettySolrClientProxyTest extends 
SolrTestCaseJ4 {
         ALLOW_PATHS_SYSPROP,
         ExternalPaths.SERVER_HOME.toAbsolutePath().toString()); // Needed for 
configset location
     solrTestRule.enableProxy();
-    solrTestRule.startSolr(createTempDir());
+    solrTestRule.startSolr();
     // Actually only need extremely minimal configSet but just use the default
     solrTestRule
         .newCollection()
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java 
b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
index 4f7c4029e12..4b0a1f286be 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
@@ -103,11 +103,8 @@ public abstract class SolrExampleTests extends 
SolrExampleTestsBase {
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java 
b/solr/solrj/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
index 85dd1c8266d..d64b999560b 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
@@ -51,11 +51,8 @@ public class TestBatchUpdate extends SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP,
         ExternalPaths.SERVER_HOME.toAbsolutePath().toString()); // Needed for 
configset location
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection("collection1")
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   static final int numdocs = 1000;
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/TestSolrJErrorHandling.java 
b/solr/solrj/src/test/org/apache/solr/client/solrj/TestSolrJErrorHandling.java
index 2a5ca071267..023874d77dd 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/TestSolrJErrorHandling.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/TestSolrJErrorHandling.java
@@ -66,11 +66,8 @@ public class TestSolrJErrorHandling extends SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP,
         ExternalPaths.SERVER_HOME.toAbsolutePath().toString()); // Needed for 
configset location
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection("collection1")
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Override
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTestBase.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTestBase.java
index 4c2eca633c9..3ccb0f39011 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTestBase.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClientTestBase.java
@@ -199,10 +199,7 @@ public abstract class ConcurrentUpdateSolrClientTestBase 
extends SolrTestCaseJ4
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @AfterClass
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
index 8eaa9feb82a..c80338e412b 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientBadInputTest.java
@@ -45,11 +45,8 @@ public class HttpSolrClientBadInputTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP,
         ExternalPaths.SERVER_HOME.toAbsolutePath().toString()); // Needed for 
configset location
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection("collection1")
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
index 73d6d19ccfe..b9d76b80133 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientTestBase.java
@@ -97,10 +97,7 @@ public abstract class HttpSolrClientTestBase extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Override
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
index 647f912b11d..e82dcb1ca9f 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttpSolrClientBadInputTest.java
@@ -44,11 +44,8 @@ public class LBHttpSolrClientBadInputTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP,
         ExternalPaths.SERVER_HOME.toAbsolutePath().toString()); // Needed for 
configset location
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection("collection1")
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java 
b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java
index c1efae5ef56..721a9492539 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.client.solrj.request;
 
+import java.nio.file.Path;
 import org.apache.solr.SolrTestCase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.response.SolrPingResponse;
@@ -35,10 +36,11 @@ public class SolrPingTest extends SolrTestCase {
 
   @BeforeClass
   public static void beforeClass() throws Exception {
-    solrTestRule.startSolr(SolrTestCaseJ4.getFile("solrj/solr"));
+    Path solrHome = SolrTestCaseJ4.getFile("solrj/solr");
+    solrTestRule.startSolr(solrHome);
 
     SolrTestCaseJ4.newRandomConfig();
-    solrTestRule.newCollection().withConfigSet("../collection1").create();
+    
solrTestRule.newCollection().withConfigSet(solrHome.resolve("collection1")).create();
   }
 
   @Before
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DirectJsonQueryRequestFacetingEmbeddedTest.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DirectJsonQueryRequestFacetingEmbeddedTest.java
index 488dd83f41c..0717ab90c7d 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DirectJsonQueryRequestFacetingEmbeddedTest.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/request/json/DirectJsonQueryRequestFacetingEmbeddedTest.java
@@ -20,7 +20,6 @@ package org.apache.solr.client.solrj.request.json;
 import static org.apache.solr.SolrTestCaseJ4.getFile;
 
 import java.util.List;
-import org.apache.lucene.tests.util.LuceneTestCase;
 import org.apache.solr.SolrTestCase;
 import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
 import org.apache.solr.client.solrj.SolrClient;
@@ -43,7 +42,6 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
   @ClassRule
   public static final EmbeddedSolrServerTestRule solrTestRule = new 
EmbeddedSolrServerTestRule();
 
-  private static final String COLLECTION_NAME = "collection1";
   private static final int NUM_TECHPRODUCTS_DOCS = 32;
   private static final int NUM_IN_STOCK = 17;
   private static final int NUM_ELECTRONICS = 12;
@@ -56,17 +54,14 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
   @BeforeClass
   public static void beforeClass() throws Exception {
 
-    solrTestRule.startSolr(LuceneTestCase.createTempDir());
+    solrTestRule.startSolr();
 
-    solrTestRule
-        .newCollection(COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
-    SolrClient client = solrTestRule.getSolrClient(COLLECTION_NAME);
+    SolrClient client = solrTestRule.getSolrClient();
 
     ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update");
-    up.setParam("collection", COLLECTION_NAME);
+    up.setParam("collection", client.getDefaultCollection());
     up.addFile(getFile("solrj/techproducts.xml"), "application/xml");
     up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
     UpdateResponse updateResponse = up.process(client);
@@ -90,7 +85,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -125,7 +120,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -163,7 +158,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -204,7 +199,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -239,7 +234,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -260,7 +255,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -286,7 +281,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -324,7 +319,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -364,7 +359,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -403,7 +398,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -434,7 +429,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "  }",
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_TECHPRODUCTS_DOCS, 
10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -466,7 +461,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_ELECTRONICS, 10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -497,7 +492,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_ELECTRONICS, 10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -527,7 +522,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_ELECTRONICS, 10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -557,7 +552,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_ELECTRONICS, 10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
@@ -594,7 +589,7 @@ public class DirectJsonQueryRequestFacetingEmbeddedTest 
extends SolrTestCase {
             "}");
     final DirectJsonQueryRequest request = new 
DirectJsonQueryRequest(jsonBody);
 
-    QueryResponse response = request.process(solrTestRule.getSolrClient(), 
COLLECTION_NAME);
+    QueryResponse response = request.process(solrTestRule.getSolrClient());
 
     assertExpectedDocumentsFoundAndReturned(response, NUM_IN_STOCK, 10);
     final NestableJsonFacet topLevelFacetData = 
response.getJsonFacetingResponse();
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/response/InputStreamResponseParserTest.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/response/InputStreamResponseParserTest.java
index 3332e82aa1c..984d19864d4 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/response/InputStreamResponseParserTest.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/response/InputStreamResponseParserTest.java
@@ -53,11 +53,8 @@ public class InputStreamResponseParserTest extends 
SolrTestCaseJ4 {
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Before
diff --git 
a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSuggesterResponse.java
 
b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSuggesterResponse.java
index cf66ac7a63f..d159bcc5328 100644
--- 
a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSuggesterResponse.java
+++ 
b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSuggesterResponse.java
@@ -45,11 +45,8 @@ public class TestSuggesterResponse extends SolrTestCaseJ4 {
   public static void beforeClass() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   static String field = "cat";
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 3a4cbe2532a..3ff7e74aaa2 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
@@ -2114,6 +2114,7 @@ public abstract class SolrTestCaseJ4 extends SolrTestCase 
{
    * using {@code this.getClass()}.
    */
   public static Path getFile(String name) {
+    // see if it's a classpath resource
     final URL url =
         SolrTestCaseJ4.class
             .getClassLoader()
@@ -2128,10 +2129,13 @@ public abstract class SolrTestCaseJ4 extends 
SolrTestCase {
                 + name);
       }
     }
+
+    // see if it's a file path resource
     final Path file = Path.of(name);
     if (Files.exists(file)) {
-      return file;
+      return file.toAbsolutePath(); // absolute to reduce ambiguity
     }
+
     throw new RuntimeException(
         "Cannot find resource in classpath or in file-system (relative to 
CWD): "
             + file.toAbsolutePath());
diff --git 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/BasicHttpSolrClientTest.java
 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/BasicHttpSolrClientTest.java
index 6e5320ae7ae..c7367bab551 100644
--- 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/BasicHttpSolrClientTest.java
+++ 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/BasicHttpSolrClientTest.java
@@ -103,10 +103,7 @@ public class BasicHttpSolrClientTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientBadInputTest.java
 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientBadInputTest.java
index 8fec38bf318..9522bb62e48 100644
--- 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientBadInputTest.java
+++ 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientBadInputTest.java
@@ -44,11 +44,8 @@ public class ConcurrentUpdateSolrClientBadInputTest extends 
SolrTestCaseJ4 {
   public static void beforeTest() throws Exception {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientTest.java
 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientTest.java
index 48dc85a8d03..804580f6c2b 100644
--- 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientTest.java
+++ 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/ConcurrentUpdateSolrClientTest.java
@@ -143,10 +143,7 @@ public class ConcurrentUpdateSolrClientTest extends 
SolrTestCaseJ4 {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
     solrTestRule.startSolr(createTempDir(), new Properties(), jettyConfig);
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
   }
 
   @Test
diff --git 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/HttpSolrClientConPoolTest.java
 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/HttpSolrClientConPoolTest.java
index cbce7fe26cf..1bd221afad7 100644
--- 
a/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/HttpSolrClientConPoolTest.java
+++ 
b/solr/test-framework/src/test/org/apache/solr/client/solrj/apache/HttpSolrClientConPoolTest.java
@@ -53,19 +53,13 @@ public class HttpSolrClientConPoolTest extends 
SolrTestCaseJ4 {
   public static void beforeTest() throws SolrServerException, IOException {
     EnvUtils.setProperty(
         ALLOW_PATHS_SYSPROP, 
ExternalPaths.SERVER_HOME.toAbsolutePath().toString());
-    solrTestRule.startSolr(createTempDir());
-    solrTestRule
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    solrTestRule.startSolr();
+    
solrTestRule.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
     fooUrl = solrTestRule.getBaseUrl();
 
-    secondJetty.startSolr(createTempDir());
-    secondJetty
-        .newCollection(DEFAULT_TEST_COLLECTION_NAME)
-        .withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET)
-        .create();
+    secondJetty.startSolr();
+    
secondJetty.newCollection().withConfigSet(ExternalPaths.TECHPRODUCTS_CONFIGSET).create();
 
     barUrl = secondJetty.getBaseUrl();
   }


Reply via email to