aboutsummaryrefslogtreecommitdiffstats
path: root/gui-pdp-monitoring
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-10 12:52:21 -0400
committerJim Hahn <jrh3@att.com>2021-05-10 12:53:22 -0400
commitcc035870af8fa909fc19774f0b9382cf00e051a8 (patch)
treea382cf847fe38a7e0c8e049b702eee22b6a54f80 /gui-pdp-monitoring
parentbb9489515b7a4bcbfc3e28407ec5f4f1fc4df6bb (diff)
Fix sonars in policy-gui
Fixed: - use "var" Only fixed the ones I saw visually, as SonarLint wouldn't run - something about missing node.js. Issue-ID: POLICY-3094 Change-Id: I594d424b42ce446d86724d75b1dd9ec868c14f2b Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'gui-pdp-monitoring')
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java7
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameterParser.java7
-rw-r--r--gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/rest/PdpMonitoringRestResource.java7
-rw-r--r--gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java2
-rw-r--r--gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringRestTest.java3
5 files changed, 14 insertions, 12 deletions
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
index 4324124..385e2b5 100644
--- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
+++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java
@@ -25,7 +25,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
import lombok.ToString;
-import org.onap.policy.common.parameters.ValidationResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,7 +67,7 @@ public class PdpMonitoringMain {
public PdpMonitoringMain(final String[] args) {
// Server parameter parsing
- final PdpMonitoringServerParameterParser parser = new PdpMonitoringServerParameterParser();
+ final var parser = new PdpMonitoringServerParameterParser();
try {
// Get and check the parameters
@@ -83,7 +82,7 @@ public class PdpMonitoringMain {
}
// Validate the parameters
- final ValidationResult validationResult = parameters.validate();
+ final var validationResult = parameters.validate();
if (!validationResult.isValid()) {
throw new PdpMonitoringServerParameterException(
PDP_MONITORING_PREFIX + this + ") parameters invalid, " + validationResult.getResult() + '\n'
@@ -180,7 +179,7 @@ public class PdpMonitoringMain {
*/
public static void main(final String[] args) {
try {
- final PdpMonitoringMain main = new PdpMonitoringMain(args);
+ final var main = new PdpMonitoringMain(args);
main.init();
} catch (final Exception e) {
LOGGER.error("start failed", e);
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 5d9d290..76fa005 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -66,7 +67,7 @@ public class PdpMonitoringServerParameterParser {
throw new PdpMonitoringServerParameterException("invalid command line arguments specified", e);
}
- final PdpMonitoringServerParameters parameters = new PdpMonitoringServerParameters();
+ final var parameters = new PdpMonitoringServerParameters();
final String[] remainingArgs = commandLine.getArgs();
if (commandLine.getArgs().length > 0) {
@@ -102,8 +103,8 @@ public class PdpMonitoringServerParameterParser {
* @return help string
*/
public String getHelp(final String mainClassName) {
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter stringPrintWriter = new PrintWriter(stringWriter);
+ final var stringWriter = new StringWriter();
+ final var stringPrintWriter = new PrintWriter(stringWriter);
final HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(stringPrintWriter, 120, mainClassName + " [options...] ", "", options, 0, 0, "");
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 bb11c26..419fe04 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -119,7 +120,7 @@ public class PdpMonitoringRestResource {
@QueryParam("username") final String username, @QueryParam("password") final String password,
@QueryParam("id") final String id) throws HttpClientConfigException, CoderException {
- PdpGroups pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get()
+ var pdpGroups = getHttpClient(useHttps, hostname, port, username, password, "policy/pap/v1/pdps").get()
.readEntity(PdpGroups.class);
String groupName;
String subGroup;
@@ -139,7 +140,7 @@ public class PdpMonitoringRestResource {
.filter(instance -> instance.getInstanceId().equals(instanceId)))
.filter(Objects::nonNull).findFirst().orElseThrow();
- final StatisticsResponse responseObject = new StatisticsResponse();
+ final var responseObject = new StatisticsResponse();
// Engine Service data
responseObject.setEngineId(pdp.getInstanceId());
@@ -204,7 +205,7 @@ public class PdpMonitoringRestResource {
private HttpClient getHttpClient(String useHttps, String hostname, int port, String username, String password,
String basePath) throws HttpClientConfigException {
- BusTopicParams busParams = new BusTopicParams();
+ var busParams = new BusTopicParams();
busParams.setClientName("pdp-monitoring");
busParams.setHostname(hostname);
busParams.setManaged(false);
diff --git a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
index b680cac..3606b44 100644
--- a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
+++ b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringMainTest.java
@@ -140,7 +140,7 @@ public class MonitoringMainTest {
public void testMonitoringForeverStart() {
final String[] eventArgs = {"-t", "-1"};
- PdpMonitoringMain monRestMain = new PdpMonitoringMain(eventArgs);
+ var monRestMain = new PdpMonitoringMain(eventArgs);
Thread monThread = new Thread() {
@Override
diff --git a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringRestTest.java b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringRestTest.java
index 06fe3b3..a8459cd 100644
--- a/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringRestTest.java
+++ b/gui-pdp-monitoring/src/test/java/org/onap/policy/gui/pdp/monitoring/MonitoringRestTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -32,7 +33,7 @@ public class MonitoringRestTest {
@Test
public void test() {
- PdpMonitoringServerParameters parameters = new PdpMonitoringServerParameters();
+ var parameters = new PdpMonitoringServerParameters();
parameters.setPort(12345);
assertEquals(12345, parameters.getPort());
}