aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-06-12 13:49:26 +0000
committerGerrit Code Review <gerrit@onap.org>2020-06-12 13:49:26 +0000
commit20a1fa1609834ead24608e16fdfb85504a5b97d8 (patch)
tree80249babd83a13eff0b6fc7818f8955111ac1cb4
parent1ce01c244fbcc328e0f03adb78b87fc776b74829 (diff)
parentad08d0685db264df653166fa784e8005e9d62619 (diff)
Merge "sonar issue drools applications - 3"
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java2
-rw-r--r--controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java7
-rw-r--r--controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java2
-rw-r--r--controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java9
4 files changed, 8 insertions, 12 deletions
diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
index eeb382ae1..a19006e05 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
+++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java
@@ -187,7 +187,7 @@ public class ControlLoopMetricsFeatureTest {
@Test
public void getSequenceNumber() {
ControlLoopMetricsFeature feature = new ControlLoopMetricsFeature();
- assertEquals(feature.getSequenceNumber(), ControlLoopMetricsFeature.FEATURE_SEQUENCE_PRIORITY);
+ assertEquals(ControlLoopMetricsFeature.FEATURE_SEQUENCE_PRIORITY, feature.getSequenceNumber());
}
@Test
diff --git a/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java b/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
index 0ecbda672..c19a80e7e 100644
--- a/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
+++ b/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.m2.adapters;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -39,15 +40,15 @@ public class VirtualOnsetAdapterTest {
VirtualControlLoopEvent virtualControlLoopEvent = new VirtualControlLoopEvent();
VirtualOnsetAdapter virtualOnsetAdapter =
VirtualOnsetAdapter.class.cast(OnsetAdapter.get(virtualControlLoopEvent));
- assertTrue(virtualOnsetAdapter != null);
+ assertNotNull(virtualOnsetAdapter);
ControlLoopNotification notification = virtualOnsetAdapter.createNotification(virtualControlLoopEvent);
- assertTrue(notification != null);
+ assertNotNull(notification);
// we want an exact class match, so 'instanceOf' is not being used
assertEquals(VirtualControlLoopNotification.class, notification.getClass());
ControlLoopEvent controlLoopEvent = new ControlLoopEvent() {};
notification = virtualOnsetAdapter.createNotification(controlLoopEvent);
- assertTrue(notification != null);
+ assertNotNull(notification);
}
}
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
index 42e06f98f..cc0df4580 100644
--- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
+++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
@@ -28,7 +28,6 @@ import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopException;
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.guard.PolicyGuardResponse;
@@ -88,7 +87,6 @@ public class AppcLcmHealthCheckOperation extends AppcLcmOperation {
if (!(object instanceof AppcLcmDmaapWrapper)) {
if (object instanceof PolicyGuardResponse) {
incomingGuardMessage((PolicyGuardResponse) object);
- return;
}
// ignore this message (not sure why we even got it)
return;
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
index 6a2518f46..668860eb1 100644
--- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
+++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
@@ -245,7 +245,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
* the lock, but it has now became available.
*/
public void lockAvailable() {
- if (this.state == LCM_WAIT_FOR_LOCK) {
+ if (LCM_WAIT_FOR_LOCK.equals(this.state)) {
// we have the lock -- invoke 'quardQuery()',
// go to the appropriate state, and mark the transaction as modified
guardQuery();
@@ -265,7 +265,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
* obtained.
*/
public void lockUnavailable() {
- if (this.state == LCM_WAIT_FOR_LOCK) {
+ if (LCM_WAIT_FOR_LOCK.equals(this.state)) {
try {
setErrorStatus("Already processing event with this target");
} catch (ControlLoopException e) {
@@ -314,7 +314,6 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
payload = setRebootPayload();
break;
default:
- payload = null;
break;
}
@@ -485,7 +484,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
void incomingGuardMessage(PolicyGuardResponse response) {
// this message is only meaningful if we are waiting for a
// 'guard' response -- ignore it, if this isn't the case
- if (this.state == LCM_GUARD_PENDING) {
+ if (LCM_GUARD_PENDING.equals(this.state)) {
if ("Deny".equals(response.getResult())) {
// this is a guard failure
logger.error("LCM operation denied by 'Guard'");
@@ -510,10 +509,8 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
if (! (object instanceof AppcLcmDmaapWrapper)) {
if (object instanceof PolicyGuardResponse) {
incomingGuardMessage((PolicyGuardResponse)object);
- return;
} else if (object instanceof ControlLoopEvent) {
incomingAbatedEvent((ControlLoopEvent) object);
- return;
}
// ignore this message (not sure why we even got it)
return;