From 9496f31d3b2a1674f57a0395d050be0d9c6b87f0 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 13 Apr 2021 14:22:19 -0400 Subject: Make op history classes work with generic events Issue-ID: POLICY-3198 Change-Id: I5b80d35fbb523094ae5464e9c058fd8f2c71ff50 Signed-off-by: Jim Hahn --- .../OperationHistoryDataManagerImplTest.java | 36 +++++++++++----------- .../OperationHistoryDataManagerStubTest.java | 4 +-- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'controlloop/common/eventmanager/src/test') 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 a360a7474..9d32a85e1 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 @@ -173,7 +173,7 @@ public class OperationHistoryDataManagerImplTest { @Test public void testStore_testStop() throws InterruptedException { // store - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); runThread(); @@ -200,7 +200,7 @@ public class OperationHistoryDataManagerImplTest { mgr.stop(); // store - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); assertEquals(0, mgr.getRecordsCommitted()); } @@ -212,7 +212,7 @@ public class OperationHistoryDataManagerImplTest { public void testStoreTooManyItems() throws InterruptedException { final int nextra = 5; for (int nitems = 0; nitems < MAX_QUEUE_LENGTH + nextra; ++nitems) { - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); } runThread(); @@ -233,9 +233,9 @@ public class OperationHistoryDataManagerImplTest { mgr = new RealThread(); mgr.start(); - mgr.store(REQ_ID, event, MY_ENTITY, operation); - mgr.store(REQ_ID, event, MY_ENTITY, operation); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); waitForThread(); @@ -269,9 +269,9 @@ public class OperationHistoryDataManagerImplTest { mgr = new RealThread(); mgr.start(); - mgr.store(REQ_ID, event, MY_ENTITY, operation); - mgr.store(REQ_ID, event, MY_ENTITY, operation); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); waitForThread(); @@ -286,7 +286,7 @@ public class OperationHistoryDataManagerImplTest { // arrange to throw an exception when(emfSpy.createEntityManager()).thenThrow(EXPECTED_EXCEPTION); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); runThread(); } @@ -299,25 +299,25 @@ public class OperationHistoryDataManagerImplTest { */ // no start time - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); // no end time operation = new ControlLoopOperation(operation); operation.setSubRequestId(UUID.randomUUID().toString()); operation.setStart(Instant.now()); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); // both start and end times operation = new ControlLoopOperation(operation); operation.setSubRequestId(UUID.randomUUID().toString()); operation.setEnd(Instant.now()); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); // only end time operation = new ControlLoopOperation(operation); operation.setSubRequestId(UUID.randomUUID().toString()); operation.setStart(null); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); runThread(); @@ -341,22 +341,22 @@ public class OperationHistoryDataManagerImplTest { // no start time operation.setStart(null); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); // no end time operation = new ControlLoopOperation(operation); operation.setStart(Instant.now()); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), 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); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); // only end time operation = new ControlLoopOperation(operation); operation.setStart(null); - mgr.store(REQ_ID, event, MY_ENTITY, operation); + mgr.store(REQ_ID, event.getClosedLoopControlName(), event, MY_ENTITY, operation); runThread(); diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStubTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStubTest.java index a6f50629c..4774af427 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStubTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStubTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ public class OperationHistoryDataManagerStubTest { public void test() { OperationHistoryDataManagerStub mgr = new OperationHistoryDataManagerStub(); - assertThatCode(() -> mgr.store(null, null, null, null)).doesNotThrowAnyException(); + assertThatCode(() -> mgr.store(null, null, null, null, null)).doesNotThrowAnyException(); assertThatCode(() -> mgr.stop()).doesNotThrowAnyException(); } } -- cgit 1.2.3-korg