summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-08 10:49:39 -0400
committerJim Hahn <jrh3@att.com>2020-06-09 13:06:47 +0000
commit5d4f44ab8e63d736817a7ae6795bb558a425660b (patch)
tree114945adb8b44d82707ba743283e5a0f23dd56f0 /models-interactions/model-actors/actor.sdnr/src
parent53bc2418c365246d457a09d2cded0d9bde9c212b (diff)
Flesh out junits for SDNR and VFC actors
Issue-ID: POLICY-2619 Change-Id: Ic0096a25dbcb40dc00f4b97cfafa57d162c7bdfd Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnr/src')
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java23
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/resources/service.yaml38
2 files changed, 60 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
index 12a1666a0..799872d08 100644
--- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java
@@ -26,14 +26,17 @@ import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.time.Instant;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.junit.Test;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.ControlLoopResponse;
import org.onap.policy.controlloop.ControlLoopTargetType;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.actor.test.BasicActor;
import org.onap.policy.controlloop.actorserviceprovider.Operator;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.Target;
@@ -45,7 +48,7 @@ import org.onap.policy.sdnr.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SdnrActorServiceProviderTest {
+public class SdnrActorServiceProviderTest extends BasicActor {
private static final String MODIFY_CONFIG = "ModifyConfig";
@@ -95,6 +98,24 @@ public class SdnrActorServiceProviderTest {
}
@Test
+ public void testConstructor() {
+ SdnrActorServiceProvider prov = new SdnrActorServiceProvider();
+ assertEquals(0, prov.getSequenceNumber());
+
+ // verify that it has the operators we expect
+ var expected = Arrays.asList(SdnrOperation.NAME).stream().sorted().collect(Collectors.toList());
+ var actual = prov.getOperationNames().stream().sorted().collect(Collectors.toList());
+
+ assertEquals(expected.toString(), actual.toString());
+ }
+
+ @Test
+ public void testActorService() {
+ // verify that it all plugs into the ActorService
+ verifyActorService(SdnrActorServiceProvider.NAME, "service.yaml");
+ }
+
+ @Test
public void testGetOperator() {
SdnrActorServiceProvider sp = new SdnrActorServiceProvider();
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/resources/service.yaml b/models-interactions/model-actors/actor.sdnr/src/test/resources/service.yaml
new file mode 100644
index 000000000..f18e99cdd
--- /dev/null
+++ b/models-interactions/model-actors/actor.sdnr/src/test/resources/service.yaml
@@ -0,0 +1,38 @@
+#
+# ============LICENSE_START======================================================
+# ONAP
+# ===============================================================================
+# Copyright (C) 2020 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END========================================================
+#
+topics:
+ topicSources:
+ - topicCommInfrastructure: NOOP
+ topic: my-source
+ servers:
+ - localhost
+ managed: true
+ topicSinks:
+ - topicCommInfrastructure: NOOP
+ topic: my-sink
+ servers:
+ - localhost
+ managed: true
+actors:
+ SDNR:
+ sinkTopic: my-sink
+ sourceTopic: my-source
+ operations:
+ any: {}