summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-14 18:00:36 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-09-14 18:00:53 -0400
commita4f095aac46fcdd61877fdfc290080a76c119409 (patch)
tree60f31a87bf1d266a5ccda3b95437054ea0e042a3 /controlloop
parent8ba1edd2ff587c0d42fe8892c5285c705c9faa59 (diff)
Clear eclipse warnings and sonar
Removing warnings introduced with A&AI code. This should also address sonar criticals and majors. Issue-ID: POLICY-140 Change-Id: I3f8186dd9c5aa52bfbb061bf95d67b5614b3fb2e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java27
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java30
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java5
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java2
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java9
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java10
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java8
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java13
-rw-r--r--controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java13
9 files changed, 35 insertions, 82 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index 2248fcd48..0fb25b1bf 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -26,18 +26,17 @@ import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
-import java.util.List;
import java.util.UUID;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Iterator;
+import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AAIGETVserverResponse;
+import org.onap.policy.aai.AAIManager;
import org.onap.policy.controlloop.ControlLoopEventStatus;
+import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.policy.FinalResult;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
@@ -49,13 +48,6 @@ import org.onap.policy.guard.TargetLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.AAIGETVserverResponse;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.RelationshipList;
-import org.onap.policy.aai.Relationship;
-
public class ControlLoopEventManager implements LockCallback, Serializable {
/**
@@ -580,7 +572,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) {
- RelationshipList relationshipList = new RelationshipList();
if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
String value = aaiResponse.isClosedLoopDisabled;
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
@@ -593,7 +584,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVserverResponse aaiResponse) {
- RelationshipList relationshipList = new RelationshipList();
if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
String value = aaiResponse.isClosedLoopDisabled;
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
@@ -624,9 +614,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vserverName != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/nodes/vservers?vserver-name=";
- response = manager.getQueryByVserverName(url, user, password, requestID, vserverName);
+ response = AAIManager.getQueryByVserverName(url, user, password, requestID, vserverName);
}
} catch (Exception e) {
logger.error("getAAIVserverInfo exception: ", e);
@@ -646,13 +635,11 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vnfName != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
- response = manager.getQueryByVnfName(url, user, password, requestID, vnfName);
+ response = AAIManager.getQueryByVnfName(url, user, password, requestID, vnfName);
} else if (vnfID != null) {
- AAIManager manager = new AAIManager();
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf/";
- response = manager.getQueryByVnfID(url, user, password, requestID, vnfID);
+ response = AAIManager.getQueryByVnfID(url, user, password, requestID, vnfID);
}
} catch (Exception e) {
logger.error("getAAIVnfInfo exception: ", e);
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index ef7a1a94c..2e208748f 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -20,40 +20,26 @@
package org.onap.policy.controlloop.eventmanager;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.time.Instant;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.UUID;
import org.junit.Test;
-import org.onap.policy.aai.AAIGETVserverResponse;
import org.onap.policy.aai.AAIGETVnfResponse;
+import org.onap.policy.aai.AAIGETVserverResponse;
+import org.onap.policy.aai.RelatedToProperty;
import org.onap.policy.aai.RelatedToPropertyItem;
import org.onap.policy.aai.Relationship;
import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.RelationshipDataItem;
import org.onap.policy.aai.RelationshipList;
-import org.onap.policy.aai.AAIManager;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.appc.Request;
-import org.onap.policy.appc.Response;
-import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appc.ResponseValue;
import org.onap.policy.controlloop.ControlLoopEventStatus;
-
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.Util;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
-import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.controlloop.processor.ControlLoopProcessor;
-import org.onap.policy.controlloop.processor.ControlLoopProcessorTest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,6 +65,7 @@ public class ControlLoopEventManagerTest {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
+ @SuppressWarnings("unused")
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
@@ -104,32 +91,31 @@ public class ControlLoopEventManagerTest {
onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
- ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
logger.info("testIsClosedLoopDisabled --");
- AAIManager manager = new AAIManager();
String user = "POLICY";
String password = "POLICY";
String vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491";
String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf/";
AAIGETVnfResponse response = getQueryByVnfID2(url, user, password, onset.requestID, vnfID);
assertNotNull(response);
- boolean disabled = eventManager.isClosedLoopDisabled(response);
+ boolean disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVnfID - isClosedLoopDisabled: " + disabled);
String vnfName = "lll_vnf_010317";
url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
response = getQueryByVnfName2(url, user, password, onset.requestID, vnfName);
assertNotNull(response);
- disabled = eventManager.isClosedLoopDisabled(response);
+ disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVnfName2 - isClosedLoopDisabled: " + disabled);
String vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0";
url = "https://aai-ext1.test.att.com:8443//aai/v11/nodes/vservers?vserver-name=";
+ @SuppressWarnings("unused")
AAIGETVserverResponse response2 = getQueryByVserverName2(url, user, password, onset.requestID, vserverName);
assertNotNull(response);
- disabled = eventManager.isClosedLoopDisabled(response);
+ disabled = ControlLoopEventManager.isClosedLoopDisabled(response);
logger.info("QueryByVserverName - isClosedLoopDisabled: " + disabled);
} catch (Exception e) {
fail(e.getMessage());
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
index 57140cebe..a641383df 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponseWrapper.java
@@ -24,6 +24,11 @@ import java.util.UUID;
import org.onap.policy.aai.AAIGETResponse;
public class AAIGETResponseWrapper implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9167822470867043968L;
+
public UUID requestID;
public AAIGETResponse aairesponse;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
index b318f72ef..8ab94e9a4 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java
@@ -21,8 +21,6 @@
package org.onap.policy.aai;
import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
import com.google.gson.annotations.SerializedName;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
index 51954ac6f..3d33eab1e 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
@@ -21,19 +21,10 @@
package org.onap.policy.aai;
import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.onap.policy.aai.AAIGETVserverResponse;
-import org.onap.policy.aai.AAIGETVnfResponse;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAINQRequest;
-import org.onap.policy.aai.AAINQResponse;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
import org.slf4j.Logger;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
index 9b207ef68..a040f0d61 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java
@@ -20,12 +20,16 @@
package org.onap.policy.aai;
-import java.util.List;
-import java.util.LinkedList;
+import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
-public class RelationshipDataItem {
+public class RelationshipDataItem implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 550450041634939767L;
@SerializedName("relationship-key")
public String relationshipKey;
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
index 14f601730..b31b3a6dc 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java
@@ -25,9 +25,13 @@ import java.io.Serializable;
import java.util.List;
import java.util.LinkedList;
-public class RelationshipList {
+public class RelationshipList implements Serializable {
- @SerializedName("relationship-list")
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6115655704973981989L;
+ @SerializedName("relationship-list")
public List<Relationship> relationshipList = new LinkedList<>();
public RelationshipList() {
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
index 3b489155c..e668ca372 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java
@@ -20,22 +20,11 @@
package org.onap.policy.aai;
-import static org.junit.Assert.*;
-import java.util.List;
-import java.util.LinkedList;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.Relationship;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.aai.RelationshipList;
+import org.junit.Test;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAIGETVnfResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.junit.Test;
-
public class AAIGETVnfResponseTest {
private static final Logger logger = LoggerFactory.getLogger(AAIGETVnfResponseTest.class);
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
index b24826576..83d2a2682 100644
--- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
+++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java
@@ -20,22 +20,11 @@
package org.onap.policy.aai;
-import static org.junit.Assert.*;
-import java.util.List;
-import java.util.LinkedList;
-import org.onap.policy.aai.RelationshipDataItem;
-import org.onap.policy.aai.RelationshipData;
-import org.onap.policy.aai.RelatedToPropertyItem;
-import org.onap.policy.aai.Relationship;
-import org.onap.policy.aai.RelatedToProperty;
-import org.onap.policy.aai.RelationshipList;
+import org.junit.Test;
import org.onap.policy.aai.util.Serialization;
-import org.onap.policy.aai.AAIGETVserverResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.junit.Test;
-
public class AAIGETVserverResponseTest {
private static final Logger logger = LoggerFactory.getLogger(AAIGETVserverResponseTest.class);