summaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2021-05-07 18:09:13 -0500
committerjhh <jorge.hernandez-herrero@att.com>2021-05-07 18:09:13 -0500
commit16a9a1018dd6e9390543a27970174d8fd00a68bd (patch)
tree0c779c0674aef86ff6ceb1a1e7d9dade5783c115 /feature-lifecycle/src
parentc2e25b77402244fdc9f443628ec127e03606c9f6 (diff)
sonars policy-utils and feature-lifecycle
Issue-ID: POLICY-3289 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: Iaf7423f840fb39a27c3e5fd293159d1336d5557a
Diffstat (limited to 'feature-lifecycle/src')
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java8
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java4
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java14
-rw-r--r--feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java3
4 files changed, 14 insertions, 15 deletions
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());
diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java
index 13d65915..f4772eb9 100644
--- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java
+++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStatePassiveTest.java
@@ -29,7 +29,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
@@ -254,7 +253,7 @@ public class LifecycleStatePassiveTest extends LifecycleStateRunningTest {
}
@Test
- public void testStateChange() throws CoderException, IOException {
+ public void testStateChange() throws CoderException {
/* no name */
PdpStateChange change = new PdpStateChange();
change.setPdpGroup("A");