aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/eventmanager/pom.xml1
-rw-r--r--controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java5
-rw-r--r--controlloop/common/guard/pom.xml3
-rw-r--r--controlloop/m2/adapters/src/main/java/org/onap/policy/m2/adapters/VirtualOnsetAdapter.java4
-rw-r--r--controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java6
-rw-r--r--controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmActor.java2
-rw-r--r--controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java5
-rw-r--r--controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java9
-rw-r--r--controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmActorTest.java5
-rw-r--r--controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java4
-rw-r--r--controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java4
-rw-r--r--controlloop/m2/appclcm/src/test/java/model/AppcLcmResponseCodeTest.java1
-rw-r--r--controlloop/m2/base/src/main/java/org/onap/policy/m2/base/GuardAdjunct.java1
-rw-r--r--controlloop/m2/base/src/main/java/org/onap/policy/m2/base/OnsetAdapter.java15
-rw-r--r--controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java1
-rw-r--r--controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java23
-rw-r--r--controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java2
-rw-r--r--controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java6
-rw-r--r--controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java8
-rw-r--r--controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java3
-rw-r--r--controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java1
-rw-r--r--controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java1
-rw-r--r--controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java7
-rw-r--r--controlloop/m2/test/src/test/java/org/onap/policy/m2/test/AppcLcmTest.java2
-rw-r--r--controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java10
-rw-r--r--controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimGuard.java3
-rw-r--r--controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java7
-rw-r--r--controlloop/m2/util/src/main/java/org/onap/policy/util/DroolsSessionCommonSerializable.java5
-rw-r--r--controlloop/m2/util/src/test/java/org/onap/policy/util/DroolsSessionCommonSerializableTest.java3
29 files changed, 41 insertions, 106 deletions
diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml
index aa4f8e8bb..a2ac8aee1 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -41,7 +41,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
index d05b97589..02842da65 100644
--- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
+++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java
@@ -23,7 +23,6 @@ package org.onap.policy.drools.server.restful;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.Collections;
@@ -151,10 +150,6 @@ public class RestTransactionTrackerTest {
assertNotNull(HttpClient.getBody(response, clazz));
}
- private <T> void empty(Response response, Class<T> clazz) {
- assertNull(HttpClient.getBody(response, clazz));
- }
-
@NotNull
private Response checkResponse(int statusCode, Response response) {
assertEquals(statusCode, response.getStatus());
diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml
index 8c355db36..ec3c0e485 100644
--- a/controlloop/common/guard/pom.xml
+++ b/controlloop/common/guard/pom.xml
@@ -2,7 +2,7 @@
============LICENSE_START=======================================================
drools-pdp-apps
================================================================================
- Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2020 Bell Canada.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,7 +77,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/controlloop/m2/adapters/src/main/java/org/onap/policy/m2/adapters/VirtualOnsetAdapter.java b/controlloop/m2/adapters/src/main/java/org/onap/policy/m2/adapters/VirtualOnsetAdapter.java
index e9ca1164d..1a3a5f66c 100644
--- a/controlloop/m2/adapters/src/main/java/org/onap/policy/m2/adapters/VirtualOnsetAdapter.java
+++ b/controlloop/m2/adapters/src/main/java/org/onap/policy/m2/adapters/VirtualOnsetAdapter.java
@@ -21,12 +21,10 @@
package org.onap.policy.m2.adapters;
import java.io.Serializable;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopNotification;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
-
import org.onap.policy.m2.base.OnsetAdapter;
public class VirtualOnsetAdapter extends OnsetAdapter implements Serializable {
@@ -50,7 +48,7 @@ public class VirtualOnsetAdapter extends OnsetAdapter implements Serializable {
@Override
public ControlLoopNotification createNotification(ControlLoopEvent event) {
if (event instanceof VirtualControlLoopEvent) {
- return new VirtualControlLoopNotification((VirtualControlLoopEvent)event);
+ return new VirtualControlLoopNotification((VirtualControlLoopEvent) event);
}
// Right now, the onset event from the transaction is used to locate
diff --git a/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java b/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
index c19a80e7e..4b38b1e14 100644
--- a/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
+++ b/controlloop/m2/adapters/src/test/java/org/onap/policy/m2/adapters/VirtualOnsetAdapterTest.java
@@ -22,10 +22,8 @@ package org.onap.policy.m2.adapters;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopNotification;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
@@ -47,7 +45,9 @@ public class VirtualOnsetAdapterTest {
// we want an exact class match, so 'instanceOf' is not being used
assertEquals(VirtualControlLoopNotification.class, notification.getClass());
- ControlLoopEvent controlLoopEvent = new ControlLoopEvent() {};
+ ControlLoopEvent controlLoopEvent = new ControlLoopEvent() {
+ private static final long serialVersionUID = 1L;
+ };
notification = virtualOnsetAdapter.createNotification(controlLoopEvent);
assertNotNull(notification);
}
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmActor.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmActor.java
index f89d3b873..ee9ebdc3d 100644
--- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmActor.java
+++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmActor.java
@@ -21,10 +21,8 @@
package org.onap.policy.m2.appclcm;
import java.io.Serializable;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.policy.Policy;
-
import org.onap.policy.m2.adapters.VirtualOnsetAdapter;
import org.onap.policy.m2.base.Actor;
import org.onap.policy.m2.base.Operation;
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
index cc0df4580..40e0b0afb 100644
--- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
+++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmHealthCheckOperation.java
@@ -22,7 +22,6 @@ package org.onap.policy.m2.appclcm;
import java.util.HashMap;
import java.util.Map;
-
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.utils.coder.CoderException;
@@ -33,7 +32,6 @@ import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.guard.PolicyGuardResponse;
import org.onap.policy.m2.appclcm.model.AppcLcmResponseCode;
import org.onap.policy.m2.base.Transaction;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,6 +58,7 @@ public class AppcLcmHealthCheckOperation extends AppcLcmOperation {
* the appc lcm response json payload
* @return the string that contains the state of the vnf
*/
+ @SuppressWarnings("unchecked")
private String getVnfHealthState(String jsonPayload) {
HashMap<String, Object> healthCheckPayloadMap;
try {
@@ -96,7 +95,7 @@ public class AppcLcmHealthCheckOperation extends AppcLcmOperation {
// The rest of this method is mostly copied from
// 'ControlLoopOperationManager.onResponse'.
- AppcLcmOutput response = ((AppcLcmDmaapWrapper)object).getBody().getOutput();
+ AppcLcmOutput response = ((AppcLcmDmaapWrapper) object).getBody().getOutput();
//
// Determine which subrequestID (ie. attempt)
diff --git a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
index 668860eb1..24f8ed5ab 100644
--- a/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
+++ b/controlloop/m2/appclcm/src/main/java/org/onap/policy/m2/appclcm/AppcLcmOperation.java
@@ -21,12 +21,10 @@
package org.onap.policy.m2.appclcm;
import com.google.common.collect.ImmutableList;
-
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
-
import org.onap.policy.appclcm.AppcLcmBody;
import org.onap.policy.appclcm.AppcLcmCommonHeader;
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
@@ -47,7 +45,6 @@ import org.onap.policy.m2.appclcm.model.AppcLcmResponseCode;
import org.onap.policy.m2.base.GuardAdjunct;
import org.onap.policy.m2.base.Operation;
import org.onap.policy.m2.base.Transaction;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -164,7 +161,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
return;
}
- this.onset = (VirtualControlLoopEvent)onset;
+ this.onset = (VirtualControlLoopEvent) onset;
// fetch or create the guard adjunct -- note that 'guard' operations are
// only performed if a 'GuardContext' is present, and the adjunct was
@@ -508,7 +505,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
public void incomingMessage(Object object) {
if (! (object instanceof AppcLcmDmaapWrapper)) {
if (object instanceof PolicyGuardResponse) {
- incomingGuardMessage((PolicyGuardResponse)object);
+ incomingGuardMessage((PolicyGuardResponse) object);
} else if (object instanceof ControlLoopEvent) {
incomingAbatedEvent((ControlLoopEvent) object);
}
@@ -520,7 +517,7 @@ public class AppcLcmOperation implements Operation, LockAdjunct.Requestor, Seria
// The rest of this method is mostly copied from
// 'ControlLoopOperationManager.onResponse'.
- AppcLcmOutput response = ((AppcLcmDmaapWrapper)object).getBody().getOutput();
+ AppcLcmOutput response = ((AppcLcmDmaapWrapper) object).getBody().getOutput();
//
// Determine which subrequestID (ie. attempt)
diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmActorTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmActorTest.java
index e1bc16292..1c6e81ec6 100644
--- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmActorTest.java
+++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmActorTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
import java.util.Properties;
import java.util.UUID;
-
import org.drools.core.WorkingMemory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -42,12 +41,8 @@ import org.onap.policy.m2.appclcm.AppcLcmActor;
import org.onap.policy.m2.appclcm.AppcLcmHealthCheckOperation;
import org.onap.policy.m2.appclcm.AppcLcmOperation;
import org.onap.policy.m2.base.Transaction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class AppcLcmActorTest {
- private static Logger logger = LoggerFactory.getLogger(AppcLcmActorTest.class);
-
public static Policy policy;
public static VirtualControlLoopEvent event;
public static Transaction transaction;
diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java
index f49204e65..6e606b28b 100644
--- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java
+++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmHealthCheckOperationTest.java
@@ -23,18 +23,14 @@ package appclcm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import static org.mockito.Mockito.mock;
import java.util.Properties;
import java.util.UUID;
-
import org.drools.core.WorkingMemory;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
import org.onap.policy.appclcm.util.Serialization;
diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
index 780039978..e270c3d71 100644
--- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
+++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
@@ -30,13 +30,10 @@ import static org.mockito.Mockito.mock;
import java.util.HashMap;
import java.util.Properties;
import java.util.UUID;
-
import org.drools.core.WorkingMemory;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.appclcm.AppcLcmInput;
import org.onap.policy.appclcm.util.Serialization;
@@ -51,7 +48,6 @@ import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.m2.appclcm.AppcLcmOperation;
import org.onap.policy.m2.base.Transaction;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/controlloop/m2/appclcm/src/test/java/model/AppcLcmResponseCodeTest.java b/controlloop/m2/appclcm/src/test/java/model/AppcLcmResponseCodeTest.java
index fc3349253..327f8c5d4 100644
--- a/controlloop/m2/appclcm/src/test/java/model/AppcLcmResponseCodeTest.java
+++ b/controlloop/m2/appclcm/src/test/java/model/AppcLcmResponseCodeTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;
-
import org.onap.policy.m2.appclcm.model.AppcLcmResponseCode;
diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/GuardAdjunct.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/GuardAdjunct.java
index 34397e2b9..d3675ae12 100644
--- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/GuardAdjunct.java
+++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/GuardAdjunct.java
@@ -21,7 +21,6 @@
package org.onap.policy.m2.base;
import java.io.Serializable;
-
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.guard.GuardContext;
diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/OnsetAdapter.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/OnsetAdapter.java
index 37a999f06..3c164cfd2 100644
--- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/OnsetAdapter.java
+++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/OnsetAdapter.java
@@ -21,15 +21,12 @@
package org.onap.policy.m2.base;
import java.io.Serializable;
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopNotification;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +39,7 @@ public class OnsetAdapter implements Serializable {
private static Logger logger = LoggerFactory.getLogger(OnsetAdapter.class);
// table mapping onset message class to 'OnsetAdapter' instance
- private static Map<Class,OnsetAdapter> map = new ConcurrentHashMap<>();
+ private static Map<Class<?>, OnsetAdapter> map = new ConcurrentHashMap<>();
/**
* This method is called to add an entry to the table.
@@ -51,7 +48,7 @@ public class OnsetAdapter implements Serializable {
* @param value an instance of 'OnsetAdapter' that should be
* associated with 'clazz'
*/
- public static void register(Class clazz, OnsetAdapter value) {
+ public static void register(Class<?> clazz, OnsetAdapter value) {
// only create an entry if one doesn't already exist
map.putIfAbsent(clazz, value);
}
@@ -79,14 +76,14 @@ public class OnsetAdapter implements Serializable {
// one will be chosen "at random".
// we need to look for the best match of 'clazz'
- HashSet<Class> matches = new HashSet<>();
- Class chosenMatch = null;
+ HashSet<Class<?>> matches = new HashSet<>();
+ Class<?> chosenMatch = null;
synchronized (map) {
for (Class<?> possibleMatch : map.keySet()) {
if (possibleMatch.isAssignableFrom(clazz)) {
// we have a match -- see if it is the best match
boolean add = true;
- for (Class<?> match : new ArrayList<Class>(matches)) {
+ for (Class<?> match : new ArrayList<Class<?>>(matches)) {
if (match.isAssignableFrom(possibleMatch)) {
// 'possibleMatch' is a better match than 'match'
matches.remove(match);
@@ -134,6 +131,8 @@ public class OnsetAdapter implements Serializable {
// the new 'ControlLoopNotification' is abstract
public static class BaseControlLoopNotification extends ControlLoopNotification {
+ private static final long serialVersionUID = 1L;
+
BaseControlLoopNotification(ControlLoopEvent event) {
super(event);
}
diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java
index ec5ab8ef6..c8ee901c3 100644
--- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java
+++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Operation.java
@@ -21,7 +21,6 @@
package org.onap.policy.m2.base;
import java.io.Serializable;
-
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.policy.Policy;
diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
index 41c251e2a..f964e207e 100644
--- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
+++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
@@ -29,11 +29,9 @@ import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.UUID;
-
import lombok.Getter;
import org.drools.core.WorkingMemory;
import org.kie.api.runtime.rule.FactHandle;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopNotification;
import org.onap.policy.controlloop.ControlLoopNotificationType;
@@ -42,7 +40,6 @@ import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.FinalResult;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,7 +55,7 @@ public class Transaction implements Serializable {
// This table maps 'actor' names to objects implementing the
// 'Actor' interface. 'ServiceLoader' is used to locate and create
// these objects, and populate the table.
- private static Map<String,Actor> nameToActor = new HashMap<>();
+ private static Map<String, Actor> nameToActor = new HashMap<>();
static {
// use 'ServiceLoader' to locate all of the 'Actor' implementations
@@ -428,7 +425,7 @@ public class Transaction implements Serializable {
break;
case FAILURE:
- nextPolicy = processResult_Failure();
+ nextPolicy = processResultFailure();
break;
case FAILURE_TIMEOUT:
@@ -499,7 +496,7 @@ public class Transaction implements Serializable {
}
// returns the next policy if the current operation fails
- private String processResult_Failure() {
+ private String processResultFailure() {
String nextPolicy = null;
int attempt = currentOperation.getAttempt();
if (attempt <= currentPolicy.getRetry()) {
@@ -507,20 +504,19 @@ public class Transaction implements Serializable {
Actor actor = nameToActor.get(currentPolicy.getActor());
if (actor != null) {
attempt += 1;
- logger.debug("found Actor, attempt " + attempt);
+ logger.debug("found Actor, attempt {}", attempt);
currentOperation =
actor.createOperation(this, currentPolicy, onset, attempt);
createHistEntry();
} else {
- logger.error("'Transaction' can't find actor "
- + currentPolicy.getActor());
+ logger.error("'Transaction' can't find actor {}", currentPolicy.getActor());
}
} else {
// operation failed, and no retries (or no retries left)
nextPolicy = (attempt == 1
? currentPolicy.getFailure()
: currentPolicy.getFailure_retries());
- logger.debug("moving to policy " + nextPolicy);
+ logger.debug("moving to policy {}", nextPolicy);
}
return nextPolicy;
}
@@ -592,11 +588,10 @@ public class Transaction implements Serializable {
actor.createOperation(this, currentPolicy, onset, 1);
createHistEntry();
} else {
- logger.error("'Transaction' can't find actor "
- + currentPolicy.getActor());
+ logger.error("'Transaction' can't find actor {}", currentPolicy.getActor());
}
} else {
- logger.error("Transaction' can't find policy " + id);
+ logger.error("Transaction' can't find policy {}", id);
}
if (currentOperation == null) {
@@ -670,7 +665,7 @@ public class Transaction implements Serializable {
T adjunct = null;
try {
// create the adjunct (may trigger an exception)
- adjunct = clazz.newInstance();
+ adjunct = clazz.getDeclaredConstructor().newInstance();
// initialize the adjunct (may also trigger an exception */
adjunct.init(Transaction.this);
diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java
index ce5f2df1f..33b4928b1 100644
--- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java
+++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/ActorOperationTest.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
-
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopException;
import org.onap.policy.controlloop.policy.Policy;
@@ -37,6 +36,7 @@ public class ActorOperationTest {
public static final String STATE = "COMPLETE";
public static class TestOperation implements Operation {
+ private static final long serialVersionUID = 1L;
@Override
public Object getRequest() throws ControlLoopException {
diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java
index 78aab89d4..facde545a 100644
--- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java
+++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/GuardAdjunctTest.java
@@ -26,14 +26,11 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
import java.time.Instant;
import java.util.UUID;
-
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.guard.GuardContext;
@@ -41,7 +38,6 @@ import org.powermock.reflect.Whitebox;
public class GuardAdjunctTest {
private static final String ADJUNCT_CONTEXT_FIELD = "context";
- private static final String ADJUNCT_TRANSACTION_FIELD = "transaction";
private static GuardAdjunct adjunct;
private static Transaction transaction;
@@ -73,7 +69,7 @@ public class GuardAdjunctTest {
assertTrue(adjunct.asyncQuery(policy, "testTarget", UUID.randomUUID().toString()));
GuardContext savedContext = Whitebox.getInternalState(adjunct, ADJUNCT_CONTEXT_FIELD);
- Whitebox.setInternalState(adjunct, ADJUNCT_CONTEXT_FIELD, (GuardContext)null);
+ Whitebox.setInternalState(adjunct, ADJUNCT_CONTEXT_FIELD, (GuardContext) null);
try {
assertFalse(adjunct.asyncQuery(policy, "testTarget", UUID.randomUUID().toString()));
diff --git a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java
index 30546d0ec..c5fa6befd 100644
--- a/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java
+++ b/controlloop/m2/base/src/test/java/org/onap/policy/m2/base/TransactionTest.java
@@ -25,14 +25,13 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.time.Instant;
import java.util.LinkedList;
import java.util.UUID;
-
import org.drools.core.WorkingMemory;
import org.drools.core.impl.StatefulKnowledgeSessionImpl;
import org.junit.BeforeClass;
@@ -46,7 +45,6 @@ import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.FinalResult;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.Target;
-import org.onap.policy.m2.base.GuardAdjunct;
public class TransactionTest {
@@ -61,7 +59,7 @@ public class TransactionTest {
public static void setUpBeforeClass() {
mockWorkingMemory = mock(WorkingMemory.class);
FactHandle factHandle = mock(FactHandle.class);
- when(mockWorkingMemory.getFactHandle(anyObject())).thenReturn(factHandle);
+ when(mockWorkingMemory.getFactHandle(any())).thenReturn(factHandle);
}
@Test
@@ -310,7 +308,7 @@ public class TransactionTest {
Transaction transaction = new Transaction(mockWorkingMemory, CL_NAME, UUID.randomUUID(), createControlLoop());
ControlLoopNotification notification = transaction.processError();
assertNull(notification);
-
+
VirtualControlLoopEvent onset =
createControlLoopEvent(UUID.randomUUID(), CL_NAME, null, "VM", "vserver.vserver-name");
transaction.setControlLoopEvent(onset);
diff --git a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
index 1bfb6ae4c..d41e30cb6 100644
--- a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
+++ b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
@@ -33,7 +33,6 @@ import javax.persistence.Persistence;
import org.drools.core.WorkingMemory;
import org.onap.policy.drools.core.PolicyContainer;
import org.onap.policy.drools.core.PolicySession;
-import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyControllerConstants;
import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.util.DroolsSessionCommonSerializable;
@@ -257,7 +256,7 @@ public class GuardContext implements Serializable {
// 'EntityManagerFactory' does not exist yet -- create one
// copy database properties to a 'HashMap'
- HashMap<Object,Object> propertiesMap = new HashMap<>(dbProperties);
+ HashMap<Object, Object> propertiesMap = new HashMap<>(dbProperties);
// use 'ClassLoader' from Drools session
propertiesMap.put("eclipselink.classloader",
diff --git a/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java b/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java
index 7242b9f12..54fd323c2 100644
--- a/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java
+++ b/controlloop/m2/guard/src/test/java/org/onap/policy/guard/GuardContextTest.java
@@ -37,7 +37,6 @@ import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-
import org.drools.core.WorkingMemory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
diff --git a/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java b/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
index 98d82876e..937317cfa 100644
--- a/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
+++ b/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
@@ -21,7 +21,6 @@
package org.onap.policy.drools.m2.lock;
import java.io.Serializable;
-
import org.onap.policy.drools.core.lock.Lock;
import org.onap.policy.drools.core.lock.LockCallback;
import org.onap.policy.drools.system.PolicyEngineConstants;
diff --git a/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java b/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java
index 65ad01a1d..2b4a29b34 100644
--- a/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java
+++ b/controlloop/m2/lock/src/test/java/org/onap/policy/drools/m2/lock/LockAdjunctTest.java
@@ -26,23 +26,16 @@ import static org.junit.Assert.assertTrue;
import java.util.Properties;
import java.util.UUID;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-
import org.onap.policy.drools.core.lock.Lock;
import org.onap.policy.drools.core.lock.LockCallback;
import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.m2.base.Transaction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class LockAdjunctTest {
- private static Logger logger = LoggerFactory.getLogger(LockAdjunctTest.class);
-
public class TestOwner implements LockCallback {
@Override
diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/AppcLcmTest.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/AppcLcmTest.java
index a35e8c6ae..31003cba3 100644
--- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/AppcLcmTest.java
+++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/AppcLcmTest.java
@@ -87,7 +87,7 @@ public class AppcLcmTest {
"${notificationTopic}", "NOTIFICATION-APPCLCM-TOPIC",
"${operationTopic}", "APPC-REQUEST-APPCLCM-TOPIC",
"${policyName}", "appclcm",
- "${policyScope}", "service=vUSP;resource=vCTS;type=operational" ,
+ "${policyScope}", "service=vUSP;resource=vCTS;type=operational",
"${policyVersion}",
"org.onap.policy.m2.test:appclcm:" + projectVersion,
"${unique}", "2");
diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java
index 925e9451f..1c11fccdb 100644
--- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java
+++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimDmaap.java
@@ -25,7 +25,6 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -34,7 +33,6 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,7 +45,7 @@ public class SimDmaap {
private static Logger logger = LoggerFactory.getLogger(SimDmaap.class);
// maps topic name to 'Topic' instance
- static Map<String,Topic> topicTable = new ConcurrentHashMap<>();
+ static Map<String, Topic> topicTable = new ConcurrentHashMap<>();
/**
* Each instance of this class corresponds to a DMAAP or UEB topic.
@@ -57,7 +55,7 @@ public class SimDmaap {
String topic;
// maps group name into group instance
- Map<String,Group> groupTable = new ConcurrentHashMap<>();
+ Map<String, Group> groupTable = new ConcurrentHashMap<>();
/**
* Create or get a Topic.
@@ -114,7 +112,7 @@ public class SimDmaap {
// no more messages
break;
}
- String[] prefix = data.substring(cur,leftBrace).split("\\.");
+ String[] prefix = data.substring(cur, leftBrace).split("\\.");
if (prefix.length == 3) {
try {
// determine length of message, and advance current position
@@ -216,7 +214,7 @@ public class SimDmaap {
builder.append("[\"").append(message);
// add up to '<limit>-1' more messages
- for (int i = 1 ; i < limit ; i += 1) {
+ for (int i = 1; i < limit; i += 1) {
// fetch the next message -- don't wait if it isn't currently there
message = messages.poll();
if (message == null) {
diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimGuard.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimGuard.java
index 578dd6dc3..67df8503a 100644
--- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimGuard.java
+++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/SimGuard.java
@@ -21,16 +21,13 @@
package org.onap.policy.m2.test;
import com.google.gson.JsonObject;
-
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java
index 48155fd88..f6740f83b 100644
--- a/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java
+++ b/controlloop/m2/test/src/test/java/org/onap/policy/m2/test/Util.java
@@ -28,13 +28,11 @@ import com.att.nsa.cambria.client.CambriaClientBuilders;
import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder;
import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
import com.att.nsa.cambria.client.CambriaConsumer;
-
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -47,7 +45,6 @@ import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -165,7 +162,7 @@ public class Util {
public static String openAndReplace(String fileName, String... args)
throws IOException, FileNotFoundException {
String text = fileToString(new File(fileName));
- for (int i = 0 ; i < args.length ; i += 2) {
+ for (int i = 0; i < args.length; i += 2) {
text = text.replace(args[i], args[i + 1]);
}
return text;
@@ -202,7 +199,7 @@ public class Util {
*/
public static JsonObject json(Object... data) {
JsonObject obj = new JsonObject();
- for (int i = 0 ; i < data.length ; i += 2) {
+ for (int i = 0; i < data.length; i += 2) {
obj.add(data[i].toString(), toJsonElement(data[i + 1]));
}
return obj;
diff --git a/controlloop/m2/util/src/main/java/org/onap/policy/util/DroolsSessionCommonSerializable.java b/controlloop/m2/util/src/main/java/org/onap/policy/util/DroolsSessionCommonSerializable.java
index d8501fea8..0834026a0 100644
--- a/controlloop/m2/util/src/main/java/org/onap/policy/util/DroolsSessionCommonSerializable.java
+++ b/controlloop/m2/util/src/main/java/org/onap/policy/util/DroolsSessionCommonSerializable.java
@@ -20,11 +20,9 @@
package org.onap.policy.util;
-import java.io.InvalidObjectException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.HashMap;
-
import org.onap.policy.drools.core.PolicySession;
/**
@@ -116,7 +114,7 @@ public class DroolsSessionCommonSerializable implements Serializable {
session.setAdjunct(Adjunct.class, adjunct);
} else {
// found the adjunct -- return it
- adjunct = (Adjunct)adj;
+ adjunct = (Adjunct) adj;
//adjunct = Adjunct.class.cast(adj);
}
}
@@ -132,5 +130,6 @@ public class DroolsSessionCommonSerializable implements Serializable {
* warnings.
*/
private static class Adjunct extends HashMap<String, Object> {
+ private static final long serialVersionUID = 1L;
}
}
diff --git a/controlloop/m2/util/src/test/java/org/onap/policy/util/DroolsSessionCommonSerializableTest.java b/controlloop/m2/util/src/test/java/org/onap/policy/util/DroolsSessionCommonSerializableTest.java
index 2448d176b..24c04f70d 100644
--- a/controlloop/m2/util/src/test/java/org/onap/policy/util/DroolsSessionCommonSerializableTest.java
+++ b/controlloop/m2/util/src/test/java/org/onap/policy/util/DroolsSessionCommonSerializableTest.java
@@ -27,11 +27,8 @@ import static org.mockito.Mockito.when;
import org.junit.Test;
import org.junit.runner.RunWith;
-
import org.mockito.Mockito;
-
import org.onap.policy.drools.core.PolicySession;
-
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;