summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java8
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java4
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java15
-rw-r--r--controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java22
-rw-r--r--controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java3
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java2
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java8
-rw-r--r--controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java24
8 files changed, 44 insertions, 42 deletions
diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
index 5130276e2..1fffe043c 100644
--- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java
@@ -53,9 +53,9 @@ public class AppcServiceProviderTest {
private static final Logger logger = LoggerFactory.getLogger(AppcServiceProviderTest.class);
- private static VirtualControlLoopEvent onsetEvent;
- private static ControlLoopOperation operation;
- private static Policy policy;
+ private static final VirtualControlLoopEvent onsetEvent;
+ private static final ControlLoopOperation operation;
+ private static final Policy policy;
static {
/*
@@ -124,7 +124,7 @@ public class AppcServiceProviderTest {
@Test
public void constructModifyConfigRequestTest() {
- Request appcRequest = null;
+ Request appcRequest;
appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01");
/* The service provider must return a non null APPC request */
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index c370f153f..1d4af389f 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -299,7 +299,7 @@ public class AppcLcmActorServiceProvider implements Actor {
return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message);
}
- /* Save the APPC response's message for Policy noticiation message. */
+ /* Save the APPC response's message for Policy notification message. */
message = appcResponse.getStatus().getMessage();
/* Maps the APPC response result to a Policy result. */
@@ -326,7 +326,7 @@ public class AppcLcmActorServiceProvider implements Actor {
* This method reads and validates environmental properties coming from the policy engine. Null
* properties cause an {@link IllegalArgumentException} runtime exception to be thrown
*
- * @param string the name of the parameter to retrieve
+ * @param enginePropertyName the name of the parameter to retrieve
* @return the property value
*/
private static String getPeManagerEnvProperty(String enginePropertyName) {
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
index 48c613dce..f6131b135 100644
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.appclcm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.time.Instant;
@@ -52,15 +53,15 @@ import org.onap.policy.simulators.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
public class AppcLcmServiceProviderTest {
private static final Logger logger = LoggerFactory.getLogger(AppcLcmServiceProviderTest.class);
- private static VirtualControlLoopEvent onsetEvent;
- private static ControlLoopOperation operation;
- private static Policy policy;
- private static LcmRequestWrapper dmaapRequest;
- private static LcmResponseWrapper dmaapResponse;
+ private static final VirtualControlLoopEvent onsetEvent;
+ private static final ControlLoopOperation operation;
+ private static final Policy policy;
+ private static final LcmResponseWrapper dmaapResponse;
static {
/*
@@ -99,7 +100,7 @@ public class AppcLcmServiceProviderTest {
policy.setTimeout(300);
/* A sample DMAAP request wrapper. */
- dmaapRequest = new LcmRequestWrapper();
+ LcmRequestWrapper dmaapRequest = new LcmRequestWrapper();
dmaapRequest.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1");
dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
dmaapRequest.setType("request");
@@ -224,7 +225,7 @@ public class AppcLcmServiceProviderTest {
dmaapResponse.getBody().getStatus().setCode(100);
dmaapResponse.getBody().getStatus().setMessage("ACCEPTED");
result = AppcLcmActorServiceProvider.processResponse(dmaapResponse);
- assertEquals(null, result.getKey());
+ assertNull(result.getKey());
/* If APPC is successful, PolicyResult is success */
dmaapResponse.getBody().getStatus().setCode(400);
diff --git a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
index 49b4e9885..de4e43949 100644
--- a/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/SOActorServiceProvider.java
@@ -121,7 +121,7 @@ public class SOActorServiceProvider implements Actor {
// Perform named query request and handle response
AaiNqResponseWrapper aaiResponseWrapper = performAaiNamedQueryRequest(onset);
if (aaiResponseWrapper == null) {
- // Tracing and error handling handied in the "performAaiNamedQueryRequest()" method
+ // Tracing and error handling handled in the "performAaiNamedQueryRequest()" method
return null;
}
@@ -292,8 +292,8 @@ public class SOActorServiceProvider implements Actor {
/**
* Constructs and sends an AAI vserver Named Query.
*
- * @param onset the virtial control loop event
- * @returns the response to the AAI Named Query
+ * @param onset the virtual control loop event
+ * @return the response to the AAI Named Query
*/
private AaiNqResponseWrapper performAaiNamedQueryRequest(VirtualControlLoopEvent onset) {
@@ -353,10 +353,10 @@ public class SOActorServiceProvider implements Actor {
* @return the base or non base index or -1 if the index was not found
*/
private int findIndex(List<AaiNqInventoryResponseItem> inventoryResponseItems, boolean baseIndexFlag) {
- for (AaiNqInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
- if (invenoryResponseItem.getVfModule() != null
- && baseIndexFlag == invenoryResponseItem.getVfModule().getIsBaseVfModule()) {
- return inventoryResponseItems.indexOf(invenoryResponseItem);
+ for (AaiNqInventoryResponseItem inventoryResponseItem : inventoryResponseItems) {
+ if (inventoryResponseItem.getVfModule() != null
+ && baseIndexFlag == inventoryResponseItem.getVfModule().getIsBaseVfModule()) {
+ return inventoryResponseItems.indexOf(inventoryResponseItem);
}
}
@@ -373,9 +373,9 @@ public class SOActorServiceProvider implements Actor {
@SuppressWarnings("unused")
private int findNonBaseModules(List<AaiNqInventoryResponseItem> inventoryResponseItems) {
int nonBaseModuleCount = 0;
- for (AaiNqInventoryResponseItem invenoryResponseItem : inventoryResponseItems) {
- if (invenoryResponseItem.getVfModule() != null
- && (!invenoryResponseItem.getVfModule().getIsBaseVfModule())) {
+ for (AaiNqInventoryResponseItem inventoryResponseItem : inventoryResponseItems) {
+ if (inventoryResponseItem.getVfModule() != null
+ && (!inventoryResponseItem.getVfModule().getIsBaseVfModule())) {
nonBaseModuleCount++;
}
}
@@ -398,7 +398,7 @@ public class SOActorServiceProvider implements Actor {
* This method reads and validates environmental properties coming from the policy engine. Null
* properties cause an {@link IllegalArgumentException} runtime exception to be thrown
*
- * @param string the name of the parameter to retrieve
+ * @param enginePropertyName the name of the parameter to retrieve
* @return the property value
*/
private static String getPeManagerEnvProperty(String enginePropertyName) {
diff --git a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
index 65425b01e..caf89eb45 100644
--- a/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
+++ b/controlloop/common/actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/TestVFCActorServiceProvider.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
+import java.util.Objects;
import java.util.UUID;
import org.junit.AfterClass;
@@ -98,7 +99,7 @@ public class TestVFCActorServiceProvider {
VFCRequest request =
VFCActorServiceProvider.constructRequest(onset, operation, policy, new AaiGetVnfResponse());
- assertEquals(requestId, request.getRequestId());
+ assertEquals(requestId, Objects.requireNonNull(request).getRequestId());
assertEquals("dorothy.gale.1939", request.getHealRequest().getVnfInstanceId());
assertEquals("restartvm", request.getHealRequest().getAdditionalParams().getAction());
}
diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
index b0b7eb566..aeb536c57 100644
--- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
+++ b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/ActorService.java
@@ -35,7 +35,7 @@ public class ActorService {
private static ActorService service;
// USed to load actors
- private ServiceLoader<Actor> loader;
+ private final ServiceLoader<Actor> loader;
private ActorService() {
loader = ServiceLoader.load(Actor.class);
diff --git a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java
index 46cc6f643..47e02a5cb 100644
--- a/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java
+++ b/controlloop/common/actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/spi/Actor.java
@@ -24,12 +24,12 @@ import java.util.List;
public interface Actor {
- public String actor();
+ String actor();
- public List<String> recipes();
+ List<String> recipes();
- public List<String> recipeTargets(String recipe);
+ List<String> recipeTargets(String recipe);
- public List<String> recipePayloads(String recipe);
+ List<String> recipePayloads(String recipe);
}
diff --git a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java
index 0fd00e12a..af04cc138 100644
--- a/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java
+++ b/controlloop/common/actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/TestActor.java
@@ -33,28 +33,28 @@ public class TestActor implements Actor {
@Override
public List<String> recipes() {
- List<String> recipieList = new ArrayList<>();
- recipieList.add("Dorothy");
- recipieList.add("Wizard");
+ List<String> recipeList = new ArrayList<>();
+ recipeList.add("Dorothy");
+ recipeList.add("Wizard");
- return recipieList;
+ return recipeList;
}
@Override
public List<String> recipeTargets(String recipe) {
- List<String> recipieTargetList = new ArrayList<>();
- recipieTargetList.add("Wicked Witch");
- recipieTargetList.add("Wizard of Oz");
+ List<String> recipeTargetList = new ArrayList<>();
+ recipeTargetList.add("Wicked Witch");
+ recipeTargetList.add("Wizard of Oz");
- return recipieTargetList;
+ return recipeTargetList;
}
@Override
public List<String> recipePayloads(String recipe) {
- List<String> recipiePayloadList = new ArrayList<>();
- recipiePayloadList.add("Dorothy");
- recipiePayloadList.add("Toto");
+ List<String> recipePayloadList = new ArrayList<>();
+ recipePayloadList.add("Dorothy");
+ recipePayloadList.add("Toto");
- return recipiePayloadList;
+ return recipePayloadList;
}
}