aboutsummaryrefslogtreecommitdiffstats
path: root/policy-domains/src/main/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-06 15:33:23 -0400
committerJim Hahn <jrh3@att.com>2020-04-06 19:30:02 -0400
commit15014b8ca386a8bfd5c26435f45de94ca06e95e8 (patch)
tree3cca518b950dfa35da0ea64dab2f9ff2b80f4595 /policy-domains/src/main/java/org/onap
parentece155048af47ea83ff898c999aa5137dc99a988 (diff)
Address sonar issues in drools-pdp
Addressed the following sonar issues: - add "final" to public static fields - commented code; some were bogus - just updated the comments so sonar is happy - use "{}" instead of string concatenation - junit should assert something - when using logger, invoke compute-intensive tasks conditionally - use superclass name instead of subclass name to access static fields - don't always return the same value - remove "transient" from fields of classes that aren't Serializable - don't nest try/catch blocks - use appropriate class name in Logger.getLogger() - use Predicate<T> instead of Function<T,Boolean> - remove unused parameters from private methods - either log or throw - remove duplicate methods - use remove() TLS instead of set(null) - null check is implicit in instanceof check - do something with return value - don't use volatile - don't return "null" list; used Optional instead - add no-arg constructor to non-Serializable superclass - add callSuper=true for EqualsAndHashCode - don't declare "throws XXX" where XXX is a subclass of RuntimeException - remove serialVersionUID field if the class isn't Serializable Also addressed some eclipse warnings: - unused fields - suppress generic typic cast warnings Issue-ID: POLICY-2305 Change-Id: I906d5bf71c1f86531423e23b3667a585cdba45e1 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-domains/src/main/java/org/onap')
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/artifact/NativeArtifactPolicy.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerTopic.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/legacy/LegacyPolicy.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalPolicy.java2
-rw-r--r--policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalProperties.java2
8 files changed, 16 insertions, 0 deletions
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/artifact/NativeArtifactPolicy.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/artifact/NativeArtifactPolicy.java
index 0f53b532..9fa8230d 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/artifact/NativeArtifactPolicy.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/artifact/NativeArtifactPolicy.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.artifact;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import org.onap.policy.drools.domain.models.DroolsPolicy;
@@ -31,6 +32,7 @@ import org.onap.policy.drools.domain.models.DroolsPolicy;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class NativeArtifactPolicy extends DroolsPolicy implements Serializable {
private static final long serialVersionUID = -8171337852833516581L;
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
index 09236c84..92372765 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.controller;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import org.onap.policy.drools.domain.models.DroolsPolicy;
@@ -31,6 +32,7 @@ import org.onap.policy.drools.domain.models.DroolsPolicy;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class ControllerPolicy extends DroolsPolicy implements Serializable {
private static final long serialVersionUID = -8171337852833516581L;
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java
index 87af6c36..c4772f3b 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.controller;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
@@ -31,6 +32,7 @@ import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class ControllerSinkTopic extends ControllerTopic implements Serializable {
private static final long serialVersionUID = 8770353732981476267L;
}
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java
index e41f4dc3..97a21e6c 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.controller;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
@@ -31,6 +32,7 @@ import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class ControllerSourceTopic extends ControllerTopic implements Serializable {
private static final long serialVersionUID = -1732598566914643612L;
}
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerTopic.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerTopic.java
index 2954350d..fd78da76 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerTopic.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerTopic.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.controller;
import java.util.List;
import lombok.Data;
+import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@@ -31,6 +32,7 @@ import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
+@NoArgsConstructor
public abstract class ControllerTopic {
protected String topicName;
protected List<ControllerEvent> events;
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/legacy/LegacyPolicy.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/legacy/LegacyPolicy.java
index f4fcb702..d18300d1 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/legacy/LegacyPolicy.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/legacy/LegacyPolicy.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.legacy;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import org.onap.policy.drools.domain.models.DroolsPolicy;
@@ -32,6 +33,7 @@ import org.onap.policy.drools.domain.models.DroolsPolicy;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class LegacyPolicy extends DroolsPolicy implements Serializable {
private static final long serialVersionUID = 4100092564657497713L;
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalPolicy.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalPolicy.java
index d158608b..433dc3e1 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalPolicy.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalPolicy.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.domain.models.operational;
import java.io.Serializable;
import lombok.Data;
+import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;
import org.onap.policy.drools.domain.models.DroolsPolicy;
@@ -32,6 +33,7 @@ import org.onap.policy.drools.domain.models.DroolsPolicy;
@Data
@SuperBuilder
+@EqualsAndHashCode(callSuper = true)
public class OperationalPolicy extends DroolsPolicy implements Serializable {
private static final long serialVersionUID = 4100092564657497713L;
diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalProperties.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalProperties.java
index 993ba024..f41d5c0f 100644
--- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalProperties.java
+++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/operational/OperationalProperties.java
@@ -44,11 +44,13 @@ public class OperationalProperties implements Serializable {
/**
* Timeout in seconds.
*/
+ @Builder.Default
private int timeout = 30;
/**
* Abatement.
*/
+ @Builder.Default
private boolean abatement = false;
/**