diff options
author | pramod.jamkhedkar <pramod@research.att.com> | 2019-11-13 13:36:56 -0500 |
---|---|---|
committer | pramod.jamkhedkar <pramod@research.att.com> | 2019-11-15 12:51:55 -0500 |
commit | 9398165f5c35e686e2570c68cd0eb4a2e9254a02 (patch) | |
tree | a725c77c9986505250163c1199429afa1acb68dc /controlloop/templates/template.demo/src/test/java | |
parent | 03dff4f370602a2e6726d2b8357e10c30dcf8210 (diff) |
Removing Named Query
Removing all the related files and necessary modifications for removing named query. The code now only supports Custom Query.
Issue-ID: POLICY-2125
Change-Id: I2d376eb955d69f45c39ad4d4a1cfacb4d620ca8e
Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'controlloop/templates/template.demo/src/test/java')
6 files changed, 30 insertions, 18 deletions
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java index 57085f614..f41bd874b 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java @@ -53,10 +53,9 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene public static void setUpBeforeClass() { ControlLoopBase.setUpBeforeClass( "../archetype-cl-amsterdam/src/main/resources/archetype-resources" - + "/src/main/resources/__closedLoopControlName__.drl", + + "/src/main/resources/__closedLoopControlName__.drl", "src/test/resources/yaml/policy_ControlLoop_vCPE.yaml", - "service=ServiceDemo;resource=Res1Demo;type=operational", - "CL_vCPE", + "service=ServiceDemo;resource=Res1Demo;type=operational", "CL_vCPE", "org.onap.closed_loop.ServiceDemo:VNFS:1.0.0"); } @@ -81,7 +80,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene * Simulate an onset event the policy engine will receive from DCAE to kick off processing * through the rules */ - sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "vCPEInfraVNF13", true); + sendEvent(pair.first, requestId, ControlLoopEventStatus.ONSET, "OzVServer", true); kieSession.fireUntilHalt(); @@ -152,10 +151,10 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene Object obj = null; if ("POLICY-CL-MGT".equals(topic)) { obj = org.onap.policy.controlloop.util.Serialization.gsonJunit.fromJson(event, - org.onap.policy.controlloop.VirtualControlLoopNotification.class); + org.onap.policy.controlloop.VirtualControlLoopNotification.class); } else if ("APPC-LCM-READ".equals(topic)) { obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event, - org.onap.policy.appclcm.AppcLcmDmaapWrapper.class); + org.onap.policy.appclcm.AppcLcmDmaapWrapper.class); } assertNotNull(obj); if (obj instanceof VirtualControlLoopNotification) { @@ -163,20 +162,24 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene String policyName = notification.getPolicyName(); if (policyName.endsWith("EVENT")) { logger.debug("Rule Fired: " + notification.getPolicyName()); - assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification())); + assertTrue( + ControlLoopNotificationType.ACTIVE.equals(notification.getNotification())); } else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) { logger.debug("Rule Fired: " + notification.getPolicyName()); - assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); + assertTrue( + ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); assertNotNull(notification.getMessage()); assertTrue(notification.getMessage().startsWith("Sending guard query")); } else if (policyName.endsWith("GUARD.RESPONSE")) { logger.debug("Rule Fired: " + notification.getPolicyName()); - assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); + assertTrue( + ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); assertNotNull(notification.getMessage()); assertTrue(notification.getMessage().toLowerCase().endsWith("permit")); } else if (policyName.endsWith("GUARD_PERMITTED")) { logger.debug("Rule Fired: " + notification.getPolicyName()); - assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); + assertTrue( + ControlLoopNotificationType.OPERATION.equals(notification.getNotification())); assertNotNull(notification.getMessage()); assertTrue(notification.getMessage().startsWith("actor=APPC")); } else if (policyName.endsWith("OPERATION.TIMEOUT")) { @@ -186,17 +189,20 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene fail("Operation Timed Out"); } else if (policyName.endsWith("APPC.LCM.RESPONSE")) { logger.debug("Rule Fired: " + notification.getPolicyName()); - assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification())); + assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS + .equals(notification.getNotification())); assertNotNull(notification.getMessage()); assertTrue(notification.getMessage().startsWith("actor=APPC")); sendEvent(pair.first, requestId, ControlLoopEventStatus.ABATED); } else if (policyName.endsWith("EVENT.MANAGER")) { logger.debug("Rule Fired: " + notification.getPolicyName()); if ("getFail".equals(notification.getAai().get("generic-vnf.vnf-name"))) { - assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification()); + assertEquals(ControlLoopNotificationType.FINAL_FAILURE, + notification.getNotification()); kieSession.halt(); } else { - assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.getNotification()); + assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, + notification.getNotification()); kieSession.halt(); } } else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) { @@ -238,7 +244,8 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene * @param requestId the requestId for this event * @param status could be onset or abated */ - protected void sendEvent(ControlLoopPolicy policy, UUID requestId, ControlLoopEventStatus status) { + protected void sendEvent(ControlLoopPolicy policy, UUID requestId, + ControlLoopEventStatus status) { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); @@ -250,8 +257,8 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene kieSession.insert(event); } - protected void sendEvent(ControlLoopPolicy policy, UUID requestId, ControlLoopEventStatus status, String vnfName, - boolean isEnriched) { + protected void sendEvent(ControlLoopPolicy policy, UUID requestId, + ControlLoopEventStatus status, String vnfName, boolean isEnriched) { VirtualControlLoopEvent event = new VirtualControlLoopEvent(); event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName()); event.setRequestId(requestId); @@ -260,6 +267,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", vnfName); + event.getAai().put("vserver.vserver-name", vnfName); if (isEnriched) { event.getAai().put("generic-vnf.in-maint", "false"); event.getAai().put("generic-vnf.is-closed-loop-disabled", "false"); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java index 1a5bf3982..0e05a0c6d 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopCqTest.java @@ -235,7 +235,7 @@ public class VdnsControlLoopCqTest extends ControlLoopBase implements TopicListe event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); - event.getAai().put("vserver.vserver-name", "Ete_vFWCLvFWSNK_7ba1fbde_0"); + event.getAai().put("vserver.vserver-name", "OzVServer"); event.getAai().put("vserver.is-closed-loop-disabled", "false"); event.getAai().put("vserver.prov-status", "ACTIVE"); event.setClosedLoopEventStatus(status); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java index 3c658c1fd..da237fa05 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VdnsControlLoopTest.java @@ -267,7 +267,7 @@ public class VdnsControlLoopTest extends ControlLoopBase implements TopicListene event.setTargetType(ControlLoopTargetType.VNF); event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); - event.getAai().put("vserver.vserver-name", "dfw1lb01lb01"); + event.getAai().put("vserver.vserver-name", "OzVServer"); event.getAai().put("vserver.is-closed-loop-disabled", "false"); event.getAai().put("vserver.prov-status", "ACTIVE"); event.setClosedLoopEventStatus(status); diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java index c326da145..cbdf09c8d 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VfwControlLoopTest.java @@ -285,6 +285,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", "testGenericVnfID"); + event.getAai().put("vserver.vserver-name", "testVserverName"); event.setClosedLoopEventStatus(status); kieSession.insert(event); } @@ -306,6 +307,7 @@ public class VfwControlLoopTest extends ControlLoopBase implements TopicListener event.setClosedLoopAlarmStart(Instant.now()); event.setAai(new HashMap<>()); event.getAai().put("generic-vnf.vnf-name", vnfId); + event.getAai().put("vserver.vserver-name", vnfId); event.setClosedLoopEventStatus(status); kieSession.insert(event); } diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java index 9d3486f5b..d3aedd68f 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VpciControlLoopTest.java @@ -265,6 +265,7 @@ public class VpciControlLoopTest extends ControlLoopBase implements TopicListene event.getAai().put("generic-vnf.is-closed-loop-disabled", "false"); event.getAai().put("generic-vnf.prov-status", "ACTIVE"); event.getAai().put("generic-vnf.vnf-id", "notused"); + event.getAai().put("vserver.vserver-name", "OzVServer"); } else { event.getAai().put("generic-vnf.vnf-id", "getFail"); } diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java index d0427e47f..527fd298d 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VsonhControlLoopTest.java @@ -269,6 +269,7 @@ public class VsonhControlLoopTest extends ControlLoopBase implements TopicListen event.getAai().put("generic-vnf.is-closed-loop-disabled", "false"); event.getAai().put("generic-vnf.prov-status", "ACTIVE"); event.getAai().put("generic-vnf.vnf-id", "notused"); + event.getAai().put("vserver.vserver-name", "OzVServer"); } else { event.getAai().put("generic-vnf.vnf-id", "getFail"); } |