summaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2022-04-11 11:18:04 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2022-04-12 11:11:07 +0100
commit9dbc162db1f26e9b37641c73fff8fba0d4f23c81 (patch)
tree616324d4a87545189937524db6ba475a16f1a363 /main/src/test/java/org
parent055c1546c92e797dc54cdb9e41a1d032abdf49b4 (diff)
Fix incorrect deployments counter on parallel execution
Change-Id: I72bde10eae615e2c89ccc1a211c6385404b9b3c7 Issue-ID: POLICY-4088 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/comm/CommonRequestBase.java8
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java2
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java5
3 files changed, 13 insertions, 2 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/CommonRequestBase.java b/main/src/test/java/org/onap/policy/pap/main/comm/CommonRequestBase.java
index dd206062..4086b6a1 100644
--- a/main/src/test/java/org/onap/policy/pap/main/comm/CommonRequestBase.java
+++ b/main/src/test/java/org/onap/policy/pap/main/comm/CommonRequestBase.java
@@ -28,17 +28,20 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Queue;
import java.util.function.Consumer;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.mockito.ArgumentCaptor;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.RequestIdDispatcher;
import org.onap.policy.common.endpoints.listeners.TypedMessageListener;
+import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.pdp.concepts.PdpMessage;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpStatus;
@@ -86,6 +89,11 @@ public class CommonRequestBase {
protected RequestParams reqParams;
protected PdpModifyRequestMapParams mapParams;
+ @BeforeClass
+ public static void setupBeforeAll() {
+ Registry.registerOrReplace(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry());
+ }
+
/**
* Sets up.
*
diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java
index cc1f74b4..306ec8cd 100644
--- a/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/notification/DeploymentStatusTest.java
@@ -90,7 +90,7 @@ public class DeploymentStatusTest {
*/
@BeforeClass
public static void setUpBeforeClass() {
- Registry.register(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry());
+ Registry.registerOrReplace(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry());
}
/**
diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
index 5fec269a..48e3f57e 100644
--- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import java.util.Collections;
import java.util.Set;
import javax.ws.rs.core.Response.Status;
@@ -41,11 +42,13 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pap.concepts.PolicyNotification;
import org.onap.policy.models.pap.concepts.PolicyStatus;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.pap.main.PapConstants;
import org.onap.policy.pap.main.PolicyPapRuntimeException;
import org.onap.policy.pap.main.comm.Publisher;
import org.onap.policy.pap.main.comm.QueueToken;
@@ -91,7 +94,7 @@ public class PolicyNotifierTest {
public void setUp() {
try {
when(policyStatusService.getGroupPolicyStatus(anyString())).thenReturn(Collections.emptyList());
-
+ Registry.registerOrReplace(PapConstants.REG_METER_REGISTRY, new SimpleMeterRegistry());
notifier = new MyNotifier(publisher);
} catch (PfModelException e) {