pzampino commented on code in PR #792:
URL: https://github.com/apache/knox/pull/792#discussion_r1318003196


##########
gateway-service-health/src/main/java/org/apache/knox/gateway/service/health/PingResource.java:
##########
@@ -72,16 +78,31 @@ private Response getPingResponse() {
     response.setHeader(CACHE_CONTROL, NO_CACHE);
     response.setContentType(CONTENT_TYPE);
     try (PrintWriter writer = response.getWriter()) {
-      writer.println(getPingContent());
+      writer.println(OK);

Review Comment:
   Is this changing the behavior of the HEALTH service in an incompatible way? 
Or is it still always returning "OK"? Want to make sure we do not need to have 
a new API version (i.e., v2)?



##########
gateway-server/src/main/java/org/apache/knox/gateway/services/factory/GatewayStatusCheckerFactory.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.services.factory;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.unmodifiableList;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.Service;
+import org.apache.knox.gateway.services.ServiceLifecycleException;
+import org.apache.knox.gateway.services.ServiceType;
+import org.apache.knox.gateway.services.topology.impl.GatewayStatusChecker;
+
+public class GatewayStatusCheckerFactory extends AbstractServiceFactory {
+
+  @Override
+  protected Service createService(GatewayServices gatewayServices, ServiceType 
serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String 
implementation) throws ServiceLifecycleException {
+    return new GatewayStatusChecker();

Review Comment:
   Why not just pass in the GatewayConfig here at instantiation time instead of 
later in GatewayServer? Then initTopologiesToCheck could be parameterless.



##########
gateway-service-health/src/test/java/org/apache/knox/gateway/service/health/PingResourceTest.java:
##########
@@ -24,6 +24,6 @@ public class PingResourceTest {
   @Test
   public void testPingCdoGetontent() {
     PingResource pr = new PingResource();
-    Assert.assertEquals(pr.getPingContent(), pr.CONTENT);
+    Assert.assertEquals(PingResource.OK, pr.OK);

Review Comment:
   What is this testing now? Just comparing constant values?



##########
gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/GatewayStatusChecker.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.knox.gateway.services.topology.impl;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.knox.gateway.GatewayMessages;
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.services.Service;
+import org.apache.knox.gateway.services.ServiceLifecycleException;
+
+public class GatewayStatusChecker implements Service {

Review Comment:
   Minor: Is GatewayStatusService better than GatewayStatusChecker?



-- 
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: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to