diff options
Diffstat (limited to 'controlloop/common/rules-test/src/main/java')
-rw-r--r-- | controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTest.java index 0baac9e8c..7c34fc875 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTest.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseRuleTest.java @@ -88,6 +88,7 @@ public abstract class BaseRuleTest { // VDNS private static final String VDNS_TOSCA_LEGACY_POLICY = "vdns/tosca-legacy-vdns.json"; private static final String VDNS_TOSCA_COMPLIANT_POLICY = "vdns/tosca-compliant-vdns.json"; + private static final String VDNS_TOSCA_COMPLIANT_RAINY_POLICY = "vdns/tosca-compliant-vdns-rainy.json"; private static final String VDNS_ONSET = "vdns/vdns.onset.json"; // VFW @@ -334,6 +335,15 @@ public abstract class BaseRuleTest { httpSunnyDay(VDNS_TOSCA_COMPLIANT_POLICY, VDNS_ONSET); } + /** + * Vdns Rainy Day with Compliant Tosca Policy. + */ + @Test + public void testVdnsRainyDayCompliant() { + httpRainyDay(VDNS_TOSCA_COMPLIANT_RAINY_POLICY, VDNS_ONSET); + } + + // VFW /** @@ -647,6 +657,33 @@ public abstract class BaseRuleTest { waitForFinalSuccess(policy, policyClMgt); } + /** + * Rainy day scenario for use cases that use an HTTP simulator. + * + * @param policyFile file containing the ToscaPolicy to be loaded + * @param onsetFile file containing the ONSET to be injected + * @param operation expected APPC operation request + */ + protected void httpRainyDay(String policyFile, String onsetFile) { + policyClMgt = topics.createListener(POLICY_CL_MGT_TOPIC, VirtualControlLoopNotification.class, controller); + + assertEquals(0, controller.getDrools().factCount(rules.getControllerName())); + policy = rules.setupPolicyFromFile(policyFile); + assertEquals(2, controller.getDrools().factCount(rules.getControllerName())); + + /* Inject an ONSET event over the DCAE topic */ + topics.inject(DCAE_TOPIC, onsetFile); + + /* Wait to acquire a LOCK and a PDP-X PERMIT */ + waitForLockAndPermit(policy, policyClMgt); + + /* --- Operation Completed --- */ + waitForOperationFailure(); + + /* --- Transaction Completed --- */ + waitForFinalFailure(policy, policyClMgt); + } + protected long getCreateCount() { return ControlLoopEventManager2.getCreateCount(); } |