aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java108
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java54
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java74
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java26
4 files changed, 131 insertions, 131 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index 559eab9d9..2b296616d 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -157,15 +157,15 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
this.onset = event;
this.numOnsets = 1;
//
- notification.notification = ControlLoopNotificationType.ACTIVE;
+ notification.setNotification(ControlLoopNotificationType.ACTIVE);
//
// Set ourselves as active
//
this.isActivated = true;
} catch (ControlLoopException e) {
logger.error("{}: activate threw: ",this, e);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = e.getMessage();
+ notification.setNotification(ControlLoopNotificationType.REJECTED);
+ notification.setMessage(e.getMessage());
}
return notification;
}
@@ -214,15 +214,15 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
//
//
//
- notification.notification = ControlLoopNotificationType.ACTIVE;
+ notification.setNotification(ControlLoopNotificationType.ACTIVE);
//
// Set ourselves as active
//
this.isActivated = true;
} catch (ControlLoopException e) {
logger.error("{}: activate threw: ",this, e);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = e.getMessage();
+ notification.setNotification(ControlLoopNotificationType.REJECTED);
+ notification.setMessage(e.getMessage());
}
return notification;
}
@@ -251,9 +251,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
//
// Yes we have timed out
//
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- notification.message = "Control Loop timed out";
- notification.history.addAll(this.controlLoopHistory);
+ notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
+ notification.setMessage("Control Loop timed out");
+ notification.getHistory().addAll(this.controlLoopHistory);
return notification;
}
//
@@ -269,18 +269,18 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
switch (result) {
case FINAL_FAILURE_EXCEPTION:
- notification.message = "Exception in processing closed loop";
+ notification.setMessage("Exception in processing closed loop");
case FINAL_FAILURE:
case FINAL_FAILURE_RETRIES:
case FINAL_FAILURE_TIMEOUT:
case FINAL_FAILURE_GUARD:
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
+ notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
break;
case FINAL_OPENLOOP:
- notification.notification = ControlLoopNotificationType.FINAL_OPENLOOP;
+ notification.setNotification(ControlLoopNotificationType.FINAL_OPENLOOP);
break;
case FINAL_SUCCESS:
- notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
+ notification.setNotification(ControlLoopNotificationType.FINAL_SUCCESS);
break;
default:
return null;
@@ -288,7 +288,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
//
// Be sure to add all the history
//
- notification.history.addAll(this.controlLoopHistory);
+ notification.getHistory().addAll(this.controlLoopHistory);
return notification;
}
@@ -401,7 +401,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
LockResult<GuardResult, TargetLock> lockResult = PolicyGuard.lockTarget(
this.currentOperation.policy.getTarget().getType(),
this.currentOperation.getTargetEntity(),
- this.onset.requestID,
+ this.onset.getRequestID(),
this);
//
// Was it acquired?
@@ -440,7 +440,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public NEW_EVENT_STATUS onNewEvent(VirtualControlLoopEvent event) throws AAIException {
try {
this.checkEventSyntax(event);
- if (event.closedLoopEventStatus == ControlLoopEventStatus.ONSET) {
+ if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ONSET) {
//
// Check if this is our original ONSET
//
@@ -460,7 +460,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
//
this.numOnsets++;
return NEW_EVENT_STATUS.SUBSEQUENT_ONSET;
- } else if (event.closedLoopEventStatus == ControlLoopEventStatus.ABATED) {
+ } else if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ABATED) {
//
// Have we already got an abatement?
//
@@ -499,9 +499,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public VirtualControlLoopNotification setControlLoopTimedOut() {
this.controlLoopTimedOut = FinalResult.FINAL_FAILURE_TIMEOUT;
VirtualControlLoopNotification notification = new VirtualControlLoopNotification(this.onset);
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- notification.message = "Control Loop timed out";
- notification.history.addAll(this.controlLoopHistory);
+ notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
+ notification.setMessage("Control Loop timed out");
+ notification.getHistory().addAll(this.controlLoopHistory);
return notification;
}
@@ -528,43 +528,43 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public void checkEventSyntax(VirtualControlLoopEvent event) throws ControlLoopException {
- if (event.closedLoopEventStatus == null ||
- (event.closedLoopEventStatus != ControlLoopEventStatus.ONSET &&
- event.closedLoopEventStatus != ControlLoopEventStatus.ABATED)) {
+ if (event.getClosedLoopEventStatus() == null ||
+ (event.getClosedLoopEventStatus() != ControlLoopEventStatus.ONSET &&
+ event.getClosedLoopEventStatus() != ControlLoopEventStatus.ABATED)) {
throw new ControlLoopException("Invalid value in closedLoopEventStatus");
}
- if (event.closedLoopControlName == null || event.closedLoopControlName.length() < 1) {
+ if (event.getClosedLoopControlName() == null || event.getClosedLoopControlName().length() < 1) {
throw new ControlLoopException("No control loop name");
}
- if (event.requestID == null) {
+ if (event.getRequestID() == null) {
throw new ControlLoopException("No request ID");
}
- if (event.closedLoopEventStatus == ControlLoopEventStatus.ABATED) {
+ if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ABATED) {
return;
}
- if (event.target == null || event.target.length() < 1) {
+ if (event.getTarget() == null || event.getTarget().length() < 1) {
throw new ControlLoopException("No target field");
- } else if (! "VM_NAME".equalsIgnoreCase(event.target) &&
- ! "VNF_NAME".equalsIgnoreCase(event.target) &&
- ! "vserver.vserver-name".equalsIgnoreCase(event.target) &&
- ! "generic-vnf.vnf-id".equalsIgnoreCase(event.target) &&
- ! "generic-vnf.vnf-name".equalsIgnoreCase(event.target) ) {
+ } else if (! "VM_NAME".equalsIgnoreCase(event.getTarget()) &&
+ ! "VNF_NAME".equalsIgnoreCase(event.getTarget()) &&
+ ! "vserver.vserver-name".equalsIgnoreCase(event.getTarget()) &&
+ ! "generic-vnf.vnf-id".equalsIgnoreCase(event.getTarget()) &&
+ ! "generic-vnf.vnf-name".equalsIgnoreCase(event.getTarget()) ) {
throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME");
}
- if (event.AAI == null) {
+ if (event.getAAI() == null) {
throw new ControlLoopException("AAI is null");
}
- if (event.AAI.get("generic-vnf.vnf-id") == null && event.AAI.get("vserver.vserver-name") == null &&
- event.AAI.get("generic-vnf.vnf-name") == null) {
+ if (event.getAAI().get("generic-vnf.vnf-id") == null && event.getAAI().get("vserver.vserver-name") == null &&
+ event.getAAI().get("generic-vnf.vnf-name") == null) {
throw new ControlLoopException("generic-vnf.vnf-id or generic-vnf.vnf-name or vserver.vserver-name information missing");
}
}
public void queryAai(VirtualControlLoopEvent event) throws AAIException {
- if (event.AAI.get("vserver.is-closed-loop-disabled") == null &&
- event.AAI.get("generic-vnf.is-closed-loop-disabled") == null) {
+ if (event.getAAI().get("vserver.is-closed-loop-disabled") == null &&
+ event.getAAI().get("generic-vnf.is-closed-loop-disabled") == null) {
try {
- if (event.AAI.get("generic-vnf.vnf-id") != null) {
+ if (event.getAAI().get("generic-vnf.vnf-id") != null) {
vnfResponse = getAAIVnfInfo(event);
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-id)");
@@ -575,7 +575,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (isClosedLoopDisabled(vnfResponse) == true) {
throw new AAIException("is-closed-loop-disabled is set to true");
}
- } else if (event.AAI.get("generic-vnf.vnf-name") != null) {
+ } else if (event.getAAI().get("generic-vnf.vnf-name") != null) {
vnfResponse = getAAIVnfInfo(event);
if (vnfResponse == null) {
throw new AAIException("AAI Response is null (query by vnf-name)");
@@ -586,7 +586,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (isClosedLoopDisabled(vnfResponse) == true) {
throw new AAIException("is-closed-loop-disabled is set to true");
}
- } else if (event.AAI.get("vserver.vserver-name") != null) {
+ } else if (event.getAAI().get("vserver.vserver-name") != null) {
vserverResponse = getAAIVserverInfo(event);
if (vserverResponse == null) {
throw new AAIException("AAI Response is null (query by vserver-name)");
@@ -632,25 +632,25 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static boolean isClosedLoopDisabled(VirtualControlLoopEvent event) {
- if ("true".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled")) ||
- "T".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled")) ||
- "yes".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled")) ||
- "Y".equalsIgnoreCase(event.AAI.get("vserver.is-closed-loop-disabled"))) {
+ if ("true".equalsIgnoreCase(event.getAAI().get("vserver.is-closed-loop-disabled")) ||
+ "T".equalsIgnoreCase(event.getAAI().get("vserver.is-closed-loop-disabled")) ||
+ "yes".equalsIgnoreCase(event.getAAI().get("vserver.is-closed-loop-disabled")) ||
+ "Y".equalsIgnoreCase(event.getAAI().get("vserver.is-closed-loop-disabled"))) {
return true;
}
- else if ("true".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
- "T".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
- "yes".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled")) ||
- "Y".equalsIgnoreCase(event.AAI.get("generic-vnf.is-closed-loop-disabled"))) {
+ else if ("true".equalsIgnoreCase(event.getAAI().get("generic-vnf.is-closed-loop-disabled")) ||
+ "T".equalsIgnoreCase(event.getAAI().get("generic-vnf.is-closed-loop-disabled")) ||
+ "yes".equalsIgnoreCase(event.getAAI().get("generic-vnf.is-closed-loop-disabled")) ||
+ "Y".equalsIgnoreCase(event.getAAI().get("generic-vnf.is-closed-loop-disabled"))) {
return true;
}
return false;
}
public static AAIGETVserverResponse getAAIVserverInfo(VirtualControlLoopEvent event) throws ControlLoopException {
- UUID requestID = event.requestID;
+ UUID requestID = event.getRequestID();
AAIGETVserverResponse response = null;
- String vserverName = event.AAI.get("vserver.vserver-name");
+ String vserverName = event.getAAI().get("vserver.vserver-name");
try {
if (vserverName != null) {
@@ -671,10 +671,10 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public static AAIGETVnfResponse getAAIVnfInfo(VirtualControlLoopEvent event) throws ControlLoopException {
- UUID requestID = event.requestID;
+ UUID requestID = event.getRequestID();
AAIGETVnfResponse response = null;
- String vnfName = event.AAI.get("generic-vnf.vnf-name");
- String vnfID = event.AAI.get("generic-vnf.vnf-id");
+ String vnfName = event.getAAI().get("generic-vnf.vnf-name");
+ String vnfID = event.getAAI().get("generic-vnf.vnf-id");
aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url");
aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
@@ -715,7 +715,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
@Override
public String toString() {
return "ControlLoopEventManager [closedLoopControlName=" + closedLoopControlName + ", requestID=" + requestID
- + ", processor=" + processor + ", onset=" + (onset != null ? onset.requestID : "null") + ", numOnsets=" + numOnsets + ", numAbatements="
+ + ", processor=" + processor + ", onset=" + (onset != null ? onset.getRequestID() : "null") + ", numOnsets=" + numOnsets + ", numAbatements="
+ numAbatements + ", isActivated="
+ isActivated + ", currentOperation=" + currentOperation + ", targetLock=" + targetLock + "]";
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index 0ce3bc5c3..acbacc824 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -62,7 +62,7 @@ public class ControlLoopOperationManager implements Serializable {
@Override
public String toString() {
- return "ControlLoopOperationManager [onset=" + (onset != null ? onset.requestID : "null") + ", policy="
+ return "ControlLoopOperationManager [onset=" + (onset != null ? onset.getRequestID() : "null") + ", policy="
+ (policy != null ? policy.getId() : "null") + ", attempts=" + attempts
+ ", policyResult=" + policyResult
+ ", currentOperation=" + currentOperation + ", operationHistory=" + operationHistory
@@ -137,19 +137,19 @@ public class ControlLoopOperationManager implements Serializable {
case VM:
case VNF:
VirtualControlLoopEvent virtualOnset = (VirtualControlLoopEvent) this.onset;
- if (this.onset.target.equalsIgnoreCase("vserver.vserver-name")) {
- return virtualOnset.AAI.get("vserver.vserver-name");
+ if (this.onset.getTarget().equalsIgnoreCase("vserver.vserver-name")) {
+ return virtualOnset.getAAI().get("vserver.vserver-name");
}
- else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-id")) {
- return virtualOnset.AAI.get("generic-vnf.vnf-id");
+ else if (this.onset.getTarget().equalsIgnoreCase("generic-vnf.vnf-id")) {
+ return virtualOnset.getAAI().get("generic-vnf.vnf-id");
}
- else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) {
+ else if (this.onset.getTarget().equalsIgnoreCase("generic-vnf.vnf-name")) {
/*
* If the onset is enriched with the vnf-id,
* we don't need an A&AI response
*/
- if (virtualOnset.AAI.containsKey("generic-vnf.vnf-id")) {
- return virtualOnset.AAI.get("generic-vnf.vnf-id");
+ if (virtualOnset.getAAI().containsKey("generic-vnf.vnf-id")) {
+ return virtualOnset.getAAI().get("generic-vnf.vnf-id");
}
/*
@@ -256,10 +256,10 @@ public class ControlLoopOperationManager implements Serializable {
this.policyResult = null;
Operation operation = new Operation();
operation.attempt = ++this.attempts;
- operation.operation.actor = this.policy.getActor();
- operation.operation.operation = this.policy.getRecipe();
- operation.operation.target = this.policy.getTarget().toString();
- operation.operation.subRequestId = Integer.toString(operation.attempt);
+ operation.operation.setActor(this.policy.getActor());
+ operation.operation.setOperation(this.policy.getRecipe());
+ operation.operation.setTarget(this.policy.getTarget().toString());
+ operation.operation.setSubRequestId(Integer.toString(operation.attempt));
//
// Now determine which actor we need to construct a request for
//
@@ -657,16 +657,16 @@ public class ControlLoopOperationManager implements Serializable {
OperationsHistoryDbEntry newEntry = new OperationsHistoryDbEntry();
- newEntry.closedLoopName = this.onset.closedLoopControlName;
- newEntry.requestId = this.onset.requestID.toString();
- newEntry.actor = this.currentOperation.operation.actor;
- newEntry.operation = this.currentOperation.operation.operation;
+ newEntry.closedLoopName = this.onset.getClosedLoopControlName();
+ newEntry.requestId = this.onset.getRequestID().toString();
+ newEntry.actor = this.currentOperation.operation.getActor();
+ newEntry.operation = this.currentOperation.operation.getOperation();
newEntry.target = this.targetEntity;
- newEntry.starttime = Timestamp.from(this.currentOperation.operation.start);
- newEntry.subrequestId = this.currentOperation.operation.subRequestId;
- newEntry.endtime = new Timestamp(this.currentOperation.operation.end.toEpochMilli());
- newEntry.message = this.currentOperation.operation.message;
- newEntry.outcome = this.currentOperation.operation.outcome;
+ newEntry.starttime = Timestamp.from(this.currentOperation.operation.getStart());
+ newEntry.subrequestId = this.currentOperation.operation.getSubRequestId();
+ newEntry.endtime = new Timestamp(this.currentOperation.operation.getEnd().toEpochMilli());
+ newEntry.message = this.currentOperation.operation.getMessage();
+ newEntry.outcome = this.currentOperation.operation.getOutcome();
em.getTransaction().begin();
em.persist(newEntry);
@@ -685,9 +685,9 @@ public class ControlLoopOperationManager implements Serializable {
}
if (this.currentOperation != null) {
if (this.currentOperation.attempt == attempt.intValue()) {
- this.currentOperation.operation.end = Instant.now();
- this.currentOperation.operation.message = message;
- this.currentOperation.operation.outcome = result.toString();
+ this.currentOperation.operation.setEnd(Instant.now());
+ this.currentOperation.operation.setMessage(message);
+ this.currentOperation.operation.setOutcome(result.toString());
this.currentOperation.policyResult = result;
//
// Save it in history
@@ -708,9 +708,9 @@ public class ControlLoopOperationManager implements Serializable {
}
for (Operation op : this.operationHistory) {
if (op.attempt == attempt.intValue()) {
- op.operation.end = Instant.now();
- op.operation.message = message;
- op.operation.outcome = result.toString();
+ op.operation.setEnd(Instant.now());
+ op.operation.setMessage(message);
+ op.operation.setOutcome(result.toString());
op.policyResult = result;
return;
}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index bc832a907..d4083150d 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -59,15 +59,15 @@ public class ControlLoopEventManagerTest {
private static VirtualControlLoopEvent onset;
static {
onset = new VirtualControlLoopEvent();
- onset.closedLoopControlName = "ControlLoop-vUSP";
- onset.requestID = UUID.randomUUID();
- onset.target = "VM_NAME";
- onset.closedLoopAlarmStart = Instant.now();
- onset.AAI = new HashMap<String, String>();
- onset.AAI.put("cloud-region.identity-url", "foo");
- onset.AAI.put("vserver.selflink", "bar");
- onset.AAI.put("generic-vnf.vnf-id", "83f674e8-7555-44d7-9a39-bdc3770b0491");
- onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ onset.setClosedLoopControlName("ControlLoop-vUSP");
+ onset.setRequestID(UUID.randomUUID());
+ onset.setTarget("VM_NAME");
+ onset.setClosedLoopAlarmStart(Instant.now());
+ onset.setAAI(new HashMap<String, String>());
+ onset.getAAI().put("cloud-region.identity-url", "foo");
+ onset.getAAI().put("vserver.selflink", "bar");
+ onset.getAAI().put("generic-vnf.vnf-id", "83f674e8-7555-44d7-9a39-bdc3770b0491");
+ onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
}
@BeforeClass
@@ -90,7 +90,7 @@ public class ControlLoopEventManagerTest {
@Test
public void testAAIVnfInfo() {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
AAIGETVnfResponse response = getQueryByVnfID2(PolicyEngine.manager.getEnvironmentProperty("aai.url") + "/aai/v11/network/generic-vnfs/generic-vnf/",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -107,7 +107,7 @@ public class ControlLoopEventManagerTest {
@Test
public void testAAIVnfInfo2() {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
AAIGETVnfResponse response = getQueryByVnfName2(PolicyEngine.manager.getEnvironmentProperty("aai.url") + "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -124,7 +124,7 @@ public class ControlLoopEventManagerTest {
@Test
public void testAAIVserver() {
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
AAIGETVserverResponse response = getQueryByVserverName2(PolicyEngine.manager.getEnvironmentProperty("aai.url") + "/aai/v11/nodes/vservers?vserver-name=",
PolicyEngine.manager.getEnvironmentProperty("aai.username"),
@@ -144,7 +144,7 @@ public class ControlLoopEventManagerTest {
// Load up the policy
//
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
logger.info("testIsClosedLoopDisabled --");
@@ -179,12 +179,12 @@ public class ControlLoopEventManagerTest {
@Test
public void abatemetCheckEventSyntaxTest() {
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = "abatementAAI";
- event.requestID = UUID.randomUUID();
- event.target = "generic-vnf.vnf-id";
- event.closedLoopAlarmStart = Instant.now();
- event.closedLoopEventStatus = ControlLoopEventStatus.ABATED;
- ControlLoopEventManager manager = new ControlLoopEventManager(event.closedLoopControlName, event.requestID);
+ event.setClosedLoopControlName("abatementAAI");
+ event.setRequestID(UUID.randomUUID());
+ event.setTarget("generic-vnf.vnf-id");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setClosedLoopEventStatus(ControlLoopEventStatus.ABATED);
+ ControlLoopEventManager manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID());
assertNull(manager.getVnfResponse());
assertNull(manager.getVserverResponse());
try {
@@ -198,8 +198,8 @@ public class ControlLoopEventManagerTest {
assertNull(manager.getVserverResponse());
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", "abatementTest");
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", "abatementTest");
try {
manager.checkEventSyntax(event);
} catch (ControlLoopException e) {
@@ -215,19 +215,19 @@ public class ControlLoopEventManagerTest {
public void subsequentOnsetTest() {
UUID requestId = UUID.randomUUID();
VirtualControlLoopEvent event = new VirtualControlLoopEvent();
- event.closedLoopControlName = "TwoOnsetTest";
- event.requestID = requestId;
- event.target = "generic-vnf.vnf-id";
- event.closedLoopAlarmStart = Instant.now();
- event.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- event.AAI = new HashMap<>();
- event.AAI.put("generic-vnf.vnf-name", "onsetOne");
+ event.setClosedLoopControlName("TwoOnsetTest");
+ event.setRequestID(requestId);
+ event.setTarget("generic-vnf.vnf-id");
+ event.setClosedLoopAlarmStart(Instant.now());
+ event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
+ event.setAAI(new HashMap<>());
+ event.getAAI().put("generic-vnf.vnf-name", "onsetOne");
- ControlLoopEventManager manager = new ControlLoopEventManager(event.closedLoopControlName, event.requestID);
+ ControlLoopEventManager manager = new ControlLoopEventManager(event.getClosedLoopControlName(), event.getRequestID());
VirtualControlLoopNotification notification = manager.activate(event);
assertNotNull(notification);
- assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification);
+ assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification());
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {
@@ -244,13 +244,13 @@ public class ControlLoopEventManagerTest {
assertNull(manager.getVserverResponse());
VirtualControlLoopEvent event2 = new VirtualControlLoopEvent();
- event2.closedLoopControlName = "TwoOnsetTest";
- event2.requestID = requestId;
- event2.target = "generic-vnf.vnf-id";
- event2.closedLoopAlarmStart = Instant.now();
- event2.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
- event2.AAI = new HashMap<>();
- event2.AAI.put("generic-vnf.vnf-name", "onsetTwo");
+ event2.setClosedLoopControlName("TwoOnsetTest");
+ event2.setRequestID(requestId);
+ event2.setTarget("generic-vnf.vnf-id");
+ event2.setClosedLoopAlarmStart(Instant.now());
+ event2.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
+ event2.setAAI(new HashMap<>());
+ event2.getAAI().put("generic-vnf.vnf-name", "onsetTwo");
try {
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index 1714d3e26..76020b0c9 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
@@ -58,13 +58,13 @@ public class ControlLoopOperationManagerTest {
private static VirtualControlLoopEvent onset;
static {
onset = new VirtualControlLoopEvent();
- onset.requestID = UUID.randomUUID();
- onset.target = "generic-vnf.vnf-name";
- onset.target_type = ControlLoopTargetType.VNF;
- onset.closedLoopAlarmStart = Instant.now();
- onset.AAI = new HashMap<>();
- onset.AAI.put("generic-vnf.vnf-name", "testTriggerSource");
- onset.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+ onset.setRequestID(UUID.randomUUID());
+ onset.setTarget("generic-vnf.vnf-name");
+ onset.setTargetType(ControlLoopTargetType.VNF);
+ onset.setClosedLoopAlarmStart(Instant.now());
+ onset.setAAI(new HashMap<>());
+ onset.getAAI().put("generic-vnf.vnf-name", "testTriggerSource");
+ onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
/* Set environment properties */
PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
@@ -92,7 +92,7 @@ public class ControlLoopOperationManagerTest {
// Load up the policy
//
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
//
// Create a processor
@@ -101,11 +101,11 @@ public class ControlLoopOperationManagerTest {
//
// create the manager
//
- ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
+ ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestID());
VirtualControlLoopNotification notification = eventManager.activate(onset);
assertNotNull(notification);
- assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification);
+ assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification());
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {
@@ -221,7 +221,7 @@ public class ControlLoopOperationManagerTest {
// Load up the policy
//
final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml("src/test/resources/test.yaml");
- onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ onset.setClosedLoopControlName(pair.a.getControlLoop().getControlLoopName());
try {
//
// Create a processor
@@ -230,11 +230,11 @@ public class ControlLoopOperationManagerTest {
//
// create the manager
//
- ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
+ ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.getClosedLoopControlName(), onset.getRequestID());
VirtualControlLoopNotification notification = eventManager.activate(onset);
assertNotNull(notification);
- assertEquals(ControlLoopNotificationType.ACTIVE, notification.notification);
+ assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification());
ControlLoopEventManager.NEW_EVENT_STATUS status = null;
try {