aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2019-11-08 08:42:55 -0600
committerjhh <jorge.hernandez-herrero@att.com>2019-11-08 14:40:02 -0600
commitf38687b040bec7b8556fb4bde229343831fa43fd (patch)
tree8c1706c077c8a45e6bf05423b5d2a6004bf81983 /policy-management
parent0588d03bb8e9ea5faebf65d4af8e4bff735a96ae (diff)
Miscellaneous code clean up
Issue-ID: POLICY-2203 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5731d4636bd2aaecbc486406298bcba1b19e8f4d Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'policy-management')
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java2
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java22
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java2
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java2
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java44
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java4
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java4
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java1
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java8
9 files changed, 44 insertions, 45 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
index dd654b1d..8e78b077 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
@@ -137,7 +137,7 @@ public interface DroolsController extends Startable, Lockable {
* @param modelHash the hash for the model
* @return true it owns it
*/
- boolean ownsCoder(Class<? extends Object> coderClass, int modelHash);
+ boolean ownsCoder(Class<?> coderClass, int modelHash);
/**
* fetches a class from the model.
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
index b641f24a..7652a671 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
@@ -43,8 +43,8 @@ public interface DroolsControllerFactory {
* @throws IllegalArgumentException with invalid parameters
* @throws LinkageError Failure to link rules and models in Drools Libraries
*/
- public DroolsController build(Properties properties, List<? extends TopicSource> eventSources,
- List<? extends TopicSink> eventSinks) throws LinkageError;
+ DroolsController build(Properties properties, List<? extends TopicSource> eventSources,
+ List<? extends TopicSink> eventSinks) throws LinkageError;
/**
* Explicit construction of a Drools Controller.
@@ -59,33 +59,33 @@ public interface DroolsControllerFactory {
* @throws IllegalArgumentException with invalid parameters
* @throws LinkageError Failure to link rules and models in Drools Libraries
*/
- public DroolsController build(String groupId, String artifactId, String version,
- List<TopicCoderFilterConfiguration> decoderConfigurations,
- List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError;
+ DroolsController build(String groupId, String artifactId, String version,
+ List<TopicCoderFilterConfiguration> decoderConfigurations,
+ List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError;
/**
* Releases the Drools Controller from operation.
*
* @param controller the Drools Controller to shut down
*/
- public void shutdown(DroolsController controller);
+ void shutdown(DroolsController controller);
/**
* Disables all Drools Controllers from operation.
*/
- public void shutdown();
+ void shutdown();
/**
* Destroys and releases resources for a Drools Controller.
*
* @param controller the Drools Controller to destroy
*/
- public void destroy(DroolsController controller);
+ void destroy(DroolsController controller);
/**
* Destroys all Drools Controllers.
*/
- public void destroy();
+ void destroy();
/**
* Gets the Drools Controller associated with the maven group and artifact id.
@@ -97,12 +97,12 @@ public interface DroolsControllerFactory {
* @return the Drools Controller
* @throws IllegalArgumentException with invalid parameters
*/
- public DroolsController get(String groupId, String artifactId, String version);
+ DroolsController get(String groupId, String artifactId, String version);
/**
* returns the current inventory of Drools Controllers.
*
* @return a list of Drools Controllers
*/
- public List<DroolsController> inventory();
+ List<DroolsController> inventory();
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
index 77bfcf9f..9b832b04 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
@@ -375,7 +375,7 @@ public class MavenDroolsController implements DroolsController {
@Override
- public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) {
+ public boolean ownsCoder(Class<?> coderClass, int modelHash) {
if (!isClass(coderClass.getName())) {
logger.error("{}{} cannot be retrieved. ", this, coderClass.getName());
return false;
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
index 5416d321..a43a1467 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
@@ -138,7 +138,7 @@ public class NullDroolsController implements DroolsController {
}
@Override
- public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) {
+ public boolean ownsCoder(Class<?> coderClass, int modelHash) {
throw new IllegalStateException(makeInvokeMsg());
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
index 6cbe94ae..7e268591 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
@@ -120,7 +120,7 @@ public interface EventProtocolCoder {
* @param eventProtocolParams parameter object for event protocol
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public void addDecoder(EventProtocolParams eventProtocolParams);
+ void addDecoder(EventProtocolParams eventProtocolParams);
/**
* removes all decoders associated with the controller id.
@@ -140,7 +140,7 @@ public interface EventProtocolCoder {
* @param topic the topic
* @throws IllegalArgumentException if invalid arguments have been provided
*/
- public void removeDecoders(String groupId, String artifactId, String topic);
+ void removeDecoders(String groupId, String artifactId, String topic);
/**
* Given a controller id and a topic, it gives back its filters.
@@ -151,7 +151,7 @@ public interface EventProtocolCoder {
* @return list of decoders
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public List<CoderFilters> getDecoderFilters(String groupId, String artifactId, String topic);
+ List<CoderFilters> getDecoderFilters(String groupId, String artifactId, String topic);
/**
* gets all decoders associated with the group and artifact ids.
@@ -160,7 +160,7 @@ public interface EventProtocolCoder {
* @param artifactId of the controller
* @throws IllegalArgumentException if invalid arguments have been provided
*/
- public List<CoderFilters> getDecoderFilters(String groupId, String artifactId);
+ List<CoderFilters> getDecoderFilters(String groupId, String artifactId);
/**
* Given a controller id, a topic, and a classname, it gives back the classes that implements the decoding.
@@ -172,8 +172,8 @@ public interface EventProtocolCoder {
* @return list of decoders
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public CoderFilters getDecoderFilters(
- String groupId, String artifactId, String topic, String classname);
+ CoderFilters getDecoderFilters(
+ String groupId, String artifactId, String topic, String classname);
/**
* Given a controller id and a topic, it gives back the decoding configuration.
@@ -184,7 +184,7 @@ public interface EventProtocolCoder {
* @return decoding toolset
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public ProtocolCoderToolset getDecoders(String groupId, String artifactId, String topic);
+ ProtocolCoderToolset getDecoders(String groupId, String artifactId, String topic);
/**
* Given a controller id and a topic, it gives back all the decoding configurations.
@@ -194,7 +194,7 @@ public interface EventProtocolCoder {
* @return decoding toolset
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public List<ProtocolCoderToolset> getDecoders(String groupId, String artifactId);
+ List<ProtocolCoderToolset> getDecoders(String groupId, String artifactId);
/**
* Given a controller id and a topic, it gives back the classes that implements the encoding.
@@ -205,7 +205,7 @@ public interface EventProtocolCoder {
* @return list of decoders
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public List<CoderFilters> getEncoderFilters(String groupId, String artifactId, String topic);
+ List<CoderFilters> getEncoderFilters(String groupId, String artifactId, String topic);
/**
* gets all encoders associated with the group and artifact ids.
@@ -215,7 +215,7 @@ public interface EventProtocolCoder {
* @return List of filters
* @throws IllegalArgumentException if invalid arguments have been provided
*/
- public List<CoderFilters> getEncoderFilters(String groupId, String artifactId);
+ List<CoderFilters> getEncoderFilters(String groupId, String artifactId);
/**
* get encoder based on coordinates and classname.
@@ -227,8 +227,8 @@ public interface EventProtocolCoder {
* @return CoderFilters decoders
* @throws IllegalArgumentException invalid arguments passed in
*/
- public CoderFilters getEncoderFilters(
- String groupId, String artifactId, String topic, String classname);
+ CoderFilters getEncoderFilters(
+ String groupId, String artifactId, String topic, String classname);
/**
* is there a decoder supported for the controller id and topic.
@@ -238,7 +238,7 @@ public interface EventProtocolCoder {
* @param topic protocol
* @return true if supported
*/
- public boolean isDecodingSupported(String groupId, String artifactId, String topic);
+ boolean isDecodingSupported(String groupId, String artifactId, String topic);
/**
* Adds a Encoder class to encode the protocol over this topic.
@@ -246,7 +246,7 @@ public interface EventProtocolCoder {
* @param eventProtocolParams parameter object for event protocol
* @throw IllegalArgumentException if an invalid parameter is passed
*/
- public void addEncoder(EventProtocolParams eventProtocolParams);
+ void addEncoder(EventProtocolParams eventProtocolParams);
/**
* is there an encoder supported for the controller id and topic.
@@ -256,7 +256,7 @@ public interface EventProtocolCoder {
* @param topic protocol
* @return true if supported
*/
- public boolean isEncodingSupported(String groupId, String artifactId, String topic);
+ boolean isEncodingSupported(String groupId, String artifactId, String topic);
/**
* get encoder based on topic and encoded class.
@@ -266,7 +266,7 @@ public interface EventProtocolCoder {
* @return list of filters
* @throws IllegalArgumentException invalid arguments passed in
*/
- public List<CoderFilters> getReverseEncoderFilters(String topic, String encodedClass);
+ List<CoderFilters> getReverseEncoderFilters(String topic, String encodedClass);
/**
* gets the identifier of the creator of the encoder.
@@ -276,7 +276,7 @@ public interface EventProtocolCoder {
* @return a drools controller
* @throws IllegalArgumentException invalid arguments passed in
*/
- public DroolsController getDroolsController(String topic, Object encodedClass);
+ DroolsController getDroolsController(String topic, Object encodedClass);
/**
* gets the identifier of the creator of the encoder.
@@ -286,7 +286,7 @@ public interface EventProtocolCoder {
* @return list of drools controllers
* @throws IllegalArgumentException invalid arguments passed in
*/
- public List<DroolsController> getDroolsControllers(String topic, Object encodedClass);
+ List<DroolsController> getDroolsControllers(String topic, Object encodedClass);
/**
* decode topic's stringified event (json) to corresponding Event Object.
@@ -300,7 +300,7 @@ public interface EventProtocolCoder {
* @throws UnsupportedOperationException if the operation is not supported
* @throws IllegalStateException if the system is in an illegal state
*/
- public Object decode(String groupId, String artifactId, String topic, String json);
+ Object decode(String groupId, String artifactId, String topic, String json);
/**
* encodes topic's stringified event (json) to corresponding Event Object.
@@ -312,7 +312,7 @@ public interface EventProtocolCoder {
* @return encoded string
* @throws IllegalArgumentException invalid arguments passed in
*/
- public String encode(String groupId, String artifactId, String topic, Object event);
+ String encode(String groupId, String artifactId, String topic, Object event);
/**
* encodes topic's stringified event (json) to corresponding Event Object.
@@ -323,7 +323,7 @@ public interface EventProtocolCoder {
* @throws IllegalArgumentException invalid arguments passed in
* @throws UnsupportedOperationException operation cannot be performed
*/
- public String encode(String topic, Object event);
+ String encode(String topic, Object event);
/**
* encodes topic's stringified event (json) to corresponding Event Object.
@@ -335,5 +335,5 @@ public interface EventProtocolCoder {
* @throws IllegalArgumentException invalid arguments passed in
* @throws UnsupportedOperationException operation cannot be performed
*/
- public String encode(String topic, Object event, DroolsController droolsController);
+ String encode(String topic, Object event, DroolsController droolsController);
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
index cb0749d9..db09cb47 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
@@ -309,8 +309,8 @@ public interface PolicyEngine extends Startable, Lockable, TopicListener {
* {@code false} otherwise
* @return a new lock
*/
- public Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
- boolean waitForLock);
+ Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
+ boolean waitForLock);
/**
* Invoked when the host goes into the active state.
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
index 6e529c74..0f046d23 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
@@ -221,7 +221,7 @@ class PolicyEngineManager implements PolicyEngine {
defaultConfig.put(
PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME
+ PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
- "" + Integer.toString(TELEMETRY_SERVER_DEFAULT_PORT));
+ "" + TELEMETRY_SERVER_DEFAULT_PORT);
defaultConfig.put(
PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME
+ PolicyEndPointProperties.PROPERTY_HTTP_REST_PACKAGES_SUFFIX,
@@ -663,7 +663,7 @@ class PolicyEngineManager implements PolicyEngine {
@FunctionalInterface
private static interface PredicateWithEx<T> {
- public boolean test(T value) throws InterruptedException;
+ boolean test(T value) throws InterruptedException;
}
@Override
diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java
index e237a455..e7f65296 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java
@@ -32,7 +32,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kie.api.builder.ReleaseId;
diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
index 2bbb08bf..8607fd6d 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
@@ -84,8 +84,8 @@ public class ProtocolCoderToolsetTest {
public void testGsonToolset(JsonProtocolFilter protocolFilter) {
GsonProtocolCoderToolset gsonToolset = new GsonProtocolCoderToolset(
EventProtocolParams.builder().topic(JUNIT_PROTOCOL_CODER_TOPIC)
- .groupId(this.releaseId.getGroupId())
- .artifactId(this.releaseId.getArtifactId())
+ .groupId(releaseId.getGroupId())
+ .artifactId(releaseId.getArtifactId())
.eventClass(Triple.class.getName())
.protocolFilter(protocolFilter)
.customGsonCoder(null)
@@ -193,8 +193,8 @@ public class ProtocolCoderToolsetTest {
private void validateInitialization(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset) {
Assert.assertTrue(CONTROLLER_ID.equals(coderToolset.getControllerId()));
- Assert.assertTrue(this.releaseId.getGroupId().equals(coderToolset.getGroupId()));
- Assert.assertTrue(this.releaseId.getArtifactId().equals(coderToolset.getArtifactId()));
+ Assert.assertTrue(releaseId.getGroupId().equals(coderToolset.getGroupId()));
+ Assert.assertTrue(releaseId.getArtifactId().equals(coderToolset.getArtifactId()));
Assert.assertNull(coderToolset.getCustomCoder());
Assert.assertTrue(coderToolset.getCoders().size() == 1);