summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.test
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors/actor.test')
-rw-r--r--models-interactions/model-actors/actor.test/pom.xml14
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java7
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java4
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java2
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicActorTest.java7
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java62
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java34
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java36
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyActor.java7
-rw-r--r--models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyOperator.java3
10 files changed, 91 insertions, 85 deletions
diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml
index 4cc73b18f..ff1030ce5 100644
--- a/models-interactions/model-actors/actor.test/pom.xml
+++ b/models-interactions/model-actors/actor.test/pom.xml
@@ -55,11 +55,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.onap.policy.models.policy-models-interactions</groupId>
<artifactId>simulators</artifactId>
<version>${project.version}</version>
@@ -74,6 +69,15 @@
<artifactId>mockito-core</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-junit-jupiter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java
index 8d7291051..cce4da420 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,9 +21,9 @@
package org.onap.policy.controlloop.actor.test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.FileNotFoundException;
import java.util.Map;
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
index 22332ae86..3f339d011 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java
@@ -21,8 +21,8 @@
package org.onap.policy.controlloop.actor.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.Mockito.lenient;
import java.util.List;
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
index b037189b0..48ee9dcfc 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
@@ -21,7 +21,7 @@
package org.onap.policy.controlloop.actor.test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import jakarta.ws.rs.core.Response;
import java.util.Map;
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicActorTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicActorTest.java
index 65ab0bbb3..1cd3827ab 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicActorTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicActorTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,12 +25,12 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import java.io.FileNotFoundException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class BasicActorTest extends BasicActor {
+class BasicActorTest extends BasicActor {
@Test
- public void testVerifyActorService_testStartOtherServices_testStopOtherServices() {
+ void testVerifyActorService_testStartOtherServices_testStopOtherServices() {
// mostly empty service
verifyActorService(DummyActor.NAME, "service.yaml");
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
index ebfc267cc..c795f9cc5 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java
@@ -22,70 +22,72 @@
package org.onap.policy.controlloop.actor.test;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import java.util.function.BiConsumer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.simulators.TopicServer;
-@RunWith(MockitoJUnitRunner.class)
-public class BasicBidirectionalTopicOperationTest {
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+@ExtendWith(MockitoExtension.class)
+class BasicBidirectionalTopicOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
@Mock
private BiConsumer<String, StandardCoderObject> listener;
- private BasicBidirectionalTopicOperation<String> oper;
+ private BasicBidirectionalTopicOperation<String> oper = new MyOperation(ACTOR, OPERATION);
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
+ @BeforeAll
+ void setUpBeforeClass() throws Exception {
BasicBidirectionalTopicOperation.initBeforeClass(BasicBidirectionalTopicOperation.MY_SINK,
BasicBidirectionalTopicOperation.MY_SOURCE);
}
- @AfterClass
- public static void tearDownAfterClass() {
+ @AfterAll
+ static void tearDownAfterClass() {
BasicBidirectionalTopicOperation.destroyAfterClass();
}
/**
* Sets up.
*/
- @Before
- public void setUp() throws Exception {
- oper = new MyOperation(ACTOR, OPERATION);
+ @BeforeEach
+ void setUp() throws Exception {
oper.setUpBasic();
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
oper.tearDownBasic();
}
@Test
- public void testTopicMgr() {
+ void testTopicMgr() {
assertNotNull(BasicBidirectionalTopicOperation.topicMgr.getTopicHandler(
BasicBidirectionalTopicOperation.MY_SINK, BasicBidirectionalTopicOperation.MY_SOURCE));
}
@Test
- public void testBasicBidirectionalTopicOperation() {
+ void testBasicBidirectionalTopicOperation() {
oper.tearDownBasic();
oper = new MyOperation();
@@ -96,20 +98,14 @@ public class BasicBidirectionalTopicOperationTest {
}
@Test
- public void testBasicBidirectionalTopicOperationStringString() {
- assertEquals(ACTOR, oper.actorName);
- assertEquals(OPERATION, oper.operationName);
- }
-
- @Test
- public void testSetUp() {
+ void testSetUp() {
assertNotNull(oper.config);
assertNotNull(oper.outcome);
assertNotNull(oper.executor);
}
@Test
- public void testInitOperator() {
+ void testInitOperator() {
oper.initConfig();
assertSame(oper.topicHandler, oper.config.getTopicHandler());
@@ -118,7 +114,7 @@ public class BasicBidirectionalTopicOperationTest {
}
@Test
- public void testProvideResponse() {
+ void testProvideResponse() {
String response = "{\"input\": 10}";
oper.provideResponse(listener, response);
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
index 2f16c4226..58392b96e 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,48 +21,48 @@
package org.onap.policy.controlloop.actor.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import jakarta.ws.rs.client.InvocationCallback;
import jakarta.ws.rs.core.Response;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
-@RunWith(MockitoJUnitRunner.class)
-public class BasicHttpOperationTest {
+@ExtendWith(MockitoExtension.class)
+class BasicHttpOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
private BasicHttpOperation oper;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
- public void testBasicHttpOperation() {
+ void testBasicHttpOperation() {
oper = new BasicHttpOperation();
assertEquals(BasicOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicOperation.DEFAULT_OPERATION, oper.operationName);
}
@Test
- public void testBasicHttpOperationStringString() {
+ void testBasicHttpOperationStringString() {
assertEquals(ACTOR, oper.actorName);
assertEquals(OPERATION, oper.operationName);
}
@Test
- public void testSetUp() throws Exception {
+ void testSetUp() throws Exception {
assertNotNull(oper.client);
assertSame(oper.client, oper.factory.get(BasicHttpOperation.MY_CLIENT));
assertEquals(200, oper.rawResponse.getStatus());
@@ -73,7 +73,7 @@ public class BasicHttpOperationTest {
}
@Test
- public void testInitOperator() throws Exception {
+ void testInitOperator() throws Exception {
oper.initConfig();
assertSame(oper.client, oper.config.getClient());
@@ -81,7 +81,7 @@ public class BasicHttpOperationTest {
}
@Test
- public void testProvideResponse() throws Exception {
+ void testProvideResponse() throws Exception {
InvocationCallback<Response> cb = new InvocationCallback<>() {
@Override
public void completed(Response response) {
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
index 34d0d122d..9ce1b214e 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,56 +21,58 @@
package org.onap.policy.controlloop.actor.test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.controlloop.actorserviceprovider.Util;
-@RunWith(MockitoJUnitRunner.class)
-public class BasicOperationTest {
+@ExtendWith(MockitoExtension.class)
+ class BasicOperationTest {
private static final String ACTOR = "my-actor";
private static final String OPERATION = "my-operation";
private BasicOperation oper;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
oper = new BasicHttpOperation(ACTOR, OPERATION);
oper.setUpBasic();
}
@Test
- public void testBasicHttpOperation() {
+ void testBasicHttpOperation() {
oper = new BasicHttpOperation();
assertEquals(BasicHttpOperation.DEFAULT_ACTOR, oper.actorName);
assertEquals(BasicHttpOperation.DEFAULT_OPERATION, oper.operationName);
}
@Test
- public void testBasicHttpOperationStringString() {
+ void testBasicHttpOperationStringString() {
assertEquals(ACTOR, oper.actorName);
assertEquals(OPERATION, oper.operationName);
}
@Test
- public void testSetUp() throws Exception {
+ void testSetUp() throws Exception {
assertNotNull(oper.future);
assertNotNull(oper.outcome);
assertNotNull(oper.executor);
}
@Test
- public void testMakeContext() {
+ void testMakeContext() {
oper.makeContext();
assertSame(oper.service, oper.params.getActorService());
@@ -81,12 +83,12 @@ public class BasicOperationTest {
}
@Test
- public void testMakePayload() {
+ void testMakePayload() {
assertNull(oper.makePayload());
}
@Test
- public void testVerifyRequest() throws CoderException {
+ void testVerifyRequest() throws CoderException {
Map<String, Object> map = Util.translateToMap("", ResourceUtils.getResourceAsString("actual.json"));
oper.verifyRequest("expected.json", map, "svc-request-id", "vnf-id");
}
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyActor.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyActor.java
index c862a18b7..1590ac314 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyActor.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyActor.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,9 +24,9 @@ package org.onap.policy.controlloop.actor.test;
import org.onap.policy.controlloop.actorserviceprovider.impl.ActorImpl;
public class DummyActor extends ActorImpl {
- public static final String NAME = "MyActor";
- public static final String MY_OPERATION1 = "MyOperationA";
- public static final String MY_OPERATION2 = "MyOperationB";
+ static final String NAME = "MyActor";
+ static final String MY_OPERATION1 = "MyOperationA";
+ static final String MY_OPERATION2 = "MyOperationB";
/**
* Constructs the object.
diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyOperator.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyOperator.java
index efd3b6500..6cb43627c 100644
--- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyOperator.java
+++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/DummyOperator.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +25,7 @@ import org.onap.policy.controlloop.actorserviceprovider.Operation;
import org.onap.policy.controlloop.actorserviceprovider.impl.OperatorPartial;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-public class DummyOperator extends OperatorPartial {
+class DummyOperator extends OperatorPartial {
public DummyOperator(String actorName, String name) {
super(actorName, name);