summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-09-21 09:31:25 -0400
committerJim Hahn <jrh3@att.com>2018-09-21 10:12:52 -0400
commitd85e766c5538de762820132ac723d928f5a9bf89 (patch)
tree738c4de12a3a261035bbb25199558a490d550d3e /controlloop/common/eventmanager/src/main/java
parentfaf283066f186838665ed5c38c1ba8319041bc1c (diff)
new sonar issues in drools-applications
Don't return null lists from AAI. Transient TargetLock. Extract aai.url, et. al., constants. Don't allocate extra unneeded variable. Re-order fields in xacml attributes. Extract "vserver" constant from simulator. Replace thread sleep with join. Change-Id: Iee1bd182862632af1f131cca5db5b526f5865b9f Issue-ID: POLICY-1129 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main/java')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java23
1 files changed, 13 insertions, 10 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 bd1904904..93535efc1 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
@@ -75,6 +75,10 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public static final String GENERIC_VNF_PROV_STATUS = "generic-vnf.prov-status";
public static final String VSERVER_PROV_STATUS = "vserver.prov-status";
+ private static final String AAI_URL = "aai.url";
+ private static final String AAI_USERNAME = "aai.username";
+ private static final String AAI_PASSWD = "aai.password";
+
private static final String QUERY_AAI_ERROR_MSG = "Exception from queryAai: ";
/**
@@ -101,7 +105,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
private LinkedList<ControlLoopOperation> controlLoopHistory = new LinkedList<>();
private ControlLoopOperationManager currentOperation = null;
private ControlLoopOperationManager lastOperationManager = null;
- private TargetLock targetLock = null;
+ private transient TargetLock targetLock = null;
private AaiGetVnfResponse vnfResponse = null;
private AaiGetVserverResponse vserverResponse = null;
private boolean useTargetLock = true;
@@ -876,9 +880,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vserverName != null) {
- String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
- String aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
- String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
+ String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty(AAI_URL);
+ String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME);
+ String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASSWD);
String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
String url = aaiHostUrl + aaiGetQueryByVserver;
logger.info("AAI Host URL by VServer: {}", url);
@@ -906,9 +910,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String vnfName = event.getAai().get(GENERIC_VNF_VNF_NAME);
String vnfId = event.getAai().get(GENERIC_VNF_VNF_ID);
- String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty("aai.url");
- String aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
- String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
+ String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty(AAI_URL);
+ String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME);
+ String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASSWD);
try {
if (vnfName != null) {
@@ -955,7 +959,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
final AaiNqInstanceFilters aaiNqInstanceFilter = new AaiNqInstanceFilters();
// queryParameters
- // TODO: UUID.fromString($params.getAaiNamedQueryUUID()) AaiNamedQueryUUID
aaiNqNamedQuery.setNamedQueryUuid(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
aaiNqQueryParam.setNamedQuery(aaiNqNamedQuery);
aaiNqRequest.setQueryParameters(aaiNqQueryParam);
@@ -973,8 +976,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
logger.debug("AAI Request sent: {}", Serialization.gsonPretty.toJson(aaiNqRequest));
}
- AaiNqResponse aaiNqResponse = new AaiManager(new RESTManager()).postQuery(getPeManagerEnvProperty("aai.url"),
- getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiNqRequest,
+ AaiNqResponse aaiNqResponse = new AaiManager(new RESTManager()).postQuery(getPeManagerEnvProperty(AAI_URL),
+ getPeManagerEnvProperty(AAI_USERNAME), getPeManagerEnvProperty(AAI_PASSWD), aaiNqRequest,
onset.getRequestId());
// Check AAI response