Fix basic code issues in controlloop

Found few issues while going through the code. Fixing
these issues in the controlloop package classes

Issue-ID: POLICY-1017
Change-Id: I24d0ce1257ad689c3e9d9b7a3bea07eeb65383f1
Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
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 5130276..1fffe04 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 @@
 
     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 @@
     @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 c370f15..1d4af38 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 @@
             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 @@
      * 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 48c613d..f6131b1 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 @@
 
 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.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 @@
         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 @@
         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 49b4e98..de4e439 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 @@
         // 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 @@
     /**
      * 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 @@
      * @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 @@
     @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 @@
      * 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 65425b0..caf89eb 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.assertNull;
 import static org.junit.Assert.fail;
 
+import java.util.Objects;
 import java.util.UUID;
 
 import org.junit.AfterClass;
@@ -98,7 +99,7 @@
         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 b0b7eb5..aeb536c 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 @@
     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 46cc6f6..47e02a5 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 @@
 
 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 0fd00e1..af04cc1 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 @@
 
     @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;
     }
 }