Apache Solr open-source search software
SOLR-16276: redundant variable in tests (#924)
Eric Pughe103f15ec979
diff --git a/solr/core/src/test/org/apache/solr/CursorPagingTest.java b/solr/core/src/test/org/apache/solr/CursorPagingTest.javaindex b9553667f4b..cca3bd21195 100644--- a/solr/core/src/test/org/apache/solr/CursorPagingTest.java+++ b/solr/core/src/test/org/apache/solr/CursorPagingTest.java@@ -154,7 +154,6 @@ public class CursorPagingTest extends SolrTestCaseJ4 {SolrParams params = null;final String intsort = "int" + (random().nextBoolean() ? "" : "_dv");- final String intmissingsort = intsort;// trivial base case: ensure cursorMark against an empty index doesn't blow upcursorMark = CURSOR_MARK_START;@@ -338,7 +337,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {"rows", "3","fl", "id","json.nl", "map",- "sort", intmissingsort + "_first asc, id asc");+ "sort", intsort + "_first asc, id asc");cursorMark =assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark),@@ -374,7 +373,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {"rows", "3","fl", "id","json.nl", "map",- "sort", intmissingsort + "_last asc, id asc");+ "sort", intsort + "_last asc, id asc");cursorMark =assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark),diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.javaindex f4ecd91fc20..388a8d37655 100644--- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java+++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java@@ -1987,8 +1987,7 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {client = upClients.get(which);}- QueryResponse rsp = client.query(params);- return rsp;+ return client.query(params);}protected void comparePartialResponses(diff --git a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java b/solr/core/src/test/org/apache/solr/TestRandomFaceting.javaindex fae236b08c2..edaa4d3f38c 100644--- a/solr/core/src/test/org/apache/solr/TestRandomFaceting.java+++ b/solr/core/src/test/org/apache/solr/TestRandomFaceting.java@@ -499,7 +499,6 @@ public class TestRandomFaceting extends SolrTestCaseJ4 {@SuppressWarnings({"rawtypes"})private Map getFacetFieldMap(Object json) {Object facet_counts = ((Map) json).get("facet_counts");- Map facet_fields = (Map) ((Map) facet_counts).get("facet_fields");- return facet_fields;+ return (Map) ((Map) facet_counts).get("facet_fields");}}diff --git a/solr/core/src/test/org/apache/solr/client/solrj/impl/ConnectionReuseTest.java b/solr/core/src/test/org/apache/solr/client/solrj/impl/ConnectionReuseTest.javaindex 44639f522cb..3faccde0198 100644--- a/solr/core/src/test/org/apache/solr/client/solrj/impl/ConnectionReuseTest.java+++ b/solr/core/src/test/org/apache/solr/client/solrj/impl/ConnectionReuseTest.java@@ -185,9 +185,8 @@ public class ConnectionReuseTest extends SolrCloudTestCase {public HttpClientConnection getConn(ConnectionRequest mConn)throws InterruptedException, ConnectionPoolTimeoutException, ExecutionException {- HttpClientConnection conn = mConn.get(30, TimeUnit.SECONDS);- return conn;+ return mConn.get(30, TimeUnit.SECONDS);}public void headerRequest(@@ -212,7 +211,6 @@ public class ConnectionReuseTest extends SolrCloudTestCase {public ConnectionRequest getClientConnectionRequest(HttpClient httpClient, HttpRoute route, PoolingHttpClientConnectionManager cm) {- ConnectionRequest mConn = cm.requestConnection(route, HttpSolrClient.cacheKey);- return mConn;+ return cm.requestConnection(route, HttpSolrClient.cacheKey);}}diff --git a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.javaindex 2ec2c925b37..5728b6c9c2d 100644--- a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java@@ -302,10 +302,9 @@ public class CloudExitableDirectoryReaderTest extends SolrCloudTestCase {params.add(cases[random().nextInt(cases.length)]);for (; ; creep *= 1.5) {- final int boundary = creep;- try (Trap catchClass = catchCount(boundary)) {+ try (Trap catchClass = catchCount(creep)) {- params.set("boundary", boundary);+ params.set("boundary", creep);QueryResponse rsp = client.query(COLLECTION, params);assertEquals("" + rsp, rsp.getStatus(), 0);assertNo500s("" + rsp);diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.javaindex 01e7976db3f..2a5f232618a 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionPropsTest.java@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;@LuceneTestCase.Slow@SolrTestCaseJ4.SuppressSSLpublic class CollectionPropsTest extends SolrCloudTestCase {+ private static final int TIMEOUT = 5000;private String collectionName;private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());@@ -117,8 +118,8 @@ public class CollectionPropsTest extends SolrCloudTestCase {cluster.getZkStateReader().registerCollectionPropsWatcher(collectionName, w);collectionProps.setCollectionProperty(collectionName, "property1", "value1");collectionProps.setCollectionProperty(collectionName, "property2", "value2");- waitForValue("property1", "value1", 5000);- waitForValue("property2", "value2", 5000);+ waitForValue("property1", "value1");+ waitForValue("property2", "value2");// HACK: don't let our watcher be removed until we're sure it's "up to date"// with the final prop values expected below...@@ -129,11 +130,11 @@ public class CollectionPropsTest extends SolrCloudTestCase {collectionProps.setCollectionProperty(collectionName, "property1", null);collectionProps.setCollectionProperty(collectionName, "property2", "newValue");- waitForValue("property1", null, 5000);- waitForValue("property2", "newValue", 5000);+ waitForValue("property1", null);+ waitForValue("property2", "newValue");collectionProps.setCollectionProperty(collectionName, "property2", null);- waitForValue("property2", null, 5000);+ waitForValue("property2", null);collectionProps.setCollectionProperty(collectionName, "property2", null); // no changecheckValue("property2", null);@@ -153,12 +154,11 @@ public class CollectionPropsTest extends SolrCloudTestCase {assertEquals("Unexpected value for collection property: " + propertyName, expectedValue, value);}- private void waitForValue(String propertyName, String expectedValue, int timeout)- throws InterruptedException {+ private void waitForValue(String propertyName, String expectedValue) throws InterruptedException {final ZkStateReader zkStateReader = cluster.getZkStateReader();Object lastValueSeen = null;- for (int i = 0; i < timeout; i += 10) {+ for (int i = 0; i < TIMEOUT; i += 10) {final Object value = zkStateReader.getCollectionProperties(collectionName).get(propertyName);if ((expectedValue == null && value == null)|| (expectedValue != null && expectedValue.equals(value))) {diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.javaindex ec43e2a6aae..a6badf142cd 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java@@ -77,6 +77,7 @@ import org.slf4j.LoggerFactory;@LuceneTestCase.Slowpublic class CollectionsAPISolrJTest extends SolrCloudTestCase {+ private static final int TIMEOUT = 3000;private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());@Before@@ -674,18 +675,17 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {// Check for value changeCollectionAdminRequest.setCollectionProperty(collectionName, propName, "false").process(cluster.getSolrClient());- checkCollectionProperty(collectionName, propName, "false", 3000);+ checkCollectionProperty(collectionName, propName, "false");// Check for removing valueCollectionAdminRequest.setCollectionProperty(collectionName, propName, null).process(cluster.getSolrClient());- checkCollectionProperty(collectionName, propName, null, 3000);+ checkCollectionProperty(collectionName, propName, null);}- private void checkCollectionProperty(- String collection, String propertyName, String propertyValue, long timeoutMs)+ private void checkCollectionProperty(String collection, String propertyName, String propertyValue)throws InterruptedException {- TimeOut timeout = new TimeOut(timeoutMs, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);+ TimeOut timeout = new TimeOut(TIMEOUT, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);while (!timeout.hasTimedOut()) {Thread.sleep(10);if (Objects.equals(diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteStatusTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteStatusTest.javaindex cfc5e794f20..32236e2f9a4 100644--- a/solr/core/src/test/org/apache/solr/cloud/DeleteStatusTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteStatusTest.java@@ -40,7 +40,7 @@ public class DeleteStatusTest extends SolrCloudTestCase {}// Basically equivalent to RequestStatus.waitFor(), but doesn't delete the id from the queue- private static RequestStatusState waitForRequestState(String id, SolrClient client, int timeout)+ private static RequestStatusState waitForRequestState(String id, SolrClient client)throws IOException, SolrServerException, InterruptedException {RequestStatusState state = RequestStatusState.SUBMITTED;long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(MAX_WAIT_TIMEOUT);@@ -64,7 +64,7 @@ public class DeleteStatusTest extends SolrCloudTestCase {final String asyncId =CollectionAdminRequest.createCollection(collection, "conf1", 1, 1).processAsync(client);- waitForRequestState(asyncId, client, MAX_WAIT_TIMEOUT);+ waitForRequestState(asyncId, client);assertEquals(RequestStatusState.COMPLETED,@@ -116,8 +116,8 @@ public class DeleteStatusTest extends SolrCloudTestCase {String id2 =CollectionAdminRequest.createCollection("flush2", "conf1", 1, 1).processAsync(client);- assertEquals(RequestStatusState.COMPLETED, waitForRequestState(id1, client, MAX_WAIT_TIMEOUT));- assertEquals(RequestStatusState.COMPLETED, waitForRequestState(id2, client, MAX_WAIT_TIMEOUT));+ assertEquals(RequestStatusState.COMPLETED, waitForRequestState(id1, client));+ assertEquals(RequestStatusState.COMPLETED, waitForRequestState(id2, client));CollectionAdminRequest.deleteAllAsyncIds().process(client);diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.javaindex b05127cd22d..bf79164ad7b 100644--- a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java@@ -168,7 +168,6 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {QueryResponse rsp = null;final String intsort = "int" + (random().nextBoolean() ? "" : "_dv");- final String intmissingsort = intsort;// trivial base case: ensure cursorMark against an empty index doesn't blow upcursorMark = CURSOR_MARK_START;@@ -180,7 +179,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(0, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals(cursorMark, assertHashNextCursorMark(rsp));@@ -208,7 +207,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(0, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals(cursorMark, assertHashNextCursorMark(rsp));@@ -222,7 +221,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals(cursorMark, assertHashNextCursorMark(rsp));@@ -236,25 +235,25 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(9, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 9, 8, 7, 6);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(9, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 5, 3, 2, 1);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(9, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 0);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(9, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -282,7 +281,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", intsort + " asc, id asc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 7, 0, 3);assertEquals(3, rsp.getFacetField("str").getValues().size());assertEquals("a", rsp.getFacetField("str").getValues().get(0).getName());@@ -291,7 +290,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 4, 1, 6);assertEquals("a", rsp.getFacetField("str").getValues().get(0).getName());assertEquals(4, rsp.getFacetField("str").getValues().get(0).getCount());@@ -299,7 +298,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 9, 2);assertEquals("a", rsp.getFacetField("str").getValues().get(0).getName());assertEquals(4, rsp.getFacetField("str").getValues().get(0).getCount());@@ -307,7 +306,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("a", rsp.getFacetField("str").getValues().get(0).getName());assertEquals(4, rsp.getFacetField("str").getValues().get(0).getCount());@@ -322,28 +321,28 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"rows", "3","fl", "id","json.nl", "map",- "sort", intmissingsort + "_first asc, id asc");+ "sort", intsort + "_first asc, id asc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 3, 7, 0);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 4, 1, 6);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 9, 2);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -356,28 +355,28 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"rows", "3","fl", "id","json.nl", "map",- "sort", intmissingsort + "_last asc, id asc");+ "sort", intsort + "_last asc, id asc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 7, 0, 4);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 1, 6, 9);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 2, 3);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -392,19 +391,19 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "str asc, id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 6, 4, 3, 1, 8, 5);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 0, 9, 7, 2);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -422,38 +421,38 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", primarysort + " asc, " + intsort + " desc, id desc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 2, 9);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 7, 4);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 3, 8);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 5, 6);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 1, 0);cursorMark = assertHashNextCursorMark(rsp);// we've exactly exhausted all the results, but solr had no way of know that//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -469,13 +468,13 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", intsort + " asc, id asc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(2, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 7, 3);cursorMark = assertHashNextCursorMark(rsp);//rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(2, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp);assertEquals("no more docs, but cursorMark has changed", cursorMark, assertHashNextCursorMark(rsp));@@ -532,7 +531,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {"sort", "str asc, id asc");rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(10, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 1, 3);cursorMark = assertHashNextCursorMark(rsp);// delete the last guy we got@@ -540,7 +539,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {commit();rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(9, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 4, 6);cursorMark = assertHashNextCursorMark(rsp);// delete the next guy we expect@@ -548,7 +547,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {commit();rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 5, 8);cursorMark = assertHashNextCursorMark(rsp);// update a doc we've already seen so it repeats@@ -556,7 +555,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {commit();rsp = query(p(params, CURSOR_MARK_PARAM, cursorMark));assertNumFound(8, rsp);- assertStartsAt(0, rsp);+ assertStartsAtBeginning(rsp);assertDocList(rsp, 2, 5);cursorMark = assertHashNextCursorMark(rsp);// update the next doc we expect so it's now in the past@@ -726,12 +725,12 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {/*** Given a QueryResponse returned by SolrServer.query, asserts that the start on the doc list- * matches the expectation+ * starts at the beginning** @see org.apache.solr.client.solrj.SolrClient#query*/- private void assertStartsAt(int expected, QueryResponse rsp) {- assertEquals(expected, extractDocList(rsp).getStart());+ private void assertStartsAtBeginning(QueryResponse rsp) {+ assertEquals(0, extractDocList(rsp).getStart());}/**diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.javaindex 326aecd15e1..4b63cf8fcce 100644--- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java@@ -145,9 +145,8 @@ public class LeaderElectionIntegrationTest extends SolrCloudTestCase {private String getLeader(String collection) throws InterruptedException {ZkNodeProps props = cluster.getZkStateReader().getLeaderRetry(collection, "shard1", 30000);- String leader = props.getStr(ZkStateReader.NODE_NAME_PROP);- return leader;+ return props.getStr(ZkStateReader.NODE_NAME_PROP);}@AfterClassdiff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.javaindex eff94d0e72e..e496a587933 100644--- a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java@@ -103,6 +103,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {private static final String ADMIN_PATH = "/admin/cores";private static final String COLLECTION_NAME = "mycollection";private static final String CONFIG_NAME = "myconfig";+ private static final int MAX_WAIT_MS = 10000;private static OverseerTaskQueue workQueueMock;private static OverseerTaskQueue stateUpdateQueueMock;@@ -894,10 +895,10 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {}}- protected void waitForEmptyQueue(long maxWait) throws Exception {- final TimeOut timeout = new TimeOut(maxWait, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);+ protected void waitForEmptyQueue() throws Exception {+ final TimeOut timeout = new TimeOut(MAX_WAIT_MS, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);while (queue.peek() != null) {- if (timeout.hasTimedOut()) fail("Queue not empty within " + maxWait + " ms");+ if (timeout.hasTimedOut()) fail("Queue not empty within " + MAX_WAIT_MS + " ms");Thread.sleep(100);}}@@ -971,7 +972,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {createNodeListToSend,sendCreateNodeList,!dontShuffleCreateNodeSet);- waitForEmptyQueue(10000);+ waitForEmptyQueue();if (collectionExceptedToBeCreated) {assertNotNull(lastProcessMessageResult.getResponse().toString(), lastProcessMessageResult);diff --git a/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java b/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.javaindex 75214c53a89..44757908cee 100644--- a/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java@@ -82,7 +82,7 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {designateJettys.add(cloudJettys.get(n));}- waitUntilOverseerDesignateIsLeader(zkStateReader.getZkClient(), designates, MAX_WAIT_TIME);+ waitUntilOverseerDesignateIsLeader(zkStateReader.getZkClient(), designates);zkStateReader.getZkClient().printLayoutToStream(System.out);@@ -100,8 +100,7 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {> 0;if (liveDesignates) {boolean success =- waitUntilOverseerDesignateIsLeader(- zkStateReader.getZkClient(), designates, MAX_WAIT_TIME);+ waitUntilOverseerDesignateIsLeader(zkStateReader.getZkClient(), designates);if (!success) {leader =OverseerCollectionConfigSetProcessor.getLeaderNode(zkStateReader.getZkClient());@@ -115,8 +114,7 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {}cloudJetty.jetty.start();boolean success =- waitUntilOverseerDesignateIsLeader(- zkStateReader.getZkClient(), designates, MAX_WAIT_TIME);+ waitUntilOverseerDesignateIsLeader(zkStateReader.getZkClient(), designates);if (!success) {leader = OverseerCollectionConfigSetProcessor.getLeaderNode(zkStateReader.getZkClient());if (leader == null)@@ -145,11 +143,11 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {}static boolean waitUntilOverseerDesignateIsLeader(- SolrZkClient testZkClient, List<String> overseerDesignates, long timeoutInNanos)+ SolrZkClient testZkClient, List<String> overseerDesignates)throws KeeperException, InterruptedException {long now = System.nanoTime();// the maximum amount of time we're willing to wait to see the designate as leader- long maxTimeout = now + timeoutInNanos;+ long maxTimeout = now + RollingRestartTest.MAX_WAIT_TIME;long timeout = now + TimeUnit.NANOSECONDS.convert(60, TimeUnit.SECONDS);boolean firstTime = true;int stableCheckTimeout = 2000;diff --git a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.javaindex 22fb8bdcc84..8372c559176 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java@@ -145,9 +145,8 @@ public class TestAuthenticationFramework extends SolrCloudTestCase {filterChain.doFilter(request, response);return true;}- HttpServletRequest httpRequest = request;- String username = httpRequest.getHeader("username");- String password = httpRequest.getHeader("password");+ String username = request.getHeader("username");+ String password = request.getHeader("password");log.info("Username: {}, password: {}", username, password);if (MockAuthenticationPlugin.expectedUsername.equals(username)diff --git a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.javaindex c5e5632521d..64968718d7e 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestConfigSetsAPI.java@@ -434,7 +434,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {false);assertNotNull(map);unIgnoreException("The configuration name should be provided");- long statusCode = (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status"));+ long statusCode = (long) getObjectByPath(map, Arrays.asList("responseHeader", "status"));assertEquals(400l, statusCode);SolrZkClient zkClient =@@ -466,7 +466,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {false);assertNotNull(map);unIgnoreException("already exists`");- statusCode = (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status"));+ statusCode = (long) getObjectByPath(map, Arrays.asList("responseHeader", "status"));assertEquals(400l, statusCode);assertTrue("Expected file doesnt exist in zk. It's possibly overwritten",@@ -682,7 +682,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {// Should not set trusted=true in configSetignoreException("Either empty zipped data, or non-zipped data was passed. In order to upload a configSet, you must zip a non-empty directory to upload.");- assertEquals(400, uploadBadConfigSet(configsetName, configsetSuffix, "solr", true, true, v2));+ assertEquals(400, uploadBadConfigSet(configsetName, configsetSuffix, "solr", v2));assertEquals("Expecting version bump",solrconfigZkVersion,@@ -1333,18 +1333,16 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {}private static String getSecurityJson() throws KeeperException, InterruptedException {- String securityJson =- "{\n"- + " 'authentication':{\n"- + " 'blockUnknown': false,\n"- + " 'class':'"- + MockAuthenticationPlugin.class.getName()- + "'},\n"- + " 'authorization':{\n"- + " 'class':'"- + MockAuthorizationPlugin.class.getName()- + "'}}";- return securityJson;+ return "{\n"+ + " 'authentication':{\n"+ + " 'blockUnknown': false,\n"+ + " 'class':'"+ + MockAuthenticationPlugin.class.getName()+ + "'},\n"+ + " 'authorization':{\n"+ + " 'class':'"+ + MockAuthorizationPlugin.class.getName()+ + "'}}";}private void uploadConfigSetWithAssertions(String configSetName, String suffix, String username)@@ -1413,13 +1411,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {v2);}- private long uploadBadConfigSet(- String configSetName,- String suffix,- String username,- boolean overwrite,- boolean cleanup,- boolean v2)+ private long uploadBadConfigSet(String configSetName, String suffix, String username, boolean v2)throws IOException {// Read single file from sample configs. This should fail the unzipping@@ -1428,8 +1420,8 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {configSetName,suffix,username,- overwrite,- cleanup,+ true /* overwrite */,+ true /* cleanup */,v2);}@@ -1464,9 +1456,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {username,usePut);assertNotNull(map);- long statusCode =- (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status"));- return statusCode;+ return (long) getObjectByPath(map, Arrays.asList("responseHeader", "status"));} // else "not" a V2 request...try {@@ -1522,9 +1512,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {username,usePut);assertNotNull(map);- long statusCode =- (long) getObjectByPath(map, false, Arrays.asList("responseHeader", "status"));- return statusCode;+ return (long) getObjectByPath(map, Arrays.asList("responseHeader", "status"));} // else "not" a V2 request...try {@@ -1677,8 +1665,7 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {return m;}- private static Object getObjectByPath(- Map<?, ?> root, boolean onlyPrimitive, java.util.List<String> hierarchy) {+ private static Object getObjectByPath(Map<?, ?> root, List<String> hierarchy) {Map<?, ?> obj = root;for (int i = 0; i < hierarchy.size(); i++) {String s = hierarchy.get(i);@@ -1688,9 +1675,6 @@ public class TestConfigSetsAPI extends SolrCloudTestCase {if (obj == null) return null;} else {Object val = obj.get(s);- if (onlyPrimitive && val instanceof Map) {- return null;- }return val;}}diff --git a/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java b/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.javaindex f48aec46cfe..5d14d96c65a 100644--- a/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java+++ b/solr/core/src/test/org/apache/solr/cloud/TestHashPartitioner.java@@ -295,14 +295,12 @@ public class TestHashPartitioner extends SolrTestCaseJ4 {slices.put(slice.getName(), slice);}- DocCollection coll =- new DocCollection(- "collection1",- slices,- Collections.singletonMap(- ZkStateReader.CONFIGNAME_PROP, ConfigSetsHandler.DEFAULT_CONFIGSET_NAME),- router);- return coll;+ return new DocCollection(+ "collection1",+ slices,+ Collections.singletonMap(+ ZkStateReader.CONFIGNAME_PROP, ConfigSetsHandler.DEFAULT_CONFIGSET_NAME),+ router);}// from negative to positive, the upper bits of the hash ranges should bediff --git a/solr/core/src/test/org/apache/solr/core/HelloStream.java b/solr/core/src/test/org/apache/solr/core/HelloStream.javaindex 52bf6437261..022ffac02ac 100644--- a/solr/core/src/test/org/apache/solr/core/HelloStream.java+++ b/solr/core/src/test/org/apache/solr/core/HelloStream.java@@ -69,8 +69,7 @@ public class HelloStream extends TupleStream implements Expressible {@Overridepublic StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {- StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));- return expression;+ return new StreamExpression(factory.getFunctionName(this.getClass()));}@Overridediff --git a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.javaindex be3d63af15b..4a9bc1b2015 100644--- a/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java+++ b/solr/core/src/test/org/apache/solr/handler/ReplicationTestHelper.java@@ -64,8 +64,7 @@ public final class ReplicationTestHelper {public static HttpSolrClient createNewSolrClient(String baseUrl) {try {// set up the client...- HttpSolrClient client = SolrTestCaseJ4.getHttpSolrClient(baseUrl, 15000, 90000);- return client;+ return SolrTestCaseJ4.getHttpSolrClient(baseUrl, 15000, 90000);} catch (Exception ex) {throw new RuntimeException(ex);}diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.javaindex bb7f150ff0f..1ff1cdbe75c 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java@@ -87,6 +87,7 @@ import org.slf4j.LoggerFactory;public class TestReplicationHandler extends SolrTestCaseJ4 {private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());+ private static final long TIMEOUT = 30000;JettySolrRunner leaderJetty, followerJetty, repeaterJetty;HttpSolrClient leaderClient, followerClient, repeaterClient;@@ -1011,10 +1012,10 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {assertEquals(totalDocs, leaderQueryResult.getNumFound());// index fetch- Date followerCoreStart = watchCoreStartAt(followerClient, 30 * 1000, null);+ Date followerCoreStart = watchCoreStartAt(followerClient, null);pullFromTo(leaderJetty, followerJetty);if (confCoreReload) {- watchCoreStartAt(followerClient, 30 * 1000, followerCoreStart);+ watchCoreStartAt(followerClient, followerCoreStart);}// get docs from follower and check if number is equal to leader@@ -1425,7 +1426,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {rQuery(0, "*:*", followerClient); // sanity check w/retry// record collection1's start time on follower- final Date followerStartTime = watchCoreStartAt(followerClient, 30 * 1000, null);+ final Date followerStartTime = watchCoreStartAt(followerClient, null);// add a doc with new field and commit on leader to trigger index fetch from follower.index(leaderClient, "id", "2000", "name", "name = " + 2000, "newname", "n2000");@@ -1433,7 +1434,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {rQuery(1, "newname:n2000", leaderClient); // sanity check// wait for follower to reload core by watching updated startTime- watchCoreStartAt(followerClient, 30 * 1000, followerStartTime);+ watchCoreStartAt(followerClient, followerStartTime);NamedList<Object> leaderQueryRsp2 = rQuery(1, "id:2000", leaderClient);SolrDocumentList leaderQueryResult2 = (SolrDocumentList) leaderQueryRsp2.get("response");@@ -1775,20 +1776,19 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {* assertion failure.** @param client The SolrClient to poll- * @param timeout the max milliseconds to continue polling for* @param min the startTime value must exceed this value before the method will return, if null* this method will return the first startTime value encountered.* @return the startTime value of collection*/@SuppressWarnings("unchecked")- private Date watchCoreStartAt(SolrClient client, final long timeout, final Date min)+ private Date watchCoreStartAt(SolrClient client, final Date min)throws InterruptedException, IOException, SolrServerException {final long sleepInterval = 200;long timeSlept = 0;try (HttpSolrClient adminClient = adminClient(client)) {SolrParams p = params("action", "status", "core", "collection1");- while (timeSlept < timeout) {+ while (timeSlept < TIMEOUT) {QueryRequest req = new QueryRequest(p);req.setPath("/admin/cores");try {diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.javaindex 94daacb4df5..369243c4fff 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandlerBackup.java@@ -44,7 +44,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;import org.apache.solr.client.solrj.embedded.JettySolrRunner;-import org.apache.solr.client.solrj.impl.HttpSolrClient;import org.apache.solr.util.FileUtils;import org.junit.After;import org.junit.Before;@@ -88,8 +87,7 @@ public class TestReplicationHandlerBackup extends SolrJettyTestBase {try {// set up the client...final String baseUrl = buildUrl(port, context);- HttpSolrClient client = getHttpSolrClient(baseUrl, 15000, 60000);- return client;+ return getHttpSolrClient(baseUrl, 15000, 60000);} catch (Exception ex) {throw new RuntimeException(ex);}diff --git a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.javaindex dae30ad4d5f..1c831c2a7aa 100644--- a/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java+++ b/solr/core/src/test/org/apache/solr/handler/TestRestoreCore.java@@ -32,7 +32,6 @@ import org.apache.solr.SolrTestCaseJ4;import org.apache.solr.client.solrj.SolrClient;import org.apache.solr.client.solrj.embedded.JettyConfig;import org.apache.solr.client.solrj.embedded.JettySolrRunner;-import org.apache.solr.client.solrj.impl.HttpSolrClient;import org.apache.solr.common.SolrInputDocument;import org.apache.solr.util.FileUtils;import org.junit.After;@@ -71,8 +70,7 @@ public class TestRestoreCore extends SolrJettyTestBase {try {// set up the client...final String baseUrl = buildUrl(port, context);- HttpSolrClient client = getHttpSolrClient(baseUrl, 15000, 60000);- return client;+ return getHttpSolrClient(baseUrl, 15000, 60000);} catch (Exception ex) {throw new RuntimeException(ex);}diff --git a/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java b/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.javaindex 31aa6a2429b..41714e4ec49 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminCreateDiscoverTest.java@@ -60,7 +60,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {solrHomeDirectory = null;}- private static void setupCore(String coreName, boolean blivet) throws IOException {+ private static void setupCore(String coreName) throws IOException {File instDir = new File(solrHomeDirectory, coreName);File subHome = new File(instDir, "conf");assertTrue("Failed to make subdirectory ", subHome.mkdirs());@@ -79,7 +79,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {@Testpublic void testCreateSavesSysProps() throws Exception {- setupCore(coreSysProps, true);+ setupCore(coreSysProps);// create a new core (using CoreAdminHandler) w/ properties// Just to be sure it's NOT written to the core.properties file@@ -164,7 +164,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {@Testpublic void testCannotCreateTwoCoresWithSameInstanceDir() throws Exception {- setupCore(coreDuplicate, true);+ setupCore(coreDuplicate);File workDir = new File(solrHomeDirectory, coreDuplicate);File data = new File(workDir, "data");@@ -215,7 +215,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {@Testpublic void testInstanceDirAsPropertyParam() throws Exception {- setupCore("testInstanceDirAsPropertyParam-XYZ", true);+ setupCore("testInstanceDirAsPropertyParam-XYZ");// make sure workDir is different even if core name is used as instanceDirFile workDir = new File(solrHomeDirectory, "testInstanceDirAsPropertyParam-XYZ");@@ -263,7 +263,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {@Testpublic void testCreateSavesRegProps() throws Exception {- setupCore(coreNormal, true);+ setupCore(coreNormal);// create a new core (using CoreAdminHandler) w/ properties// Just to be sure it's NOT written to the core.properties filediff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestApiFramework.java b/solr/core/src/test/org/apache/solr/handler/admin/TestApiFramework.javaindex 04be03acca4..3fc04884a09 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/TestApiFramework.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestApiFramework.java@@ -19,7 +19,6 @@ package org.apache.solr.handler.admin;import static java.nio.charset.StandardCharsets.UTF_8;import static org.apache.solr.api.ApiBag.EMPTY_SPEC;-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;import static org.apache.solr.common.params.CommonParams.COLLECTIONS_HANDLER_PATH;import static org.apache.solr.common.params.CommonParams.CONFIGSETS_HANDLER_PATH;@@ -137,8 +136,7 @@ public class TestApiFramework extends SolrTestCaseJ4 {assertEquals("shard1", parts.get("shard"));assertEquals("replica1", parts.get("replica"));- SolrQueryResponse rsp =- invoke(containerHandlers, null, "/collections/_introspect", GET, mockCC);+ SolrQueryResponse rsp = invoke(containerHandlers, null, "/collections/_introspect", mockCC);Set<String> methodNames = new HashSet<>();methodNames.add(rsp.getValues()._getStr("/spec[0]/methods[0]", null));@@ -152,17 +150,13 @@ public class TestApiFramework extends SolrTestCaseJ4 {rsp =invoke(- coreHandlers,- "/schema/_introspect",- "/collections/hello/schema/_introspect",- GET,- mockCC);+ coreHandlers, "/schema/_introspect", "/collections/hello/schema/_introspect", mockCC);methodNames.add(rsp.getValues()._getStr("/spec[0]/methods[0]", null));methodNames.add(rsp.getValues()._getStr("/spec[1]/methods[0]", null));assertTrue(methodNames.contains("POST"));assertTrue(methodNames.contains("GET"));- rsp = invoke(coreHandlers, "/", "/collections/hello/_introspect", GET, mockCC);+ rsp = invoke(coreHandlers, "/", "/collections/hello/_introspect", mockCC);assertConditions(rsp.getValues().asMap(2),Map.of(@@ -361,7 +355,6 @@ public class TestApiFramework extends SolrTestCaseJ4 {PluginBag<SolrRequestHandler> reqHandlers,String path,String fullPath,- SolrRequest.METHOD method,CoreContainer mockCC) {HashMap<String, String> parts = new HashMap<>();boolean containerHandlerLookup = mockCC.getRequestHandlers() == reqHandlers;diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.javaindex 8cbb8d24fe7..79ad7e42913 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestCollectionAPIs.java@@ -102,7 +102,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{create:{name:'newcoll', config:'schemaless', numShards:2, replicationFactor:2 }}",- null,"{name:newcoll, fromApi:'true', replicationFactor:'2', nrtReplicas:'2', collection.configName:schemaless, numShards:'2', operation:create}");compareOutput(@@ -110,7 +109,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{create:{name:'newcoll', config:'schemaless', numShards:2, nrtReplicas:2 }}",- null,"{name:newcoll, fromApi:'true', nrtReplicas:'2', replicationFactor:'2', collection.configName:schemaless, numShards:'2', operation:create}");compareOutput(@@ -118,7 +116,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{create:{name:'newcoll', config:'schemaless', numShards:2, nrtReplicas:2, tlogReplicas:2, pullReplicas:2 }}",- null,"{name:newcoll, fromApi:'true', nrtReplicas:'2', replicationFactor:'2', tlogReplicas:'2', pullReplicas:'2', collection.configName:schemaless, numShards:'2', operation:create}");// test a create collection operation with custom properties@@ -127,7 +124,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{create:{name:'newcoll', config:'schemaless', numShards:2, replicationFactor:2, properties:{prop1:'prop1val', prop2: prop2val} }}",- null,"{name:newcoll, fromApi:'true', replicationFactor:'2', nrtReplicas:'2', collection.configName:schemaless, numShards:'2', operation:create, property.prop1:prop1val, property.prop2:prop2val}");compareOutput(@@ -135,7 +131,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{create-alias:{name: aliasName , collections:[c1,c2] }}",- null,"{operation : createalias, name: aliasName, collections:\"c1,c2\" }");compareOutput(@@ -143,26 +138,19 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections",POST,"{delete-alias:{ name: aliasName}}",- null,"{operation : deletealias, name: aliasName}");compareOutput(- apiBag,- "/collections/collName",- POST,- "{reload:{}}",- null,- "{name:collName, operation :reload}");+ apiBag, "/collections/collName", POST, "{reload:{}}", "{name:collName, operation :reload}");compareOutput(- apiBag, "/collections/collName", DELETE, null, null, "{name:collName, operation :delete}");+ apiBag, "/collections/collName", DELETE, null, "{name:collName, operation :delete}");compareOutput(apiBag,"/collections/collName/shards/shard1",DELETE,null,- null,"{collection:collName, shard: shard1 , operation :deleteshard }");compareOutput(@@ -170,7 +158,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards/shard1/replica1?deleteDataDir=true&onlyIfDown=true",DELETE,null,- null,"{collection:collName, shard: shard1, replica :replica1 , deleteDataDir:'true', onlyIfDown: 'true', operation :deletereplica }");compareOutput(@@ -178,7 +165,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards",POST,"{split:{shard:shard1, ranges: '0-1f4,1f5-3e8,3e9-5dc', coreProperties : {prop1:prop1Val, prop2:prop2Val} }}",- null,"{collection: collName , shard : shard1, ranges :'0-1f4,1f5-3e8,3e9-5dc', operation : splitshard, property.prop1:prop1Val, property.prop2: prop2Val}");compareOutput(@@ -186,7 +172,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards",POST,"{add-replica:{shard: shard1, node: 'localhost_8978' , coreProperties : {prop1:prop1Val, prop2:prop2Val} }}",- null,"{collection: collName , shard : shard1, node :'localhost_8978', operation : addreplica, property.prop1:prop1Val, property.prop2: prop2Val}");compareOutput(@@ -194,7 +179,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards",POST,"{split:{ splitKey:id12345, coreProperties : {prop1:prop1Val, prop2:prop2Val} }}",- null,"{collection: collName , split.key : id12345 , operation : splitshard, property.prop1:prop1Val, property.prop2: prop2Val}");compareOutput(@@ -202,7 +186,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards",POST,"{add-replica:{shard: shard1, node: 'localhost_8978' , type:'TLOG' }}",- null,"{collection: collName , shard : shard1, node :'localhost_8978', operation : addreplica, type: TLOG}");compareOutput(@@ -210,7 +193,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName/shards",POST,"{add-replica:{shard: shard1, node: 'localhost_8978' , type:'PULL' }}",- null,"{collection: collName , shard : shard1, node :'localhost_8978', operation : addreplica, type: PULL}");// TODO annotation-based v2 APIs still miss enum support to validate the 'type' parameter as@@ -226,7 +208,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName",POST,"{add-replica-property : {name:propA , value: VALA, shard: shard1, replica:replica1}}",- null,"{collection: collName, shard: shard1, replica : replica1 , property : propA , operation : addreplicaprop, property.value : 'VALA'}");compareOutput(@@ -234,7 +215,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/collName",POST,"{delete-replica-property : {property: propA , shard: shard1, replica:replica1} }",- null,"{collection: collName, shard: shard1, replica : replica1 , property : propA , operation : deletereplicaprop}");compareOutput(@@ -242,7 +222,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/cluster",POST,"{add-role : {role : overseer, node : 'localhost_8978'} }",- null,"{operation : addrole ,role : overseer, node : 'localhost_8978'}");compareOutput(@@ -250,7 +229,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/cluster",POST,"{remove-role : {role : overseer, node : 'localhost_8978'} }",- null,"{operation : removerole ,role : overseer, node : 'localhost_8978'}");compareOutput(@@ -258,7 +236,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/coll1",POST,"{balance-shard-unique : {property: preferredLeader} }",- null,"{operation : balanceshardunique ,collection : coll1, property : preferredLeader}");compareOutput(@@ -266,7 +243,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/coll1",POST,"{migrate-docs : {forwardTimeout: 1800, target: coll2, splitKey: 'a123!'} }",- null,"{operation : migrate ,collection : coll1, target.collection:coll2, forward.timeout:1800, split.key:'a123!'}");compareOutput(@@ -274,7 +250,6 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {"/collections/coll1",POST,"{set-collection-property : {name: 'foo', value:'bar'} }",- null,"{operation : collectionprop, name : coll1, propertyName:'foo', propertyValue:'bar'}");}@@ -283,9 +258,8 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {final String path,final SolrRequest.METHOD method,final String payload,- final CoreContainer cc,String expectedOutputMapJson) {- Pair<SolrQueryRequest, SolrQueryResponse> ctx = makeCall(apiBag, path, method, payload, cc);+ Pair<SolrQueryRequest, SolrQueryResponse> ctx = makeCall(apiBag, path, method, payload);ZkNodeProps output = (ZkNodeProps) ctx.second().getValues().get(ZkNodeProps.class.getName());@SuppressWarnings("unchecked")Map<String, ?> expected = (Map<String, ?>) fromJSONString(expectedOutputMapJson);@@ -298,10 +272,9 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {final String path,final SolrRequest.METHOD method,final String payload,- final CoreContainer cc,String expectedErrorMsg) {RuntimeException e =- expectThrows(RuntimeException.class, () -> makeCall(apiBag, path, method, payload, cc));+ expectThrows(RuntimeException.class, () -> makeCall(apiBag, path, method, payload));assertTrue("Expected exception with error message '"+ expectedErrorMsg@@ -311,11 +284,7 @@ public class TestCollectionAPIs extends SolrTestCaseJ4 {}public static Pair<SolrQueryRequest, SolrQueryResponse> makeCall(- final ApiBag apiBag,- String path,- final SolrRequest.METHOD method,- final String payload,- final CoreContainer cc) {+ final ApiBag apiBag, String path, final SolrRequest.METHOD method, final String payload) {SolrParams queryParams = new MultiMapSolrParams(Collections.emptyMap());if (path.indexOf('?') > 0) {String queryStr = path.substring(path.indexOf('?') + 1);diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestConfigsApi.java b/solr/core/src/test/org/apache/solr/handler/admin/TestConfigsApi.javaindex 7e2672dd07b..5c21c3a295e 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/TestConfigsApi.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestConfigsApi.java@@ -52,12 +52,7 @@ public class TestConfigsApi extends SolrTestCaseJ4 {apiBag.registerObject(o.configSetCommands);// for (Api api : handler.getApis()) apiBag.register(api, emptyMap());compareOutput(- apiBag,- "/cluster/configs/sample",- DELETE,- null,- null,- "{name :sample, operation:delete}");+ apiBag, "/cluster/configs/sample", DELETE, null, "{name :sample, operation:delete}");}}}diff --git a/solr/core/src/test/org/apache/solr/handler/admin/TestCoreAdminApis.java b/solr/core/src/test/org/apache/solr/handler/admin/TestCoreAdminApis.javaindex 6624e86a25c..ddf8639da76 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/TestCoreAdminApis.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/TestCoreAdminApis.java@@ -49,26 +49,25 @@ public class TestCoreAdminApis extends SolrTestCaseJ4 {apiBag,"/cores",SolrRequest.METHOD.POST,- "{create:{name: hello, instanceDir : someDir, schema: 'schema.xml'}}",- mockCC);+ "{create:{name: hello, instanceDir : someDir, schema: 'schema.xml'}}");Object[] params = calls.get("create");assertEquals("hello", params[0]);assertEquals(fromJSONString("{schema : schema.xml}"), params[2]);TestCollectionAPIs.makeCall(- apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{swap:{with: core2}}", mockCC);+ apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{swap:{with: core2}}");params = calls.get("swap");assertEquals("core1", params[0]);assertEquals("core2", params[1]);TestCollectionAPIs.makeCall(- apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{rename:{to: core2}}", mockCC);+ apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{rename:{to: core2}}");params = calls.get("rename");assertEquals("core1", params[0]);assertEquals("core2", params[1]);TestCollectionAPIs.makeCall(- apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{unload:{deleteIndex : true}}", mockCC);+ apiBag, "/cores/core1", SolrRequest.METHOD.POST, "{unload:{deleteIndex : true}}");params = calls.get("unload");assertEquals("core1", params[0]);assertEquals(Boolean.TRUE, params[1]);diff --git a/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.javaindex dd1fc536481..e0f0e14a534 100644--- a/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/QueryElevationComponentTest.java@@ -89,11 +89,7 @@ public class QueryElevationComponentTest extends SolrTestCaseJ4 {}private void init(String schema) throws Exception {- init("solrconfig-elevate.xml", schema);- }-- private void init(String config, String schema) throws Exception {- initCore(config, schema);+ initCore("solrconfig-elevate.xml", schema);clearIndex();assertU(commit());}diff --git a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.javaindex 7a53bab8077..6d6a0a1b5c5 100644--- a/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java+++ b/solr/core/src/test/org/apache/solr/handler/component/ShardsAllowListTest.java@@ -61,10 +61,10 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {private static int nodesPerCluster;private static void appendClusterNodes(- final StringBuilder sb, final String delimiter, final MiniSolrCloudCluster cluster) {+ final StringBuilder sb, final MiniSolrCloudCluster cluster) {cluster.getJettySolrRunners()- .forEach((jetty) -> sb.append(jetty.getBaseUrl().toString() + delimiter));+ .forEach((jetty) -> sb.append(jetty.getBaseUrl().toString() + ","));}@BeforeClass@@ -85,15 +85,13 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {@Overridepublic MiniSolrCloudCluster apply(String clusterId) {try {- final MiniSolrCloudCluster cluster =- new MiniSolrCloudCluster.Builder(nodesPerCluster(clusterId), createTempDir())- .addConfig("conf", configset("cloud-dynamic"))- .withSolrXml(- MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML.replace(- MiniSolrCloudCluster.TEST_URL_ALLOW_LIST,- EXPLICIT_ALLOW_LIST_PROPERTY + clusterId))- .build();- return cluster;+ return new MiniSolrCloudCluster.Builder(nodesPerCluster(clusterId), createTempDir())+ .addConfig("conf", configset("cloud-dynamic"))+ .withSolrXml(+ MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML.replace(+ MiniSolrCloudCluster.TEST_URL_ALLOW_LIST,+ EXPLICIT_ALLOW_LIST_PROPERTY + clusterId))+ .build();} catch (Exception e) {throw new RuntimeException(e);}@@ -107,7 +105,7 @@ public class ShardsAllowListTest extends MultiSolrCloudTestCase {new DefaultClusterInitFunction(numShards, numReplicas) {@Overridepublic void accept(String clusterId, MiniSolrCloudCluster cluster) {- appendClusterNodes(sb, ",", cluster);+ appendClusterNodes(sb, cluster);if (clusterId.equals(EXPLICIT_CLUSTER_KEY)) {System.setProperty(EXPLICIT_ALLOW_LIST_PROPERTY + clusterId, sb.toString());for (JettySolrRunner runner : cluster.getJettySolrRunners()) {diff --git a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.javaindex 99170a4d432..e5067cab01b 100644--- a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java+++ b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java@@ -1250,10 +1250,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {helpTestDateFacets("bday_drf", FacetRangeMethod.FILTER);}- private void helpTestDateFacets(final String fieldName, final FacetRangeMethod rangeFacetMethod) {+ private void helpTestDateFacets(final String f, final FacetRangeMethod rangeFacetMethod) {final String p = "facet.range";final String b = "facet_ranges";- final String f = fieldName;final String c = "/lst[@name='counts']";final String pre = "//lst[@name='" + b + "']/lst[@name='" + f + "']" + c;final String meta = pre + "/../";@@ -1532,10 +1531,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {* Similar to helpTestDateFacets, but for different fields with test data exactly on boundary* marks*/- private void helpTestDateRangeFacetsWithIncludeOption(final String fieldName) {+ private void helpTestDateRangeFacetsWithIncludeOption(final String f) {final String p = "facet.range";final String b = "facet_ranges";- final String f = fieldName;final String c = "/lst[@name='counts']";final String pre = "//lst[@name='" + b + "']/lst[@name='" + f + "']" + c;final String meta = pre + "/../";@@ -1923,10 +1921,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {helpTestDateRangeFacetsWithTz("a_tdt");}- private void helpTestDateRangeFacetsWithTz(final String fieldName) {+ private void helpTestDateRangeFacetsWithTz(final String f) {final String p = "facet.range";final String b = "facet_ranges";- final String f = fieldName;final String c = "/lst[@name='counts']";final String pre = "//lst[@name='" + b + "']/lst[@name='" + f + "']" + c;final String meta = pre + "/../";@@ -2059,8 +2056,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {}private void helpTestNumericRangeFacetsDoubleOverflow(- final String fieldName, final FacetRangeMethod method) {- final String f = fieldName;+ final String f, final FacetRangeMethod method) {final String pre = "//lst[@name='facet_ranges']/lst[@name='" + f + "']/lst[@name='counts']";final String meta = pre + "/../";@@ -2105,10 +2101,8 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {helpTestFractionalNumberRangeFacets(fieldName, FacetRangeMethod.FILTER);}- private void helpTestFractionalNumberRangeFacets(- final String fieldName, FacetRangeMethod method) {+ private void helpTestFractionalNumberRangeFacets(final String f, FacetRangeMethod method) {- final String f = fieldName;final String pre = "//lst[@name='facet_ranges']/lst[@name='" + f + "']/lst[@name='counts']";final String meta = pre + "/../";@@ -2340,8 +2334,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {}private void helpTestNumericRangeFacetsLongOverflow(- final String fieldName, final FacetRangeMethod method) {- final String f = fieldName;+ final String f, final FacetRangeMethod method) {final String pre = "//lst[@name='facet_ranges']/lst[@name='" + f + "']/lst[@name='counts']";final String meta = pre + "/../";@@ -2386,12 +2379,11 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {helpTestWholeNumberRangeFacets(fieldName, FacetRangeMethod.FILTER);}- private void helpTestWholeNumberRangeFacets(final String fieldName, FacetRangeMethod method) {+ private void helpTestWholeNumberRangeFacets(final String f, FacetRangeMethod method) {// the float test covers a lot of the weird edge cases// here we just need some basic sanity checking of the parsing- final String f = fieldName;final String pre = "//lst[@name='facet_ranges']/lst[@name='" + f + "']/lst[@name='counts']";final String meta = pre + "/../";diff --git a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.javaindex f32e504d84d..9154044d046 100644--- a/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java+++ b/solr/core/src/test/org/apache/solr/request/TestIntervalFaceting.java@@ -988,6 +988,7 @@ public class TestIntervalFaceting extends SolrTestCaseJ4 {SolrException.ErrorCode.BAD_REQUEST);}+ @SuppressWarnings("SameParameterValue")private void assertStringInterval(String fieldName, String intervalStr, String expectedStart, String expectedEnd)throws SyntaxError {diff --git a/solr/core/src/test/org/apache/solr/request/TestStreamBody.java b/solr/core/src/test/org/apache/solr/request/TestStreamBody.javaindex 8d9852336ea..ffca1e89a03 100644--- a/solr/core/src/test/org/apache/solr/request/TestStreamBody.java+++ b/solr/core/src/test/org/apache/solr/request/TestStreamBody.java@@ -85,7 +85,7 @@ public class TestStreamBody extends RestTestBase {// SOLR-3161@Testpublic void testQtUpdateFails() throws Exception {- enableStreamBody(true);+ enableStreamBody();SolrQuery query = new SolrQuery();query.setQuery("*:*"); // for anythingquery.add("echoHandler", "true");@@ -127,17 +127,15 @@ public class TestStreamBody extends RestTestBase {SolrException se =expectThrows(SolrException.class, () -> queryRequest.process(getSolrClient()));assertTrue(se.getMessage(), se.getMessage().contains("Stream Body is disabled"));- enableStreamBody(true);+ enableStreamBody();queryRequest.process(getSolrClient());}- // Enables/disables stream.body through Config API- private void enableStreamBody(boolean enable) throws Exception {+ // Enables stream.body through Config API+ private void enableStreamBody() throws Exception {RestTestHarness harness = restTestHarness;String payload =- "{ 'set-property' : { 'requestDispatcher.requestParsers.enableStreamBody':"- + enable- + "} }";+ "{ 'set-property' : { 'requestDispatcher.requestParsers.enableStreamBody':" + true + "} }";runConfigCommand(harness, "/config?wt=json", payload);}}diff --git a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.javaindex 5a466765d61..14bbcec28fd 100644--- a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java+++ b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java@@ -74,7 +74,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {static final String DISTANCE_MILES = "93.416565";public void testDistanceUnitsDegrees() throws Exception {- setupRPTField("degrees", "true");+ setupRPTField("degrees");assertU(adoc("str", "X", "geo", INDEXED_COORDINATES));assertU(commit());@@ -105,7 +105,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}public void testDistanceUnitsKilometers() throws Exception {- setupRPTField("kilometers", "true");+ setupRPTField("kilometers");assertU(adoc("str", "X", "geo", INDEXED_COORDINATES));assertU(commit());@@ -136,7 +136,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}public void testJunkValuesForDistanceUnits() {- Exception ex = expectThrows(Exception.class, () -> setupRPTField("rose", "true"));+ Exception ex = expectThrows(Exception.class, () -> setupRPTField("rose"));assertTrue(ex.getMessage().startsWith("Must specify distanceUnits as one of"));}@@ -184,7 +184,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}public void testGeoDistanceFunctionWithBackCompat() throws Exception {- setupRPTField(null, "true");+ setupRPTField(null);assertU(adoc("str", "X", "geo", "1,2"));assertU(commit());@@ -197,7 +197,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}public void testGeoDistanceFunctionWithKilometers() throws Exception {- setupRPTField("kilometers", "true");+ setupRPTField("kilometers");assertU(adoc("str", "X", "geo", "1,2"));assertU(commit());@@ -209,7 +209,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}public void testGeoDistanceFunctionWithMiles() throws Exception {- setupRPTField("miles", "true");+ setupRPTField("miles");assertU(adoc("str", "X", "geo", "1,2"));assertU(commit());@@ -223,7 +223,6 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {public void testShapeToFromStringWKT() throws Exception {setupRPTField("miles",- "true","WKT",random().nextBoolean()? new SpatialRecursivePrefixTreeFieldType()@@ -246,7 +245,6 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {public void testShapeToFromStringGeoJSON() throws Exception {setupRPTField("miles",- "true","GeoJSON",random().nextBoolean()? new SpatialRecursivePrefixTreeFieldType()@@ -262,7 +260,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {assertEquals(json, out);}- private void setupRPTField(String distanceUnits, String geo, String format, FieldType fieldType)+ private void setupRPTField(String distanceUnits, String format, FieldType fieldType)throws Exception {deleteCore();File managedSchemaFile = new File(tmpConfDir, "managed-schema.xml");@@ -286,7 +284,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {}Map<String, String> rptMap = new HashMap<String, String>();if (distanceUnits != null) rptMap.put("distanceUnits", distanceUnits);- if (geo != null) rptMap.put("geo", geo);+ rptMap.put("geo", "true");if (format != null) {rptMap.put("format", format);}@@ -312,7 +310,7 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {assertU(delQ("*:*"));}- private void setupRPTField(String distanceUnits, String geo) throws Exception {- setupRPTField(distanceUnits, geo, null, null);+ private void setupRPTField(String distanceUnits) throws Exception {+ setupRPTField(distanceUnits, null, null);}}diff --git a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.javaindex 23bd86e510b..38f32739efd 100644--- a/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java+++ b/solr/core/src/test/org/apache/solr/schema/TestManagedSchemaThreadSafety.java@@ -52,10 +52,11 @@ import org.mockito.stubbing.Answer;public class TestManagedSchemaThreadSafety extends SolrTestCaseJ4 {private static final class SuspendingZkClient extends SolrZkClient {+ private static final int ZK_CLIENT_TIMEOUT = 30000;AtomicReference<Thread> slowpoke = new AtomicReference<>();- private SuspendingZkClient(String zkServerAddress, int zkClientTimeout) {- super(zkServerAddress, zkClientTimeout);+ private SuspendingZkClient(String zkServerAddress) {+ super(zkServerAddress, ZK_CLIENT_TIMEOUT);}boolean isSlowpoke() {@@ -109,14 +110,14 @@ public class TestManagedSchemaThreadSafety extends SolrTestCaseJ4 {final String configsetName = "managed-config"; //- try (SolrZkClient client = new SuspendingZkClient(zkServer.getZkHost(), 30000)) {+ try (SolrZkClient client = new SuspendingZkClient(zkServer.getZkHost())) {// we can pick any to load configs, I suppose, but here we checkclient.upConfig(configset("cloud-managed-upgrade"), configsetName);}ExecutorService executor = ExecutorUtil.newMDCAwareCachedThreadPool("threadpool");- try (SolrZkClient raceJudge = new SuspendingZkClient(zkServer.getZkHost(), 30000)) {+ try (SolrZkClient raceJudge = new SuspendingZkClient(zkServer.getZkHost())) {ZkController zkController = createZkController(raceJudge);diff --git a/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java b/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.javaindex a73422ec4e3..edada27727a 100644--- a/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java+++ b/solr/core/src/test/org/apache/solr/search/RankQParserPluginTest.java@@ -67,19 +67,19 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {assertSyntaxError("No Field","Field can't be empty",- () -> getRankQParser(new ModifiableSolrParams(), null, req()).parse());+ () -> getRankQParser(new ModifiableSolrParams(), req()).parse());assertSyntaxError("Field empty","Field can't be empty",- () -> getRankQParser(params(FIELD, ""), null, req()).parse());+ () -> getRankQParser(params(FIELD, ""), req()).parse());assertSyntaxError("Field doesn't exist","Field \"foo\" not found",- () -> getRankQParser(params(FIELD, "foo"), null, req()).parse());+ () -> getRankQParser(params(FIELD, "foo"), req()).parse());assertSyntaxError("ID is not a feature field","Field \"id\" is not a RankField",- () -> getRankQParser(params(FIELD, "id"), null, req()).parse());+ () -> getRankQParser(params(FIELD, "id"), req()).parse());}public void testBadLogParameters() {@@ -92,7 +92,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FIELD, "rank_1",FUNCTION, "log",WEIGHT, "0"),- null,req()).parse());assertSyntaxError(@@ -104,7 +103,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FIELD, "rank_1",FUNCTION, "log",SCALING_FACTOR, "0"),- null,req()).parse());}@@ -119,7 +117,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FIELD, "rank_1",FUNCTION, "satu",WEIGHT, "2"),- null,req()).parse());assertSyntaxError(@@ -132,7 +129,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FUNCTION, "satu",PIVOT, "1",WEIGHT, "-1"),- null,req()).parse());}@@ -147,7 +143,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FIELD, "rank_1",FUNCTION, "sigm",EXPONENT, "1"),- null,req()).parse());assertSyntaxError(@@ -159,7 +154,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FIELD, "rank_1",FUNCTION, "sigm",PIVOT, "1"),- null,req()).parse());assertSyntaxError(@@ -173,7 +167,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {PIVOT, "1",EXPONENT, "1",WEIGHT, "-1"),- null,req()).parse());assertSyntaxError(@@ -186,7 +179,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FUNCTION, "sigm",PIVOT, "0",EXPONENT, "1"),- null,req()).parse());assertSyntaxError(@@ -199,7 +191,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {FUNCTION, "sigm",PIVOT, "1",EXPONENT, "0"),- null,req()).parse());}@@ -213,7 +204,6 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {params(FIELD, "rank_1",FUNCTION, "foo"),- null,req()).parse());}@@ -319,7 +309,7 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {private void assertValidRankQuery(String expectedToString, SolrParams localParams)throws IOException, SyntaxError {- QParser parser = getRankQParser(localParams, null, req());+ QParser parser = getRankQParser(localParams, req());Query q = parser.parse();assertNotNull(q);assertThat(q.toString(), CoreMatchers.equalTo(expectedToString));@@ -358,10 +348,10 @@ public class RankQParserPluginTest extends SolrTestCaseJ4 {assertThat(se.getMessage(), CoreMatchers.containsString(expectedExceptionMsg));}- private RankQParser getRankQParser(- SolrParams localParams, SolrParams params, SolrQueryRequest req) throws IOException {+ private RankQParser getRankQParser(SolrParams localParams, SolrQueryRequest req)+ throws IOException {try (RankQParserPlugin rankQPPlugin = new RankQParserPlugin()) {- return (RankQParser) rankQPPlugin.createParser("", localParams, params, req);+ return (RankQParser) rankQPPlugin.createParser("", localParams, null, req);}}}diff --git a/solr/core/src/test/org/apache/solr/search/TestCancellableCollector.java b/solr/core/src/test/org/apache/solr/search/TestCancellableCollector.javaindex e5210ec3ade..1641f14bea5 100644--- a/solr/core/src/test/org/apache/solr/search/TestCancellableCollector.java+++ b/solr/core/src/test/org/apache/solr/search/TestCancellableCollector.java@@ -117,20 +117,10 @@ public class TestCancellableCollector extends SolrTestCase {assertEquals(topDocs.totalHits.value, topScoreDocCollector.getTotalHits());}- private void cancelQuery(CancellableCollector cancellableCollector, final int sleepTime) {+ private void cancelQuery(CancellableCollector cancellableCollector) {executor.submit(() -> {- // Wait for some time to let the query start- try {- if (sleepTime > 0) {- Thread.sleep(sleepTime);- }-- cancellableCollector.cancel();- } catch (InterruptedException e) {- Thread.currentThread().interrupt();- throw new RuntimeException(e.getMessage());- }+ cancellableCollector.cancel();});}@@ -157,7 +147,7 @@ public class TestCancellableCollector extends SolrTestCase {CancellableCollector.QueryCancelledException.class,() -> {// Cancel the query before the document collection starts- cancelQuery(cancellableCollector, 0);+ cancelQuery(cancellableCollector);executeSearchTest(searcher, query, cancellableCollector, 5000);});@@ -172,7 +162,7 @@ public class TestCancellableCollector extends SolrTestCase {CancellableCollector.QueryCancelledException.class,() -> {// Cancel the query before the document collection starts- cancelQuery(cancellableCollector, 0);+ cancelQuery(cancellableCollector);executeSearchTest(searcher, query, cancellableCollector, 5000);});diff --git a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.javaindex a9d2063326a..ba34b465d2c 100644--- a/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java+++ b/solr/core/src/test/org/apache/solr/search/TestCollapseQParserPlugin.java@@ -371,8 +371,8 @@ public class TestCollapseQParserPlugin extends SolrTestCaseJ4 {@Testpublic void testDoubleCollapse() {- testDoubleCollapse("group_s", "");- testDoubleCollapse("group_i", "");+ testDoubleCollapse("group_s");+ testDoubleCollapse("group_i");}/*@@ -381,7 +381,7 @@ public class TestCollapseQParserPlugin extends SolrTestCaseJ4 {* the by finally method of the first collapse. This specific test is meant to confirm that any feature* that causes searches to not visit each segment (such as early query termination) doesn't break collapse.*/- private void testDoubleCollapse(String group, String hint) {+ private void testDoubleCollapse(String group) {String[] doc = {"id", "1", "term_s", "YYYY", group, "1", "test_i", "5", "test_l", "10", "test_f", "2000"};@@ -421,8 +421,8 @@ public class TestCollapseQParserPlugin extends SolrTestCaseJ4 {ModifiableSolrParams params = new ModifiableSolrParams();params.add("q", "id:(1 2 5)");- params.add("fq", "{!collapse cost=200 field=term_s " + hint + "}");- params.add("fq", "{!collapse cost=400 field=" + group + "" + hint + "}");+ params.add("fq", "{!collapse cost=200 field=term_s }");+ params.add("fq", "{!collapse cost=400 field=" + group + "}");params.add("defType", "edismax");params.add("bf", "field(test_i)");@@ -431,8 +431,8 @@ public class TestCollapseQParserPlugin extends SolrTestCaseJ4 {params = new ModifiableSolrParams();params.add("q", "id:(1 2 5)");- params.add("fq", "{!collapse cost=200 max=test_i field=term_s " + hint + "}");- params.add("fq", "{!collapse cost=400 max=test_i field=" + group + "" + hint + "}");+ params.add("fq", "{!collapse cost=200 max=test_i field=term_s }");+ params.add("fq", "{!collapse cost=400 max=test_i field=" + group + "}");params.add("defType", "edismax");params.add("bf", "field(test_i)");diff --git a/solr/core/src/test/org/apache/solr/search/TestDocSet.java b/solr/core/src/test/org/apache/solr/search/TestDocSet.javaindex 6de3340689b..3d844936f69 100644--- a/solr/core/src/test/org/apache/solr/search/TestDocSet.java+++ b/solr/core/src/test/org/apache/solr/search/TestDocSet.java@@ -406,8 +406,7 @@ public class TestDocSet extends SolrTestCase {subs[i] = dummyIndexReader(rand.nextInt(maxDoc));}- MultiReader mr = new MultiReader(subs);- return mr;+ return new MultiReader(subs);}private static boolean checkNullOrEmpty(DocIdSetIterator[] disis) throws IOException {diff --git a/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.javaindex 5b811f14c49..5a9bf4ae6c7 100644--- a/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java+++ b/solr/core/src/test/org/apache/solr/search/TestHashQParserPlugin.java@@ -82,8 +82,7 @@ public class TestHashQParserPlugin extends SolrTestCaseJ4 {params.add("fq", "{!hash worker=0 workers=1 cost=" + getCost(random()) + "}");params.add("partitionKeys", "a_i");params.add("wt", "xml");- ModifiableSolrParams finalParams = params;- expectThrows(SolrException.class, () -> h.query(req(finalParams)));+ expectThrows(SolrException.class, () -> h.query(req(params)));}@Testdiff --git a/solr/core/src/test/org/apache/solr/search/TestSearchPerf.java b/solr/core/src/test/org/apache/solr/search/TestSearchPerf.javaindex d6bbfd46127..d04bcb7199d 100644--- a/solr/core/src/test/org/apache/solr/search/TestSearchPerf.java+++ b/solr/core/src/test/org/apache/solr/search/TestSearchPerf.java@@ -33,6 +33,8 @@ import org.junit.BeforeClass;/** */public class TestSearchPerf extends SolrTestCaseJ4 {+ private static final int ITERATIONS = 500;+@BeforeClasspublic static void beforeClass() throws Exception {initCore("solrconfig.xml", "schema11.xml");@@ -153,8 +155,7 @@ public class TestSearchPerf extends SolrTestCaseJ4 {return ret;}- int doListGen(int iter, Query q, List<Query> filt, boolean cacheQuery, boolean cacheFilt)- throws Exception {+ private int doListGen(Query q, List<Query> filt) throws Exception {SolrQueryRequest req = lrf.makeRequest();SolrIndexSearcher searcher = req.getSearcher();@@ -162,22 +163,15 @@ public class TestSearchPerf extends SolrTestCaseJ4 {final RTimer timer = new RTimer();int ret = 0;- for (int i = 0; i < iter; i++) {+ for (int i = 0; i < ITERATIONS; i++) {DocList l =- searcher.getDocList(- q,- filt,- (Sort) null,- 0,- 10,- (cacheQuery ? 0 : SolrIndexSearcher.NO_CHECK_QCACHE)- | (cacheFilt ? 0 : SolrIndexSearcher.NO_CHECK_FILTERCACHE));+ searcher.getDocList(q, filt, (Sort) null, 0, 10, SolrIndexSearcher.NO_CHECK_QCACHE);ret += l.matches();}double elapsed = timer.getTime();System.out.println(- "ret=" + ret + " time=" + elapsed + " throughput=" + iter * 1000 / (elapsed + 1));+ "ret=" + ret + " time=" + elapsed + " throughput=" + ITERATIONS * 1000 / (elapsed + 1));req.close();assertTrue(ret > 0); // make sure we did some work@@ -248,8 +242,7 @@ public class TestSearchPerf extends SolrTestCaseJ4 {createIndex2(indexSize, "foomany_s", "t10_100_ws");- // doListGen(100, q, filters, false, true);- doListGen(500, q, filters, false, true);+ doListGen(q, filters);req.close();}diff --git a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.javaindex de4612281ce..3aed5e46d5a 100644--- a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java+++ b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java@@ -209,10 +209,9 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {@Testpublic void checkResultFormat() {// Check input and output format is the same- String IN = "89.9,-130"; // lat,lon- String OUT = IN; // IDENTICAL!+ final String IN_OUT = "89.9,-130"; // lat,lon- assertU(adoc("id", "11", fieldName, IN));+ assertU(adoc("id", "11", fieldName, IN_OUT));assertU(commit());assertQ(@@ -224,8 +223,8 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {"rows","1000","fq",- "{!bbox sfield=" + fieldName + " pt=" + IN + " d=9}"),- "//result/doc/*[@name='" + fieldName + "']//text()='" + OUT + "'");+ "{!bbox sfield=" + fieldName + " pt=" + IN_OUT + " d=9}"),+ "//result/doc/*[@name='" + fieldName + "']//text()='" + IN_OUT + "'");}@Testdiff --git a/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java b/solr/core/src/test/org/apache/solr/search/TestTaskManagement.javaindex 74a946d7651..9e44b1cd6b8 100644--- a/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java+++ b/solr/core/src/test/org/apache/solr/search/TestTaskManagement.java@@ -132,7 +132,7 @@ public class TestTaskManagement extends SolrCloudTestCase {NamedList<String> tasks = listTasks();for (int i = 0; i < 100; i++) {- cancelFutures.add(cancelQuery(Integer.toString(i), 0, queryIdsSet, notFoundIdsSet));+ cancelFutures.add(cancelQuery(Integer.toString(i), queryIdsSet, notFoundIdsSet));}cancelFutures.forEach(CompletableFuture::join);@@ -204,10 +204,7 @@ public class TestTaskManagement extends SolrCloudTestCase {}private CompletableFuture<Void> cancelQuery(- final String queryID,- final int sleepTime,- Set<Integer> cancelledQueryIdsSet,- Set<Integer> notFoundQueryIdSet) {+ final String queryID, Set<Integer> cancelledQueryIdsSet, Set<Integer> notFoundQueryIdSet) {return CompletableFuture.runAsync(() -> {ModifiableSolrParams params = new ModifiableSolrParams();@@ -216,29 +213,19 @@ public class TestTaskManagement extends SolrCloudTestCase {SolrRequest<?> request = new QueryRequest(params);request.setPath("/tasks/cancel");- // Wait for some time to let the query starttry {- if (sleepTime > 0) {- Thread.sleep(sleepTime);- }-- try {- NamedList<Object> queryResponse;+ NamedList<Object> queryResponse;- queryResponse = cluster.getSolrClient().request(request);+ queryResponse = cluster.getSolrClient().request(request);- int responseCode = (int) queryResponse.get("responseCode");+ int responseCode = (int) queryResponse.get("responseCode");- if (responseCode == 200 /* HTTP OK */) {- cancelledQueryIdsSet.add(Integer.parseInt(queryID));- } else if (responseCode == 404 /* HTTP NOT FOUND */) {- notFoundQueryIdSet.add(Integer.parseInt(queryID));- }- } catch (Exception e) {- throw new CompletionException(e);+ if (responseCode == 200 /* HTTP OK */) {+ cancelledQueryIdsSet.add(Integer.parseInt(queryID));+ } else if (responseCode == 404 /* HTTP NOT FOUND */) {+ notFoundQueryIdSet.add(Integer.parseInt(queryID));}- } catch (InterruptedException e) {- Thread.currentThread().interrupt();+ } catch (Exception e) {throw new CompletionException(e);}},diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.javaindex 02463f081dd..79614defad8 100644--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java@@ -1762,8 +1762,6 @@ public class TestJsonFacets extends SolrTestCaseHS {client.deleteByQuery("*:*", null);- Client iclient = client;-/* This code was not needed yet, but may be needed if we want to force empty shard results more often.// create a new indexing client that doesn't use one shard to better test for empty or non-existent resultsif (!client.local()) {@@ -1802,10 +1800,10 @@ public class TestJsonFacets extends SolrTestCaseHS {"true",sparse_s,"one");- iclient.add(doc, null);- iclient.add(doc, null);- iclient.add(doc, null); // a couple of deleted docs- iclient.add(+ client.add(doc, null);+ client.add(doc, null);+ client.add(doc, null); // a couple of deleted docs+ client.add(sdoc("id","2",@@ -1840,9 +1838,9 @@ public class TestJsonFacets extends SolrTestCaseHS {Z_num_l,"0"),null);- iclient.add(sdoc("id", "3"), null);- iclient.commit();- iclient.add(+ client.add(sdoc("id", "3"), null);+ client.commit();+ client.add(sdoc("id","4",@@ -1875,7 +1873,7 @@ public class TestJsonFacets extends SolrTestCaseHS {Z_num_l,Long.MIN_VALUE),null);- iclient.add(+ client.add(sdoc("id","5",@@ -1900,8 +1898,8 @@ public class TestJsonFacets extends SolrTestCaseHS {multi_ss,"a"),null);- iclient.commit();- iclient.add(+ client.commit();+ client.add(sdoc("id","6",@@ -1930,7 +1928,7 @@ public class TestJsonFacets extends SolrTestCaseHS {Z_num_l,Long.MAX_VALUE),null);- iclient.commit();+ client.commit();client.commit();// test for presence of debugging infodiff --git a/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java b/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.javaindex 16322184b97..eb1ca78b66a 100644--- a/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java+++ b/solr/core/src/test/org/apache/solr/search/function/TestOrdValues.java@@ -39,7 +39,6 @@ import org.apache.lucene.store.Directory;import org.apache.lucene.tests.analysis.MockAnalyzer;import org.apache.lucene.tests.index.RandomIndexWriter;import org.apache.lucene.tests.search.QueryUtils;-import org.apache.lucene.tests.util.TestUtil;import org.apache.lucene.util.BytesRef;import org.apache.solr.SolrTestCase;import org.apache.solr.legacy.LegacyFloatField;@@ -62,7 +61,7 @@ public class TestOrdValues extends SolrTestCase {@BeforeClasspublic static void beforeClass() throws Exception {- createIndex(false);+ createIndex();}/** Test OrdFieldSource */@@ -215,7 +214,7 @@ public class TestOrdValues extends SolrTestCase {analyzer = null;}- protected static void createIndex(boolean doMultiSegment) throws Exception {+ protected static void createIndex() throws Exception {if (VERBOSE) {System.out.println("TEST: setUp");}@@ -223,9 +222,6 @@ public class TestOrdValues extends SolrTestCase {dir = newDirectory();analyzer = new MockAnalyzer(random());IndexWriterConfig iwc = newIndexWriterConfig(analyzer).setMergePolicy(newLogMergePolicy());- if (doMultiSegment) {- iwc.setMaxBufferedDocs(TestUtil.nextInt(random(), 2, 7));- }RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwc);// add docs not exactly in natural ID order, to verify we do check the order of docs by scoresint remaining = N_DOCS;@@ -241,12 +237,11 @@ public class TestOrdValues extends SolrTestCase {i = (i + 4) % N_DOCS;remaining--;}- if (!doMultiSegment) {- if (VERBOSE) {- System.out.println("TEST: setUp full merge");- }- iw.forceMerge(1);+ if (VERBOSE) {+ System.out.println("TEST: setUp full merge");}+ iw.forceMerge(1);+iw.close();if (VERBOSE) {System.out.println("TEST: setUp done close");diff --git a/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java b/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.javaindex 2062edcf2f4..4f146cda937 100644--- a/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java+++ b/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java@@ -51,7 +51,7 @@ public class CacheHeaderTest extends CacheHeaderTestBase {@Testpublic void testCacheVetoHandler() throws Exception {- File f = makeFile(CONTENTS);+ File f = makeFile(CacheHeaderTest.CONTENTS, StandardCharsets.UTF_8.name());HttpRequestBase m =getUpdateMethod("GET",@@ -269,10 +269,6 @@ public class CacheHeaderTest extends CacheHeaderTestBase {}}- protected File makeFile(String contents) {- return makeFile(contents, StandardCharsets.UTF_8.name());- }-protected File makeFile(String contents, String charset) {try {File f = createTempFile("cachetest", "csv").toFile();diff --git a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.javaindex 90a601994d3..2a00acc7c17 100644--- a/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java+++ b/solr/core/src/test/org/apache/solr/update/MaxSizeAutoCommitTest.java@@ -124,8 +124,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {hardCommitTracker,updateHandler,() -> {- updateRequestHandler.handleRequest(- constructBatchAddDocRequest(0, numDocsToAdd), updateResp);+ updateRequestHandler.handleRequest(constructBatchAddDocRequest(numDocsToAdd), updateResp);});}@@ -149,8 +148,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {hardCommitTracker,updateHandler,() -> {- updateRequestHandler.handleRequest(- constructBatchAddDocRequest(0, numDocsToAdd), updateResp);+ updateRequestHandler.handleRequest(constructBatchAddDocRequest(numDocsToAdd), updateResp);});// Send a bunch of redundant deletes@@ -193,8 +191,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {hardCommitTracker,updateHandler,() -> {- updateRequestHandler.handleRequest(- constructBatchAddDocRequest(0, numDocsToAdd), updateResp);+ updateRequestHandler.handleRequest(constructBatchAddDocRequest(numDocsToAdd), updateResp);});// Delete all documents - should trigger a commit@@ -204,7 +201,7 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {updateHandler,() -> {updateRequestHandler.handleRequest(- constructBatchDeleteDocRequest(0, numDocsToAdd), updateResp);+ constructBatchDeleteDocRequest(numDocsToAdd), updateResp);});}@@ -212,40 +209,37 @@ public class MaxSizeAutoCommitTest extends SolrTestCaseJ4 {* Construct a batch add document request with a series of very simple Solr docs with increasing* IDs.*- * @param startId the document ID to begin with* @param batchSize the number of documents to include in the batch* @return a SolrQueryRequestBase*/- private SolrQueryRequestBase constructBatchAddDocRequest(int startId, int batchSize) {- return constructBatchRequestHelper(startId, batchSize, MaxSizeAutoCommitTest::addDoc);+ private SolrQueryRequestBase constructBatchAddDocRequest(int batchSize) {+ return constructBatchRequestHelper(batchSize, MaxSizeAutoCommitTest::addDoc);}/*** Construct a batch delete document request, with IDs incrementing from startId*- * @param startId the document ID to begin with* @param batchSize the number of documents to include in the batch* @return a SolrQueryRequestBase*/- private SolrQueryRequestBase constructBatchDeleteDocRequest(int startId, int batchSize) {- return constructBatchRequestHelper(startId, batchSize, MaxSizeAutoCommitTest::delDoc);+ private SolrQueryRequestBase constructBatchDeleteDocRequest(int batchSize) {+ return constructBatchRequestHelper(batchSize, MaxSizeAutoCommitTest::delDoc);}/*** Helper for constructing a batch update request*- * @param startId the document ID to begin with* @param batchSize the number of documents to include in the batch* @param requestFn a function that takes an (int) ID and returns an XML string of the request to* add to the batch request* @return a SolrQueryRequestBase*/private SolrQueryRequestBase constructBatchRequestHelper(- int startId, int batchSize, Function<Integer, String> requestFn) {+ int batchSize, Function<Integer, String> requestFn) {SolrQueryRequestBase updateReq =new SolrQueryRequestBase(core, new MapSolrParams(new HashMap<>())) {};List<String> docs = new ArrayList<>();- for (int i = startId; i < startId + batchSize; i++) {+ for (int i = 0; i < batchSize; i++) {docs.add(requestFn.apply(i));}updateReq.setContentStreams(toContentStreams(docs));diff --git a/solr/core/src/test/org/apache/solr/update/PeerSyncWithBufferUpdatesTest.java b/solr/core/src/test/org/apache/solr/update/PeerSyncWithBufferUpdatesTest.javaindex b04dac9b175..7d66edfc96b 100644--- a/solr/core/src/test/org/apache/solr/update/PeerSyncWithBufferUpdatesTest.java+++ b/solr/core/src/test/org/apache/solr/update/PeerSyncWithBufferUpdatesTest.java@@ -100,7 +100,7 @@ public class PeerSyncWithBufferUpdatesTest extends BaseDistributedSearchTestCaseadd(client1, seenLeader, sdoc("id", "23", "_version_", v));// client1 should be able to sync- assertSync(client1, numVersions, true, shardsArr[0]);+ assertSync(client1, numVersions, shardsArr[0]);// on-wire updates arrived at jetty1add(client1, seenLeader, sdoc("id", "21", "_version_", v - 2));@@ -172,7 +172,7 @@ public class PeerSyncWithBufferUpdatesTest extends BaseDistributedSearchTestCase}}// with many gaps, client1 should be able to sync- assertSync(client1, numVersions, true, shardsArr[0]);+ assertSync(client1, numVersions, shardsArr[0]);}private static class DeleteByQuery {@@ -215,7 +215,7 @@ public class PeerSyncWithBufferUpdatesTest extends BaseDistributedSearchTestCaseassertEquals(docsAdded.size(), qacResponse.getResults().getNumFound());}- void assertSync(SolrClient client, int numVersions, boolean expectedResult, String syncWith)+ void assertSync(SolrClient client, int numVersions, String syncWith)throws IOException, SolrServerException {QueryRequest qr =new QueryRequest(@@ -227,6 +227,6 @@ public class PeerSyncWithBufferUpdatesTest extends BaseDistributedSearchTestCase"syncWithLeader",syncWith));NamedList<?> rsp = client.request(qr);- assertEquals(expectedResult, rsp.get("syncWithLeader"));+ assertEquals(true, rsp.get("syncWithLeader"));}}diff --git a/solr/core/src/test/org/apache/solr/update/PeerSyncWithIndexFingerprintCachingTest.java b/solr/core/src/test/org/apache/solr/update/PeerSyncWithIndexFingerprintCachingTest.javaindex d502e6d93b6..07fd1ec8c4c 100644--- a/solr/core/src/test/org/apache/solr/update/PeerSyncWithIndexFingerprintCachingTest.java+++ b/solr/core/src/test/org/apache/solr/update/PeerSyncWithIndexFingerprintCachingTest.java@@ -83,7 +83,7 @@ public class PeerSyncWithIndexFingerprintCachingTest extends BaseDistributedSearAssert.assertTrue(IndexFingerprint.compare(before, after) != 0);// replica which missed the delete operation should be able to sync- assertSync(client1, numVersions, true, shardsArr[0]);+ assertSync(client1, numVersions, shardsArr[0]);client0.commit();client1.commit();@@ -98,7 +98,7 @@ public class PeerSyncWithIndexFingerprintCachingTest extends BaseDistributedSearreturn IndexFingerprint.fromObject(rsp.get("fingerprint"));}- void assertSync(SolrClient client, int numVersions, boolean expectedResult, String... syncWith)+ void assertSync(SolrClient client, int numVersions, String... syncWith)throws IOException, SolrServerException {QueryRequest qr =new QueryRequest(@@ -110,6 +110,6 @@ public class PeerSyncWithIndexFingerprintCachingTest extends BaseDistributedSear"sync",StrUtils.join(Arrays.asList(syncWith), ',')));NamedList<?> rsp = client.request(qr);- assertEquals(expectedResult, rsp.get("sync"));+ assertEquals(true, rsp.get("sync"));}}diff --git a/solr/core/src/test/org/apache/solr/update/PeerSyncWithLeaderAndIndexFingerprintCachingTest.java b/solr/core/src/test/org/apache/solr/update/PeerSyncWithLeaderAndIndexFingerprintCachingTest.javaindex 73a3a7d54cf..0f048e79c47 100644--- a/solr/core/src/test/org/apache/solr/update/PeerSyncWithLeaderAndIndexFingerprintCachingTest.java+++ b/solr/core/src/test/org/apache/solr/update/PeerSyncWithLeaderAndIndexFingerprintCachingTest.java@@ -28,7 +28,7 @@ import org.apache.solr.common.util.StrUtils;public class PeerSyncWithLeaderAndIndexFingerprintCachingTestextends PeerSyncWithIndexFingerprintCachingTest {@Override- void assertSync(SolrClient client, int numVersions, boolean expectedResult, String... syncWith)+ void assertSync(SolrClient client, int numVersions, String... syncWith)throws IOException, SolrServerException {QueryRequest qr =new QueryRequest(@@ -41,6 +41,6 @@ public class PeerSyncWithLeaderAndIndexFingerprintCachingTestStrUtils.join(Arrays.asList(syncWith), ',')));@SuppressWarnings({"rawtypes"})NamedList rsp = client.request(qr);- assertEquals(expectedResult, (Boolean) rsp.get("syncWithLeader"));+ assertEquals(true, (Boolean) rsp.get("syncWithLeader"));}}diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.javaindex 275d289b83f..a9e3e5299b5 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdateWithRouteField.java@@ -85,7 +85,7 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {new UpdateRequest().deleteByQuery("*:*").commit(cluster.getSolrClient(), COLLECTION);- new UpdateRequest().add(createDocs(NUMBER_OF_DOCS)).commit(cluster.getSolrClient(), COLLECTION);+ new UpdateRequest().add(createDocs()).commit(cluster.getSolrClient(), COLLECTION);int id = TestUtil.nextInt(random(), 1, NUMBER_OF_DOCS - 1);SolrDocument solrDocument = queryDoc(id);@@ -160,9 +160,9 @@ public class TestInPlaceUpdateWithRouteField extends SolrCloudTestCase {}}- private Collection<SolrInputDocument> createDocs(int number) {+ private Collection<SolrInputDocument> createDocs() {List<SolrInputDocument> result = new ArrayList<>();- for (int i = 0; i < number; i++) {+ for (int i = 0; i < NUMBER_OF_DOCS; i++) {String randomShard = shards[random().nextInt(shards.length)];result.add(sdoc("id", String.valueOf(i), "shardName", randomShard, "inplace_updatable_int", i));diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.javaindex 5007f48afea..ed31ce8dbed 100644--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesDistrib.java@@ -1490,8 +1490,7 @@ public class TestInPlaceUpdatesDistrib extends AbstractFullDistribZkTestBase {private String getBaseUrl(String id) throws IOException {DocCollection collection = cloudClient.getClusterState().getCollection(DEFAULT_COLLECTION);Slice slice = collection.getRouter().getTargetSlice(id, null, null, null, collection);- String baseUrl = slice.getLeader().getCoreUrl();- return baseUrl;+ return slice.getLeader().getCoreUrl();}UpdateRequest regularUpdateRequest(Object... fields) throws SolrServerException, IOException {diff --git a/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.javaindex 33cceacd319..b40f65fc2e0 100644--- a/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/AddSchemaFieldsUpdateProcessorFactoryTest.java@@ -64,8 +64,7 @@ public class AddSchemaFieldsUpdateProcessorFactoryTest extends UpdateProcessorTedoc.addField("id", "1");doc.addField(fieldName, null);- SolrInputDocument finalDoc = doc;- expectThrows(AssertionError.class, () -> processAdd("add-fields-no-run-processor", finalDoc));+ expectThrows(AssertionError.class, () -> processAdd("add-fields-no-run-processor", doc));expectThrows(AssertionError.class,diff --git a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.javaindex 6378f3fffe0..11ae41b2985 100644--- a/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/AtomicUpdateProcessorFactoryTest.java@@ -206,7 +206,7 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {cmd.getReq(),new SolrQueryResponse(),createDistributedUpdateProcessor(- cmd.getReq(), rsp, createRunUpdateProcessor(cmd.getReq(), rsp, null)))+ cmd.getReq(), rsp, createRunUpdateProcessor(cmd.getReq(), rsp))).processAdd(cmd);} catch (IOException e) {}@@ -238,8 +238,8 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {}private UpdateRequestProcessor createRunUpdateProcessor(- SolrQueryRequest req, SolrQueryResponse rsp, UpdateRequestProcessor next) {- return new RunUpdateProcessorFactory().getInstance(req, rsp, next);+ SolrQueryRequest req, SolrQueryResponse rsp) {+ return new RunUpdateProcessorFactory().getInstance(req, rsp, null);}private String generateRandomString() {diff --git a/solr/core/src/test/org/apache/solr/update/processor/TolerantUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/TolerantUpdateProcessorTest.javaindex c94c5334cd5..b3da9faf00f 100644--- a/solr/core/src/test/org/apache/solr/update/processor/TolerantUpdateProcessorTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/TolerantUpdateProcessorTest.java@@ -114,10 +114,10 @@ public class TolerantUpdateProcessorTest extends UpdateProcessorTestBase {@Testpublic void testValidAdds() throws IOException {SolrInputDocument validDoc = doc(field("id", "1"), field("text", "the quick brown fox"));- add("tolerant-chain-max-errors-10", null, validDoc);+ add("tolerant-chain-max-errors-10", validDoc);validDoc = doc(field("id", "2"), field("text", "the quick brown fox"));- add("tolerant-chain-max-errors-not-set", null, validDoc);+ add("tolerant-chain-max-errors-not-set", validDoc);assertU(commit());assertQ(req("q", "*:*"), "//result[@numFound='2']");@@ -129,7 +129,7 @@ public class TolerantUpdateProcessorTest extends UpdateProcessorTestBase {public void testInvalidAdds() throws IOException {SolrInputDocument invalidDoc1 = doc(field("text", "the quick brown fox")); // no id// This doc should fail without being tolerant- Exception e = expectThrows(Exception.class, () -> add("not-tolerant", null, invalidDoc1));+ Exception e = expectThrows(Exception.class, () -> add("not-tolerant", invalidDoc1));assertTrue(e.getMessage().contains("Document is missing mandatory uniqueKey field"));assertAddsSucceedWithErrors(@@ -418,10 +418,9 @@ public class TolerantUpdateProcessorTest extends UpdateProcessorTestBase {}}- protected SolrQueryResponse add(- final String chain, SolrParams requestParams, final SolrInputDocument doc)+ protected SolrQueryResponse add(final String chain, final SolrInputDocument doc)throws IOException {- return add(chain, requestParams, Arrays.asList(new SolrInputDocument[] {doc}));+ return add(chain, null, Arrays.asList(new SolrInputDocument[] {doc}));}protected SolrQueryResponse add(diff --git a/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java b/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.javaindex c17c9fd857a..46858324829 100644--- a/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java+++ b/solr/core/src/test/org/apache/solr/update/processor/UUIDUpdateProcessorFallbackTest.java@@ -155,7 +155,7 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {}/** Convenience method for building up SolrInputFields */- SolrInputField field(String name, float boost, Object... values) {+ SolrInputField f(String name, Object... values) {SolrInputField f = new SolrInputField(name);for (Object v : values) {f.addValue(v);@@ -163,11 +163,6 @@ public class UUIDUpdateProcessorFallbackTest extends SolrTestCaseJ4 {return f;}- /** Convenience method for building up SolrInputFields with default boost */- SolrInputField f(String name, Object... values) {- return field(name, 1.0F, values);- }-/*** Runs a document through the specified chain, and returns the final document used when the chain* is completed (NOTE: some chains may modify the document in place