chibenwa commented on code in PR #2399:
URL: https://github.com/apache/james-project/pull/2399#discussion_r1745328094


##########
server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/HealthCheckRoutesTest.java:
##########
@@ -419,11 +578,25 @@ void 
getHealthchecksShouldReturnHealthCheckWhenHealthCheckPresent() {
     void getHealthchecksShouldReturnHealthChecksWhenHealthChecksPresent() {
         healthChecks.add(healthCheck(Result.healthy(COMPONENT_NAME_2)));
         healthChecks.add(healthCheck(Result.healthy(COMPONENT_NAME_3)));
+        updateHealthCheckRoutes();
+
         when()
            .get(HealthCheckRoutes.CHECKS)
         .then()
            .body("", hasSize(2))
            .statusCode(HttpStatus.OK_200);
     }
 
+    private void updateHealthCheckRoutes() {

Review Comment:
   **Evil**
   
   Please do without it



##########
server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java:
##########
@@ -101,11 +113,25 @@ public Object performHealthCheckForComponent(Request 
request, Response response)
     }
 
     public Object getHealthChecks(Request request, Response response) {
-        return healthChecks.stream()
-                .map(healthCheck -> new 
HealthCheckDto(healthCheck.componentName()))
-                .collect(ImmutableList.toImmutableList());
+        return healthCheckMap.values().stream()
+            .map(healthCheck -> new 
HealthCheckDto(healthCheck.componentName()))
+            .collect(ImmutableList.toImmutableList());
+    }
+
+    private Collection<HealthCheck> getHealthChecks(String 
componentNamesString) {
+        List<ComponentName> componentNames = 
Arrays.stream(componentNamesString.split("\\+")).map(ComponentName::new).toList();

Review Comment:
   Splitter.on(...).splitToList(...)



##########
server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java:
##########
@@ -56,15 +63,17 @@ public class HealthCheckRoutes implements PublicRoutes {
 
     public static final String HEALTHCHECK = "/healthcheck";
     public static final String CHECKS = "/checks";
-    
+
     private static final String PARAM_COMPONENT_NAME = "componentName";
+    private static final String QUERY_PARAM_COMPONENT_NAMES = "checks";
 
     private final JsonTransformer jsonTransformer;
-    private final Set<HealthCheck> healthChecks;
+    private final Map<ComponentName, HealthCheck> healthCheckMap;

Review Comment:
   > discussed with @quantranhong1999 --> ignore
   
   Why?
   
   I was having same comment...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to