From 16a9a1018dd6e9390543a27970174d8fd00a68bd Mon Sep 17 00:00:00 2001 From: jhh Date: Fri, 7 May 2021 18:09:13 -0500 Subject: sonars policy-utils and feature-lifecycle Issue-ID: POLICY-3289 Signed-off-by: jhh Change-Id: Iaf7423f840fb39a27c3e5fd293159d1336d5557a --- .../org/onap/policy/drools/lifecycle/LifecycleFsm.java | 8 ++++---- .../drools/lifecycle/PolicyTypeNativeDroolsController.java | 4 ++-- .../policy/drools/server/restful/RestLifecycleManager.java | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'feature-lifecycle/src/main/java/org/onap') diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java index c4f2f873..5882025a 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java @@ -595,7 +595,7 @@ public class LifecycleFsm implements Startable { } private boolean stopTimers() { - boolean success = true; + var success = true; if (statusTask != null) { success = statusTask.cancel(false); } @@ -613,7 +613,7 @@ public class LifecycleFsm implements Startable { } protected PdpStatus statusPayload(@NonNull PdpState state) { - PdpStatus status = new PdpStatus(); + var status = new PdpStatus(); status.setName(name); status.setPdpGroup(group); status.setPdpSubgroup(subGroup); @@ -629,7 +629,7 @@ public class LifecycleFsm implements Startable { * It provides a snapshot of the current statistics. */ public PdpStatistics statisticsPayload() { - PdpStatistics updateStats = new PdpStatistics(stats); + var updateStats = new PdpStatistics(stats); updateStats.setTimeStamp(Instant.now()); try { @@ -754,7 +754,7 @@ public class LifecycleFsm implements Startable { // these may be overridden by junit tests protected ScheduledExecutorService makeExecutor() { - ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1); + var exec = new ScheduledThreadPoolExecutor(1); exec.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); exec.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); exec.setRemoveOnCancelPolicy(true); diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java index cb7da95e..361b4b10 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java @@ -63,8 +63,8 @@ public class PolicyTypeNativeDroolsController implements PolicyTypeController { @Override public boolean deploy(ToscaPolicy policy) { - Properties controllerProps = new Properties(); - ControllerPolicy controllerPolicy = toDomainPolicy(policy); + var controllerProps = new Properties(); + var controllerPolicy = toDomainPolicy(policy); if (controllerPolicy == null) { return false; } diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java index 381fd600..494c708b 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java @@ -151,7 +151,7 @@ public class RestLifecycleManager { public Response updateState( @ApiParam(value = "state", required = true) @PathParam("state") String state) { - PdpStateChange change = new PdpStateChange(); + var change = new PdpStateChange(); change.setPdpGroup(LifecycleFeature.getFsm().getGroup()); change.setPdpSubgroup(LifecycleFeature.getFsm().getSubGroup()); change.setState(PdpState.valueOf(state)); @@ -273,12 +273,12 @@ public class RestLifecycleManager { public Response deployTrackedPolicy( @ApiParam(value = "Tosca Policy", required = true) String policy) { - ToscaPolicy toscaPolicy = getToscaPolicy(policy); + var toscaPolicy = getToscaPolicy(policy); if (toscaPolicy == null) { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } - PolicyTypeController typeController = getPolicyTypeController(toscaPolicy); + var typeController = getPolicyTypeController(toscaPolicy); if (typeController == null) { return Response.status(Response.Status.NOT_FOUND).build(); } @@ -386,7 +386,7 @@ public class RestLifecycleManager { @Path("policies/operations/validation") @ApiOperation(value = "Validates a policy", responseContainer = "List") public Response validateOperation(@ApiParam(value = "Tosca Policy", required = true) String policy) { - ToscaPolicy toscaPolicy = getToscaPolicy(policy); + var toscaPolicy = getToscaPolicy(policy); if (toscaPolicy == null) { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } @@ -413,12 +413,12 @@ public class RestLifecycleManager { } private Response deployUndeployOperation(String policy, boolean deploy) { - ToscaPolicy toscaPolicy = getToscaPolicy(policy); + var toscaPolicy = getToscaPolicy(policy); if (toscaPolicy == null) { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } - PolicyTypeController typeController = getPolicyTypeController(toscaPolicy); + var typeController = getPolicyTypeController(toscaPolicy); if (typeController == null) { return Response.status(Response.Status.NOT_FOUND).build(); } @@ -441,7 +441,7 @@ public class RestLifecycleManager { } private PdpUpdate getPolicyUpdate() { - PdpUpdate update = new PdpUpdate(); + var update = new PdpUpdate(); update.setName(LifecycleFeature.getFsm().getName()); update.setPdpGroup(LifecycleFeature.getFsm().getGroup()); update.setPdpSubgroup(LifecycleFeature.getFsm().getSubGroup()); -- cgit 1.2.3-korg