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.java12
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java26
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java20
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java4
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java4
5 files changed, 33 insertions, 33 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 1892746f1..d1d2cefd2 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
@@ -335,7 +335,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
// PLD - this is simply comparing the policy. Do we want to equals the whole object?
//
if (this.currentOperation.policy.equals(operation.policy)) {
- System.out.println("Finishing " + this.currentOperation.policy.recipe + " result is " + this.currentOperation.getOperationResult());
+ System.out.println("Finishing " + this.currentOperation.policy.getRecipe() + " result is " + this.currentOperation.getOperationResult());
//
// Save history
//
@@ -380,7 +380,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
// Ask the Guard
//
LockResult<GuardResult, TargetLock> lockResult = PolicyGuard.lockTarget(
- this.currentOperation.policy.target.type,
+ this.currentOperation.policy.getTarget().getType(),
this.getTargetInstance(this.currentOperation.policy),
this.onset.requestID,
this);
@@ -486,7 +486,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public int getControlLoopTimeout(Integer defaultTimeout) {
if (this.processor != null && this.processor.getControlLoop() != null) {
- return this.processor.getControlLoop().timeout;
+ return this.processor.getControlLoop().getTimeout();
}
if (defaultTimeout != null) {
return defaultTimeout;
@@ -543,9 +543,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public String getTargetInstance(Policy policy) {
- if (policy.target != null) {
- if (policy.target.type != null) {
- switch(policy.target.type) {
+ if (policy.getTarget() != null) {
+ if (policy.getTarget().getType() != null) {
+ switch(policy.getTarget().getType()) {
case PNF:
break;
case VM:
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 81c85b1e8..ff7b2c74d 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
@@ -51,7 +51,7 @@ public class ControlLoopOperationManager implements Serializable {
@Override
public String toString() {
return "ControlLoopOperationManager [onset=" + (onset != null ? onset.requestID : "null") + ", policy="
- + (policy != null ? policy.id : "null") + ", attempts=" + attempts
+ + (policy != null ? policy.getId() : "null") + ", attempts=" + attempts
+ ", policyResult=" + policyResult
+ ", currentOperation=" + currentOperation + ", operationHistory=" + operationHistory
+ "]";
@@ -122,7 +122,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Let's make a sanity check
//
- switch (policy.actor) {
+ switch (policy.getActor()) {
case "APPC":
break;
case "AOTS":
@@ -151,7 +151,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Check if we have maxed out on retries
//
- if (this.policy.retry == null || this.policy.retry < 1) {
+ if (this.policy.getRetry() == null || this.policy.getRetry() < 1) {
//
// No retries are allowed, so check have we even made
// one attempt to execute the operation?
@@ -172,7 +172,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Have we maxed out on retries?
//
- if (this.attempts > this.policy.retry) {
+ if (this.attempts > this.policy.getRetry()) {
if (this.policyResult == null) {
this.policyResult = PolicyResult.FAILURE_RETRIES;
}
@@ -185,14 +185,14 @@ public class ControlLoopOperationManager implements Serializable {
this.policyResult = null;
Operation operation = new Operation();
operation.attempt = ++this.attempts;
- operation.operation.actor = this.policy.actor.toString();
- operation.operation.operation = this.policy.recipe;
- operation.operation.target = this.policy.target.toString();
+ operation.operation.actor = this.policy.getActor().toString();
+ operation.operation.operation = this.policy.getRecipe();
+ operation.operation.target = this.policy.getTarget().toString();
operation.operation.subRequestId = Integer.toString(operation.attempt);
//
// Now determine which actor we need to construct a request for
//
- switch (policy.actor) {
+ switch (policy.getActor()) {
case "APPC":
//Request request = APPCActorServiceProvider.constructRequest(onset, operation.operation, this.policy);
this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
@@ -311,8 +311,8 @@ public class ControlLoopOperationManager implements Serializable {
System.out.println("getOperationTimeout returning 0");
return 0;
}
- System.out.println("getOperationTimeout returning " + this.policy.timeout);
- return this.policy.timeout;
+ System.out.println("getOperationTimeout returning " + this.policy.getTimeout());
+ return this.policy.getTimeout();
}
public String getOperationTimeoutString(int defaultTimeout) {
@@ -398,7 +398,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Check if there were no retries specified
//
- if (policy.retry == null || policy.retry == 0) {
+ if (policy.getRetry() == null || policy.getRetry() == 0) {
//
// The result is the failure
//
@@ -433,14 +433,14 @@ public class ControlLoopOperationManager implements Serializable {
}
private boolean isRetriesMaxedOut() {
- if (policy.retry == null || policy.retry == 0) {
+ if (policy.getRetry() == null || policy.getRetry() == 0) {
//
// There were NO retries specified, so declare
// this as completed.
//
return (this.attempts > 0);
}
- return (this.attempts > policy.retry);
+ return (this.attempts > policy.getRetry());
}
private void storeOperationInDataBase(){
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
index bc94068ab..b6fad23d9 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
@@ -43,7 +43,7 @@ public class ControlLoopProcessor {
Object obj = y.load(this.yaml);
if (obj instanceof ControlLoopPolicy) {
this.policy = (ControlLoopPolicy) obj;
- this.currentPolicy = this.policy.controlLoop.trigger_policy;
+ this.currentPolicy = this.policy.getControlLoop().getTrigger_policy();
} else {
this.policy = null;
throw new ControlLoopException("Unable to parse yaml into ControlLoopPolicy object");
@@ -57,7 +57,7 @@ public class ControlLoopProcessor {
}
public ControlLoop getControlLoop() {
- return this.policy.controlLoop;
+ return this.policy.getControlLoop();
}
public FinalResult checkIsCurrentPolicyFinal() {
@@ -65,8 +65,8 @@ public class ControlLoopProcessor {
}
public Policy getCurrentPolicy() {
- for (Policy policy : this.policy.policies) {
- if (policy.id.equals(this.currentPolicy)) {
+ for (Policy policy : this.policy.getPolicies()) {
+ if (policy.getId().equals(this.currentPolicy)) {
return policy;
}
}
@@ -81,22 +81,22 @@ public class ControlLoopProcessor {
}
switch (result) {
case SUCCESS:
- this.currentPolicy = policy.success;
+ this.currentPolicy = policy.getSuccess();
break;
case FAILURE:
- this.currentPolicy = policy.failure;
+ this.currentPolicy = policy.getFailure();
break;
case FAILURE_TIMEOUT:
- this.currentPolicy = policy.failure_timeout;
+ this.currentPolicy = policy.getFailure_timeout();
break;
case FAILURE_RETRIES:
- this.currentPolicy = policy.failure_retries;
+ this.currentPolicy = policy.getFailure_retries();
break;
case FAILURE_EXCEPTION:
- this.currentPolicy = policy.failure_exception;
+ this.currentPolicy = policy.getFailure_exception();
break;
case FAILURE_GUARD:
- this.currentPolicy = policy.failure_guard;
+ this.currentPolicy = policy.getFailure_guard();
break;
default:
throw new ControlLoopException("Bad policy result given: " + result);
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 1cb8b5a5d..fd7540ae7 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
@@ -65,7 +65,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.controlLoop.controlLoopName;
+ onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
//
// Create a processor
@@ -173,7 +173,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.controlLoop.controlLoopName;
+ onset.closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
try {
//
// Create a processor
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java
index 2ed216658..6000ca831 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java
@@ -68,7 +68,7 @@ public class ControlLoopProcessorTest {
}
Policy policy = processor.getCurrentPolicy();
assertNotNull(policy);
- System.out.println("current policy is: " + policy.id + " " + policy.name);
+ System.out.println("current policy is: " + policy.getId() + " " + policy.getName());
processor.nextPolicyForResult(PolicyResult.SUCCESS);
}
}
@@ -84,7 +84,7 @@ public class ControlLoopProcessorTest {
}
Policy policy = processor.getCurrentPolicy();
assertNotNull(policy);
- System.out.println("current policy is: " + policy.id + " " + policy.name);
+ System.out.println("current policy is: " + policy.getId() + " " + policy.getName());
processor.nextPolicyForResult(PolicyResult.FAILURE);
}
}