Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
755c6d1
SOLR-17968: Rename HttpSolrClient to HttpApacheSolrClient
dsmiley Nov 1, 2025
f35170a
SOLR-17968: HttpSolrClient returns in org.apache.solr.client.solrj
dsmiley Nov 1, 2025
7552398
Reference HttpApacheSolrClient where appropriate.
dsmiley Nov 1, 2025
1295041
ref guide sample code
dsmiley Nov 1, 2025
93ae2a4
deprecations
dsmiley Nov 3, 2025
829e69c
Don't override getBaseURL
dsmiley Nov 3, 2025
22b070a
Change some HttpSolrClient references to HttpApacheSolrClient
dsmiley Nov 3, 2025
561a6d6
changelog
dsmiley Nov 3, 2025
82e7908
Merge branch 'main' into SOLR-17968-HttpSolrClient
dsmiley Dec 18, 2025
2a435c0
HttpApacheSolrClient no longer implements HttpClient
dsmiley Dec 27, 2025
096a5e5
Rename HttpSolrClientBase to HttpSolrClient.
dsmiley Dec 27, 2025
3705b87
Add HttpSolrClient.builder(baseUrl) static method
dsmiley Dec 27, 2025
1e2c987
Merge branch 'main' into SOLR-17968-HttpSolrClient
dsmiley Dec 27, 2025
43589c2
fix from merge
dsmiley Dec 27, 2025
abd4860
Merge remote-tracking branch 'apache/main' into SOLR-17968-HttpSolrCl…
dsmiley Jan 14, 2026
6b3f53e
solrj-streaming need not depend on jetty
dsmiley Jan 19, 2026
34e02e3
Merge branch 'refs/heads/main' into SOLR-17968-HttpSolrClient
dsmiley May 9, 2026
71472f5
Tests...
dsmiley May 11, 2026
00f488a
withHttpClient takes baseSolrUrl
dsmiley May 11, 2026
d7c767a
Tests, switch
dsmiley May 12, 2026
9b88f72
Merge branch 'main' into TestsStopUsingApacheHttpClient
dsmiley May 19, 2026
aba0816
Ignore TestRequestRateLimiter for now
dsmiley May 19, 2026
68cf3c1
Stop using HttpClientUtil
dsmiley May 19, 2026
c342722
SSLTestConfig no longer depends on Apache httpcomponents
dsmiley May 19, 2026
ba8acfa
New build tests.ssl option to force SSL when supported
dsmiley May 19, 2026
47943d6
Remove package org.apache.solr.client.solrj.apache
dsmiley May 19, 2026
1c46d68
Drop dependencies
dsmiley May 19, 2026
75f8dfb
Fix BasicDistributedZk2Test TransactionLog leak after session expiry
dsmiley May 19, 2026
b14e3ff
changelog
dsmiley May 19, 2026
b76222f
revert httpclient/httpcore LICENSE & NOTICE
dsmiley May 20, 2026
529b0a3
restore solr/ui/gradle.lockfile
dsmiley May 20, 2026
1af5b60
changelog cleanup
dsmiley May 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: >
Tests updated to NOT use org.apache.solr.client.solrj.apache which is now also removed.
solr-test-framework doesn't use/depend on Apache HttpClient/httpcomponents anymore.
type: other
authors:
- name: David Smiley
links:
- name: SOLR-18188
url: https://issues.apache.org/jira/browse/SOLR-18188
1 change: 1 addition & 0 deletions gradle/testing/randomization.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ configure(allprojects.findAll {project -> project.path.startsWith(":solr")}) {
testOptions += [
[propName: 'tests.src.home', value: null, description: "See SOLR-14023."],
[propName: 'solr.tests.use.numeric.points', value: null, description: "Point implementation to use (true=numerics, false=trie)."],
[propName: 'tests.ssl', value: false, description: "Force SSL on for all tests that support it (respects @SuppressSSL)."],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a separate PR for this build convenience thing. It's also debatable it should be elevated to be in this list.

]
}
}
Expand Down
3 changes: 0 additions & 3 deletions solr/api/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ org.apache.commons:commons-math3:3.6.1=jarValidation,testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=jarValidation,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=jarValidation,testRuntimeClasspath
org.apache.httpcomponents:httpmime:4.5.14=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.25.3=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.25.3=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.25.3=jarValidation,testRuntimeClasspath
Expand Down
3 changes: 0 additions & 3 deletions solr/benchmark/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ org.apache.commons:commons-math3:3.6.1=annotationProcessor,compileClasspath,jarV
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpmime:4.5.14=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.25.3=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.25.3=jarValidation,runtimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.25.3=jarValidation,runtimeClasspath,testRuntimeClasspath
Expand Down
1 change: 0 additions & 1 deletion solr/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ dependencies {
testRuntimeOnly(libs.mockito.subclass, {
exclude group: "net.bytebuddy", module: "byte-buddy-agent"
})
testImplementation libs.apache.httpcomponents.httpclient

testImplementation libs.opentelemetry.sdk.testing
}
3 changes: 0 additions & 3 deletions solr/core/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ org.apache.commons:commons-math3:3.6.1=apiHelper,compileClasspath,jarValidation,
org.apache.curator:curator-client:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=apiHelper,compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpclient:4.5.14=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpcore:4.4.16=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.httpcomponents:httpmime:4.5.14=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.25.3=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.25.3=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.25.3=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public void testInteractiveSolrCloudExample() throws Exception {

// index some docs - to verify all is good for both shards
try (CloudSolrClient cloudClient =
new RandomizingCloudHttp2SolrClientBuilder(
new RandomizingCloudSolrClientBuilder(
List.of(executor.solrCloudCluster.getZkServer().getZkAddress()), Optional.empty())
.withDefaultCollection(collectionName)
.build()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ private void searchSeveralWays(
} else {
// new CloudSolrClient (random shardLeadersOnly)

RandomizingCloudSolrClientBuilder builder = new RandomizingCloudSolrClientBuilder(cluster);
var builder = new RandomizingCloudSolrClientBuilder(cluster);
boolean useDefaultCollection = random().nextBoolean();
try (CloudSolrClient solrClient =
useDefaultCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CommonParams;
Expand Down Expand Up @@ -158,11 +159,25 @@ public void test() throws Exception {
.getZkController()
.getZkClient()
.getCuratorFramework()
.blockUntilConnected(50, TimeUnit.MILLISECONDS);
.blockUntilConnected(30, TimeUnit.SECONDS);

indexr("id", docId + 1, t1, "slip this doc in");

waitForRecoveriesToFinish(false);
// Wait for the session-expired node to fully re-register its replica as ACTIVE.
// waitForRecoveriesToFinish alone is insufficient because it ignores replicas on nodes
// not yet back in live_nodes, which can race with teardown.
String expiredNodeName = cloudJetty.jetty.getNodeName();
ZkStateReader.from(cloudClient)
.waitForState(
DEFAULT_COLLECTION,
60,
TimeUnit.SECONDS,
(liveNodes, collectionState) ->
liveNodes.contains(expiredNodeName)
&& collectionState.getSlices().stream()
.flatMap(s -> s.getReplicas().stream())
.filter(r -> liveNodes.contains(r.getNodeName()))
.allMatch(r -> r.getState() == Replica.State.ACTIVE));

checkShardConsistency(SHARD1);
checkShardConsistency(SHARD2);
Expand Down Expand Up @@ -285,7 +300,7 @@ private void bringDownShardIndexSomeDocsAndRecover() throws Exception {

// ensure shard is dead
expectThrows(
SolrServerException.class,
Exception.class,
"This server should be down and this update should have failed",
() -> index_specific(deadShard.client.solrClient, id, 999, i1, 107, t1, "specific doc!"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.apache.HttpSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest.Create;
Expand Down Expand Up @@ -695,10 +695,9 @@ public void test() throws Exception {

// try add commitWithin
long before = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
for (SolrClient client : clients) {
for (var client : clients) {
assertEquals(
"unexpected pre-commitWithin document count on node: "
+ ((HttpSolrClient) client).getBaseURL(),
"unexpected pre-commitWithin document count on node: " + client.getBaseURL(),
before,
client.query(new SolrQuery("*:*")).getResults().getNumFound());
}
Expand Down Expand Up @@ -1040,7 +1039,7 @@ private void testShardParamVariations() throws Exception {

private void testStopAndStartCoresInOneInstance() throws Exception {
JettySolrRunner jetty = jettys.get(0);
try (final SolrClient httpSolrClient = (HttpSolrClient) jetty.newClient(15000, 60000)) {
try (final var httpSolrClient = jetty.newClient(15000, 60000)) {
ThreadPoolExecutor executor = null;
try {
executor =
Expand Down Expand Up @@ -1149,9 +1148,9 @@ protected CollectionAdminResponse createCollection(

CollectionAdminResponse res = new CollectionAdminResponse();
if (client == null) {
final String baseUrl = ((HttpSolrClient) clients.get(clientIndex)).getBaseURL();
final String baseUrl = clients.get(clientIndex).getBaseURL();

try (SolrClient aClient = createNewSolrClient("", baseUrl)) {
try (SolrClient aClient = createNewSolrClient(baseUrl, null)) {
res.setResponse(aClient.request(request));
}
} else {
Expand Down Expand Up @@ -1259,7 +1258,7 @@ private void doOptimisticLockingAndUpdating() throws Exception {

private void testNumberOfCommitsWithCommitAfterAdd() throws SolrServerException, IOException {
log.info("### STARTING testNumberOfCommitsWithCommitAfterAdd");
long startCommits = getNumCommits((HttpSolrClient) clients.get(0));
long startCommits = getNumCommits(clients.getFirst());

NamedList<Object> result =
clients
Expand All @@ -1270,17 +1269,13 @@ private void testNumberOfCommitsWithCommitAfterAdd() throws SolrServerException,
.setCommitWithin(900000)
.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true));

long endCommits = getNumCommits((HttpSolrClient) clients.get(0));
long endCommits = getNumCommits(clients.getFirst());
assertEquals(startCommits + 1L, endCommits);
}

private Long getNumCommits(HttpSolrClient sourceClient) throws SolrServerException, IOException {
String collection = sourceClient.getDefaultCollection();
try (SolrClient client =
new HttpSolrClient.Builder(sourceClient.getBaseURL())
.withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
.withSocketTimeout(60000, TimeUnit.MILLISECONDS)
.build()) {
private Long getNumCommits(HttpSolrClient client) throws SolrServerException, IOException {
String collection = client.getDefaultCollection();
{
var req = new MetricsRequest(SolrParams.of("wt", "prometheus"));

NamedList<Object> resp = client.request(req);
Expand Down Expand Up @@ -1318,7 +1313,7 @@ private void testANewCollectionInOneInstanceWithManualShardAssignement() throws
.setNode(jettys.get(0).getNodeName())
.process(cloudClient);
for (String coreName : resp.getCollectionCoresStatus().keySet()) {
collectionClients.add(createNewSolrClient(coreName, jettys.get(0).getBaseUrl().toString()));
collectionClients.add(createNewSolrClient(jettys.get(0).getBaseUrl().toString(), coreName));
}
}

Expand Down Expand Up @@ -1379,11 +1374,7 @@ private void testANewCollectionInOneInstanceWithManualShardAssignement() throws
.getLeader("shard1");

// now test that unloading a core gets us a new leader
try (SolrClient unloadClient =
new HttpSolrClient.Builder(jettys.get(0).getBaseUrl().toString())
.withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
.withSocketTimeout(60000, TimeUnit.MILLISECONDS)
.build()) {
try (SolrClient unloadClient = jettys.getFirst().newClient(15000, 60000)) {
Unload unloadCmd = new Unload(true);
unloadCmd.setCoreName(leader.getCoreName());

Expand Down Expand Up @@ -1431,12 +1422,11 @@ public void run() {

private void testSearchByCollectionName() throws SolrServerException, IOException {
log.info("### STARTING testSearchByCollectionName");
SolrClient client = clients.get(0);
final String baseUrl = ((HttpSolrClient) client).getBaseURL();
final String baseUrl = clients.getFirst().getBaseURL();

// the cores each have different names, but if we add the collection name to the url
// we should get mapped to the right core
try (SolrClient client1 = createNewSolrClient(oneInstanceCollection, baseUrl)) {
try (SolrClient client1 = createNewSolrClient(baseUrl, oneInstanceCollection)) {
SolrQuery query = new SolrQuery("*:*");
long oneDocs = client1.query(query).getResults().getNumFound();
assertEquals(3, oneDocs);
Expand All @@ -1445,13 +1435,12 @@ private void testSearchByCollectionName() throws SolrServerException, IOExceptio

private void testUpdateByCollectionName() throws SolrServerException, IOException {
log.info("### STARTING testUpdateByCollectionName");
SolrClient client = clients.get(0);
final String baseUrl = ((HttpSolrClient) client).getBaseURL();
final String baseUrl = clients.getFirst().getBaseURL();

// the cores each have different names, but if we add the collection name to the url
// we should get mapped to the right core
// test hitting an update url
try (SolrClient client1 = createNewSolrClient(oneInstanceCollection, baseUrl)) {
try (SolrClient client1 = createNewSolrClient(baseUrl, oneInstanceCollection)) {
client1.commit();
}
}
Expand All @@ -1465,7 +1454,7 @@ private void testANewCollectionInOneInstance() throws Exception {
assertEquals(0, response.getStatus());
List<SolrClient> collectionClients = new ArrayList<>();
for (String coreName : response.getCollectionCoresStatus().keySet()) {
collectionClients.add(createNewSolrClient(coreName, jettys.get(0).getBaseUrl().toString()));
collectionClients.add(createNewSolrClient(jettys.get(0).getBaseUrl().toString(), coreName));
}

SolrClient client1 = collectionClients.get(0);
Expand Down Expand Up @@ -1539,7 +1528,7 @@ private void createSolrCore(

pending.add(completionService.submit(call));

collectionClients.add(createNewSolrClient(collection + num, baseUrl));
collectionClients.add(createNewSolrClient(baseUrl, collection + num));
}

private void testMultipleCollections() throws Exception {
Expand Down Expand Up @@ -1661,7 +1650,7 @@ private void createNewCollection(final String collection) throws InterruptedExce
return null;
};

collectionClients.add(createNewSolrClient(collection, runner.getBaseUrl().toString()));
collectionClients.add(createNewSolrClient(runner.getBaseUrl().toString(), collection));
pending.add(completionService.submit(call));
while (pending != null && pending.size() > 0) {

Expand All @@ -1672,35 +1661,6 @@ private void createNewCollection(final String collection) throws InterruptedExce
}
}

@Override
protected SolrClient createNewSolrClient(String collection, String baseUrl) {

SolrClient client = getHttpSolrClient(baseUrl, collection);

return client;
}

/**
* @param collection the name of a collection or core to set as the "default" on the created
* client.
* @param baseUrl the "base" URL of a Solr node. Should <em>not</em> contain a collection or core
* name.
* @param connectionTimeoutMillis the HTTP connection timeout in milliseconds
* @param socketTimeoutMillis the HTTP socket-read timeout in milliseconds
*/
protected SolrClient createNewSolrClient(
String collection, String baseUrl, int connectionTimeoutMillis, int socketTimeoutMillis) {

SolrClient client =
new HttpSolrClient.Builder(baseUrl)
.withDefaultCollection(collection)
.withConnectionTimeout(connectionTimeoutMillis, TimeUnit.MILLISECONDS)
.withSocketTimeout(socketTimeoutMillis, TimeUnit.MILLISECONDS)
.build();

return client;
}

@Override
protected QueryResponse queryRandomShard(ModifiableSolrParams params)
throws SolrServerException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.concurrent.TimeUnit;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.apache.CloudLegacySolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.common.SolrInputDocument;
Expand Down Expand Up @@ -133,7 +132,7 @@ protected CloudSolrClient createCloudClient(String defaultCollection) {

protected CloudSolrClient createCloudClient(String defaultCollection, int socketTimeout) {

return getCloudSolrClient(
return createNewCloudSolrClient(
zkServer.getZkAddress(), defaultCollection, random().nextBoolean(), 30000, socketTimeout);
}

Expand Down Expand Up @@ -183,13 +182,7 @@ public void test() throws Exception {
if (runFullThrottle) {
ftIndexThread =
new FullThrottleStoppableIndexingThread(
((CloudLegacySolrClient) cloudClient).getHttpClient(),
controlClient,
cloudClient,
clients,
"ft1",
true,
this.clientSoTimeout);
controlClient, cloudClient, clients, "ft1", true, this.clientSoTimeout);
ftIndexThread.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.concurrent.TimeUnit;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.apache.CloudLegacySolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.SolrQuery;
import org.apache.solr.common.SolrInputDocument;
Expand Down Expand Up @@ -144,7 +143,7 @@ protected CloudSolrClient createCloudClient(String defaultCollection) {
}

protected CloudSolrClient createCloudClient(String defaultCollection, int socketTimeout) {
return getCloudSolrClient(
return createNewCloudSolrClient(
zkServer.getZkAddress(), defaultCollection, random().nextBoolean(), 30000, socketTimeout);
}

Expand Down Expand Up @@ -217,13 +216,7 @@ public void test() throws Exception {
if (runFullThrottle) {
ftIndexThread =
new FullThrottleStoppableIndexingThread(
((CloudLegacySolrClient) cloudClient).getHttpClient(),
controlClient,
cloudClient,
clients,
"ft1",
true,
this.clientSoTimeout);
controlClient, cloudClient, clients, "ft1", true, this.clientSoTimeout);
ftIndexThread.start();
}

Expand Down
Loading
Loading