diff options
author | daniel <dc443y@att.com> | 2017-10-30 07:58:34 -0500 |
---|---|---|
committer | daniel <dc443y@att.com> | 2017-10-30 08:08:59 -0500 |
commit | 08c54826db08f104359e36a67e4a3affb477a245 (patch) | |
tree | 3899d7df05736589f5d2dcef07c3b60d4c8dfba7 /controlloop/common/eventmanager/src/test/java | |
parent | c9d429d17c8e19620ff760870d295ce05d5190af (diff) |
Fix Final Failure on AAI Queries
The drools engine will now send final failure notifications
if there is an error returned from A&AI queries instead of
rejected notifications.
Issue-Id: POLICY-364
Change-Id: Ie9c22686d859c633bad47d223726957cc9599f7c
Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java')
2 files changed, 39 insertions, 1 deletions
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 223361505..be0eb2bc3 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 @@ -40,6 +40,7 @@ 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.util.AAIException; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopException; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -227,6 +228,17 @@ public class ControlLoopEventManagerTest { assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification); + + ControlLoopEventManager.NEW_EVENT_STATUS status = null; + try { + status = manager.onNewEvent(event); + } catch (AAIException e) { + logger.warn(e.toString()); + fail("A&AI Query Failed"); + } + assertNotNull(status); + assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.FIRST_ONSET, status); + AAIGETVnfResponse response = manager.getVnfResponse(); assertNotNull(response); assertNull(manager.getVserverResponse()); @@ -240,7 +252,13 @@ public class ControlLoopEventManagerTest { event2.AAI = new HashMap<>(); event2.AAI.put("generic-vnf.vnf-name", "onsetTwo"); - ControlLoopEventManager.NEW_EVENT_STATUS status = manager.onNewEvent(event2); + + try { + status = manager.onNewEvent(event2); + } catch (AAIException e) { + logger.warn(e.toString()); + fail("A&AI Query Failed"); + } assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.SUBSEQUENT_ONSET, status); AAIGETVnfResponse response2 = manager.getVnfResponse(); assertNotNull(response2); diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java index e7a31190e..1714d3e26 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java @@ -107,6 +107,16 @@ public class ControlLoopOperationManagerTest { assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification); + ControlLoopEventManager.NEW_EVENT_STATUS status = null; + try { + status = eventManager.onNewEvent(onset); + } catch (AAIException e) { + logger.warn(e.toString()); + fail("A&AI Query Failed"); + } + assertNotNull(status); + assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.FIRST_ONSET, status); + ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager); logger.debug("{}",manager); // @@ -226,6 +236,16 @@ public class ControlLoopOperationManagerTest { assertNotNull(notification); assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification); + ControlLoopEventManager.NEW_EVENT_STATUS status = null; + try { + status = eventManager.onNewEvent(onset); + } catch (AAIException e) { + logger.warn(e.toString()); + fail("A&AI Query Failed"); + } + assertNotNull(status); + assertEquals(ControlLoopEventManager.NEW_EVENT_STATUS.FIRST_ONSET, status); + ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager); // // |