2323import java .util .Arrays ;
2424import java .util .Collection ;
2525import java .util .Properties ;
26- import org .apache .solr .client .api .model .NodeHealthResponse ;
2726import org .apache .solr .client .solrj .RemoteSolrException ;
2827import org .apache .solr .client .solrj .SolrClient ;
2928import org .apache .solr .client .solrj .SolrRequest ;
3029import org .apache .solr .client .solrj .SolrServerException ;
3130import org .apache .solr .client .solrj .request .CollectionAdminRequest ;
3231import org .apache .solr .client .solrj .request .GenericSolrRequest ;
3332import org .apache .solr .client .solrj .request .HealthCheckRequest ;
34- import org .apache .solr .client .solrj .request .V2Request ;
3533import org .apache .solr .client .solrj .response .CollectionAdminResponse ;
3634import org .apache .solr .client .solrj .response .HealthCheckResponse ;
37- import org .apache .solr .client .solrj .response .V2Response ;
3835import org .apache .solr .cloud .CloudDescriptor ;
3936import org .apache .solr .cloud .ClusterStateMockUtil ;
4037import org .apache .solr .cloud .SolrCloudTestCase ;
@@ -106,11 +103,7 @@ public void testHealthCheckHandler() throws Exception {
106103
107104 // negative check of our (new) "broken" node that we deliberately put into an unhealthy state
108105 RemoteSolrException e =
109- expectThrows (
110- RemoteSolrException .class ,
111- () -> {
112- runHealthcheckWithClient (solrClient );
113- });
106+ expectThrows (RemoteSolrException .class , () -> runHealthcheckWithClient (solrClient ));
114107 assertTrue (e .getMessage (), e .getMessage ().contains ("Host Unavailable" ));
115108 assertEquals (SolrException .ErrorCode .SERVICE_UNAVAILABLE .code , e .code ());
116109 } finally {
@@ -137,48 +130,6 @@ public void testHealthCheckHandlerSolrJ() throws IOException, SolrServerExceptio
137130 }
138131 }
139132
140- @ Test
141- public void testHealthCheckV2Api () throws Exception {
142- V2Response res = new V2Request .Builder ("/node/health" ).build ().process (cluster .getSolrClient ());
143- assertEquals (0 , res .getStatus ());
144- var b = res .getResponse ().get (CommonParams .STATUS );
145- var c = NodeHealthResponse .NodeStatus .OK ;
146- // assertEquals(c, b);
147- assertTrue (b .toString ().contains (("OK" )));
148-
149- // add a new node for the purpose of negative testing
150- JettySolrRunner newJetty = cluster .startJettySolrRunner ();
151- try (SolrClient solrClient = getHttpSolrClient (newJetty .getBaseUrl ().toString ())) {
152-
153- // positive check that our (new) "healthy" node works with direct http client
154- var d =
155- new V2Request .Builder ("/node/health" )
156- .build ()
157- .process (solrClient )
158- .getResponse ()
159- .get (CommonParams .STATUS );
160- // assertEquals(
161- // NodeHealthResponse.NodeStatus.OK,
162- // );
163- assertTrue (d .toString ().contains (("OK" )));
164-
165- // now "break" our (new) node
166- newJetty .getCoreContainer ().getZkController ().getZkClient ().close ();
167-
168- // negative check of our (new) "broken" node that we deliberately put into an unhealthy state
169- RemoteSolrException e =
170- expectThrows (
171- RemoteSolrException .class ,
172- () -> {
173- new V2Request .Builder ("/node/health" ).build ().process (solrClient );
174- });
175- assertTrue (e .getMessage (), e .getMessage ().contains ("Host Unavailable" ));
176- assertEquals (SolrException .ErrorCode .SERVICE_UNAVAILABLE .code , e .code ());
177- } finally {
178- newJetty .stop ();
179- }
180- }
181-
182133 @ Test
183134 public void testFindUnhealthyCores () {
184135 // Simulate two nodes, with two collections:
0 commit comments