aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@ericsson.com>2017-12-14 07:40:18 -0800
committerLiam Fallon <liam.fallon@ericsson.com>2017-12-14 20:07:40 -0800
commitfe4cd8e4c08a19ac543ca93c577b8b3a12a1524f (patch)
tree263a3c0dc2ad9504c6a891f6c5b9d025b0fa74b7 /controlloop/common/eventmanager/src/main
parent5cfd3b7066e6a6305e140fa59b1fccb8e3c5f81b (diff)
Cleanup of A&AI message model module.
Fields have been made fields private in POJOs, and wrote JUnit unit tests to bring up code coverage. AAIManager also changed to use non-static methods so that it can be stubbed with Mockito. Change-Id: I871427ced5db8a1dfd6495fef4e6d84adf264e65 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com> Issue-ID: POLICY-455 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java21
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java2
2 files changed, 12 insertions, 11 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 4adcff048..559eab9d9 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
@@ -46,6 +46,7 @@ import org.onap.policy.guard.LockCallback;
import org.onap.policy.guard.PolicyGuard;
import org.onap.policy.guard.PolicyGuard.LockResult;
import org.onap.policy.guard.TargetLock;
+import org.onap.policy.rest.RESTManager;
import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -568,7 +569,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-id)");
}
- if (vnfResponse.requestError != null) {
+ if (vnfResponse.getRequestError() != null) {
throw new AAIException("AAI Responded with a request error (query by vnf-id)");
}
if (isClosedLoopDisabled(vnfResponse) == true) {
@@ -579,7 +580,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-name)");
}
- if (vnfResponse.requestError != null) {
+ if (vnfResponse.getRequestError() != null) {
throw new AAIException("AAI Responded with a request error (query by vnf-name)");
}
if (isClosedLoopDisabled(vnfResponse) == true) {
@@ -590,7 +591,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (vserverResponse == null) {
throw new AAIException("AAI Response is null (query by vserver-name)");
}
- if (vserverResponse.requestError != null) {
+ if (vserverResponse.getRequestError() != null) {
throw new AAIException("AAI responded with a request error (query by vserver-name)");
}
if (isClosedLoopDisabled(vserverResponse) == true) {
@@ -607,8 +608,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVnfResponse aaiResponse) {
- if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
- String value = aaiResponse.isClosedLoopDisabled;
+ if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) {
+ String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
"yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) {
return true;
@@ -619,8 +620,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(AAIGETVserverResponse aaiResponse) {
- if (aaiResponse != null && aaiResponse.isClosedLoopDisabled != null) {
- String value = aaiResponse.isClosedLoopDisabled;
+ if (aaiResponse != null && aaiResponse.getIsClosedLoopDisabled() != null) {
+ String value = aaiResponse.getIsClosedLoopDisabled();
if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) ||
"yes".equalsIgnoreCase(value) || "Y".equalsIgnoreCase(value)) {
return true;
@@ -659,7 +660,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
String url = aaiHostURL + aaiGetQueryByVserver;
logger.info("url: " + url);
- response = AAIManager.getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName);
+ response = new AAIManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName);
}
} catch (Exception e) {
logger.error("getAAIVserverInfo exception: ", e);
@@ -684,12 +685,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
String url = aaiHostURL + aaiGetQueryByVnfName;
logger.info("url: " + url);
- response = AAIManager.getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName);
+ response = new AAIManager(new RESTManager()).getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName);
} else if (vnfID != null) {
String aaiGetQueryByVnfID = "/aai/v11/network/generic-vnfs/generic-vnf/";
String url = aaiHostURL + aaiGetQueryByVnfID;
logger.info("url: " + url);
- response = AAIManager.getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID);
+ response = new AAIManager(new RESTManager()).getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID);
}
} catch (Exception e) {
logger.error("getAAIVnfInfo exception: ", e);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index d52f7fd47..5084d4cbc 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -157,7 +157,7 @@ public class ControlLoopOperationManager implements Serializable {
* If the vnf-name was retrieved from the onset then the vnf-id
* must be obtained from the event manager's A&AI GET query
*/
- String vnfId = this.eventManager.getVnfResponse().vnfID;
+ String vnfId = this.eventManager.getVnfResponse().getVnfID();
if (vnfId == null) {
throw new AAIException("No vnf-id found");
}