From ffb12d3ca702aa53c3f95d6e721f202f27e1aa8b Mon Sep 17 00:00:00 2001 From: Peyton Puckett Date: Tue, 17 Mar 2020 11:30:11 -0500 Subject: Add rainyDayTest for VFW Added less restrictive filter condition to consider discarded messages Issue-ID: POLICY-2431 Change-Id: I0bc5e34636699094c97bd7e5669f66df875cd6ae Signed-off-by: Peyton Puckett --- .../common/rules/test/BaseRuleTestTest.java | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'controlloop/common/rules-test/src/test') 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 @@ -315,6 +315,21 @@ public class BaseRuleTestTest { checkAppcLegacyPolicy("ModifyConfig", base::testVfwSunnyDayCompliant); } + @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); -- cgit 1.2.3-korg