Skip to content

Commit 2a81e9e

Browse files
committed
Follow the existing naming pattern.
1 parent 71feb02 commit 2a81e9e

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.apache.solr.common.util.NamedList;
2727
import org.apache.solr.core.CoreContainer;
2828
import org.apache.solr.handler.RequestHandlerBase;
29-
import org.apache.solr.handler.admin.api.NodeHealthAPI;
29+
import org.apache.solr.handler.admin.api.NodeHealth;
3030
import org.apache.solr.handler.api.V2ApiUtils;
3131
import org.apache.solr.request.SolrQueryRequest;
3232
import org.apache.solr.response.SolrQueryResponse;
@@ -59,7 +59,7 @@
5959
* <code>maxGenerationLag=&lt;max_generation_lag&gt;</code> request parameter. If <code>
6060
* maxGenerationLag</code> is not provided then health check would simply return OK.
6161
*
62-
* <p>All health-check logic lives in the v2 {@link NodeHealthAPI}; this handler is a thin v1 bridge
62+
* <p>All health-check logic lives in the v2 {@link NodeHealth}; this handler is a thin v1 bridge
6363
* that extracts request parameters and delegates.
6464
*/
6565
public class HealthCheckHandler extends RequestHandlerBase {
@@ -86,8 +86,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw
8686
final Integer maxGenerationLag =
8787
req.getParams().getInt(HealthCheckRequest.PARAM_MAX_GENERATION_LAG);
8888
V2ApiUtils.squashIntoSolrResponseWithoutHeader(
89-
rsp,
90-
new NodeHealthAPI(coreContainer).checkNodeHealth(requireHealthyCores, maxGenerationLag));
89+
rsp, new NodeHealth(coreContainer).checkNodeHealth(requireHealthyCores, maxGenerationLag));
9190
}
9291

9392
@Override
@@ -112,7 +111,7 @@ public Collection<Api> getApis() {
112111

113112
@Override
114113
public Collection<Class<? extends JerseyResource>> getJerseyResources() {
115-
return List.of(NodeHealthAPI.class);
114+
return List.of(NodeHealth.class);
116115
}
117116

118117
@Override

solr/core/src/java/org/apache/solr/handler/admin/api/NodeHealthAPI.java renamed to solr/core/src/java/org/apache/solr/handler/admin/api/NodeHealth.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@
5858
*
5959
* <p>The v1 {@link org.apache.solr.handler.admin.HealthCheckHandler} delegates to this class.
6060
*/
61-
public class NodeHealthAPI extends JerseyResource implements NodeHealthApi {
61+
public class NodeHealth extends JerseyResource implements NodeHealthApi {
6262

6363
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
6464
private static final List<State> UNHEALTHY_STATES = Arrays.asList(State.DOWN, State.RECOVERING);
6565

6666
private final CoreContainer coreContainer;
6767

6868
@Inject
69-
public NodeHealthAPI(CoreContainer coreContainer) {
69+
public NodeHealth(CoreContainer coreContainer) {
7070
this.coreContainer = coreContainer;
7171
}
7272

solr/core/src/test/org/apache/solr/handler/admin/HealthCheckHandlerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import org.apache.solr.common.params.CommonParams;
4343
import org.apache.solr.core.CoreDescriptor;
4444
import org.apache.solr.embedded.JettySolrRunner;
45-
import org.apache.solr.handler.admin.api.NodeHealthAPI;
45+
import org.apache.solr.handler.admin.api.NodeHealth;
4646
import org.junit.BeforeClass;
4747
import org.junit.Test;
4848

@@ -152,7 +152,7 @@ public void testFindUnhealthyCores() {
152152
mockCD("invalid", "invalid", "slice1", false, Replica.State.RECOVERING),
153153
// A core for a slice that is not an active slice will not fail the check
154154
mockCD("collection1", "invalid_replica1", "invalid", true, Replica.State.DOWN));
155-
long unhealthy1 = NodeHealthAPI.findUnhealthyCores(node1Cores, clusterState);
155+
long unhealthy1 = NodeHealth.findUnhealthyCores(node1Cores, clusterState);
156156
assertEquals(2, unhealthy1);
157157

158158
// Node 2
@@ -162,7 +162,7 @@ public void testFindUnhealthyCores() {
162162
mockCD("collection1", "slice1_replica4", "slice1", true, Replica.State.DOWN),
163163
mockCD(
164164
"collection2", "slice1_replica1", "slice1", true, Replica.State.RECOVERY_FAILED));
165-
long unhealthy2 = NodeHealthAPI.findUnhealthyCores(node2Cores, clusterState);
165+
long unhealthy2 = NodeHealth.findUnhealthyCores(node2Cores, clusterState);
166166
assertEquals(1, unhealthy2);
167167
}
168168
}

solr/core/src/test/org/apache/solr/handler/admin/api/NodeHealthAPITest.java renamed to solr/core/src/test/org/apache/solr/handler/admin/api/NodeHealthTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.junit.ClassRule;
3333
import org.junit.Test;
3434

35-
public class NodeHealthAPITest extends SolrCloudTestCase {
35+
public class NodeHealthTest extends SolrCloudTestCase {
3636

3737
/**
3838
* A standalone (non-ZooKeeper) Jetty instance used by the legacy-mode tests. The
@@ -107,12 +107,12 @@ public void testLegacyMode_WithoutMaxGenerationLagReturnsOk() throws Exception {
107107

108108
@Test
109109
public void testLegacyMode_WithNegativeMaxGenerationLagReturnsFailure() {
110-
// maxGenerationLag is a v1-only parameter: NodeHealthAPI.healthcheck() (v2) hardcodes it to
110+
// maxGenerationLag is a v1-only parameter: NodeHealth.healthcheck() (v2) hardcodes it to
111111
// null and never forwards it from request params. NodeApi.Healthcheck therefore cannot be used
112112
// to exercise this code path, so we call the JAX-RS implementation directly.
113113
// FIXME: IInteresting! Do we have a gap?
114114
final var response =
115-
new NodeHealthAPI(standaloneJetty.getCoreContainer()).checkNodeHealth(null, -1);
115+
new NodeHealth(standaloneJetty.getCoreContainer()).checkNodeHealth(null, -1);
116116

117117
assertNotNull(response);
118118
assertEquals(FAILURE, response.status);

0 commit comments

Comments
 (0)