From 7e6f32d775b8455e5c8f0c244ef0fb8324ce2b7a Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 22 May 2020 09:06:58 -0400 Subject: Use "outcome" to indicate pending record Mariadb is setting the "endtime" to the current time by default, so rather than indicate a pending record using a null endtime, just modified the code set "outcome" to "Started" to indicate a pending record. Also added code to ensure the "outcome" is never null, as that causes a DB error. Also addressed a comment from a previous review to log a warning message if more than one matching record is found in operations history. Issue-ID: POLICY-2581 Change-Id: I6bf67551cef46808a79cc15afeb0abbfc1b6d945 Signed-off-by: Jim Hahn --- .../controlloop/ophistory/OperationHistoryDataManagerImplTest.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'controlloop/common/eventmanager/src/test/java') 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); -- cgit 1.2.3-korg