diff options
author | 2021-06-11 16:01:27 -0400 | |
---|---|---|
committer | 2021-06-14 09:52:32 -0400 | |
commit | deec0f708a368eb979cf8d48d6221ee52cc919ad (patch) | |
tree | 2eb53886d68b4c3332a28571218f6a5709b5f473 /gui-pdp-monitoring/src | |
parent | 8c6beedc3d58420988c9e80d75aad96198e2962e (diff) |
Fix sonar in policy/gui
use "var" for local variables
Issue-ID: POLICY-3077
Change-Id: I6e31317bfda3d2b9bdde038cec709a3398f2f655
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'gui-pdp-monitoring/src')
2 files changed, 6 insertions, 5 deletions
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java index 76fa005..7846b0e 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Bell Canada. 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. @@ -106,7 +107,7 @@ public class PdpMonitoringServerParameterParser { final var stringWriter = new StringWriter(); final var stringPrintWriter = new PrintWriter(stringWriter); - final HelpFormatter helpFormatter = new HelpFormatter(); + final var helpFormatter = new HelpFormatter(); helpFormatter.printHelp(stringPrintWriter, 120, mainClassName + " [options...] ", "", options, 0, 0, ""); return stringWriter.toString(); diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java index 419fe04..ede9bee 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Bell Canada. 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. @@ -45,7 +46,6 @@ import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpEngineWorkerStatistics; import org.onap.policy.models.pdp.concepts.PdpGroups; import org.onap.policy.models.pdp.concepts.PdpStatistics; @@ -134,7 +134,7 @@ public class PdpMonitoringRestResource { throw new IllegalArgumentException("Cannot parse groupName, subGroup and instanceId from " + id); } - Pdp pdp = pdpGroups.getGroups().stream().filter(group -> group.getName().equals(groupName)) + var pdp = pdpGroups.getGroups().stream().filter(group -> group.getName().equals(groupName)) .flatMap(group -> group.getPdpSubgroups().stream().filter(sub -> sub.getPdpType().equals(subGroup))) .flatMap(sub -> sub.getPdpInstances().stream() .filter(instance -> instance.getInstanceId().equals(instanceId))) @@ -157,7 +157,7 @@ public class PdpMonitoringRestResource { final List<EngineStatus> engineStatusList = new ArrayList<>(); if (!pdpStats.isEmpty()) { - PdpStatistics pdpStatistics = pdpStats.get(groupName).get(subGroup).get(0); + var pdpStatistics = pdpStats.get(groupName).get(subGroup).get(0); responseObject.setTimeStamp(pdpStatistics.getTimeStamp().toString()); responseObject.setPolicyDeployCount(pdpStatistics.getPolicyDeployCount()); responseObject.setPolicyDeploySuccessCount(pdpStatistics.getPolicyDeploySuccessCount()); @@ -169,7 +169,7 @@ public class PdpMonitoringRestResource { // Engine Status data for (final PdpEngineWorkerStatistics engineStats : pdpStatistics.getEngineStats()) { try { - final EngineStatus engineStatusObject = new EngineStatus(); + final var engineStatusObject = new EngineStatus(); engineStatusObject.setTimestamp(pdpStatistics.getTimeStamp().toString()); engineStatusObject.setId(engineStats.getEngineId()); engineStatusObject.setStatus(engineStats.getEngineWorkerState().name()); |