summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-13 10:39:55 -0400
committerJim Hahn <jrh3@att.com>2019-06-17 10:50:16 -0400
commitd37c71292d9cbdd892f328d63f49a8027b1f13c4 (patch)
tree615a8af45285d1032a02af1214c76b938c58044d /models-interactions/model-actors/actor.sdnr/src
parentf59ec395bf1e41df894f884e70ff3185280668c0 (diff)
Fix simple sonar issues in models
Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Removed unused BeforeClass & AfterClass test methods. Removed some trailing spaces. Fixed: aai actor.appc actor.appclcm actor.sdnc actor.sdnr actor.so actor.vfc actorServiceProvider appc appclcm cds events Change-Id: I0e21cbb10db6d1217bbd0e00e6dd4fac3eb84e31 Issue-ID: POLICY-1791 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/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java1
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java14
2 files changed, 8 insertions, 7 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
index 32346bfa2..4367f54c5 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
@@ -70,7 +70,6 @@ public class SdnrActorServiceProvider implements Actor {
// Strings for recipes
private static final String RECIPE_MODIFY = "ModifyConfig";
- private static final String RECIPE_MODIFY_ANR = "ModifyConfigANR";
/* To be used in future releases when pci ModifyConfig is used */
private static final String SDNR_REQUEST_PARAMS = "request-parameters";
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 265aea341..a9178961a 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
@@ -46,6 +46,8 @@ import org.slf4j.LoggerFactory;
public class SdnrActorServiceProviderTest {
+ private static final String MODIFY_CONFIG = "ModifyConfig";
+
private static final Logger logger = LoggerFactory.getLogger(SdnrActorServiceProviderTest.class);
private static final VirtualControlLoopEvent onsetEvent;
@@ -73,7 +75,7 @@ public class SdnrActorServiceProviderTest {
/* Construct an operation with an SDNR actor and ModifyConfig operation. */
operation = new ControlLoopOperation();
operation.setActor("SDNR");
- operation.setOperation("ModifyConfig");
+ operation.setOperation(MODIFY_CONFIG);
operation.setTarget("VNF");
operation.setEnd(Instant.now());
operation.setSubRequestId("1");
@@ -85,7 +87,7 @@ public class SdnrActorServiceProviderTest {
policy.setActor("SDNR");
policy.setTarget(new Target(TargetType.VNF));
policy.getTarget().setResourceID("Eace933104d443b496b8.nodes.heat.vpg");
- policy.setRecipe("ModifyConfig");
+ policy.setRecipe(MODIFY_CONFIG);
policy.setPayload(null);
policy.setRetry(2);
policy.setTimeout(300);
@@ -132,7 +134,7 @@ public class SdnrActorServiceProviderTest {
/* An action is required and cannot be null */
assertNotNull(sdnrRequest.getAction());
- assertEquals("ModifyConfig", sdnrRequest.getAction());
+ assertEquals(MODIFY_CONFIG, sdnrRequest.getAction());
/* A payload is required and cannot be null */
assertNotNull(sdnrRequest.getPayload());
@@ -147,7 +149,7 @@ public class SdnrActorServiceProviderTest {
/* The JSON string must contain the following fields */
assertTrue(jsonRequest.contains("CommonHeader"));
assertTrue(jsonRequest.contains("Action"));
- assertTrue(jsonRequest.contains("ModifyConfig"));
+ assertTrue(jsonRequest.contains(MODIFY_CONFIG));
assertTrue(jsonRequest.contains("payload"));
PciResponse sdnrResponse = new PciResponse(sdnrRequest);
@@ -164,7 +166,7 @@ public class SdnrActorServiceProviderTest {
assertEquals("SDNR", sp.actor());
assertEquals(1, sp.recipes().size());
- assertEquals("VNF", sp.recipeTargets("ModifyConfig").get(0));
- assertEquals(2, sp.recipePayloads("ModifyConfig").size());
+ assertEquals("VNF", sp.recipeTargets(MODIFY_CONFIG).get(0));
+ assertEquals(2, sp.recipePayloads(MODIFY_CONFIG).size());
}
}