From 5d4f44ab8e63d736817a7ae6795bb558a425660b Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 8 Jun 2020 10:49:39 -0400 Subject: Flesh out junits for SDNR and VFC actors Issue-ID: POLICY-2619 Change-Id: Ic0096a25dbcb40dc00f4b97cfafa57d162c7bdfd Signed-off-by: Jim Hahn --- .../actor/vfc/VfcActorServiceProviderTest.java | 23 ++++++++++++++- .../actor.vfc/src/test/resources/service.yaml | 34 ++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 models-interactions/model-actors/actor.vfc/src/test/resources/service.yaml (limited to 'models-interactions/model-actors/actor.vfc') 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"; @@ -62,6 +65,24 @@ public class VfcActorServiceProviderTest { HttpServletServerFactoryInstance.getServerFactory().destroy(); } + @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 -- cgit 1.2.3-korg