aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java23
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/resources/service.yaml34
4 files changed, 116 insertions, 2 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: {}
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java
index db224b065..9e05f22e1 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProviderTest.java
@@ -28,8 +28,10 @@ import static org.junit.Assert.assertNull;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import java.util.Objects;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -38,11 +40,12 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.actor.test.BasicActor;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.simulators.Util;
import org.onap.policy.vfc.VfcRequest;
-public class VfcActorServiceProviderTest {
+public class VfcActorServiceProviderTest extends BasicActor {
private static final String DOROTHY_GALE_1939 = "dorothy.gale.1939";
private static final String CQ_RESPONSE_JSON = "aai/AaiCqResponse.json";
@@ -63,6 +66,24 @@ public class VfcActorServiceProviderTest {
}
@Test
+ public void testConstructor() {
+ VfcActorServiceProvider prov = new VfcActorServiceProvider();
+ assertEquals(0, prov.getSequenceNumber());
+
+ // verify that it has the operators we expect
+ var expected = Arrays.asList(Restart.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(VfcActorServiceProvider.NAME, "service.yaml");
+ }
+
+ @Test
public void testMethods() {
VfcActorServiceProvider sp = new VfcActorServiceProvider();
diff --git a/models-interactions/model-actors/actor.vfc/src/test/resources/service.yaml b/models-interactions/model-actors/actor.vfc/src/test/resources/service.yaml
new file mode 100644
index 000000000..26192e013
--- /dev/null
+++ b/models-interactions/model-actors/actor.vfc/src/test/resources/service.yaml
@@ -0,0 +1,34 @@
+#
+# ============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========================================================
+#
+httpClients:
+- clientName: my-client
+ hostname: localhost
+ port: 80
+ basePath: base-url/
+ managed: true
+actors:
+ VFC:
+ Restart:
+ clientName: my-client
+ pathGet: jobs
+ maxGets: 20
+ waitSecGet: 20
+ path: ns
+ timeoutSec: 60