summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-10-18 17:02:33 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-18 17:02:33 +0000
commit0f4579198b531a38cdef06bbeb4f51302730e4ba (patch)
treeaacfee9bfe6dde471f36e813667705d33350ebb3 /controlloop/common/eventmanager
parentf7f46f9c7ddbd7918b428649a766366d6c912b89 (diff)
parent506267bf7e9d961f1a6b2a989ee8a23ca67b9d61 (diff)
Merge "Add support for AAI Named Query error handling"
Diffstat (limited to 'controlloop/common/eventmanager')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java3
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java10
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java6
3 files changed, 13 insertions, 6 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 f8f3b4cc8..2fc43a01c 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
@@ -265,8 +265,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
switch (result) {
- case FINAL_FAILURE:
case FINAL_FAILURE_EXCEPTION:
+ notification.message = "Exception in processing closed loop";
+ case FINAL_FAILURE:
case FINAL_FAILURE_RETRIES:
case FINAL_FAILURE_TIMEOUT:
case FINAL_FAILURE_GUARD:
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 6daa4acd6..1127bce3b 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
@@ -30,6 +30,7 @@ import java.util.Properties;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
+import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appclcm.LCMResponseWrapper;
@@ -144,7 +145,7 @@ public class ControlLoopOperationManager implements Serializable {
}
}
- public Object startOperation(/*VirtualControlLoopEvent*/ControlLoopEvent onset) {
+ public Object startOperation(/*VirtualControlLoopEvent*/ControlLoopEvent onset) throws AAIException {
//
// They shouldn't call us if we currently running something
//
@@ -205,6 +206,7 @@ public class ControlLoopOperationManager implements Serializable {
* request is constructed. Otherwise an LCMRequest
* is constructed.
*/
+ this.currentOperation = operation;
if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) {
this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
@@ -215,7 +217,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Save the operation
//
- this.currentOperation = operation;
+
return operationRequest;
case "SO":
SOActorServiceProvider SOAsp = new SOActorServiceProvider();
@@ -481,6 +483,10 @@ public class ControlLoopOperationManager implements Serializable {
//
this.completeOperation(this.attempts, "Operation denied by Guard", PolicyResult.FAILURE_GUARD);
}
+
+ public void setOperationHasException(String message) {
+ this.completeOperation(this.attempts, message, PolicyResult.FAILURE_EXCEPTION);
+ }
public boolean isOperationComplete() {
//
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 90f61e0c9..c5c0bc967 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
@@ -30,12 +30,12 @@ import java.util.HashMap;
import java.util.UUID;
import org.junit.Test;
+import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appclcm.LCMRequest;
import org.onap.policy.appclcm.LCMRequestWrapper;
import org.onap.policy.appclcm.LCMResponse;
import org.onap.policy.appclcm.LCMResponseWrapper;
import org.onap.policy.controlloop.ControlLoopEventStatus;
-
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.Util;
@@ -171,7 +171,7 @@ public class ControlLoopOperationManagerTest {
assertNotNull(manager.getOperationResult());
assertTrue(manager.getOperationResult().equals(PolicyResult.FAILURE_RETRIES));
assertTrue(manager.getHistory().size() == 2);
- } catch (ControlLoopException e) {
+ } catch (ControlLoopException | AAIException e) {
fail(e.getMessage());
}
}
@@ -253,7 +253,7 @@ public class ControlLoopOperationManagerTest {
assertFalse(manager.isOperationRunning());
assertTrue(manager.getHistory().size() == 1);
assertTrue(manager.getOperationResult().equals(PolicyResult.FAILURE_TIMEOUT));
- } catch (ControlLoopException e) {
+ } catch (ControlLoopException | AAIException e) {
fail(e.getMessage());
}
}