summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-11-10 10:12:53 -0500
committerJim Hahn <jrh3@att.com>2020-11-10 10:34:18 -0500
commitfece3044e254866abd948629b05107f0de6b9ba2 (patch)
treeb5009c0cdaa049f29401532d1ec7f2ef935381f1 /controlloop/common/eventmanager/src/test
parent3e73215bd626d5508a25f6cd8edd11455d965254 (diff)
Allow mixed case in check of prov-status
Apparently SO/AAI in Frankfurt are setting the prov-status to "active" instead of "ACTIVE". Modified the code to ignore case when comparing. Issue-ID: POLICY-2890-prov-status Change-Id: Ibe2bcf451dcdc05361f40d2c5c5146eb6a9cb620 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/test')
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java13
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java16
2 files changed, 27 insertions, 2 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
index d09c2c88b..e38ef2f4e 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager2Test.java
@@ -193,6 +193,19 @@ public class ControlLoopEventManager2Test {
assertThatThrownBy(() -> new ControlLoopEventManager2(params, event, workMem))
.hasMessage("prov-status is not ACTIVE on VServer or VNF");
+ // test with both prov-status flags, with mixed case
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.VSERVER_PROV_STATUS, "active"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "ACTIVE"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
+ event.setAai(addAai(orig, ControlLoopEventManager2.GENERIC_VNF_PROV_STATUS, "active"));
+ assertThatCode(() -> new ControlLoopEventManager2(params, event, workMem)).doesNotThrowAnyException();
+
// valid
event.setAai(orig);
assertThatCode(() -> mgr.checkEventSyntax(event)).doesNotThrowAnyException();
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 db16c4528..7c89f1897 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
@@ -733,13 +733,25 @@ public class ControlLoopEventManagerTest {
aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+ // null, ACTIVE
+ aai.remove(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS);
+ aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE.toUpperCase());
+ assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+
// null, active
aai.remove(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS);
- aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE);
+ aai.put(ControlLoopEventManager.VSERVER_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE.toLowerCase());
+ assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
+
+ // ACTIVE, null
+ aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager.PROV_STATUS_ACTIVE.toUpperCase());
+ aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));
// active, null
- aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS, ControlLoopEventManager.PROV_STATUS_ACTIVE);
+ aai.put(ControlLoopEventManager.GENERIC_VNF_PROV_STATUS,
+ ControlLoopEventManager.PROV_STATUS_ACTIVE.toLowerCase());
aai.remove(ControlLoopEventManager.VSERVER_PROV_STATUS);
assertFalse(ControlLoopEventManager.isProvStatusInactive(onset));