From ad83319991bdd6a25416eff9f0adde148e2eee35 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Thu, 13 Sep 2018 20:37:15 -0400 Subject: Fix checkstyle for features submodules. These are the remaining submodules that have checkstyle. Pretty clean compile after this. There were a couple of sonar fixes in there also. Issue-ID: POLICY-882 Change-Id: I8191ea1aa261f4a7b9d3d21c108572fd31db1b8c Signed-off-by: Pamela Dragosh --- .../policy/drools/healthcheck/HealthCheck.java | 34 ++++---- .../drools/healthcheck/HealthCheckFeature.java | 91 +++++++++++----------- .../policy/drools/healthcheck/RestHealthCheck.java | 40 +++++----- 3 files changed, 86 insertions(+), 79 deletions(-) (limited to 'feature-healthcheck/src/main/java/org/onap') diff --git a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java index f4cb1cc6..d35b7371 100644 --- a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java +++ b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java @@ -35,41 +35,41 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Healthcheck + * Healthcheck. */ public interface HealthCheck extends Startable { /** - * Healthcheck Monitor + * Healthcheck Monitor. */ public static final HealthCheck monitor = new HealthCheckMonitor(); /** - * Healthcheck Report + * Healthcheck Report. */ public static class Report { /** - * Named Entity in the report + * Named Entity in the report. */ private String name; /** - * URL queried + * URL queried. */ private String url; /** - * healthy? + * healthy. */ private boolean healthy; /** - * return code + * return code. */ private int code; /** - * Message from remote entity + * Message from remote entity. */ private String message; @@ -132,7 +132,7 @@ public interface HealthCheck extends Startable { } /** - * Report aggregation + * Report aggregation. */ public static class Reports { private boolean healthy; @@ -167,7 +167,7 @@ public interface HealthCheck extends Startable { } /** - * perform a healthcheck + * Perform a healthcheck. * * @return a report */ @@ -176,27 +176,27 @@ public interface HealthCheck extends Startable { /** - * Healthcheck Monitor + * Healthcheck Monitor. */ class HealthCheckMonitor implements HealthCheck { /** - * Logger + * Logger. */ private static Logger logger = LoggerFactory.getLogger(HealthCheckMonitor.class); /** - * attached http servers + * attached http servers. */ protected volatile List servers = new ArrayList<>(); /** - * attached http clients + * attached http clients. */ protected volatile List clients = new ArrayList<>(); /** - * healthcheck configuration + * healthcheck configuration. */ protected volatile Properties healthCheckProperties = null; @@ -306,6 +306,8 @@ class HealthCheckMonitor implements HealthCheck { } /** + * Get servers. + * * @return list of attached Http Servers */ public List getServers() { @@ -313,6 +315,8 @@ class HealthCheckMonitor implements HealthCheck { } /** + * Get clients. + * * @return list of attached Http Clients */ public List getClients() { diff --git a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheckFeature.java b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheckFeature.java index 34c1fe3a..3a79a55c 100644 --- a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheckFeature.java +++ b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheckFeature.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * feature-healthcheck * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,53 +26,54 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * This feature provides healthcheck verification of remotely associated RESTful components + * This feature provides healthcheck verification of remotely associated RESTful components. */ -public class HealthCheckFeature implements PolicyEngineFeatureAPI { - - /** - * Logger - */ - private static Logger logger = LoggerFactory.getLogger(HealthCheckFeature.class); - - /** - * Properties Configuration Name - */ - public static final String CONFIGURATION_PROPERTIES_NAME = "feature-healthcheck"; +public class HealthCheckFeature implements PolicyEngineFeatureAPI { - @Override - public int getSequenceNumber() { - return 1000; - } + /** + * Logger. + */ + private static Logger logger = LoggerFactory.getLogger(HealthCheckFeature.class); - @Override - public boolean afterStart(PolicyEngine engine) { - try { - HealthCheck.monitor.start(); - } catch (IllegalStateException e) { - logger.error("Healthcheck Monitor cannot be started", e); - } - - return false; - } + /** + * Properties Configuration Name. + */ + public static final String CONFIGURATION_PROPERTIES_NAME = "feature-healthcheck"; - @Override - public boolean afterShutdown(PolicyEngine engine) { - try { - HealthCheck.monitor.stop(); - } catch (IllegalStateException e) { - logger.error("Healthcheck Monitor cannot be stopped", e); - } - - return false; - } - - /** - * gets the monitor - * @return the healthcheck monitor - */ - public HealthCheck getMonitor() { - return HealthCheck.monitor; - } + @Override + public int getSequenceNumber() { + return 1000; + } + + @Override + public boolean afterStart(PolicyEngine engine) { + try { + HealthCheck.monitor.start(); + } catch (IllegalStateException e) { + logger.error("Healthcheck Monitor cannot be started", e); + } + + return false; + } + + @Override + public boolean afterShutdown(PolicyEngine engine) { + try { + HealthCheck.monitor.stop(); + } catch (IllegalStateException e) { + logger.error("Healthcheck Monitor cannot be stopped", e); + } + + return false; + } + + /** + * Gets the monitor. + * + * @return the healthcheck monitor + */ + public HealthCheck getMonitor() { + return HealthCheck.monitor; + } } diff --git a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/RestHealthCheck.java b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/RestHealthCheck.java index 3f51ba46..734a75e0 100644 --- a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/RestHealthCheck.java +++ b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/RestHealthCheck.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * feature-healthcheck * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.drools.healthcheck; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.Info; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -27,12 +34,6 @@ import javax.ws.rs.core.Response; import org.onap.policy.drools.healthcheck.HealthCheck.Reports; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.Info; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; - @Path("/") @Api @Produces(MediaType.APPLICATION_JSON) @@ -50,28 +51,29 @@ import io.swagger.annotations.Tag; } ) public class RestHealthCheck { - + @GET @Path("healthcheck") @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value="Perform a system healthcheck", - notes="Provides healthy status of the PDP-D plus the components defined in its configuration by using a REST interface", - response=Reports.class - ) + value = "Perform a system healthcheck", + notes = "Provides healthy status of the PDP-D plus the components defined in its " + + "configuration by using a REST interface", + response = Reports.class + ) public Response healthcheck() { - return Response.status(Response.Status.OK).entity(HealthCheck.monitor.healthCheck()).build(); + return Response.status(Response.Status.OK).entity(HealthCheck.monitor.healthCheck()).build(); } - + @GET @Path("healthcheck/configuration") @Produces(MediaType.APPLICATION_JSON) @ApiOperation( - value="Configuration", - notes="Provides the Healthcheck server configuration and monitored REST clients", - response=HealthCheck.class - ) + value = "Configuration", + notes = "Provides the Healthcheck server configuration and monitored REST clients", + response = HealthCheck.class + ) public HealthCheck configuration() { - return HealthCheck.monitor; + return HealthCheck.monitor; } } -- cgit 1.2.3-korg