From 4ab3c22a653129e347c712cc29118f94b238d87b Mon Sep 17 00:00:00 2001 From: Krishnajinka Date: Mon, 6 Aug 2018 14:18:00 +0900 Subject: 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 --- .../actor/appclcm/AppcLcmActorServiceProvider.java | 4 ++-- .../actor/appclcm/AppcLcmServiceProviderTest.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'controlloop/common/actors/actor.appclcm') 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); -- cgit 1.2.3-korg