summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-02-12 08:30:59 -0500
committerJim Hahn <jrh3@att.com>2021-02-12 08:32:48 -0500
commitbb7c33c3d181f1dbeb83bda815f41256a54b5a32 (patch)
tree3250df915c5ef788daa2ae74e6bb69511a80b977 /controlloop/common/controller-usecases
parent7c1511b24bdb9bea6ec3ca4933f77011df3bbd4e (diff)
Fix sonars from dependency upgrade
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner. Issue-ID: POLICY-2910 Change-Id: I257b74626f4393aa89d2bf1b7502478422213b71 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/controller-usecases')
-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
10 files changed, 39 insertions, 59 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());