aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo/src/test
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@ericsson.com>2018-01-18 10:55:53 +0000
committerLiam Fallon <liam.fallon@ericsson.com>2018-01-18 11:06:22 +0000
commitb2a9a8adbcf036780bf47c5c94dbf65a088ab540 (patch)
treef594ceccac054e76a67e83de0712cf3896d0c8c7 /controlloop/templates/template.demo/src/test
parentbdf5640a2c68a0899363503dafa0f7cb1557e4a6 (diff)
Fix Tech Debt/JUnit on control loop event POJOs
Mainly making fields private, fixing field and methods to follow Java guidelines, and adding getter and setter methods. Unit test added for all classes in org.onap.policy.controlloop Issue-ID: POLICY-455 Change-Id: I445b7cfaf9eb921a230bbb72b06ff4455fe003ce Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/templates/template.demo/src/test')
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java68
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VCPEControlLoopTest.java96
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VDNSControlLoopTest.java84
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java98
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFWControlLoopTest.java84
5 files changed, 215 insertions, 215 deletions
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
index 869a1a6ff..826488691 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
@@ -270,64 +270,64 @@ public class ControlLoopFailureTest implements TopicListener {
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
VirtualControlLoopNotification notification = (VirtualControlLoopNotification) obj;
- String policyName = notification.policyName;
+ String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.notification));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
}
else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("Sending guard query"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.toLowerCase().endsWith("permit"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
}
else if (policyName.endsWith("OPERATION.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The operation timed out");
fail("Operation Timed Out");
}
else if (policyName.endsWith("APPC.LCM.RESPONSE")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
- if (requestId.equals(notification.requestID)) {
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
+ if (requestId.equals(notification.getRequestID())) {
sendEvent(pair.a, requestId, ControlLoopEventStatus.ABATED, "vnf01");
}
- else if (requestId2.equals(notification.requestID)) {
+ else if (requestId2.equals(notification.getRequestID())) {
sendEvent(pair.a, requestId2, ControlLoopEventStatus.ABATED, "vnf02");
}
}
else if (policyName.endsWith("EVENT.MANAGER")) {
- logger.debug("Rule Fired: " + notification.policyName);
- if (requestId3.equals(notification.requestID)) {
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ if (requestId3.equals(notification.getRequestID())) {
/*
* The event with the duplicate target should be rejected
*/
- assertTrue(ControlLoopNotificationType.REJECTED.equals(notification.notification));
+ assertTrue(ControlLoopNotificationType.REJECTED.equals(notification.getNotification()));
}
else {
- assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
+ assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.getNotification()));
}
if (++eventCount == 3) {
kieSession.halt();
}
}
else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
@@ -378,13 +378,13 @@ public class ControlLoopFailureTest implements TopicListener {
protected void sendEvent(ControlLoopPolicy policy, UUID requestID,
ControlLoopEventStatus status, String target) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "generic-vnf.vnf-id";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-id", target);
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("generic-vnf.vnf-id");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-id", target);
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
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 c95d558a5..661d8c187 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
@@ -276,55 +276,55 @@ public class VCPEControlLoopTest implements TopicListener {
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
VirtualControlLoopNotification notification = (VirtualControlLoopNotification) obj;
- String policyName = notification.policyName;
+ String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.notification));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
}
else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("Sending guard query"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.toLowerCase().endsWith("permit"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
}
else if (policyName.endsWith("OPERATION.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The operation timed out");
fail("Operation Timed Out");
}
else if (policyName.endsWith("APPC.LCM.RESPONSE")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
sendEvent(pair.a, requestID, ControlLoopEventStatus.ABATED);
}
else if (policyName.endsWith("EVENT.MANAGER")) {
- logger.debug("Rule Fired: " + notification.policyName);
- if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ if ("getFail".equals(notification.getAAI().get("generic-vnf.vnf-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
kieSession.halt();
}
else {
- assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.notification);
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.getNotification());
kieSession.halt();
}
}
else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
@@ -366,37 +366,37 @@ public class VCPEControlLoopTest implements TopicListener {
*/
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "generic-vnf.vnf-name";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", "testGenericVnfName");
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("generic-vnf.vnf-name");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", "testGenericVnfName");
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
protected void sendEvent(ControlLoopPolicy policy, UUID requestID,
ControlLoopEventStatus status, String vnfName, boolean isEnriched) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "generic-vnf.vnf-name";
- event.target_type = ControlLoopTargetType.VNF;
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", vnfName);
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("generic-vnf.vnf-name");
+ event.setTargetType(ControlLoopTargetType.VNF);
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", vnfName);
if (isEnriched) {
- event.AAI.put("generic-vnf.in-maint", "false");
- event.AAI.put("generic-vnf.is-closed-loop-disabled", "false");
- event.AAI.put("generic-vnf.orchestration-status", "Created");
- event.AAI.put("generic-vnf.prov-status", "PREPROV");
- event.AAI.put("generic-vnf.resource-version", "1");
- event.AAI.put("generic-vnf.service-id", "e8cb8968-5411-478b-906a-f28747de72cd");
- event.AAI.put("generic-vnf.vnf-id", "63b31229-9a3a-444f-9159-04ce2dca3be9");
- event.AAI.put("generic-vnf.vnf-type", "vCPEInfraService10/vCPEInfraService10 0");
+ event.getAAI().put("generic-vnf.in-maint", "false");
+ event.getAAI().put("generic-vnf.is-closed-loop-disabled", "false");
+ event.getAAI().put("generic-vnf.orchestration-status", "Created");
+ event.getAAI().put("generic-vnf.prov-status", "PREPROV");
+ event.getAAI().put("generic-vnf.resource-version", "1");
+ event.getAAI().put("generic-vnf.service-id", "e8cb8968-5411-478b-906a-f28747de72cd");
+ event.getAAI().put("generic-vnf.vnf-id", "63b31229-9a3a-444f-9159-04ce2dca3be9");
+ event.getAAI().put("generic-vnf.vnf-type", "vCPEInfraService10/vCPEInfraService10 0");
}
- event.closedLoopEventStatus = status;
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
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 f7e2c3049..25a69b14e 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
@@ -319,56 +319,56 @@ public class VDNSControlLoopTest implements TopicListener {
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
VirtualControlLoopNotification notification = (VirtualControlLoopNotification) obj;
- String policyName = notification.policyName;
+ String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.notification));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
}
else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("Sending guard query"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.toLowerCase().endsWith("permit"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=SO"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=SO"));
}
else if (policyName.endsWith("OPERATION.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The operation timed out");
fail("Operation Timed Out");
}
else if (policyName.endsWith("SO.RESPONSE")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=SO"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=SO"));
}
else if (policyName.endsWith("EVENT.MANAGER")) {
- logger.debug("Rule Fired: " + notification.policyName);
- if ("error".equals(notification.AAI.get("vserver.vserver-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ if ("error".equals(notification.getAAI().get("vserver.vserver-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
}
- else if ("getFail".equals(notification.AAI.get("vserver.vserver-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
+ else if ("getFail".equals(notification.getAAI().get("vserver.vserver-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
}
else {
- assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
+ assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.getNotification()));
}
kieSession.halt();
}
else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
@@ -390,26 +390,26 @@ public class VDNSControlLoopTest implements TopicListener {
*/
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "vserver.vserver-name";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("vserver.vserver-name", "dfw1lb01lb01");
- event.AAI.put("vserver.is-closed-loop-disabled", "false");
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("vserver.vserver-name");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("vserver.vserver-name", "dfw1lb01lb01");
+ event.getAAI().put("vserver.is-closed-loop-disabled", "false");
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vserverName) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "vserver.vserver-name";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("vserver.vserver-name", vserverName);
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("vserver.vserver-name");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("vserver.vserver-name", vserverName);
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
index 39dac8131..178b5b29d 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VFCControlLoopTest.java
@@ -192,16 +192,16 @@ public class VFCControlLoopTest implements TopicListener {
*/
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
- event.requestID = UUID.randomUUID();
- event.closedLoopEventClient = "tca.instance00009";
- event.target_type = ControlLoopTargetType.VM;
- event.target = "vserver.vserver-name";
- event.from = "DCAE";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<String, String>();
- event.AAI.put("vserver.vserver-name", "nullRequest");
- event.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ event.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
+ event.setRequestID(UUID.randomUUID());
+ event.setClosedLoopEventClient("tca.instance00009");
+ event.setTargetType(ControlLoopTargetType.VM);
+ event.setTarget("vserver.vserver-name");
+ event.setFrom("DCAE");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<String, String>());
+ event.getAAI().put("vserver.vserver-name", "nullRequest");
+ event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
kieSession.insert(event);
kieSession.fireUntilHalt();
@@ -287,53 +287,53 @@ public class VFCControlLoopTest implements TopicListener {
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
VirtualControlLoopNotification notification = (VirtualControlLoopNotification) obj;
- String policyName = notification.policyName;
+ String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.notification));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
}
else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("Sending guard query"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.toLowerCase().endsWith("permit"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=VFC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=VFC"));
}
else if (policyName.endsWith("OPERATION.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The operation timed out");
fail("Operation Timed Out");
}
else if (policyName.endsWith("VFC.RESPONSE")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=VFC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=VFC"));
}
else if (policyName.endsWith("EVENT.MANAGER")) {
- logger.debug("Rule Fired: " + notification.policyName);
- if ("nullRequest".equals(notification.AAI.get("vserver.vserver-name"))){
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ if ("nullRequest".equals(notification.getAAI().get("vserver.vserver-name"))){
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
}
else {
- assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.notification);
+ assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, notification.getNotification());
}
kieSession.halt();
}
else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
@@ -355,20 +355,20 @@ public class VFCControlLoopTest implements TopicListener {
*/
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = UUID.randomUUID();
- event.closedLoopEventClient = "tca.instance00009";
- event.target_type = ControlLoopTargetType.VM;
- event.target = "vserver.vserver-name";
- event.from = "DCAE";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<String, String>();
- event.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
- event.AAI.put("vserver.vserver-id", "vserver-id-16102016-aai3255-data-11-1");
- event.AAI.put("generic-vnf.vnf-id", "vnf-id-16102016-aai3255-data-11-1");
- event.AAI.put("service-instance.service-instance-id", "service-instance-id-16102016-aai3255-data-11-1");
- event.AAI.put("vserver.is-closed-loop-disabled", "false");
- event.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(UUID.randomUUID());
+ event.setClosedLoopEventClient("tca.instance00009");
+ event.setTargetType(ControlLoopTargetType.VM);
+ event.setTarget("vserver.vserver-name");
+ event.setFrom("DCAE");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<String, String>());
+ event.getAAI().put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ event.getAAI().put("vserver.vserver-id", "vserver-id-16102016-aai3255-data-11-1");
+ event.getAAI().put("generic-vnf.vnf-id", "vnf-id-16102016-aai3255-data-11-1");
+ event.getAAI().put("service-instance.service-instance-id", "service-instance-id-16102016-aai3255-data-11-1");
+ event.getAAI().put("vserver.is-closed-loop-disabled", "false");
+ event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
kieSession.insert(event);
}
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 95737b9c8..156fbbaa8 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
@@ -322,58 +322,58 @@ public class VFWControlLoopTest implements TopicListener {
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
VirtualControlLoopNotification notification = (VirtualControlLoopNotification) obj;
- String policyName = notification.policyName;
+ String policyName = notification.getPolicyName();
if (policyName.endsWith("EVENT")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.notification));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.ACTIVE.equals(notification.getNotification()));
}
else if (policyName.endsWith("GUARD_NOT_YET_QUERIED")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("Sending guard query"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.toLowerCase().endsWith("permit"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ 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.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
}
else if (policyName.endsWith("OPERATION.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The operation timed out");
fail("Operation Timed Out");
}
else if (policyName.endsWith("APPC.RESPONSE")) {
- logger.debug("Rule Fired: " + notification.policyName);
- assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.notification));
- assertNotNull(notification.message);
- assertTrue(notification.message.startsWith("actor=APPC"));
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ assertTrue(ControlLoopNotificationType.OPERATION_SUCCESS.equals(notification.getNotification()));
+ assertNotNull(notification.getMessage());
+ assertTrue(notification.getMessage().startsWith("actor=APPC"));
sendEvent(pair.a, requestID, ControlLoopEventStatus.ABATED);
}
else if (policyName.endsWith("EVENT.MANAGER")) {
- logger.debug("Rule Fired: " + notification.policyName);
- if ("error".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
- assertEquals("Target vnf-id could not be found", notification.message);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
+ if ("error".equals(notification.getAAI().get("generic-vnf.vnf-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
+ assertEquals("Target vnf-id could not be found", notification.getMessage());
}
- else if ("getFail".equals(notification.AAI.get("generic-vnf.vnf-name"))) {
- assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.notification);
+ else if ("getFail".equals(notification.getAAI().get("generic-vnf.vnf-name"))) {
+ assertEquals(ControlLoopNotificationType.FINAL_FAILURE, notification.getNotification());
}
else {
- assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.notification));
+ assertTrue(ControlLoopNotificationType.FINAL_SUCCESS.equals(notification.getNotification()));
}
kieSession.halt();
}
else if (policyName.endsWith("EVENT.MANAGER.TIMEOUT")) {
- logger.debug("Rule Fired: " + notification.policyName);
+ logger.debug("Rule Fired: " + notification.getPolicyName());
kieSession.halt();
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
@@ -407,13 +407,13 @@ public class VFWControlLoopTest implements TopicListener {
*/
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "generic-vnf.vnf-name";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", "testGenericVnfID");
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("generic-vnf.vnf-name");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", "testGenericVnfID");
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}
@@ -428,13 +428,13 @@ public class VFWControlLoopTest implements TopicListener {
*/
protected void sendEvent(ControlLoopPolicy policy, UUID requestID, ControlLoopEventStatus status, String vnfId) {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = policy.getControlLoop().getControlLoopName();
- event.requestID = requestID;
- event.target = "generic-vnf.vnf-name";
- event.closedLoopAlarmStart = Instant.now();
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", vnfId);
- event.closedLoopEventStatus = status;
+ event.setClosedLoopControlName(policy.getControlLoop().getControlLoopName());
+ event.setRequestID(requestID);
+ event.setTarget("generic-vnf.vnf-name");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", vnfId);
+ event.setClosedLoopEventStatus(status);
kieSession.insert(event);
}