aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java6
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java4
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java4
3 files changed, 14 insertions, 0 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
index 5e8cbbc2e..9ef892e14 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
@@ -212,6 +212,12 @@ public class ControlLoopOperationManager2 implements Serializable {
clOperation = outcome.toControlLoopOperation();
clOperation.setTarget(policy.getTarget().toString());
clResponse = outcome.getControlLoopResponse();
+
+ if (outcome.getEnd() == null) {
+ clOperation.setOutcome("Started");
+ } else if (clOperation.getOutcome() == null) {
+ clOperation.setOutcome("");
+ }
}
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
index 1d108a349..2b67865bf 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
@@ -278,6 +278,10 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
.setParameter(6, record.getTargetEntity())
.getResultList();
+ if (results.size() > 1) {
+ logger.warn("unexpected operation history record count {} for {}", results.size(), event.getRequestId());
+ }
+
Dbao entry = (results.isEmpty() ? new Dbao() : results.get(0));
entry.setClosedLoopName(event.getClosedLoopControlName());
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java
index e6d42d452..697628144 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java
@@ -340,17 +340,21 @@ public class OperationHistoryDataManagerImplTest {
*/
// no start time
+ operation.setStart(null);
mgr.store(REQ_ID, event, MY_ENTITY, operation);
// no end time
+ operation = new ControlLoopOperation(operation);
operation.setStart(Instant.now());
mgr.store(REQ_ID, event, MY_ENTITY, operation);
// both start and end times
+ operation = new ControlLoopOperation(operation);
operation.setEnd(Instant.now());
mgr.store(REQ_ID, event, MY_ENTITY, operation);
// only end time
+ operation = new ControlLoopOperation(operation);
operation.setStart(null);
mgr.store(REQ_ID, event, MY_ENTITY, operation);