summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors')
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java9
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java62
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java42
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java11
-rw-r--r--models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java6
5 files changed, 60 insertions, 70 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 249e1fc25..0dfea32d6 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertTrue;
import java.time.Instant;
import java.util.HashMap;
import java.util.UUID;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -72,8 +73,7 @@ public class AppcServiceProviderTest {
static {
/*
- * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of
- * VM.
+ * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of VM.
*/
onsetEvent = new VirtualControlLoopEvent();
onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
@@ -111,6 +111,7 @@ public class AppcServiceProviderTest {
/**
* Set up before test class.
+ *
* @throws Exception if the A&AI simulator cannot be started
*/
@BeforeClass
@@ -127,7 +128,7 @@ public class AppcServiceProviderTest {
}
@Test
- public void constructModifyConfigRequestTest() {
+ public void testConstructModifyConfigRequest() {
policy.setPayload(new HashMap<>());
policy.getPayload().put(KEY1, VALUE1);
policy.getPayload().put(KEY2, VALUE2);
@@ -180,7 +181,7 @@ public class AppcServiceProviderTest {
}
@Test
- public void constructModifyConfigRequestTest_NullPayload() {
+ public void testConstructModifyConfigRequest_NullPayload() {
Request appcRequest;
appcRequest = AppcActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01");
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
index 88fb6e97f..ef69bc1bc 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
@@ -29,6 +29,7 @@ import java.time.Instant;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.UUID;
+
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -50,7 +51,6 @@ import org.onap.policy.simulators.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
public class AppcLcmActorServiceProviderTest {
private static final String VNF01 = "vnf01";
@@ -76,8 +76,7 @@ public class AppcLcmActorServiceProviderTest {
static {
/*
- * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of
- * VM.
+ * Construct an onset with an AAI subtag containing generic-vnf.vnf-id and a target type of VM.
*/
onsetEvent = new VirtualControlLoopEvent();
onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
@@ -159,6 +158,7 @@ public class AppcLcmActorServiceProviderTest {
/**
* Set up before test class.
+ *
* @throws Exception if an error occurs
*/
@BeforeClass
@@ -222,8 +222,7 @@ public class AppcLcmActorServiceProviderTest {
}
/**
- * A test to assert that a null pointer exception is thrown if
- * the APPC response body is null.
+ * A test to assert that a null pointer exception is thrown if the APPC response body is null.
*/
@Test(expected = NullPointerException.class)
public void processNullBodyResponseTest() {
@@ -231,8 +230,7 @@ public class AppcLcmActorServiceProviderTest {
}
/**
- * A test to assert that a null pointer exception is thrown if
- * the APPC response output is null.
+ * A test to assert that a null pointer exception is thrown if the APPC response output is null.
*/
@Test(expected = NullPointerException.class)
public void processNullOutputResponseTest() {
@@ -345,19 +343,19 @@ public class AppcLcmActorServiceProviderTest {
}
@Test
- public void payloadNotPassedWhenNotSupportedByRecipe() {
- //given
+ public void testPayloadNotPassedWhenNotSupportedByRecipe() {
+ // given
Policy migratePolicy = constructPolicyWithRecipe(RECIPE_MIGRATE);
Policy rebuildPolicy = constructPolicyWithRecipe(RECIPE_REBUILD);
Policy restartPolicy = constructPolicyWithRecipe(RECIPE_RESTART);
// when
AppcLcmDmaapWrapper migrateRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, migratePolicy, VNF01);
AppcLcmDmaapWrapper rebuildRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, rebuildPolicy, VNF01);
AppcLcmDmaapWrapper restartRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, restartPolicy, VNF01);
// then
assertNull(migrateRequest.getBody().getInput().getPayload());
@@ -366,17 +364,16 @@ public class AppcLcmActorServiceProviderTest {
}
@Test
- public void payloadNotPassedWhenNotSuppliedOrEmpty() {
- //given
+ public void testPayloadNotPassedWhenNotSuppliedOrEmpty() {
+ // given
Policy noPayloadPolicy = constructHealthCheckPolicyWithPayload(null);
Policy emptyPayloadPolicy = constructHealthCheckPolicyWithPayload(new HashMap<>());
// when
AppcLcmDmaapWrapper noPayloadRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, noPayloadPolicy, VNF01);
AppcLcmDmaapWrapper emptyPayloadRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, VNF01);
-
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, emptyPayloadPolicy, VNF01);
// then
assertNull(noPayloadRequest.getBody().getInput().getPayload());
@@ -384,7 +381,7 @@ public class AppcLcmActorServiceProviderTest {
}
@Test
- public void payloadParsedProperlyForSinglePayloadParameter() {
+ public void testPayloadParsedProperlyForSinglePayloadParameter() {
// given
HashMap<String, String> payload = new HashMap<>();
payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}");
@@ -392,37 +389,34 @@ public class AppcLcmActorServiceProviderTest {
// when
AppcLcmDmaapWrapper dmaapRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01);
// then
- assertEquals(dmaapRequest.getBody().getInput().getPayload(),
- "{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}");
+ assertEquals("{\"requestParameters\": {\"host-ip-address\":\"10.183.37.25\"}}",
+ dmaapRequest.getBody().getInput().getPayload());
}
-
@Test
- public void payloadParsedProperlyForMultiplePayloadParameters() {
+ public void testPayloadParsedProperlyForMultiplePayloadParameters() {
// given
HashMap<String, String> payload = new HashMap<>();
payload.put("requestParameters", "{\"host-ip-address\":\"10.183.37.25\"}");
- payload.put("configurationParameters", "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
- + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
- + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]");
+ payload.put("configurationParameters",
+ "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
+ + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
+ + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]");
Policy otherPolicy = constructHealthCheckPolicyWithPayload(payload);
// when
AppcLcmDmaapWrapper dmaapRequest =
- AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01);
+ AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, otherPolicy, VNF01);
// then
assertEquals(dmaapRequest.getBody().getInput().getPayload(),
- "{\"requestParameters\": "
- + "{\"host-ip-address\":\"10.183.37.25\"},"
- + "\"configurationParameters\": "
- + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
- + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
- + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"
- + "}");
+ "{\"requestParameters\": " + "{\"host-ip-address\":\"10.183.37.25\"}," + "\"configurationParameters\": "
+ + "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\","
+ + "\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\","
+ + "\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" + "}");
}
private Policy constructHealthCheckPolicyWithPayload(HashMap<String, String> payload) {
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
index 8e9a4c30c..110dfabd9 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatterTest.java
@@ -25,75 +25,73 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
-
-
public class AppcLcmRecipeFormatterTest {
@Test
- public void shouldCorrectlyFormatRestartRequestWhenRestartGiven() {
- //given
+ public void testShouldCorrectlyFormatRestartRequestWhenRestartGiven() {
+ // given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Restart");
String expectedUrlRecipe = "restart";
String expectedBodyRecipe = "Restart";
- //when
+ // when
String actualUrlRecipe = recipeFormatter.getUrlRecipe();
String actualBodyRecipe = recipeFormatter.getBodyRecipe();
- //then
+ // then
assertEquals(expectedUrlRecipe, actualUrlRecipe);
assertEquals(expectedBodyRecipe, actualBodyRecipe);
}
@Test
- public void shouldReturnCapitalizedBodySingleWordRecipe() {
- //given
+ public void testShouldReturnCapitalizedBodySingleWordRecipe() {
+ // given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("moDify");
String expectedRecipe = "Modify";
- //when
+ // when
String actualRecipe = recipeFormatter.getBodyRecipe();
- //then
+ // then
assertEquals(expectedRecipe, actualRecipe);
}
@Test
- public void shouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
- //given
+ public void testShouldReturnCapitalizeAndJoinedBodyMultiWordRecipe() {
+ // given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("coNfig-moDify");
String expectedRecipe = "ConfigModify";
- //when
+ // when
String actualRecipe = recipeFormatter.getBodyRecipe();
- //then
+ // then
assertEquals(expectedRecipe, actualRecipe);
}
@Test
- public void shouldReturnLowercasedUrlSingleWordRecipe() {
- //given
+ public void testShouldReturnLowercasedUrlSingleWordRecipe() {
+ // given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("ModIfy");
String expectedRecipe = "modify";
- //when
+ // when
String actualRecipe = recipeFormatter.getUrlRecipe();
- //then
+ // then
assertEquals(expectedRecipe, actualRecipe);
}
@Test
- public void shouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
- //given
+ public void testShouldReturnLowercasedDashJoinedUrlMultiWordRecipe() {
+ // given
AppcLcmRecipeFormatter recipeFormatter = new AppcLcmRecipeFormatter("Config-MoDify");
String expectedRecipe = "config-modify";
- //when
+ // when
String actualRecipe = recipeFormatter.getUrlRecipe();
- //then
+ // then
assertEquals(expectedRecipe, actualRecipe);
}
} \ No newline at end of file
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 a9178961a..8101b12fd 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
@@ -56,8 +56,7 @@ public class SdnrActorServiceProviderTest {
static {
/*
- * Construct an onset. Using dummy AAI details since the code mandates AAI
- * details.
+ * Construct an onset. Using dummy AAI details since the code mandates AAI details.
*/
onsetEvent = new VirtualControlLoopEvent();
onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
@@ -95,7 +94,7 @@ public class SdnrActorServiceProviderTest {
}
@Test
- public void getControlLoopResponseTest() {
+ public void testGetControlLoopResponse() {
PciRequest sdnrRequest;
sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody();
PciResponse sdnrResponse = new PciResponse(sdnrRequest);
@@ -114,13 +113,13 @@ public class SdnrActorServiceProviderTest {
assertEquals(clRsp.getPolicyName(), onsetEvent.getPolicyName());
assertEquals(clRsp.getPolicyVersion(), onsetEvent.getPolicyVersion());
assertEquals(clRsp.getVersion(), onsetEvent.getVersion());
- assertEquals(clRsp.getFrom(), "SDNR");
- assertEquals(clRsp.getTarget(), "DCAE");
+ assertEquals("SDNR", clRsp.getFrom());
+ assertEquals("DCAE", clRsp.getTarget());
assertEquals(clRsp.getPayload(), sdnrResponse.getPayload());
}
@Test
- public void constructModifyConfigRequestTest() {
+ public void testConstructModifyConfigRequest() {
PciRequest sdnrRequest;
sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody();
diff --git a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java
index 482c25730..1ca379f71 100644
--- a/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.vfc/src/main/java/org/onap/policy/controlloop/actor/vfc/VfcActorServiceProvider.java
@@ -22,8 +22,10 @@ package org.onap.policy.controlloop.actor.vfc;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+
import java.util.Collections;
import java.util.List;
+
import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
@@ -33,14 +35,10 @@ import org.onap.policy.vfc.VfcHealActionVmInfo;
import org.onap.policy.vfc.VfcHealAdditionalParams;
import org.onap.policy.vfc.VfcHealRequest;
import org.onap.policy.vfc.VfcRequest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class VfcActorServiceProvider implements Actor {
private static final String GENERIC_VNF_ID = "generic-vnf.vnf-id";
- private static final Logger logger = LoggerFactory.getLogger(VfcActorServiceProvider.class);
-
// Strings for VFC Actor
private static final String VFC_ACTOR = "VFC";