From d52d6366effdbbcb243c06c031fe9f324f16c4a9 Mon Sep 17 00:00:00 2001 From: kurczews Date: Tue, 12 Dec 2017 15:47:55 +0100 Subject: Reduce complexity of HealthCheckUtils * Split bulk conditionals * Split health checks to separate methods * Fix minor issues Issue-ID: SO-353 Change-Id: Ib6298bc488a94aa4fbb253e3894532708547533d Signed-off-by: kurczews --- .../java/org/openecomp/mso/adapters/network/HealthCheckHandler.java | 2 +- .../org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java | 2 +- .../org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java | 6 +++--- .../org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java | 2 +- .../java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java | 2 +- .../java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java | 2 +- .../java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java | 2 +- .../org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java | 4 +--- 8 files changed, 10 insertions(+), 12 deletions(-) (limited to 'adapters') diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/HealthCheckHandler.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/HealthCheckHandler.java index 85bca6fdf9..5314de0e35 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/HealthCheckHandler.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/HealthCheckHandler.java @@ -48,7 +48,7 @@ import org.openecomp.mso.utils.UUIDChecker; MsoLogger.setServiceName ("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java index 0c4c1c4c09..2a74d797da 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java @@ -46,7 +46,7 @@ import org.openecomp.mso.utils.UUIDChecker; MsoLogger.setServiceName ("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java index c69aee52da..f6a3e36a71 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java @@ -131,7 +131,7 @@ public class SDNCAdapterRestImpl { MsoLogger.setServiceName ("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } @@ -152,7 +152,7 @@ public class SDNCAdapterRestImpl { // Generate a Request Id String requestId = UUIDChecker.generateUUID(msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck (msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } @@ -175,7 +175,7 @@ public class SDNCAdapterRestImpl { // Generate a Request Id String requestId = UUIDChecker.generateUUID(msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck (msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java index 0c787cac83..f7a37fc202 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java @@ -58,7 +58,7 @@ public class SDNCAdapterRest { UUIDChecker.verifyOldUUID(requestId, LOGGER); HealthCheckUtils healthCheck = new HealthCheckUtils(); - if (!healthCheck.siteStatusCheck(LOGGER, startTime)) { + if (!healthCheck.siteStatusCheck(LOGGER)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java index ce2113ec69..1a4bec4798 100644 --- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java +++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java @@ -45,7 +45,7 @@ import org.openecomp.mso.utils.UUIDChecker; MsoLogger.setServiceName ("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java index 13e963fbb3..8e163d4d25 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java @@ -56,7 +56,7 @@ public class HealthCheckHandler { MsoLogger.setServiceName("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils(); - if(!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if(!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java index 3b619d96d7..840bd025fb 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java @@ -49,7 +49,7 @@ public class HealthCheckHandler { MsoLogger.setServiceName ("Healthcheck"); UUIDChecker.verifyOldUUID(requestId, msoLogger); HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + if (!healthCheck.siteStatusCheck(msoLogger)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java index dc94a78733..4be6b93d5c 100644 --- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java +++ b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java @@ -30,8 +30,6 @@ import javax.ws.rs.HeaderParam; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -62,7 +60,7 @@ public class WMAdapterRest { UUIDChecker.verifyOldUUID(requestId, LOGGER); HealthCheckUtils healthCheck = new HealthCheckUtils(); - if (!healthCheck.siteStatusCheck(LOGGER, startTime)) { + if (!healthCheck.siteStatusCheck(LOGGER)) { return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; } -- cgit 1.2.3-korg