diff options
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); |