summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-05-22 16:05:16 -0400
committerJim Hahn <jrh3@att.com>2020-05-22 16:17:14 -0400
commit18486d18e1a684cd4df27b335f565c1d985d4f06 (patch)
tree54fa608487ee43aa88a06ab0fd51ddad38b7bbdd /controlloop/common/eventmanager/src/test/java
parent7e6f32d775b8455e5c8f0c244ef0fb8324ce2b7a (diff)
Generate SDNR notification even on timeout
If a request to SDNR times out, the actor class does not generate a notification for the DCAE_CL_RSP topic. Rather than modifying the actor, decided to modify models to handle that case. Seems like that's where it belongs anyway, as notifications are more of an application- level behavior. Issue-ID: POLICY-2580 Change-Id: Id9426c223b719efce337a604316f19335dae8a94 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java')
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java
index 3214add1c..be8b70b13 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2Test.java
@@ -54,6 +54,7 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.utils.time.PseudoExecutor;
import org.onap.policy.controlloop.ControlLoopOperation;
+import org.onap.policy.controlloop.ControlLoopResponse;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.guard.GuardActorServiceProvider;
import org.onap.policy.controlloop.actor.guard.GuardOperation;
@@ -343,6 +344,32 @@ public class ControlLoopOperationManager2Test {
}
@Test
+ public void testMakeControlLoopResponse() {
+ // should always return its input, if non-null
+ ControlLoopResponse resp = new ControlLoopResponse();
+ assertSame(resp, mgr.makeControlLoopResponse(resp));
+
+ // not an SDNR action - should return null
+ assertNull(mgr.makeControlLoopResponse(null));
+
+ /*
+ * now work with SDNR actor
+ */
+ policy.setActor("SDNR");
+ mgr = new ControlLoopOperationManager2(mgrctx, context, policy, executor);
+
+ // should still return its input, if non-null
+ resp = new ControlLoopResponse();
+ assertSame(resp, mgr.makeControlLoopResponse(resp));
+
+ // should generate a response
+ resp = mgr.makeControlLoopResponse(null);
+ assertNotNull(resp);
+ assertEquals(REQ_ID, resp.getRequestId());
+ assertNull(resp.getPayload());
+ }
+
+ @Test
public void testGetOperationMessage() {
// no history yet
assertNull(mgr.getOperationMessage());