aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-10-01 20:42:36 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-10-01 20:42:42 -0400
commit98bf012459c846d1c3906a5d1ead73cf26b8e195 (patch)
tree5f309d4ff08067b90195afbcfd986d1c67305930
parent320ff21040c901d4886fdfabdbc2708e3877a37c (diff)
Fix remaining sonar
Mostly moving variables to their right spot. Issue-ID: POLICY-1129 Change-Id: Iccc084bbb404ffd51bdd0b26b5f8c373c6142fb1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java1
-rw-r--r--controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java10
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java15
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java12
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java10
5 files changed, 25 insertions, 23 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java
index 3bf364ea4..7e4c10749 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/PolicyEngine.java
@@ -20,6 +20,7 @@
package org.onap.policy.drools;
+@FunctionalInterface
public interface PolicyEngine {
public boolean deliver(String busType, String topic, Object obj);
}
diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
index 790d434fd..909fa934f 100644
--- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
+++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetrics.java
@@ -48,6 +48,11 @@ import org.slf4j.LoggerFactory;
public interface ControlLoopMetrics {
/**
+ * Singleton manager object.
+ */
+ ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
+
+ /**
* Gets all transaction identifiers being monitored.
*
* @return transaction id list
@@ -131,11 +136,6 @@ public interface ControlLoopMetrics {
* Refresh underlying transaction management.
*/
void refresh();
-
- /**
- * Singleton manager object.
- */
- ControlLoopMetrics manager = new CacheBasedControlLoopMetricsManager();
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
index 865a442b9..e4849cea5 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java
@@ -30,9 +30,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PolicyGuard {
- private PolicyGuard() {
- // Cannot instantiate this static class
- }
private static final Logger logger = LoggerFactory.getLogger(PolicyGuard.class);
@@ -45,10 +42,6 @@ public class PolicyGuard {
private A parameterA;
private B parameterB;
- public static <A, B> LockResult<A, B> createLockResult(A parameterA, B parameterB) {
- return new LockResult<>(parameterA, parameterB);
- }
-
public LockResult(A parameterA, B parameterB) {
this.parameterA = parameterA;
this.parameterB = parameterB;
@@ -61,8 +54,16 @@ public class PolicyGuard {
public B getB() {
return parameterB;
}
+
+ public static <A, B> LockResult<A, B> createLockResult(A parameterA, B parameterB) {
+ return new LockResult<>(parameterA, parameterB);
+ }
}
+ private PolicyGuard() {
+ // Cannot instantiate this static class
+ }
+
/**
* Get the factory.
*
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
index ec4ebf9cd..35b1d2561 100644
--- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java
@@ -54,6 +54,12 @@ public class PolicyGuardXacmlHelper {
// Constant for the systme line separator
private static final String SYSTEM_LS = System.lineSeparator();
+ private UrlEntry[] restUrls = null;
+ private int restUrlIndex = 0;
+
+ // REST timeout, initialized from 'pdpx.timeout' property
+ private int timeout = 20000;
+
public PolicyGuardXacmlHelper() {
init(PolicyEngine.manager.getEnvironment());
}
@@ -72,12 +78,6 @@ public class PolicyGuardXacmlHelper {
String environment = null;
}
- private UrlEntry[] restUrls = null;
- private int restUrlIndex = 0;
-
- // REST timeout, initialized from 'pdpx.timeout' property
- private int timeout = 20000;
-
/**
* Call PDP.
*
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java
index 66ac3e612..cad32c273 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/ControlLoopGuard.java
@@ -32,6 +32,11 @@ public class ControlLoopGuard {
//DO Nothing Empty Constructor
}
+ public ControlLoopGuard(ControlLoopGuard clGuard) {
+ this.guard = new Guard();
+ this.guards = new LinkedList<>(clGuard.guards);
+ }
+
public Guard getGuard() {
return guard;
}
@@ -48,11 +53,6 @@ public class ControlLoopGuard {
this.guards = guards;
}
- public ControlLoopGuard(ControlLoopGuard clGuard) {
- this.guard = new Guard();
- this.guards = new LinkedList<>(clGuard.guards);
- }
-
@Override
public String toString() {
return "Guard [guard=" + guard + ", GuardPolicies=" + guards + "]";