summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.vfc/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-07-13 16:06:57 -0400
committerJim Hahn <jrh3@att.com>2020-07-13 16:07:54 -0400
commitc88676ec64c4c870252502bc1cfaa8990c8fd964 (patch)
treed88ec0ac29d5c3066fab025392df4a69256cf288 /models-interactions/model-actors/actor.vfc/src/test
parente4e7d15db6d2f79658e3a5f9e8326ea092afcfab (diff)
Remove legacy actor code from models
Deleted legacy actor code. That includes deleting most of the XxxManager classes. Issue-ID: POLICY-2559 Change-Id: I1ef1b900ca1d23e88da64b2c95a18986feb1b765 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.vfc/src/test')
-rw-r--r--models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorTest.java98
1 files changed, 0 insertions, 98 deletions
diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorTest.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorTest.java
index bd4bb0980..08ce8e194 100644
--- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorTest.java
+++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/VfcActorTest.java
@@ -23,48 +23,14 @@
package org.onap.policy.controlloop.actor.vfc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-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;
import org.junit.Test;
-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 VfcActorTest extends BasicActor {
- private static final String DOROTHY_GALE_1939 = "dorothy.gale.1939";
- private static final String CQ_RESPONSE_JSON = "aai/AaiCqResponse.json";
- private static final String RESTART = "Restart";
-
- /**
- * Set up before test class.
- * @throws Exception if the A&AI simulator cannot be started
- */
- @BeforeClass
- public static void setUpSimulator() throws Exception {
- Util.buildAaiSim();
- }
-
- @AfterClass
- public static void tearDownSimulator() {
- HttpServletServerFactoryInstance.getServerFactory().destroy();
- }
-
@Test
public void testConstructor() {
VfcActor prov = new VfcActor();
@@ -82,68 +48,4 @@ public class VfcActorTest extends BasicActor {
// verify that it all plugs into the ActorService
verifyActorService(VfcActor.NAME, "service.yaml");
}
-
- @Test
- public void testMethods() {
- VfcActor sp = new VfcActor();
-
- assertEquals("VFC", sp.actor());
- assertEquals(1, sp.recipes().size());
- assertEquals(RESTART, sp.recipes().get(0));
- assertEquals("VM", sp.recipeTargets(RESTART).get(0));
- assertEquals(0, sp.recipePayloads(RESTART).size());
- }
-
- @Test
- public void testConstructRequestCq() throws IOException {
- VirtualControlLoopEvent onset = new VirtualControlLoopEvent();
- ControlLoopOperation operation = new ControlLoopOperation();
-
- Policy policy = new Policy();
- policy.setRecipe("GoToOz");
-
- assertNull(VfcActor.constructRequestCq(onset, operation, policy, null));
-
- onset.getAai().put("generic-vnf.vnf-id", DOROTHY_GALE_1939);
- assertNull(VfcActor.constructRequestCq(onset, operation, policy, null));
-
-
- UUID requestId = UUID.randomUUID();
- onset.setRequestId(requestId);
- assertNull(VfcActor.constructRequestCq(onset, operation, policy, null));
-
- onset.getAai().put("generic-vnf.vnf-name", "Dorothy");
- assertNull(VfcActor.constructRequestCq(onset, operation, policy, null));
-
-
- onset.getAai().put("service-instance.service-instance-id", "");
- assertNull(VfcActor.constructRequestCq(onset, operation, policy, null));
-
- assertNull(VfcActor.constructRequestCq(onset, operation, policy,
- loadAaiResponse(CQ_RESPONSE_JSON)));
-
- policy.setRecipe(RESTART);
- assertNotNull(VfcActor.constructRequestCq(onset, operation, policy,
- loadAaiResponse(CQ_RESPONSE_JSON)));
-
- VfcRequest request = VfcActor.constructRequestCq(onset, operation, policy,
- loadAaiResponse(CQ_RESPONSE_JSON));
-
- assertEquals(requestId, Objects.requireNonNull(request).getRequestId());
- assertEquals(DOROTHY_GALE_1939, request.getHealRequest().getVnfInstanceId());
- assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction());
- }
-
- /**
- * Reads an AAI vserver named-query response from a file.
- *
- * @param fileName name of the file containing the JSON response
- * @return output from the AAI vserver named-query
- * @throws IOException if the file cannot be read
- */
- private AaiCqResponse loadAaiResponse(String fileName) throws IOException {
- String resp = IOUtils.toString(getClass().getResource(fileName), StandardCharsets.UTF_8);
- return new AaiCqResponse(resp);
- }
-
}