diff --git a/.github/actions/prepare-for-build/action.yml b/.github/actions/prepare-for-build/action.yml index fa30567b88f0..728f91f976f6 100644 --- a/.github/actions/prepare-for-build/action.yml +++ b/.github/actions/prepare-for-build/action.yml @@ -19,14 +19,14 @@ runs: using: "composite" steps: - name: Set up Java (${{ inputs.java-distribution }}, ${{ inputs.java-version }})" - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: ${{ inputs.java-distribution }} java-version: ${{ inputs.java-version }} java-package: jdk - name: Cache gradle-wrapper.jar - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: gradle/wrapper/gradle-wrapper.jar key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.jar.sha256') }} @@ -38,3 +38,8 @@ runs: # increase expiry time for the temp. develocity token. # https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#increasing-the-expiry-time-for-develocity-access-tokens develocity-token-expiry: 8 + # the default omits "wrapper", so the distribution zip is downloaded on every run + gradle-home-cache-includes: | + caches + notifications + wrapper diff --git a/.github/workflows/docker-nightly.yml b/.github/workflows/docker-nightly.yml index af65fa3c8f44..e88df30a1b0e 100644 --- a/.github/workflows/docker-nightly.yml +++ b/.github/workflows/docker-nightly.yml @@ -97,6 +97,11 @@ jobs: uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 with: develocity-token-expiry: 8 + # the default omits "wrapper", so the distribution zip is downloaded on every run + gradle-home-cache-includes: | + caches + notifications + wrapper - name: Create custom gradle.properties run: | diff --git a/gradle/java/javac.gradle b/gradle/java/javac.gradle index e4049b3e62dd..076dc9a4fb7e 100644 --- a/gradle/java/javac.gradle +++ b/gradle/java/javac.gradle @@ -17,6 +17,14 @@ // Configure Java project defaults. +// Projects that compile free of deprecation warnings and so can keep -Xlint:deprecation on. +// Everywhere else javac prints an unsuppressable "uses or overrides a deprecated API" note +// instead; move a project here once its warnings are gone. +def deprecationLintProjects = [ + ":solr:api", + ":solr:solrj", +] + allprojects { plugins.withType(JavaPlugin) { java { @@ -38,7 +46,7 @@ allprojects { tasks.withType(JavaCompile) { options.encoding = "UTF-8" options.compilerArgs += [ - "-Xlint:-deprecation", + deprecationLintProjects.contains(project.path) ? "-Xlint:deprecation" : "-Xlint:-deprecation", "-Xlint:-serial", "-Xlint:cast", "-Xlint:classfile", diff --git a/gradle/testing/randomization/policies/solr-tests.policy b/gradle/testing/randomization/policies/solr-tests.policy index f93c8cd997c1..3d4597646d36 100644 --- a/gradle/testing/randomization/policies/solr-tests.policy +++ b/gradle/testing/randomization/policies/solr-tests.policy @@ -189,9 +189,12 @@ grant { permission java.net.NetPermission "requestPasswordAuthentication"; // for java.net.http.HttpClient. See HttpJdkSolrClientTest - permission "java.net.URLPermission" "http://127.0.0.1:*/solr/-", "HEAD,GET,PUT,POST:*"; - permission "java.net.URLPermission" "https://127.0.0.1:*/solr/-", "HEAD,GET,PUT,POST:*"; - permission "java.net.URLPermission" "socket://127.0.0.1:*", "CONNECT:*"; + // JDK-8305346: a URLPermission with a numeric IPv4 host cannot be parsed while the policy is + // bootstrapping, so such a grant is dropped with a warning; the SocketPermissions above are what + // actually confine these to loopback, so the host is a wildcard here. + permission "java.net.URLPermission" "http://*:*/solr/-", "HEAD,GET,PUT,POST:*"; + permission "java.net.URLPermission" "https://*:*/solr/-", "HEAD,GET,PUT,POST:*"; + permission "java.net.URLPermission" "socket://*:*", "CONNECT:*"; permission "java.net.URLPermission" "http://localhost:*/solr/-", "HEAD,GET,PUT,POST:*"; permission "java.net.URLPermission" "https://localhost:*/solr/-", "HEAD,GET,PUT,POST:*"; @@ -202,8 +205,8 @@ grant { permission "java.net.URLPermission" "socket://[::1]:*", "CONNECT:*"; // for java.net.http.HttpClient. See ConcurrentUpdateJdkSolrClientTest - permission "java.net.URLPermission" "http://127.0.0.1:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; - permission "java.net.URLPermission" "https://127.0.0.1:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; + permission "java.net.URLPermission" "http://*:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; + permission "java.net.URLPermission" "https://*:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; permission "java.net.URLPermission" "http://localhost:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; permission "java.net.URLPermission" "https://localhost:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; permission "java.net.URLPermission" "http://[::1]:*/noOneThere/-", "HEAD,GET,PUT,POST:*"; @@ -292,4 +295,8 @@ grant { grant { permission jdk.jfr.FlightRecorderPermission "accessFlightRecorder"; + // OtelRuntimeJvmMetrics opens a JFR recording stream for the JVM metrics + permission jdk.jfr.FlightRecorderPermission "registerEvent"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.jfr.internal.event"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.event"; }; diff --git a/solr/api/src/java/org/apache/solr/client/api/model/AddPackageVersionRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/AddPackageVersionRequestBody.java index 3b077c110d3b..38c452e1bb4a 100644 --- a/solr/api/src/java/org/apache/solr/client/api/model/AddPackageVersionRequestBody.java +++ b/solr/api/src/java/org/apache/solr/client/api/model/AddPackageVersionRequestBody.java @@ -24,13 +24,15 @@ public class AddPackageVersionRequestBody { @JsonProperty("version") - @Schema(description = "The version string for this package version.", required = true) + @Schema( + description = "The version string for this package version.", + requiredMode = Schema.RequiredMode.REQUIRED) public String version; @JsonProperty("files") @Schema( description = "File paths from the file store to include in this version.", - required = true) + requiredMode = Schema.RequiredMode.REQUIRED) public List files; @JsonProperty("manifest") diff --git a/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java index 603524e4ad1e..d4b929d64c21 100644 --- a/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java +++ b/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java @@ -27,7 +27,9 @@ public AddReplicaPropertyRequestBody(String value) { this.value = value; } - @Schema(description = "The value to assign to the property.", required = true) + @Schema( + description = "The value to assign to the property.", + requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty("value") public String value; diff --git a/solr/api/src/java/org/apache/solr/client/api/model/RenameCoreRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/RenameCoreRequestBody.java index 55037117fe80..888fc12d2068 100644 --- a/solr/api/src/java/org/apache/solr/client/api/model/RenameCoreRequestBody.java +++ b/solr/api/src/java/org/apache/solr/client/api/model/RenameCoreRequestBody.java @@ -20,7 +20,9 @@ import io.swagger.v3.oas.annotations.media.Schema; public class RenameCoreRequestBody { - @Schema(description = "The new name for the Solr core.", required = true) + @Schema( + description = "The new name for the Solr core.", + requiredMode = Schema.RequiredMode.REQUIRED) @JsonProperty public String to; diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java index 07f809e60024..06cf8bec3255 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java @@ -473,6 +473,7 @@ private synchronized boolean maybeTryHeadRequestSync(URI uriNoQueryParams) { return headSucceeded; } + @SuppressWarnings("deprecation") // getContext() has no replacement yet; see SOLR-14720 private void decorateRequest(HttpRequest.Builder reqb, SolrRequest solrRequest) { reqb.timeout(Duration.of(requestTimeoutMillis, ChronoUnit.MILLIS)); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java index 79e6b8700428..44cd6a1488f5 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/CollectionAdminRequest.java @@ -261,6 +261,7 @@ public RequestStatusState processAndWait(String asyncId, SolrClient client, long } @Override + @SuppressWarnings("deprecation") // the parameter itself is on its way out; see SOLR-17712 public SolrParams getParams() { ModifiableSolrParams params = new ModifiableSolrParams(super.getParams()); if (asyncId != null) { diff --git a/solr/solrj/src/resources/java-template/api.mustache b/solr/solrj/src/resources/java-template/api.mustache index b8c0dce81687..296bfd2b3603 100644 --- a/solr/solrj/src/resources/java-template/api.mustache +++ b/solr/solrj/src/resources/java-template/api.mustache @@ -189,6 +189,8 @@ public class {{classname}} { * @param {{name}} {{description}} */ {{/description}} + // the model field this writes to may itself be deprecated + @SuppressWarnings("deprecation") public void {{setter}}({{{dataType}}} {{name}}) { this.requestBody.{{name}} = {{name}}; } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index ab0860f0b5e3..a84449977d2e 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -1155,6 +1155,7 @@ public void testStatistics() throws Exception { } @Test + @SuppressWarnings("deprecation") // covers the deprecated ping() public void testPingHandler() throws Exception { SolrClient client = getSolrClient(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java index 0c46c15fc50e..79bd7633698c 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java @@ -28,6 +28,7 @@ import org.junit.Test; /** Test properties in configuration files. */ +@SuppressWarnings("deprecation") // the embedded base class is deprecated, not this test public class TestSolrProperties extends AbstractEmbeddedSolrServerTestCase { @Test diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java index fc9825b30ca4..1981c46332b3 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java @@ -389,7 +389,8 @@ public void testShardReplicationFactors() throws Exception { CollectionAdminRequest.createCollection(collection, "conf", 2, 1).process(client); cluster.waitForActiveCollection(collection, 2, 2); - DocCollection col = client.getClusterState().getCollection(collection); + DocCollection col = + client.getClusterStateProvider().getClusterState().getCollection(collection); String shard1Url = col.getSlice("shard1").getLeader().getCoreUrl(); String shard2Url = col.getSlice("shard2").getLeader().getCoreUrl(); NamedList> routeResponses = new NamedList<>(); @@ -482,7 +483,7 @@ public void testRouting() throws Exception { // Test that queries with _route_ params are routed by the client // Track request counts on each node before query calls - ClusterState clusterState = cluster.getSolrClient().getClusterState(); + ClusterState clusterState = cluster.getSolrClient().getClusterStateProvider().getClusterState(); DocCollection col = clusterState.getCollection("routing_collection"); Map requestCountsMap = new HashMap<>(); for (Slice slice : col.getSlices()) { @@ -853,7 +854,12 @@ public void stateVersionParamTest() throws Exception { .process(cluster.getSolrClient()); cluster.waitForActiveCollection(COLLECTION, 2, 2); - DocCollection coll = cluster.getSolrClient().getClusterState().getCollection(COLLECTION); + DocCollection coll = + cluster + .getSolrClient() + .getClusterStateProvider() + .getClusterState() + .getCollection(COLLECTION); Replica r = coll.getSlices().iterator().next().getReplicas().iterator().next(); SolrQuery q = new SolrQuery().setQuery("*:*"); @@ -896,7 +902,8 @@ public void stateVersionParamTest() throws Exception { } } String theNode = null; - Set liveNodes = cluster.getSolrClient().getClusterState().getLiveNodes(); + Set liveNodes = + cluster.getSolrClient().getClusterStateProvider().getClusterState().getLiveNodes(); for (String s : liveNodes) { String n = cluster.getZkStateReader().getBaseUrlForNodeName(s); if (!allNodesOfColl.contains(n)) { @@ -1069,7 +1076,12 @@ public void testRetryUpdatesWhenClusterStateIsStale() throws Exception { // determine the coreNodeName of only current replica Collection slices = - cluster.getSolrClient().getClusterState().getCollection(COL).getSlices(); + cluster + .getSolrClient() + .getClusterStateProvider() + .getClusterState() + .getCollection(COL) + .getSlices(); assertEquals(1, slices.size()); // sanity check Slice slice = slices.iterator().next(); assertEquals(1, slice.getReplicas().size()); // sanity check @@ -1125,7 +1137,12 @@ public void testRetryUpdatesWhenClusterStateIsStale() throws Exception { /** Asserts that each doc is on the leader of the shard it routes to, querying that core alone. */ private static void assertDocsOnShardLeaders(String collection, String... ids) throws Exception { - DocCollection col = cluster.getSolrClient().getClusterState().getCollection(collection); + DocCollection col = + cluster + .getSolrClient() + .getClusterStateProvider() + .getClusterState() + .getCollection(collection); for (String id : ids) { String coreUrl = col.getRouter().getTargetSlice(id, null, null, null, col).getLeader().getCoreUrl(); @@ -1144,7 +1161,11 @@ private static void checkSingleServer(NamedList response) { NamedList rfByRoute = (NamedList) header.get(CloudSolrClient.REPFACT_BY_ROUTE); assertNotNull("no per-route rf in " + header, rfByRoute); DocCollection col = - cluster.getSolrClient().getClusterState().getCollection("routing_collection"); + cluster + .getSolrClient() + .getClusterStateProvider() + .getClusterState() + .getCollection("routing_collection"); Set leaderUrls = new HashSet<>(); for (Slice slice : col.getSlices()) { leaderUrls.add(slice.getLeader().getCoreUrl()); @@ -1263,6 +1284,7 @@ private void queryWithPreferReplicaTypes( } @Test + @SuppressWarnings("deprecation") // covers the deprecated ping() public void testPing() throws Exception { final String testCollection = "ping_test"; CollectionAdminRequest.createCollection(testCollection, "conf", 2, 1) @@ -1275,6 +1297,7 @@ public void testPing() throws Exception { assertEquals("This should be OK", 0, response.getStatus()); } + @SuppressWarnings("deprecation") // covers the deprecated ping() public void testPerReplicaStateCollection() throws Exception { String collection = getSaferTestName(); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java index 9f9233f375e8..abfb6b2d123f 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpJdkSolrClientTest.java @@ -615,6 +615,7 @@ public void testCookieHandlerSettingHonored() throws Exception { } @Test + @SuppressWarnings("deprecation") // covers the deprecated ping() public void testPing() throws Exception { try (HttpJdkSolrClient client = builder(solrTestRule.getBaseUrl()).build()) { SolrPingResponse spr = client.ping("collection1"); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java index 08f3367edcc4..ba2117fdb3a5 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/SendUpdatesToLeadersOverrideTest.java @@ -19,7 +19,7 @@ import static org.hamcrest.Matchers.everyItem; import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.isIn; +import static org.hamcrest.Matchers.in; import static org.hamcrest.Matchers.not; import java.lang.invoke.MethodHandles; @@ -94,6 +94,7 @@ public static void setupCluster() throws Exception { final List allReplicas = cluster .getSolrClient() + .getClusterStateProvider() .getClusterState() .getCollection(COLLECTION_NAME) .replicaStream() @@ -194,7 +195,7 @@ private static RecordingResults assertUpdateWithRecording( assertThat( "post-distrib should never be PULL replica", results.postDistribCores.keySet(), - everyItem(not(isIn(PULL_REPLICA_CORE_NAMES)))); + everyItem(not(in(PULL_REPLICA_CORE_NAMES)))); return results; } @@ -252,7 +253,7 @@ private void checkUpdatesDefaultToLeaders(final CloudSolrClient client) throws E assertThat( "add pre-distrib must be leader", add.preDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertEquals( "add pre and post should match", add.preDistribCores.keySet(), @@ -286,7 +287,7 @@ private void checkUpdatesDefaultToLeaders(final CloudSolrClient client) throws E assertThat( "dbq pre-distrib must be leader", record.preDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1)); assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1)); @@ -315,7 +316,7 @@ private void checkUpdatesDefaultToLeaders(final CloudSolrClient client) throws E assertThat( "multi pre-distrib must be leaders", record.preDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat( "multi pre-distrib req != pre-distrib num cores", record.preDistribRequests.keySet(), @@ -356,7 +357,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "add pre-distrib must be PULL", add.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1)); assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1)); @@ -365,7 +366,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "add post-distrib must be leader", add.postDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat("add post-distrib size", add.postDistribRequests.keySet(), hasSize(1)); assertThat("add post-distrib size", add.postDistribCommands, hasSize(1)); @@ -378,7 +379,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "del pre-distrib must be PULL", del.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1)); assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1)); @@ -398,7 +399,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "dbq pre-distrib must be PULL", record.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1)); assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1)); @@ -425,7 +426,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "multi pre-distrib must be PULL", record.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1)); assertThat("multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10)); @@ -440,7 +441,7 @@ private void checkUpdatesWithShardsPrefPull(final CloudSolrClient client) throws assertThat( "multi post-distrib cores", record.postDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat("multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10)); } } @@ -462,7 +463,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "add pre-distrib must be PULL", add.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("add pre-distrib size", add.preDistribRequests.keySet(), hasSize(1)); assertThat("add pre-distrib size", add.preDistribCommands, hasSize(1)); @@ -471,7 +472,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "add post-distrib must be leader", add.postDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat("add post-distrib size", add.postDistribRequests.keySet(), hasSize(1)); assertThat("add post-distrib size", add.postDistribCommands, hasSize(1)); @@ -485,7 +486,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "del pre-distrib must be PULL", del.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("del pre-distrib size", del.preDistribRequests.keySet(), hasSize(1)); assertThat("del pre-distrib size", del.preDistribCommands, hasSize(1)); @@ -506,7 +507,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "dbq pre-distrib must be PULL", record.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("dbq pre-distrib size", record.preDistribRequests.keySet(), hasSize(1)); assertThat("dbq pre-distrib size", record.preDistribCommands, hasSize(1)); @@ -534,7 +535,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "multi pre-distrib must be PULL", record.preDistribCores.keySet(), - everyItem(isIn(PULL_REPLICA_CORE_NAMES))); + everyItem(in(PULL_REPLICA_CORE_NAMES))); assertThat("multi pre-distrib req size", record.preDistribRequests.keySet(), hasSize(1)); assertThat("multi pre-distrib command size", record.preDistribCommands, hasSize(100 + 10)); @@ -549,7 +550,7 @@ private void checkUpdatesWithSendToLeadersFalse(final CloudSolrClient client) th assertThat( "multi post-distrib cores", record.postDistribCores.keySet(), - everyItem(isIn(LEADER_CORE_NAMES))); + everyItem(in(LEADER_CORE_NAMES))); assertThat("multi post-distrib command size", record.postDistribCommands, hasSize(100 + 10)); } } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/QueryRequestTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/QueryRequestTest.java index dfc314c2e8c8..a40b2d59ed1a 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/QueryRequestTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/QueryRequestTest.java @@ -20,6 +20,7 @@ import org.apache.solr.client.solrj.SolrRequest; import org.junit.Test; +@SuppressWarnings("deprecation") // covers the deprecated SolrQuery.setRequestHandler public class QueryRequestTest extends SolrTestCase { @Test diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java index cf50479bd433..c18f9f48158e 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java @@ -104,6 +104,7 @@ public void init() throws Exception { } @After + @SuppressWarnings("deprecation") // no replacement for SolrJettyTestRule.reset() yet public void cleanup() throws Exception { solrTestRule.reset(); } diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java index 721a94925390..a7757a3a2be5 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrPingTest.java @@ -29,6 +29,7 @@ import org.junit.Test; /** Test SolrPing in Solrj */ +@SuppressWarnings("deprecation") // this suite exists to cover the deprecated SolrPing public class SolrPingTest extends SolrTestCase { @ClassRule diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrQueryTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrQueryTest.java index 3621b697d7d2..1c86d6cc9e38 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrQueryTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SolrQueryTest.java @@ -308,6 +308,7 @@ public void testFacetDateRange() { assertEquals("+1MONTH", q.get("f.field." + FacetParams.FACET_RANGE_GAP)); } + @SuppressWarnings("deprecation") // covers the deprecated requestHandler accessors too public void testSettersGetters() { SolrQuery q = new SolrQuery("foo"); assertEquals(10, q.setFacetLimit(10).getFacetLimit()); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java index 51c5a7bc5eec..bfbbfa0acb9c 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestConfigSetAdminRequest.java @@ -92,6 +92,7 @@ private void verifyException(ConfigSetAdminRequest request, String errorCo private static class MyConfigSetAdminRequest extends ConfigSetAdminRequest { + @SuppressWarnings("deprecation") // the no-arg super constructor is deprecated public MyConfigSetAdminRequest() {} @Override diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java index 45198ba422c3..83eb5149ab73 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java @@ -41,6 +41,7 @@ import org.apache.solr.core.SolrCore; import org.junit.Test; +@SuppressWarnings("deprecation") // the embedded base class is deprecated, not this test public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase { @Test diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java index aebadc76a426..c26e551a5bff 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestV2Request.java @@ -138,7 +138,7 @@ public void testV2Forwarding() throws Exception { + "}") .build()); - ClusterState cs = cluster.getSolrClient().getClusterState(); + ClusterState cs = cluster.getSolrClient().getClusterStateProvider().getClusterState(); System.out.println("livenodes: " + cs.getLiveNodes()); String[] node = new String[1]; diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java index a299ecb4e184..decea3e166f6 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java @@ -50,6 +50,7 @@ public void setUp() throws Exception { } @Test + @SuppressWarnings("deprecation") // SolrQuery.setRequestHandler is deprecated public void testTermsResponse() throws Exception { SolrInputDocument doc = new SolrInputDocument(); doc.setField("id", 1); diff --git a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java index 009857689d11..f3ccd7f2b1ee 100644 --- a/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java +++ b/solr/solrj/src/test/org/apache/solr/common/cloud/PerReplicaStatesIntegrationTest.java @@ -56,6 +56,7 @@ public class PerReplicaStatesIntegrationTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + @SuppressWarnings("deprecation") // covers the deprecated ping() public void testPerReplicaStateCollection() throws Exception { String testCollection = "perReplicaState_test";