summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-event')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml3
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java25
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java20
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java8
6 files changed, 13 insertions, 49 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
index 6dd33237d..14b743884 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml
@@ -2,6 +2,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 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.
@@ -50,7 +51,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
index 13ecaba6a..31be69e3a 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/src/test/java/org/onap/policy/apex/plugins/event/carrier/grpc/ApexGrpcProducerTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 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 +31,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.cds.client.CdsProcessorGrpcClient;
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
index f11bd4158..694c32fb0 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml
@@ -3,6 +3,7 @@
Copyright (C) 2018 Ericsson. All rights reserved.
Modifications Copyright (C) 2019-2020 Nordix Foundation.
Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ Modifications Copyright (C) 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.
@@ -52,7 +53,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
index 20d6feb5b..545499b40 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConusmerTest.java
@@ -40,8 +40,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
@@ -73,8 +72,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerErrors() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -105,11 +102,8 @@ public class ApexRestClientConusmerTest {
assertEquals(null, arcc.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS));
rcctp.setUrl("http://some.place.that.does.not/exist");
- Mockito.doReturn(Response.Status.BAD_REQUEST.getStatusCode()).when(responseMock).getStatus();
- Mockito.doReturn(responseMock).when(builderMock).get();
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
// We have not set the URL, this test should not receive any events
@@ -118,8 +112,6 @@ public class ApexRestClientConusmerTest {
arcc.stop();
assertEquals(0, incomingEventReceiver.getEventCount());
- Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
-
// We have not set the URL, this test should not receive any events
arcc.start();
await().atMost(200, TimeUnit.MILLISECONDS).until(() -> incomingEventReceiver.getEventCount() == 0);
@@ -129,8 +121,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerHttpError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -156,7 +146,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -171,8 +160,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -196,7 +183,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -212,8 +198,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonEmpty() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -239,7 +223,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@@ -260,8 +243,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerJsonOk() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -287,7 +268,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
// We have not set the URL, this test should not receive any events
@@ -299,8 +279,6 @@ public class ApexRestClientConusmerTest {
@Test
public void testApexRestClientConsumerInvalidStatusCode() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientConsumer arcc = new ApexRestClientConsumer();
assertNotNull(arcc);
@@ -326,7 +304,6 @@ public class ApexRestClientConusmerTest {
Mockito.doReturn(builderMock).when(targetMock).request("application/json");
Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getHttpCodeFilter());
arcc.setClient(httpClientMock);
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
index ac35081f2..85a6214fb 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java
@@ -35,8 +35,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
import org.onap.policy.apex.service.engine.event.ApexEventException;
import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
@@ -107,8 +106,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPutEvent() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -135,8 +132,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventFail() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -150,11 +145,6 @@ public class ApexRestClientProducerTest {
assertEquals("RestClientConsumer", arcp.getName());
rcctp.setUrl("http://some.place.that.does.not/exist");
- Mockito.doReturn(Response.Status.OK.getStatusCode()).when(responseMock).getStatus();
- Mockito.doReturn(responseMock).when(builderMock).post(Mockito.any());
- Mockito.doReturn(builderMock).when(targetMock).request("application/json");
- Mockito.doReturn(builderMock).when(builderMock).headers(Mockito.any());
- Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl());
arcp.setClient(httpClientMock);
// test property not found
@@ -171,8 +161,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventOK() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -203,8 +191,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventCache() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -237,8 +223,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerPostEventCacheTrace() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
@@ -271,8 +255,6 @@ public class ApexRestClientProducerTest {
@Test
public void testApexRestClientProducerHttpError() throws ApexEventException {
- MockitoAnnotations.initMocks(this);
-
ApexRestClientProducer arcp = new ApexRestClientProducer();
assertNotNull(arcp);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
index 3efe054ad..08803db41 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/test/java/org/onap/policy/apex/plugins/event/carrier/restserver/AccessControlFilterTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 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,11 +31,13 @@ import javax.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnitRunner;
+@RunWith(MockitoJUnitRunner.class)
public class AccessControlFilterTest {
private AccessControlFilter acf;
@@ -46,7 +49,6 @@ public class AccessControlFilterTest {
@Before
public void beforeEach() {
- MockitoAnnotations.initMocks(this);
acf = new AccessControlFilter();
}
@@ -73,4 +75,4 @@ public class AccessControlFilterTest {
assertEquals(expected, actual);
}
-} \ No newline at end of file
+}