summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java4
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java17
2 files changed, 21 insertions, 0 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 edee4c2f0..7811b2d73 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
@@ -1048,6 +1048,10 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
}
+ if (!aai.containsKey(VSERVER_VSERVER_NAME)) {
+ throw new AaiException("Vserver name is missing");
+ }
+
UUID reqId = event.getRequestId();
AaiCqResponse response = null;
String vserverId = event.getAai().get(VSERVER_VSERVER_NAME);
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 bce96b2f0..1eec0a750 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
@@ -1293,11 +1293,28 @@ public class ControlLoopEventManagerTest {
}
@Test
+ public void testGetCqResponseEmptyVserver() {
+ try {
+ ControlLoopEventManager mgr = null;
+ mgr = makeManager(onset);
+ mgr.queryAai(onset);
+ mgr.getCqResponse(onset);
+ fail();
+
+
+ } catch (AaiException e) {
+ logger.error("testGetCqResponse Exception: ", e);
+ assertEquals(e.getMessage(), "Vserver name is missing");
+ }
+ }
+
+ @Test
public void testGetCqResponse() {
try {
ControlLoopEventManager mgr = null;
mgr = makeManager(onset);
mgr.queryAai(onset);
+ onset.getAai().put("vserver.vserver-name", "sample");
AaiCqResponse aaiCqResponse = mgr.getCqResponse(onset);
assertNotNull(aaiCqResponse);