summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2Test.java9
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/LockOperation2Test.java10
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java14
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiCqStep2Test.java8
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetPnfStep2Test.java8
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetTenantStep2Test.java8
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GetTargetEntityStep2Test.java8
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java14
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/LockStep2Test.java8
-rw-r--r--controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java11
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java8
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java6
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.java8
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImplTest.java8
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java11
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java25
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/HttpClientsTest.java9
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/ListenerTest.java10
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.java13
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/SimulatorsTest.java10
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/TopicsTest.java8
21 files changed, 83 insertions, 131 deletions
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2Test.java
index efa27a6ec..efb7e74d3 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2Test.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.
@@ -34,8 +34,9 @@ import java.util.List;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
@@ -43,6 +44,7 @@ import org.onap.policy.controlloop.actorserviceprovider.TargetType;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class GetTargetEntityOperation2Test {
private static final String GENERIC_VNF_ID = "generic-vnf.vnf-id";
private static final String VSERVER_NAME = "vserver.vserver-name";
@@ -66,8 +68,6 @@ public class GetTargetEntityOperation2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
event = new VirtualControlLoopEvent();
event.setTarget("pnf.pnf-name");
event.setAai(Map.of("pnf.pnf-name", MY_PNF));
@@ -296,7 +296,6 @@ public class GetTargetEntityOperation2Test {
@Test
public void testSetProperty() {
- when(params.getTargetType()).thenReturn(TargetType.VM);
event.setTarget(GENERIC_VNF_NAME);
// not a property of interest - should be ignored
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/LockOperation2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/LockOperation2Test.java
index 42fd9e4e4..3208d4c53 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/LockOperation2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/LockOperation2Test.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.
@@ -33,16 +33,17 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
-import org.onap.policy.controlloop.actorserviceprovider.TargetType;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class LockOperation2Test {
private static final String MY_PNF = "my-pnf";
private static final String MY_VNF = "my-vnf";
@@ -64,8 +65,6 @@ public class LockOperation2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
event = new VirtualControlLoopEvent();
event.setTarget("pnf.pnf-name");
event.setAai(Map.of("pnf.pnf-name", MY_PNF));
@@ -77,7 +76,6 @@ public class LockOperation2Test {
when(stepContext.requestLock(anyString())).thenReturn(future);
- when(params.getTargetType()).thenReturn(TargetType.PNF);
when(params.getActor()).thenReturn(MY_ACTOR);
when(params.getOperation()).thenReturn(MY_OPERATION);
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
index cce720974..98758f4da 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.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.
@@ -39,7 +39,6 @@ import static org.mockito.Mockito.when;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Deque;
import java.util.List;
import java.util.Map;
@@ -50,9 +49,10 @@ import java.util.concurrent.ForkJoinPool;
import org.drools.core.WorkingMemory;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.kie.api.runtime.rule.FactHandle;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
@@ -94,6 +94,7 @@ import org.onap.policy.sdnr.PciBody;
import org.onap.policy.sdnr.PciMessage;
import org.onap.policy.sdnr.PciResponse;
+@RunWith(MockitoJUnitRunner.class)
public class UsecasesEventManagerTest {
private static final UUID REQ_ID = UUID.randomUUID();
private static final String CL_NAME = "my-closed-loop-name";
@@ -145,13 +146,6 @@ public class UsecasesEventManagerTest {
*/
@Before
public void setUp() throws ControlLoopException, CoderException {
- MockitoAnnotations.initMocks(this);
-
- when(actors.getActor(SIMPLE_ACTOR)).thenReturn(policyActor);
- when(policyActor.getOperator(SIMPLE_OPERATION)).thenReturn(policyOperator);
- when(policyOperator.buildOperation(any())).thenReturn(policyOperation);
- when(policyOperation.getPropertyNames()).thenReturn(Collections.emptyList());
-
when(workMem.getFactHandle(any())).thenReturn(factHandle);
event = new VirtualControlLoopEvent();
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiCqStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiCqStep2Test.java
index d05aa604c..3c629591d 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiCqStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiCqStep2Test.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.
@@ -33,8 +33,9 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.aai.AaiActor;
@@ -47,6 +48,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class AaiCqStep2Test {
private static final UUID REQ_ID = UUID.randomUUID();
@@ -74,8 +76,6 @@ public class AaiCqStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
future = new CompletableFuture<>();
when(params.toBuilder()).thenReturn(ControlLoopOperationParams.builder().actorService(actors)
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetPnfStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetPnfStep2Test.java
index 7580c2c0c..897650fb3 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetPnfStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetPnfStep2Test.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.
@@ -33,8 +33,9 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.aai.AaiActor;
@@ -48,6 +49,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class AaiGetPnfStep2Test {
private static final String MY_TARGET = "my-target";
private static final UUID REQ_ID = UUID.randomUUID();
@@ -76,8 +78,6 @@ public class AaiGetPnfStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
future = new CompletableFuture<>();
when(params.toBuilder()).thenReturn(ControlLoopOperationParams.builder().actorService(actors)
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetTenantStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetTenantStep2Test.java
index 7b1bae7d8..bccfbb3be 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetTenantStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/AaiGetTenantStep2Test.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.
@@ -36,8 +36,9 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actor.aai.AaiActor;
@@ -51,6 +52,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class AaiGetTenantStep2Test {
private static final String MY_VSERVER = "my-vserver";
private static final UUID REQ_ID = UUID.randomUUID();
@@ -79,8 +81,6 @@ public class AaiGetTenantStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
future = new CompletableFuture<>();
when(params.toBuilder()).thenReturn(ControlLoopOperationParams.builder().actorService(actors)
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GetTargetEntityStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GetTargetEntityStep2Test.java
index 965d04d7f..ff9a38a81 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GetTargetEntityStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GetTargetEntityStep2Test.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.
@@ -29,8 +29,9 @@ import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.Operation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
@@ -38,6 +39,7 @@ import org.onap.policy.controlloop.eventmanager.StepContext;
import org.onap.policy.drools.apps.controller.usecases.GetTargetEntityOperation2;
import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
+@RunWith(MockitoJUnitRunner.class)
public class GetTargetEntityStep2Test {
@Mock
private ControlLoopOperationParams params;
@@ -54,8 +56,6 @@ public class GetTargetEntityStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
when(params.toBuilder()).thenReturn(ControlLoopOperationParams.builder());
master = new Step2(stepContext, params, event);
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
index 2ab647aa4..d5945a30c 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/GuardStep2Test.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.
@@ -33,8 +33,9 @@ import java.util.Map;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.RelatedToProperty;
@@ -54,6 +55,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.eventmanager.StepContext;
import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
+@RunWith(MockitoJUnitRunner.class)
public class GuardStep2Test {
private static final String SOME_OTHER_VALUE = "some-other-value";
private static final String SOME_OTHER_KEY = "some-other-key";
@@ -64,7 +66,6 @@ public class GuardStep2Test {
private static final String MY_NAME = "my-name";
private static final String MY_TYPE = "my-type";
private static final String MY_CODE = "my-code";
- private static final String MY_SERVER = "my-server";
private static final String MY_SERVER2 = "my-server-2";
private static final String MY_SERVERNAME = "my-server-name";
private static final String MY_REGION = "my-region";
@@ -97,13 +98,9 @@ public class GuardStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
aai.put("vserver.vserver-name", MY_SERVERNAME);
- when(event.getRequestId()).thenReturn(REQ_ID);
when(event.getAai()).thenReturn(aai);
- when(genericVnf.getVnfId()).thenReturn(MY_TARGET);
when(genericVnf.getVnfName()).thenReturn(MY_NAME);
when(genericVnf.getVnfType()).thenReturn(MY_TYPE);
when(genericVnf.getNfNamingCode()).thenReturn(MY_CODE);
@@ -151,9 +148,6 @@ public class GuardStep2Test {
when(customQuery.getGenericVnfByVnfId(MY_TARGET)).thenReturn(genericVnf);
- when(theVserver.getVserverId()).thenReturn(MY_SERVER);
- when(customQuery.getVserver()).thenReturn(theVserver);
-
when(cloudRegion.getCloudRegionId()).thenReturn(MY_REGION);
when(customQuery.getDefaultCloudRegion()).thenReturn(cloudRegion);
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/LockStep2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/LockStep2Test.java
index c68f1873f..fd7efe7bf 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/LockStep2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/LockStep2Test.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.
@@ -31,8 +31,9 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.Operation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -41,6 +42,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.eventmanager.ActorConstants;
import org.onap.policy.controlloop.eventmanager.StepContext;
+@RunWith(MockitoJUnitRunner.class)
public class LockStep2Test {
private static final String MY_TARGET = "my-target";
@@ -63,8 +65,6 @@ public class LockStep2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
future = new CompletableFuture<>();
when(stepContext.requestLock(MY_TARGET)).thenReturn(future);
diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
index 1fe36539e..d80484a2e 100644
--- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
+++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/step/Step2Test.java
@@ -41,13 +41,13 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.LinkedBlockingQueue;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ModelVer;
@@ -70,6 +70,7 @@ import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.eventmanager.StepContext;
import org.onap.policy.drools.apps.controller.usecases.UsecasesConstants;
+@RunWith(MockitoJUnitRunner.class)
public class Step2Test {
private static final UUID REQ_ID = UUID.randomUUID();
private static final String POLICY_ACTOR = "my-actor";
@@ -93,7 +94,6 @@ public class Step2Test {
@Mock
private AaiCqResponse aaicq;
- private CompletableFuture<OperationOutcome> future;
private Map<String, String> payload;
private VirtualControlLoopEvent event;
private BlockingQueue<OperationOutcome> starts;
@@ -106,15 +106,10 @@ public class Step2Test {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
- future = new CompletableFuture<>();
-
// configure policy operation
when(actors.getActor(POLICY_ACTOR)).thenReturn(policyActor);
when(policyActor.getOperator(POLICY_OPERATION)).thenReturn(policyOperator);
when(policyOperator.buildOperation(any())).thenReturn(policyOperation);
- when(policyOperation.start()).thenReturn(future);
when(policyOperation.getPropertyNames()).thenReturn(List.of());
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index a8632642a..596400f94 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.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.
@@ -37,9 +37,10 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
@@ -56,6 +57,7 @@ import org.onap.policy.drools.core.lock.LockState;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+@RunWith(MockitoJUnitRunner.class)
public class ControlLoopEventManagerTest {
private static final UUID REQ_ID = UUID.randomUUID();
private static final String CL_NAME = "my-closed-loop-name";
@@ -81,8 +83,6 @@ public class ControlLoopEventManagerTest {
*/
@Before
public void setUp() throws ControlLoopException, CoderException {
- MockitoAnnotations.initMocks(this);
-
params = new ControlLoopParams();
params.setClosedLoopControlName(CL_NAME);
params.setPolicyName(POLICY_NAME);
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java
index 4adb59e4b..7b0213107 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/LockDataTest.java
@@ -38,13 +38,15 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.OperationResult;
import org.onap.policy.drools.core.lock.Lock;
+@RunWith(MockitoJUnitRunner.class)
public class LockDataTest {
private static final String ENTITY = "my-entity";
@@ -66,8 +68,6 @@ public class LockDataTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
data = new LockData(ENTITY, REQ_ID);
}
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.java
index cd22881b8..8037f0037 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/StepTest.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.
@@ -45,8 +45,9 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.ControlLoopTargetType;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.ActorService;
@@ -60,6 +61,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOp
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.drools.domain.models.operational.OperationalTarget;
+@RunWith(MockitoJUnitRunner.class)
public class StepTest {
private static final UUID REQ_ID = UUID.randomUUID();
private static final String POLICY_ACTOR = "my-actor";
@@ -95,8 +97,6 @@ public class StepTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
future = new CompletableFuture<>();
// configure policy operation
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 697628144..a360a7474 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
@@ -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.
@@ -44,12 +44,14 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.ophistory.OperationHistoryDataManagerParams.OperationHistoryDataManagerParamsBuilder;
+@RunWith(MockitoJUnitRunner.class)
public class OperationHistoryDataManagerImplTest {
private static final IllegalStateException EXPECTED_EXCEPTION = new IllegalStateException("expected exception");
@@ -109,8 +111,6 @@ public class OperationHistoryDataManagerImplTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
event = new VirtualControlLoopEvent();
event.setClosedLoopControlName(MY_LOOP_NAME);
event.setRequestId(UUID.randomUUID());
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java
index 4a1cef0d9..a2b4d328e 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.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.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,8 +42,9 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Request;
import org.onap.policy.appclcm.AppcLcmBody;
@@ -63,6 +64,7 @@ import org.onap.policy.sdnr.PciMessage;
import org.onap.policy.sdnr.PciRequest;
import org.powermock.reflect.Whitebox;
+@RunWith(MockitoJUnitRunner.class)
public class BaseTestTest {
private static final String POLICY_NAME = "my-policy-name";
@@ -126,11 +128,6 @@ public class BaseTestTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
- when(policy.getIdentifier()).thenReturn(policyIdent);
- when(policyIdent.getName()).thenReturn(POLICY_NAME);
-
when(topics.createListener(eq(BaseTest.POLICY_CL_MGT_TOPIC), eq(VirtualControlLoopNotification.class),
any(StandardCoder.class))).thenReturn(policyClMgt);
when(topics.createListener(eq(BaseTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class),
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java
index 0aca1b2b8..82b9ed6cc 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.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.
* Modifications Copyright (C) 2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -40,15 +40,15 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.appc.Request;
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis;
import org.onap.policy.controlloop.ControlLoopNotificationType;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.drools.controller.DroolsController;
@@ -58,6 +58,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.sdnr.PciMessage;
import org.powermock.reflect.Whitebox;
+@RunWith(MockitoJUnitRunner.class)
public class DroolsRuleTestTest {
private static final String CONTROLLER_NAME = "my-controller-name";
@@ -128,29 +129,13 @@ public class DroolsRuleTestTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
- when(policy.getIdentifier()).thenReturn(policyIdent);
- when(policyIdent.getName()).thenReturn(POLICY_NAME);
-
- when(drools.factCount(CONTROLLER_NAME)).thenReturn(0L);
- when(controller.getDrools()).thenReturn(drools);
-
- when(rules.getControllerName()).thenReturn(CONTROLLER_NAME);
when(rules.getController()).thenReturn(controller);
- when(rules.setupPolicyFromFile(any())).thenAnswer(args -> {
- when(drools.factCount(CONTROLLER_NAME)).thenReturn(2L);
- return policy;
- });
+ when(rules.setupPolicyFromFile(any())).thenReturn(policy);
when(topics.createListener(DroolsRuleTest.POLICY_CL_MGT_TOPIC,
VirtualControlLoopNotification.class, controller)).thenReturn(policyClMgt);
when(topics.createListener(eq(DroolsRuleTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class),
any(StandardCoder.class))).thenReturn(appcLcmRead);
- when(topics.createListener(eq(DroolsRuleTest.APPC_CL_TOPIC), eq(Request.class),
- any(StandardCoderInstantAsMillis.class))).thenReturn(appcClSink);
- when(topics.createListener(eq(DroolsRuleTest.SDNR_CL_TOPIC), eq(PciMessage.class),
- any(StandardCoder.class))).thenReturn(sdnrClSink);
Function<String, Rules> ruleMaker = this::makeRules;
Supplier<HttpClients> httpClientMaker = this::makeHttpClients;
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/HttpClientsTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/HttpClientsTest.java
index 5db835343..dac10df34 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/HttpClientsTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/HttpClientsTest.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.
@@ -29,15 +29,16 @@ import java.util.Properties;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactory;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.controlloop.common.rules.test.HttpClients;
import org.onap.policy.drools.persistence.SystemPersistenceConstants;
+@RunWith(MockitoJUnitRunner.class)
public class HttpClientsTest {
private static final String CLIENT_NAME = "MY-CLIENT";
@@ -57,8 +58,6 @@ public class HttpClientsTest {
@Test
public void test() throws HttpClientConfigException {
- MockitoAnnotations.initMocks(this);
-
HttpClientFactoryInstance.getClientFactory().destroy();
HttpClients clients = new HttpClients();
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/ListenerTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/ListenerTest.java
index 07ccc405b..7a7add5a7 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/ListenerTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/ListenerTest.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.
@@ -37,16 +37,16 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicEndpoint;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicSink;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
-import org.onap.policy.controlloop.common.rules.test.Listener;
-import org.onap.policy.controlloop.common.rules.test.TopicException;
+@RunWith(MockitoJUnitRunner.class)
public class ListenerTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String MY_TOPIC = "my-topic";
@@ -87,8 +87,6 @@ public class ListenerTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
when(mgr.getNoopTopicSink(MY_TOPIC)).thenReturn(sink);
listener = new Listener<>(MY_TOPIC, msg -> msg + MSG_SUFFIX) {
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.java
index 11f7d4103..a4767dfd9 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/RulesTest.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.
@@ -46,6 +46,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.kie.api.definition.rule.Rule;
import org.kie.api.event.rule.AfterMatchFiredEvent;
import org.kie.api.event.rule.AgendaEventListener;
@@ -59,7 +60,7 @@ import org.kie.api.event.rule.RuleRuntimeEventListener;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.Match;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.utils.test.log.logback.ExtractAppender;
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.drl.legacy.ControlLoopParams;
@@ -72,6 +73,7 @@ import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.slf4j.LoggerFactory;
+@RunWith(MockitoJUnitRunner.class)
public class RulesTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String CONTROLLER_NAME = "rulesTest";
@@ -135,8 +137,6 @@ public class RulesTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
facts = new LinkedList<>();
ruleListeners = new LinkedList<>();
agendaListeners = new LinkedList<>();
@@ -193,11 +193,6 @@ public class RulesTest {
return null;
}).when(kieSession).addEventListener(any(AgendaEventListener.class));
- doAnswer(args -> {
- agendaListeners.remove(args.getArgument(0));
- return null;
- }).when(kieSession).removeEventListener(any(AgendaEventListener.class));
-
rules = new MyRules();
rules.configure(RESOURCE_DIR);
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/SimulatorsTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/SimulatorsTest.java
index 8a87c4f26..3a98c0078 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/SimulatorsTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/SimulatorsTest.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,13 +30,13 @@ import static org.mockito.Mockito.verify;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
-import org.onap.policy.controlloop.common.rules.test.SimulatorException;
-import org.onap.policy.controlloop.common.rules.test.Simulators;
import org.onap.policy.controlloop.common.rules.test.Simulators.SimulatorBuilder;
+@RunWith(MockitoJUnitRunner.class)
public class SimulatorsTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
@@ -54,8 +54,6 @@ public class SimulatorsTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
simulators = new Simulators();
}
diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/TopicsTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/TopicsTest.java
index 6ed8c3828..409c3d472 100644
--- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/TopicsTest.java
+++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/TopicsTest.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.
@@ -37,8 +37,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicEndpoint;
import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
@@ -52,6 +53,7 @@ import org.onap.policy.drools.protocol.coders.EventProtocolCoder;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
+@RunWith(MockitoJUnitRunner.class)
public class TopicsTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
private static final String MY_SOURCE_TOPIC = "my-source-topic";
@@ -104,8 +106,6 @@ public class TopicsTest {
*/
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
-
policy = new ToscaPolicy();
policy.setName(POLICY_NAME);
policy.setVersion("1.0.0");