diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2020-03-19 15:40:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-19 15:40:52 +0000 |
commit | 6b7d3064ebc4bd6e3dca5d60708e853d2a4836f2 (patch) | |
tree | bee1c31c7ef1baeb91907cf7f688e9990a1cdcb6 /controlloop/common/rules-test/src/test | |
parent | 780268ec538e303bc5bd5c93e2b813e0d3dcbcc7 (diff) | |
parent | ffb12d3ca702aa53c3f95d6e721f202f27e1aa8b (diff) |
Merge "Add rainyDayTest for VFW"
Diffstat (limited to 'controlloop/common/rules-test/src/test')
-rw-r--r-- | controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTestTest.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTestTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTestTest.java index 745013b3b..7274c6bda 100644 --- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTestTest.java +++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTestTest.java @@ -316,6 +316,21 @@ public class BaseRuleTestTest { } @Test + public void testTestVfwRainyDayLegacyFailure() { + checkAppcLegacyPolicyOperationFailure("ModifyConfig", base::testVfwRainyDayLegacyFailure); + } + + @Test + public void testTestVfwRainyDayOverallTimeout() { + checkAppcLegacyPolicyFinalFailure("ModifyConfig", base::testVfwRainyDayOverallTimeout); + } + + @Test + public void testTestVfwRainyDayCompliantTimeout() { + checkAppcLegacyPolicyFinalFailure("ModifyConfig", base::testVfwRainyDayCompliantTimeout); + } + + @Test public void testTestVlbSunnyDayLegacy() { checkHttpPolicy(base::testVlbSunnyDayLegacy); } @@ -365,6 +380,44 @@ public class BaseRuleTestTest { verify(topics).inject(eq(BaseRuleTest.APPC_CL_TOPIC), any(), any()); } + protected void checkAppcLegacyPolicyOperationFailure(String operation, Runnable test) { + enqueueAppcLegacy(operation); + enqueueClMgt(ControlLoopNotificationType.OPERATION_FAILURE); + enqueueClMgt(ControlLoopNotificationType.FINAL_FAILURE); + + test.run(); + + assertEquals(1, permitCount); + assertEquals(1, finalCount); + + assertTrue(appcLcmQueue.isEmpty()); + assertTrue(clMgtQueue.isEmpty()); + + // initial event + verify(topics).inject(eq(BaseRuleTest.DCAE_TOPIC), any()); + + // reply to each APPC request + verify(topics).inject(eq(BaseRuleTest.APPC_CL_TOPIC), any(), any()); + } + + protected void checkAppcLegacyPolicyFinalFailure(String operation, Runnable test) { + enqueueAppcLegacy(operation); + enqueueClMgt(ControlLoopNotificationType.FINAL_FAILURE); + + test.run(); + + assertEquals(1, permitCount); + assertEquals(1, finalCount); + + assertTrue(appcLcmQueue.isEmpty()); + assertTrue(clMgtQueue.isEmpty()); + + // initial event + verify(topics).inject(eq(BaseRuleTest.DCAE_TOPIC), any()); + + // There were no requests sent + } + protected void checkHttpPolicy(Runnable test) { enqueueClMgt(ControlLoopNotificationType.OPERATION_SUCCESS); enqueueClMgt(ControlLoopNotificationType.FINAL_SUCCESS); |