summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-16 02:03:12 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-16 02:04:11 +0100
commit952d4f5aab9913f961e77fa0457da5d38f31d94f (patch)
treed482ebae10ff11b3096dd85d927eca75825574d6
parenta65e4772f4557a109917532b2d9c49680ce3bb15 (diff)
Fix Sonar issues in apex
Fixing various Sonar issues in apex. Issue-ID: POLICY-1034 Change-Id: Ie693637d75bd7e38c71b7ba04886fb75636276ed Signed-off-by: liamfallon <liam.fallon@ericsson.com>
-rw-r--r--client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java2
-rw-r--r--client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java4
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java28
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java72
-rw-r--r--client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java15
-rw-r--r--client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java2
-rw-r--r--client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java4
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java2
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java8
-rw-r--r--client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java4
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java5
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java2
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java4
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java9
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java2
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java130
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java28
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java125
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java35
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java1
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java2
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java4
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java12
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java10
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java6
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java2
-rw-r--r--context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java5
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java2
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java66
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java1
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java4
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java4
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java2
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java2
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java4
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java6
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java2
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java2
-rw-r--r--plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/ApexEventListener.java1
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineServiceEventInterface.java1
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java2
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java10
-rw-r--r--testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java4
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java2
56 files changed, 352 insertions, 335 deletions
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
index 7e305788f..d56e05d29 100644
--- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
+++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ApexDeploymentRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexDeploymentRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
index fb18a002f..5026c5162 100644
--- a/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
+++ b/client/client-deployment/src/main/java/org/onap/policy/apex/client/deployment/rest/ParameterCheck.java
@@ -178,9 +178,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
index ea4f206ce..4d0959977 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorMain.java
@@ -65,20 +65,6 @@ public class ApexEditorMain {
private final PrintStream outStream;
/**
- * Main method, main entry point for command.
- *
- * @param args The command line arguments for the editor
- */
- public static void main(final String[] args) {
- try {
- final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
- editorMain.init();
- } catch (final Exception e) {
- LOGGER.error("start failed", e);
- }
- }
-
- /**
* Constructor, kicks off the editor.
*
* @param args The command line arguments for the editor
@@ -212,4 +198,18 @@ public class ApexEditorMain {
}
}
}
+
+ /**
+ * Main method, main entry point for command.
+ *
+ * @param args The command line arguments for the editor
+ */
+ public static void main(final String[] args) {
+ try {
+ final ApexEditorMain editorMain = new ApexEditorMain(args, System.out);
+ editorMain.init();
+ } catch (final Exception e) {
+ LOGGER.error("start failed", e);
+ }
+ }
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
index 72c294169..fed1a50ce 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/ApexEditorRestResource.java
@@ -536,10 +536,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -646,10 +646,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -690,10 +690,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -728,10 +728,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -849,10 +849,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -893,10 +893,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -931,10 +931,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1037,8 +1037,8 @@ public class ApexEditorRestResource {
final BeanEvent jsonbean = RestUtils.getJsonParameters(jsonString, BeanEvent.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty event name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateEvent");
return ret;
@@ -1085,10 +1085,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1124,10 +1124,10 @@ public class ApexEditorRestResource {
String version1 = version;
LOGGER.entry(name1, version1);
try {
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1171,10 +1171,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1374,8 +1374,8 @@ public class ApexEditorRestResource {
final BeanTask jsonbean = RestUtils.getJsonParameters(jsonString, BeanTask.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty task name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdateTask");
return ret;
@@ -1422,10 +1422,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1466,10 +1466,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1511,10 +1511,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1777,8 +1777,8 @@ public class ApexEditorRestResource {
final BeanPolicy jsonbean = RestUtils.getJsonParameters(jsonString, BeanPolicy.class);
- if (jsonbean.getName() == null || jsonbean.getName().equals("") || jsonbean.getVersion() == null
- || jsonbean.getVersion().equals("")) {
+ if (jsonbean.getName() == null || "".equals(jsonbean.getName()) || jsonbean.getVersion() == null
+ || "".equals(jsonbean.getVersion())) {
ret = new ApexApiResult(Result.FAILED, "Null/Empty Policy name/version (\"" + jsonbean.getName() + ":"
+ jsonbean.getVersion() + "\" passed to UpdatePolicy");
return ret;
@@ -1839,10 +1839,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
@@ -1884,10 +1884,10 @@ public class ApexEditorRestResource {
return ret;
}
- if (name1 == null || name1.equals("")) {
+ if (name1 == null || "".equals(name1)) {
name1 = null;
}
- if (version1 == null || version1.equals("")) {
+ if (version1 == null || "".equals(version1)) {
version1 = null;
}
diff --git a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
index 2bd47238a..2888b0376 100644
--- a/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
+++ b/client/client-editor/src/main/java/org/onap/policy/apex/client/editor/rest/RestUtils.java
@@ -49,6 +49,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public abstract class RestUtils {
+ // Regular expressions for checking input types
+ private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
+ /**
+ * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
+ */
+ private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
/**
* Constructor, block inheritance.
@@ -77,7 +83,7 @@ public abstract class RestUtils {
}
if (val.isJsonPrimitive() && ((JsonPrimitive) val).isString()) {
final String v = ((JsonPrimitive) val).getAsString();
- if (v == null || v.equals("")) {
+ if (v == null || "".equals(v)) {
return JsonNull.INSTANCE;
}
}
@@ -137,13 +143,6 @@ public abstract class RestUtils {
return gb.create().fromJson(jsonObject, clz);
}
- // Regular expressions for checking input types
- private static final String XML_INPUT_TYPE_REGEXP = "^\\s*<\\?xml.*>\\s*"; //starts with <?xml...>
- /**
- * starts with some kind of bracket [ or ( or {, then has something, then has bracket.
- */
- private static final String JSON_INPUT_TYPE_REGEXP = "^\\s*[\\(\\{\\[][\\s+\\S]*[\\)\\}\\]]";
-
/**
* Gets the concept from JSON.
*
diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
index bb27943d6..5812ebdb3 100644
--- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
+++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ApexServicesRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexServicesRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
index d0b374fd4..301b19f38 100644
--- a/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
+++ b/client/client-full/src/main/java/org/onap/policy/apex/client/full/rest/ParameterCheck.java
@@ -173,9 +173,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\" of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
index f5c8ad8c0..a72fbe0a7 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestParameterParser.java
@@ -38,7 +38,7 @@ import org.apache.commons.cli.ParseException;
*/
public class ApexMonitoringRestParameterParser {
// Apache Commons CLI options
- Options options;
+ private Options options;
/**
* Construct the options for the CLI RESTful services.
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
index f8cee7741..6b7f12061 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ApexMonitoringRestResource.java
@@ -195,9 +195,9 @@ public class ApexMonitoringRestResource {
parameterMap.put("AxArtifactKey#" + engineId, new String[]
{ startStop });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startEngine(engineKey);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopEngine(engineKey);
}
} catch (final Exception e) {
@@ -241,10 +241,10 @@ public class ApexMonitoringRestResource {
parameterMap.put("period", new String[]
{ Long.toString(period) });
final AxArtifactKey engineKey = ParameterCheck.getEngineKey(parameterMap);
- if (startStop.equals("Start")) {
+ if ("Start".equals(startStop)) {
engineServiceFacade.startPerioidicEvents(engineKey, period);
setPeriodicEventsState(host, true);
- } else if (startStop.equals("Stop")) {
+ } else if ("Stop".equals(startStop)) {
engineServiceFacade.stopPerioidicEvents(engineKey);
setPeriodicEventsState(host, false);
}
diff --git a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
index 90527751e..46e1452a5 100644
--- a/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
+++ b/client/client-monitoring/src/main/java/org/onap/policy/apex/client/monitoring/rest/ParameterCheck.java
@@ -173,9 +173,9 @@ public final class ParameterCheck {
}
ParameterCheck.StartStop startStop;
- if (startStopValue[0].equalsIgnoreCase("start")) {
+ if ("start".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.START;
- } else if (startStopValue[0].equalsIgnoreCase("stop")) {
+ } else if ("stop".equalsIgnoreCase(startStopValue[0])) {
startStop = ParameterCheck.StartStop.STOP;
} else {
LOGGER.warn("value \"{}\"of parameter \"{}\" not \"start\" or \"stop\"", startStopValue[0], startStopPar);
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java
index 3afd5c89d..436624b7d 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java
@@ -96,10 +96,7 @@ public class TestContextBooleanItem implements Serializable {
return false;
}
final TestContextBooleanItem other = (TestContextBooleanItem) obj;
- if (flag != other.flag) {
- return false;
- }
- return true;
+ return flag == other.flag;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java
index 2b107b492..eec5d2b47 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java
@@ -94,10 +94,7 @@ public class TestContextByteItem implements Serializable {
return false;
}
final TestContextByteItem other = (TestContextByteItem) obj;
- if (byteValue != other.byteValue) {
- return false;
- }
- return true;
+ return byteValue == other.byteValue;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
index f7c849023..188b69c05 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java
@@ -239,10 +239,7 @@ public class TestContextDateItem implements Serializable {
if (time != other.time) {
return false;
}
- if (year != other.year) {
- return false;
- }
- return true;
+ return year == other.year;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java
index efad26052..4712074a2 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java
@@ -241,10 +241,7 @@ public class TestContextDateLocaleItem implements Serializable {
} else if (!timeZoneString.equals(other.timeZoneString)) {
return false;
}
- if (utcOffset != other.utcOffset) {
- return false;
- }
- return true;
+ return utcOffset == other.utcOffset;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java
index ac4f5069f..26d98cdf4 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java
@@ -97,10 +97,7 @@ public class TestContextDoubleItem implements Serializable {
return false;
}
final TestContextDoubleItem other = (TestContextDoubleItem) obj;
- if (Double.doubleToLongBits(doubleValue) != Double.doubleToLongBits(other.doubleValue)) {
- return false;
- }
- return true;
+ return Double.doubleToLongBits(doubleValue) == Double.doubleToLongBits(other.doubleValue);
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java
index cd8165251..294cf5b55 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java
@@ -94,10 +94,7 @@ public class TestContextFloatItem implements Serializable {
return false;
}
final TestContextFloatItem other = (TestContextFloatItem) obj;
- if (Float.floatToIntBits(floatValue) != Float.floatToIntBits(other.floatValue)) {
- return false;
- }
- return true;
+ return Float.floatToIntBits(floatValue) == Float.floatToIntBits(other.floatValue);
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java
index 898302716..24cfebbc5 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java
@@ -103,10 +103,7 @@ public class TestContextIntItem implements Serializable {
return false;
}
final TestContextIntItem other = (TestContextIntItem) obj;
- if (intValue != other.intValue) {
- return false;
- }
- return true;
+ return intValue == other.intValue;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java
index be3ee60f8..025cde657 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java
@@ -95,10 +95,7 @@ public class TestContextLongItem implements Serializable {
return false;
}
final TestContextLongItem other = (TestContextLongItem) obj;
- if (longValue != other.longValue) {
- return false;
- }
- return true;
+ return longValue == other.longValue;
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java
index 215868d11..9027bfcbf 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java
@@ -30,7 +30,7 @@ public class TestContextLongObjectItem implements Serializable {
private static final int HASH_PRIME_1 = 31;
- private Long longValue = new Long(0);
+ private Long longValue = 0L;
/**
* The Constructor.
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java
index eed0c1a2f..538a5433e 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java
@@ -32,7 +32,7 @@ public class TestContextTreeMapItem implements Serializable {
private static final int HASH_PRIME_1 = 31;
- private Map<String, String> mapValue = new TreeMap<String, String>();
+ private Map<String, String> mapValue = new TreeMap<>();
/**
* The Constructor.
@@ -55,7 +55,7 @@ public class TestContextTreeMapItem implements Serializable {
*/
public Map<String, String> getMapValue() {
if (mapValue == null) {
- mapValue = new TreeMap<String, String>();
+ mapValue = new TreeMap<>();
}
return mapValue;
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java
index fe47c1af0..e38d9c640 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java
@@ -22,6 +22,7 @@ package org.onap.policy.apex.context.test.concepts;
import java.io.Serializable;
import java.util.Set;
+import java.util.SortedSet;
import java.util.TreeSet;
/**
@@ -32,7 +33,7 @@ public class TestContextTreeSetItem implements Serializable {
private static final int HASH_PRIME_1 = 31;
- private TreeSet<String> setValue = new TreeSet<String>();
+ private SortedSet<String> setValue = new TreeSet<>();
/**
* The Constructor.
@@ -51,7 +52,7 @@ public class TestContextTreeSetItem implements Serializable {
*
* @param setValue the set value
*/
- public TestContextTreeSetItem(final TreeSet<String> setValue) {
+ public TestContextTreeSetItem(final SortedSet<String> setValue) {
this.setValue = setValue;
}
@@ -62,7 +63,7 @@ public class TestContextTreeSetItem implements Serializable {
*/
public Set<String> getSetValue() {
if (setValue == null) {
- setValue = new TreeSet<String>();
+ setValue = new TreeSet<>();
}
return setValue;
}
@@ -72,7 +73,7 @@ public class TestContextTreeSetItem implements Serializable {
*
* @param setValue the sets the value
*/
- public void setSetValue(final TreeSet<String> setValue) {
+ public void setSetValue(final SortedSet<String> setValue) {
this.setValue = setValue;
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
index 189208fd5..0d2528791 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextAlbumUpdate.java
@@ -54,7 +54,7 @@ public class ContextAlbumUpdate {
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- public void testContextAlbumUpdate() throws ApexModelException, IOException, ApexException {
+ public void testContextAlbumUpdate() throws IOException, ApexException {
LOGGER.debug("Running TestContextAlbumUpdate test . . .");
final AxArtifactKey distributorKey = new AxArtifactKey(APEX_DISTRIBUTOR, VERSION);
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
index 75c615898..17c98a12d 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java
@@ -94,6 +94,17 @@ public class ContextInstantiation {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextInstantiation.class);
+ // Recurring string constants
+ private static final String TEST_POLICY_CONTEXT_ITEM000 = "TestPolicyContextItem000";
+ private static final String TEST_POLICY_CONTEXT_ITEM005 = "TestPolicyContextItem005";
+ private static final String TEST_POLICY_CONTEXT_ITEM004 = "TestPolicyContextItem004";
+ private static final String TEST_POLICY_CONTEXT_ITEM003 = "TestPolicyContextItem003";
+ private static final String TEST_POLICY_CONTEXT_ITEM002 = "TestPolicyContextItem002";
+ private static final String TEST_POLICY_CONTEXT_ITEM001 = "TestPolicyContextItem001";
+ private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
+ private static final String NULL_VALUES_ILLEGAL_TAG =
+ "album \"ExternalContextAlbum:0.0.1\" null values are illegal on key ";
+
private static final TreeSet<String> TEST_TREE_SET = new TreeSet<>();
private static final Map<String, String> TEST_HASH_MAP = new HashMap<>();
@@ -124,8 +135,8 @@ public class ContextInstantiation {
try {
- final ContextAlbum policyContextAlbum =
- contextDistributor.createContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION));
+ final ContextAlbum policyContextAlbum = contextDistributor
+ .createContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION));
assertNotNull(policyContextAlbum);
policyContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
@@ -142,8 +153,8 @@ public class ContextInstantiation {
policyContextAlbum.putAll(valueMap0);
- final TestPolicyContextItem contextItem =
- (TestPolicyContextItem) policyContextAlbum.get(TEST_POLICY_CONTEXT_ITEM);
+ final TestPolicyContextItem contextItem = (TestPolicyContextItem) policyContextAlbum
+ .get(TEST_POLICY_CONTEXT_ITEM);
assertEquals(STRING_VAL, contextItem.getTestPolicyContextItem000().getStringValue());
assertEquals(LONG_VAL, contextItem.getTestPolicyContextItem001().getLongValue());
@@ -152,8 +163,8 @@ public class ContextInstantiation {
assertEquals(contextItem.getTestPolicyContextItem004().getLongValue(), testDate.getTime());
assertEquals(TEST_HASH_MAP, contextItem.getTestPolicyContextItem005().getMapValue());
- final TestGlobalContextItem globalContext =
- getTestGlobalContextItem(contextDistributor, testDate, tci9, tciA);
+ final TestGlobalContextItem globalContext = getTestGlobalContextItem(contextDistributor, testDate, tci9,
+ tciA);
final Map<String, Object> valueMap1 = new HashMap<>();
valueMap1.put(GLOBAL_CONTEXT_KEY, globalContext);
@@ -162,8 +173,8 @@ public class ContextInstantiation {
globalContextAlbum.putAll(valueMap1);
- final TestGlobalContextItem globalContextItem =
- (TestGlobalContextItem) globalContextAlbum.get(GLOBAL_CONTEXT_KEY);
+ final TestGlobalContextItem globalContextItem = (TestGlobalContextItem) globalContextAlbum
+ .get(GLOBAL_CONTEXT_KEY);
assertFalse(globalContextItem.getTestGlobalContextItem000().getFlag());
@@ -176,13 +187,13 @@ public class ContextInstantiation {
assertDouble(PI_VAL, globalContextItem.getTestGlobalContextItem005().getDoubleValue());
assertEquals(STRING_GLOBAL_VAL, globalContextItem.getTestGlobalContextItem006().getStringValue());
- assertEquals(new Long(testDate.getTime()), globalContextItem.getTestGlobalContextItem007().getLongValue());
+ assertEquals((Long) testDate.getTime(), globalContextItem.getTestGlobalContextItem007().getLongValue());
assertEquals(testDate, globalContextItem.getTestGlobalContextItem008().getDateValue());
assertEquals(tci9.getDateValue().getTime(),
- globalContextItem.getTestGlobalContextItem009().getDateValue().getTime());
+ globalContextItem.getTestGlobalContextItem009().getDateValue().getTime());
assertEquals(tciA.getDateValue().getTime(),
- globalContextItem.getTestGlobalContextItem00A().getDateValue().getTime());
+ globalContextItem.getTestGlobalContextItem00A().getDateValue().getTime());
assertEquals(TEST_TREE_SET, globalContextItem.getTestGlobalContextItem00B().getSetValue());
assertEquals(TEST_HASH_MAP, globalContextItem.getTestGlobalContextItem00C().getMapValue());
@@ -190,8 +201,8 @@ public class ContextInstantiation {
final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel();
final TestContextDateTzItem tci9A = new TestContextDateTzItem(tci9);
- final TestContextDateLocaleItem tciA_A = new TestContextDateLocaleItem(tciA);
- final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciA_A);
+ final TestContextDateLocaleItem tciAa = new TestContextDateLocaleItem(tciA);
+ final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciAa);
final Map<String, Object> valueMap2 = new HashMap<>();
valueMap2.put(EXTERNAL_CONTEXT, externalContext);
@@ -208,8 +219,8 @@ public class ContextInstantiation {
externalContextAlbum.putAll(valueMap2);
externalContextAlbum.getAlbumDefinition().setWritable(false);
- TestExternalContextItem externalContextItem =
- (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT);
+ TestExternalContextItem externalContextItem = (TestExternalContextItem) externalContextAlbum
+ .get(EXTERNAL_CONTEXT);
assertFalse(externalContextItem.getTestExternalContextItem000().getFlag());
assertEquals(BYTE_VAL, externalContextItem.getTestExternalContextItem001().getByteValue());
@@ -220,14 +231,13 @@ public class ContextInstantiation {
assertDouble(PI_VAL, externalContextItem.getTestExternalContextItem005().getDoubleValue());
assertEquals(STRING_EXT_VAL, externalContextItem.getTestExternalContextItem006().getStringValue());
- assertEquals(new Long(testDate.getTime()),
- externalContextItem.getTestExternalContextItem007().getLongValue());
+ assertEquals((Long) testDate.getTime(), externalContextItem.getTestExternalContextItem007().getLongValue());
assertEquals(testDate, externalContextItem.getTestExternalContextItem008().getDateValue());
assertEquals(tci9A.getDateValue().getTime(),
- externalContextItem.getTestExternalContextItem009().getDateValue().getTime());
+ externalContextItem.getTestExternalContextItem009().getDateValue().getTime());
- assertEquals(tciA_A.getDateValue().getTime(),
- externalContextItem.getTestExternalContextItem00A().getDateValue().getTime());
+ assertEquals(tciAa.getDateValue().getTime(),
+ externalContextItem.getTestExternalContextItem00A().getDateValue().getTime());
assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue());
@@ -240,7 +250,8 @@ public class ContextInstantiation {
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("album \"ExternalContextAlbum:0.0.1\" clear() not allowed on read only albums",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(1, externalContextAlbum.size());
@@ -254,8 +265,8 @@ public class ContextInstantiation {
externalContextAlbum.get(null);
} catch (final ContextRuntimeException e) {
assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for get()",
- e.getMessage());
-
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
final Object aObject = externalContextAlbum.get(EXTERNAL_CONTEXT);
@@ -266,16 +277,17 @@ public class ContextInstantiation {
externalContextAlbum.put(null, null);
} catch (final ContextRuntimeException e) {
assertEquals("album \"ExternalContextAlbum:0.0.1\" null keys are illegal on keys for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
externalContextAlbum.put("TestExternalContextItem00A", null);
} catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItem00A\" for put()", e.getMessage());
+ assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- assertEquals(tciA_A, externalContextItem.getTestExternalContextItem00A());
+ assertEquals(tciAa, externalContextItem.getTestExternalContextItem00A());
// Should return the hash set
assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue());
@@ -300,24 +312,24 @@ public class ContextInstantiation {
try {
externalContextAlbum.put("TestExternalContextItem00A", null);
} catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItem00A\" for put()"));
+ assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItem00A\" for put()"));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.get(EXTERNAL_CONTEXT).equals(externalContext));
try {
externalContextAlbum.put("TestExternalContextItemFFF", null);
} catch (final ContextRuntimeException e) {
- assert (e.getMessage().equals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItemFFF\" for put()"));
+ assert (e.getMessage().equals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()"));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(1, externalContextAlbum.size());
try {
externalContextAlbum.put("TestExternalContextItemFFF", null);
} catch (final ContextRuntimeException e) {
- assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key "
- + "\"TestExternalContextItemFFF\" for put()", e.getMessage());
+ assertEquals(NULL_VALUES_ILLEGAL_TAG + "\"TestExternalContextItemFFF\" for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(1, externalContextAlbum.size());
@@ -336,11 +348,12 @@ public class ContextInstantiation {
}
private void assertContextAlbumContains(final TestExternalContextItem externalContext,
- final ContextAlbum externalContextAlbum) {
+ final ContextAlbum externalContextAlbum) {
try {
externalContextAlbum.containsKey(null);
} catch (final ContextRuntimeException e) {
assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.containsKey(EXTERNAL_CONTEXT));
@@ -350,6 +363,7 @@ public class ContextInstantiation {
externalContextAlbum.containsValue(null);
} catch (final ContextRuntimeException e) {
assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(externalContextAlbum.containsValue(externalContext));
@@ -357,15 +371,15 @@ public class ContextInstantiation {
}
private ContextAlbum getContextAlbum(final Distributor contextDistributor) throws ContextException {
- final ContextAlbum globalContextAlbum =
- contextDistributor.createContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION));
+ final ContextAlbum globalContextAlbum = contextDistributor
+ .createContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION));
assertNotNull(globalContextAlbum);
globalContextAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
return globalContextAlbum;
}
private TestGlobalContextItem getTestGlobalContextItem(final Distributor contextDistributor, final Date testDate,
- final TestContextDateTzItem tci9, final TestContextDateLocaleItem tciA) throws ContextException {
+ final TestContextDateTzItem tci9, final TestContextDateLocaleItem tciA) throws ContextException {
final AxContextModel globalContextModel = TestContextAlbumFactory.createGlobalContextModel();
final TestGlobalContextItem globalContext = getTestGlobalContextItem(testDate, tci9, tciA);
contextDistributor.registerModel(globalContextModel);
@@ -373,14 +387,14 @@ public class ContextInstantiation {
}
private TestGlobalContextItem getTestGlobalContextItem(final Date testDate, final TestContextDateTzItem tci9,
- final TestContextDateLocaleItem tciA) {
+ final TestContextDateLocaleItem tciA) {
final TestGlobalContextItem globalContext = new TestGlobalContextItem();
final TestContextBooleanItem testGlobalContextItem000 = new TestContextBooleanItem(false);
final TestContextByteItem testGlobalContextItem001 = new TestContextByteItem(BYTE_VAL);
final TestContextIntItem testGlobalContextItem002 = new TestContextIntItem(INT_VAL);
final TestContextLongItem testGlobalContextItem003 = new TestContextLongItem(LONG_VAL);
- final TestContextFloatItem testGlobalContextItem004 = new TestContextFloatItem(new Float(FLOAT_VAL));
+ final TestContextFloatItem testGlobalContextItem004 = new TestContextFloatItem(FLOAT_VAL);
final TestContextDoubleItem testGlobalContextItem005 = new TestContextDoubleItem(PI_VAL);
final TestContextStringItem testGlobalContextItem006 = new TestContextStringItem(STRING_GLOBAL_VAL);
final TestContextLongObjectItem testGlobalContextItem007 = new TestContextLongObjectItem(testDate.getTime());
@@ -389,7 +403,6 @@ public class ContextInstantiation {
final TestContextTreeSetItem testGlobalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
final TestContextTreeMapItem testGlobalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
globalContext.setTestGlobalContextItem000(testGlobalContextItem000);
globalContext.setTestGlobalContextItem001(testGlobalContextItem001);
globalContext.setTestGlobalContextItem002(testGlobalContextItem002);
@@ -415,12 +428,12 @@ public class ContextInstantiation {
final TestContextTreeMapItem contextTreeMapItem = new TestContextTreeMapItem(TEST_HASH_MAP);
final Map<String, Object> valueMapA = new LinkedHashMap<>();
- valueMapA.put("TestPolicyContextItem001", contextLongItem);
- valueMapA.put("TestPolicyContextItem002", contextDoubleItem);
- valueMapA.put("TestPolicyContextItem003", contextBooleanItem);
- valueMapA.put("TestPolicyContextItem004", contextLongItem2);
- valueMapA.put("TestPolicyContextItem005", contextTreeMapItem);
- valueMapA.put("TestPolicyContextItem000", contextStringItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM001, contextLongItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM002, contextDoubleItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM003, contextBooleanItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM004, contextLongItem2);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM005, contextTreeMapItem);
+ valueMapA.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
assertPutMethods(policyContextAlbum, contextStringItem, valueMapA);
@@ -438,23 +451,24 @@ public class ContextInstantiation {
}
private void assertPutMethods(final ContextAlbum policyContextAlbum, final TestContextStringItem contextStringItem,
- final Map<String, Object> valueMapA) {
+ final Map<String, Object> valueMapA) {
try {
- policyContextAlbum.put("TestPolicyContextItem000", contextStringItem);
+ policyContextAlbum.put(TEST_POLICY_CONTEXT_ITEM000, contextStringItem);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
- assertEquals(
- getMessage("TestPolicyContextItem000", "TestContextItem006",
+ assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006",
TestContextStringItem.class.getCanonicalName(), "stringValue=" + STRING_VAL),
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
policyContextAlbum.putAll(valueMapA);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
- assertEquals(getMessage("TestPolicyContextItem001", "TestContextItem003",
- TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage());
+ assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003",
+ TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
}
@@ -487,7 +501,7 @@ public class ContextInstantiation {
}
private TestExternalContextItem getTestExternalContextItem(final Date testDate, final TestContextDateTzItem tci9A,
- final TestContextDateLocaleItem tciAa) {
+ final TestContextDateLocaleItem tciAa) {
final TestExternalContextItem externalContext = new TestExternalContextItem();
final TestContextBooleanItem testExternalContextItem000 = new TestContextBooleanItem(false);
@@ -502,7 +516,6 @@ public class ContextInstantiation {
final TestContextTreeSetItem testExternalContextItem00B = new TestContextTreeSetItem(TEST_TREE_SET);
final TestContextTreeMapItem testExternalContextItem00C = new TestContextTreeMapItem(TEST_HASH_MAP);
-
externalContext.setTestExternalContextItem000(testExternalContextItem000);
externalContext.setTestExternalContextItem001(testExternalContextItem001);
externalContext.setTestExternalContextItem002(testExternalContextItem002);
@@ -524,10 +537,10 @@ public class ContextInstantiation {
}
private String getMessage(final String key, final String objName, final String clazzName, final String valString,
- final String compatibleClazzName) {
+ final String compatibleClazzName) {
return "Failed to set context value for key \"" + key + "\" in album \"PolicyContextAlbum:0.0.1\": "
- + "PolicyContextAlbum:0.0.1: object \"" + objName + " [" + valString + "]\" " + "of class \""
- + clazzName + "\"" + " not compatible with class \"" + compatibleClazzName + "\"";
+ + "PolicyContextAlbum:0.0.1: object \"" + objName + " [" + valString + "]\" " + "of class \""
+ + clazzName + "\"" + " not compatible with class \"" + compatibleClazzName + "\"";
}
private void assertFloat(final float actual, final float expected) {
@@ -538,7 +551,6 @@ public class ContextInstantiation {
assertTrue(Double.compare(actual, expected) == 0);
}
-
private Distributor getDistributor() throws ContextException {
final AxArtifactKey distributorKey = new AxArtifactKey("ApexDistributorInit", VERSION);
final Distributor distributor = new DistributorFactory().getDistributor(distributorKey);
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
index 95d14324c..d6a55effb 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java
@@ -62,8 +62,11 @@ import org.slf4j.ext.XLoggerFactory;
* @author Sergey Sachkov (sergey.sachkov@ericsson.com)
*/
public class ContextUpdate {
+ // Recurring string constants.
+ private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
+
private static final String ZERO = "zero";
- private static final String _0 = "0";
+ private static final String NUMBER_ZERO = "0";
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ContextUpdate.class);
@@ -74,7 +77,7 @@ public class ContextUpdate {
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- public void testContextUpdate() throws ApexModelException, IOException, ApexException {
+ public void testContextUpdate() throws IOException, ApexException {
LOGGER.debug("Running TestContextUpdate test . . .");
final Distributor contextDistributor = getDistributor();
@@ -86,35 +89,38 @@ public class ContextUpdate {
final TestContextDateLocaleItem tciA = getTestContextDateLocaleItem();
final TestContextTreeMapItem tciC = getTestContextTreeMapItem();
- longContextAlbum.put(_0, (long) 0);
- longContextAlbum.put(_0, 0);
- longContextAlbum.put(_0, _0);
+ longContextAlbum.put(NUMBER_ZERO, (long) 0);
+ longContextAlbum.put(NUMBER_ZERO, 0);
+ longContextAlbum.put(NUMBER_ZERO, NUMBER_ZERO);
try {
- longContextAlbum.put(_0, ZERO);
+ longContextAlbum.put(NUMBER_ZERO, ZERO);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\":"
+ " LongContextAlbum:0.0.1: object \"zero\" of class \"java.lang.String\" not compatible with"
+ " class \"java.lang.Long\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
- longContextAlbum.put(_0, "");
+ longContextAlbum.put(NUMBER_ZERO, "");
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals(
"Failed to set context value for key \"0\" in album \"LongContextAlbum:0.0.1\": LongContextAlbum"
+ ":0.0.1: object \"\" of class \"java.lang.String\" not compatible with class \"java.lang.Long\"",
e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
- longContextAlbum.put(_0, null);
+ longContextAlbum.put(NUMBER_ZERO, null);
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("album \"LongContextAlbum:0.0.1\" null values are illegal on key \"0\" for put()",
e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
try {
@@ -122,6 +128,7 @@ public class ContextUpdate {
fail(EXCEPTION_MESSAGE);
} catch (final ContextRuntimeException e) {
assertEquals("album \"LongContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertNull(dateContextAlbum.put("date0", tciA));
@@ -136,14 +143,13 @@ public class ContextUpdate {
private TestContextTreeMapItem getTestContextTreeMapItem() {
final Map<String, String> testHashMap = new HashMap<>();
- testHashMap.put(_0, ZERO);
+ testHashMap.put(NUMBER_ZERO, ZERO);
testHashMap.put("1", "one");
testHashMap.put("2", "two");
testHashMap.put("3", "three");
testHashMap.put("4", "four");
- final TestContextTreeMapItem tciC = new TestContextTreeMapItem(testHashMap);
- return tciC;
+ return new TestContextTreeMapItem(testHashMap);
}
private TestContextDateLocaleItem getTestContextDateLocaleItem() {
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
index 244bd7d24..293ef9205 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java
@@ -67,19 +67,31 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-
-
/**
* The Class SequentialContextInstantiation checks sequential initiation of context.
*
* @author Sergey Sachkov (sergey.sachkov@ericsson.com)
*/
public class SequentialContextInstantiation {
- private static final String DV1 = "dv1";
- private static final String DV0 = "dv0";
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(SequentialContextInstantiation.class);
+ // Recurring string constants.
+ private static final String TEST_AB = "TestAB";
+ private static final String TEST_AA = "TestAA";
+ private static final String ITEM_NULL = "ItemNull";
+ private static final String ITEM06 = "Item06";
+ private static final String ITEM05 = "Item05";
+ private static final String ITEM03 = "Item03";
+ private static final String ITEM02 = "Item02";
+ private static final String ITEM01 = "Item01";
+ private static final String ITEM00_2 = "Item00_2";
+
+ // Recurring string constants.
+ private static final String NORMAL_TEST_EXCEPTION = "normal test exception";
+ private static final String DV1 = "dv1";
+ private static final String DV0 = "dv0";
+
/**
* Test sequential context instantiation.
*
@@ -107,8 +119,10 @@ public class SequentialContextInstantiation {
dateAlbum.put("tci9", tci9);
} catch (final Exception e) {
final String message = "class \"" + TestContextDateTzItem.class.getCanonicalName()
- + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName() + "\"";
+ + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName()
+ + "\"";
assertTrue(e.getMessage().contains(message));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
final TestContextDateLocaleItem tciA01 = new TestContextDateLocaleItem(tciA00);
@@ -116,15 +130,15 @@ public class SequentialContextInstantiation {
final TestContextDateLocaleItem tciA03 = new TestContextDateLocaleItem(tciA00);
final Map<String, Object> valueMap0 = new HashMap<>();
- valueMap0.put("Item01", tciA01);
- valueMap0.put("Item02", tciA02);
- valueMap0.put("Item03", tciA03);
+ valueMap0.put(ITEM01, tciA01);
+ valueMap0.put(ITEM02, tciA02);
+ valueMap0.put(ITEM03, tciA03);
dateAlbum.putAll(valueMap0);
assertEquals(5, dateAlbum.size());
- assertEquals(tciA01, dateAlbum.get("Item01"));
- assertEquals(tciA02, dateAlbum.get("Item02"));
- assertEquals(tciA03, dateAlbum.get("Item03"));
+ assertEquals(tciA01, dateAlbum.get(ITEM01));
+ assertEquals(tciA02, dateAlbum.get(ITEM02));
+ assertEquals(tciA03, dateAlbum.get(ITEM03));
final Map<String, Object> valueMap1 = getMap(testDate, tciA00, tci9);
@@ -135,31 +149,32 @@ public class SequentialContextInstantiation {
dateAlbum1.putAll(valueMap1);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
- assertTrue(e.getMessage().endsWith(
- "not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName() + "\""));
+ assertTrue(e.getMessage().endsWith("not compatible with class \""
+ + TestContextDateLocaleItem.class.getCanonicalName() + "\""));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(5, dateAlbum1.size());
valueMap1.clear();
- valueMap1.put("Item00_2", tciA00);
+ valueMap1.put(ITEM00_2, tciA00);
dateAlbum1.putAll(valueMap1);
assertEquals(6, dateAlbum1.size());
- assertEquals(tciA00, dateAlbum1.get("Item00_2"));
- dateAlbum.remove("Item00_2");
+ assertEquals(tciA00, dateAlbum1.get(ITEM00_2));
+ dateAlbum.remove(ITEM00_2);
assertEquals(5, dateAlbum1.size());
final ContextAlbum dateAlbumCopy = getContextAlbum(DATE_CONTEXT_ALBUM, contextDistributor);
final Map<String, Object> valueMap2 = new HashMap<>();
valueMap2.put("Item04", tciA01);
- valueMap2.put("Item05", tciA02);
- valueMap2.put("Item06", tciA03);
+ valueMap2.put(ITEM05, tciA02);
+ valueMap2.put(ITEM06, tciA03);
dateAlbumCopy.putAll(valueMap2);
assertEquals(8, dateAlbumCopy.size());
- assertEquals(tciA03, dateAlbumCopy.get("Item06"));
+ assertEquals(tciA03, dateAlbumCopy.get(ITEM06));
final Collection<Object> mapValues = dateAlbum.values();
assertTrue(dateAlbumCopy.values().containsAll(mapValues));
@@ -168,18 +183,17 @@ public class SequentialContextInstantiation {
dateAlbum1.clear();
assertTrue(dateAlbum1.isEmpty());
-
dateAlbum.put("Item00", tciA00);
final Map<String, Object> valueMap3 = new HashMap<>();
- valueMap3.put("Item01", tciA01);
- valueMap3.put("Item02", tciA02);
- valueMap3.put("Item03", tciA03);
+ valueMap3.put(ITEM01, tciA01);
+ valueMap3.put(ITEM02, tciA02);
+ valueMap3.put(ITEM03, tciA03);
dateAlbum.putAll(valueMap3);
final Map<String, Object> valueMap4 = new HashMap<>();
valueMap4.put("Item04", tciA01);
- valueMap4.put("Item05", tciA02);
- valueMap4.put("Item06", tciA03);
+ valueMap4.put(ITEM05, tciA02);
+ valueMap4.put(ITEM06, tciA03);
dateAlbumCopy.putAll(valueMap4);
@@ -191,9 +205,9 @@ public class SequentialContextInstantiation {
assertAlbumGetAndPutMethods(dateAlbum, tciA03, tciA00);
// Should do removes
- dateAlbum.remove("TestAA");
- dateAlbum.remove("TestAB");
- dateAlbum.remove("ItemNull");
+ dateAlbum.remove(TEST_AA);
+ dateAlbum.remove(TEST_AB);
+ dateAlbum.remove(ITEM_NULL);
assertEquals(7, entrySet.size());
assertTrue(dateAlbumCopy.values().containsAll(mapValues));
// CHECKSTYLE:ON: checkstyle:magicNumber
@@ -208,16 +222,17 @@ public class SequentialContextInstantiation {
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("null values are illegal on method parameter \"key\"", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- assertTrue(dateAlbum.containsKey("Item05"));
+ assertTrue(dateAlbum.containsKey(ITEM05));
assertTrue(!dateAlbum.containsKey("Item07"));
try {
dateAlbum.containsValue(null);
} catch (final Exception e) {
assertEquals("null values are illegal on method parameter \"value\"", e.getMessage());
-
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertTrue(dateAlbum.containsValue(tciA01));
@@ -225,75 +240,81 @@ public class SequentialContextInstantiation {
}
private void assertAlbumGetAndPutMethods(final ContextAlbum dateAlbum, final TestContextDateLocaleItem tciA03,
- final TestContextDateLocaleItem tciA00) {
+ final TestContextDateLocaleItem tciA00) {
try {
dateAlbum.get(null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for get()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- final Object aObject = dateAlbum.get("Item03");
+ final Object aObject = dateAlbum.get(ITEM03);
assertEquals(tciA03, aObject);
try {
dateAlbum.put(null, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null keys are illegal on keys for put()", e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
// Put null ContextItem should work (return null)
try {
- dateAlbum.put("ItemNull", null);
+ dateAlbum.put(ITEM_NULL, null);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
// Should return null
- assertNull(dateAlbum.get("ItemNull"));
+ assertNull(dateAlbum.get(ITEM_NULL));
// Put should return the previous contextItem
tciA00.setDst(false);
- final TestContextDateLocaleItem tciA03_clone = new TestContextDateLocaleItem(tciA03);
- tciA03_clone.setDst(true);
- TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03_clone);
+ final TestContextDateLocaleItem tciA03Clone = new TestContextDateLocaleItem(tciA03);
+ tciA03Clone.setDst(true);
+ TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03Clone);
assertEquals(tciA03, retItem);
- retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03);
- assertEquals(tciA03_clone, retItem);
+ retItem = (TestContextDateLocaleItem) dateAlbum.put(ITEM03, tciA03);
+ assertEquals(tciA03Clone, retItem);
try {
- dateAlbum.put("ItemNull", null);
+ dateAlbum.put(ITEM_NULL, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
- assert (e.getMessage()
- .equals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"));
+ assert ("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"ItemNull\" for put()"
+ .equals(e.getMessage()));
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
- dateAlbum.put("TestAA", tciA00);
- assertEquals(tciA00, dateAlbum.get("TestAA"));
+ dateAlbum.put(TEST_AA, tciA00);
+ assertEquals(tciA00, dateAlbum.get(TEST_AA));
// Should print warning
try {
- dateAlbum.put("TestAA", null);
+ dateAlbum.put(TEST_AA, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAA\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(8, dateAlbum.size());
try {
- dateAlbum.put("TestAB", null);
+ dateAlbum.put(TEST_AB, null);
fail(EXCEPTION_MESSAGE);
} catch (final Exception e) {
assertEquals("album \"DateContextAlbum:0.0.1\" null values are illegal on key \"TestAB\" for put()",
- e.getMessage());
+ e.getMessage());
+ LOGGER.trace(NORMAL_TEST_EXCEPTION, e);
}
assertEquals(8, dateAlbum.size());
}
private Map<String, Object> getMap(final Date testDate, final TestContextDateLocaleItem tciA00,
- final TestContextDateTzItem tci9) {
+ final TestContextDateTzItem tci9) {
final TestContextBooleanItem testBadItem000 = new TestContextBooleanItem();
final TestContextByteItem testBadItem001 = new TestContextByteItem();
final TestContextIntItem testBadItem002 = new TestContextIntItem();
@@ -325,7 +346,7 @@ public class SequentialContextInstantiation {
values.put("TestBadItem007", testBadItem007);
values.put("TestBadItem008", testBadItem008);
values.put("TestBadItem009", tci9);
- values.put("Item00_2", tciA00);
+ values.put(ITEM00_2, tciA00);
return values;
}
@@ -348,7 +369,7 @@ public class SequentialContextInstantiation {
}
private ContextAlbum getContextAlbum(final String albumName, final Distributor contextDistributor)
- throws ContextException {
+ throws ContextException {
final ContextAlbum dateAlbum = contextDistributor.createContextAlbum(new AxArtifactKey(albumName, VERSION));
assertNotNull(dateAlbum);
dateAlbum.setUserArtifactStack(Constants.getAxArtifactKeyArray());
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
index 3003344b3..9689acb3d 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/factory/TestContextAlbumFactory.java
@@ -48,7 +48,10 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class TestContextAlbumFactory {
-
+ // Recurring string constants.
+ private static final String CONTEXT = "context";
+ private static final String SCHEMAS2 = "Schemas";
+ private static final String KEY_INFO_MAP_KEY = "KeyInfoMapKey";
private static final String APPLICATION = "APPLICATION";
private static final String JAVA_LONG = Long.class.getCanonicalName();
private static final String JAVA_FLAVOUR = "Java";
@@ -69,12 +72,12 @@ public final class TestContextAlbumFactory {
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION),
APPLICATION, true, policySchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(policySchema.getKey(), policySchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("PolicyContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
@@ -94,12 +97,12 @@ public final class TestContextAlbumFactory {
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION),
"GLOBAL", true, globalSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(globalSchema.getKey(), globalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("GlobalContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
@@ -119,12 +122,12 @@ public final class TestContextAlbumFactory {
final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(EXTERNAL_CONTEXT_ALBUM, VERSION),
"EXTERNAL", true, externalSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(externalSchema.getKey(), externalSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition.getKey(), albumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("ExternalContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
@@ -150,13 +153,13 @@ public final class TestContextAlbumFactory {
final AxContextAlbum albumDefinition2 =
new AxContextAlbum(longContextAlbumKey2, APPLICATION, true, longSchema.getKey());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(albumDefinition1.getKey(), albumDefinition1);
albums.getAlbumsMap().put(albumDefinition2.getKey(), albumDefinition2);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel =
new AxContextModel(new AxArtifactKey("LongContextModel", VERSION), schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
@@ -180,7 +183,7 @@ public final class TestContextAlbumFactory {
final AxContextSchema mapSchema = new AxContextSchema(new AxArtifactKey("MapSchema", VERSION), JAVA_FLAVOUR,
TestContextTreeMapItem.class.getCanonicalName());
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", VERSION));
+ final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION));
schemas.getSchemasMap().put(longSchema.getKey(), longSchema);
schemas.getSchemasMap().put(lTypeSchema.getKey(), lTypeSchema);
schemas.getSchemasMap().put(dateSchema.getKey(), dateSchema);
@@ -195,13 +198,13 @@ public final class TestContextAlbumFactory {
final AxContextAlbum mapAlbumDefinition = new AxContextAlbum(new AxArtifactKey(MAP_CONTEXT_ALBUM, VERSION),
APPLICATION, true, mapSchema.getKey());
- final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("context", VERSION));
+ final AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey(CONTEXT, VERSION));
albums.getAlbumsMap().put(longAlbumDefinition.getKey(), longAlbumDefinition);
albums.getAlbumsMap().put(lTypeAlbumDefinition.getKey(), lTypeAlbumDefinition);
albums.getAlbumsMap().put(dateAlbumDefinition.getKey(), dateAlbumDefinition);
albums.getAlbumsMap().put(mapAlbumDefinition.getKey(), mapAlbumDefinition);
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", VERSION));
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey(KEY_INFO_MAP_KEY, VERSION));
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("MultiAlbumsContextModel", VERSION),
schemas, albums, keyInformation);
contextModel.setKeyInformation(keyInformation);
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java
index 1253d2234..d1127ffa3 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/AlbumModifier.java
@@ -26,6 +26,7 @@ import org.onap.policy.apex.context.ContextException;
/**
* The Interface AlbumModifier defines the interface to allow context albums be modified during context tests.
*/
+@FunctionalInterface
public interface AlbumModifier {
/**
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java
index 82de5b4a7..c4e6ac43a 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/lock/modifier/LockType.java
@@ -64,7 +64,7 @@ public enum LockType {
*
* @param value the value
*/
- private LockType(final int value) {
+ LockType(final int value) {
this.value = value;
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
index 88cdccc88..87ffa3b40 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java
@@ -67,7 +67,7 @@ public class ConcurrentContext {
* @throws ApexException the Apex exception occurs in handling Apex
*/
public Map<String, TestContextLongItem> testConcurrentContext()
- throws ApexModelException, IOException, ApexException {
+ throws IOException, ApexException {
try {
setupAndVerifyContext();
@@ -140,7 +140,7 @@ public class ConcurrentContext {
*
* @throws ContextException the context exception
*/
- private void setupAndVerifyContext() throws ContextException {
+ private void setupAndVerifyContext() {
contextDistributor = configrationProvider.getDistributor();
ltypeAlbum = configrationProvider.getContextAlbum(contextDistributor);
final Map<String, Object> initValues = configrationProvider.getContextAlbumInitValues();
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
index 7d7548569..b8e052947 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java
@@ -119,7 +119,7 @@ public final class ConcurrentContextJvm {
public static void main(final String[] args) throws Exception {
configure();
- System.out.println("JVM Arguments: " + Arrays.toString(args));
+ LOGGER.info("JVM Arguments: " + Arrays.toString(args));
// CHECKSTYLE:OFF: checkstyle:magicNumber
// An even number of arguments greater than 3
@@ -137,7 +137,7 @@ public final class ConcurrentContextJvm {
final int threadLoops = getIntValue("threadLoops", args, 3);
final int albumSize = getIntValue("albumSize", args, 4);
final int lockType = getIntValue("lockType", args, 5);
- final String hazelCastfileLocation = getStringValue("hazelcast file location", args, 6);;
+ final String hazelCastfileLocation = getStringValue("hazelcast file location", args, 6);
System.setProperty("hazelcast.config", hazelCastfileLocation);
@@ -162,10 +162,8 @@ public final class ConcurrentContextJvm {
} catch (final Exception e) {
LOGGER.error("error running test in JVM", e);
- return;
}
// CHECKSTYLE:ON: checkstyle:magicNumber
-
}
private static String getStringValue(final String key, final String[] args, final int position) {
@@ -204,7 +202,7 @@ public final class ConcurrentContextJvm {
// first non-loopback
// IPv4 address
// on a host
- final TreeSet<String> ipAddressSet = new TreeSet<String>();
+ final TreeSet<String> ipAddressSet = new TreeSet<>();
final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (final NetworkInterface netint : Collections.list(nets)) {
@@ -217,10 +215,10 @@ public final class ConcurrentContextJvm {
}
}
- if (ipAddressSet.size() == 0) {
+ if (ipAddressSet.isEmpty()) {
throw new Exception("cound not find real IP address for test");
}
- System.out.println("Setting jgroups.tcp.address to: " + ipAddressSet.first());
+ LOGGER.info("Setting jgroups.tcp.address to: " + ipAddressSet.first());
System.setProperty("jgroups.tcp.address", ipAddressSet.first());
}
}
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
index 339c95d26..dca72391a 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java
@@ -72,11 +72,11 @@ public class ConcurrentContextJvmThread implements Runnable, Closeable {
commandList.add(System.getProperty("java.class.path"));
commandList.add(ConcurrentContextJvm.class.getCanonicalName());
commandList.add(configrationProvider.getTestName());
- commandList.add(new Integer(jvm).toString());
- commandList.add(new Integer(configrationProvider.getThreadCount()).toString());
- commandList.add(new Integer(configrationProvider.getLoopSize()).toString());
- commandList.add(new Integer(configrationProvider.getAlbumSize()).toString());
- commandList.add(new Integer(configrationProvider.getLockType().getValue()).toString());
+ commandList.add(Integer.toString(jvm));
+ commandList.add(Integer.toString(configrationProvider.getThreadCount()));
+ commandList.add(Integer.toString(configrationProvider.getLoopSize()));
+ commandList.add(Integer.toString(configrationProvider.getAlbumSize()));
+ commandList.add(Integer.toString(configrationProvider.getLockType().getValue()));
commandList.add(System.getProperty("hazelcast.config", ""));
for (final Entry<String, ParameterGroup> parameterServiceEntry : ParameterService.getAll()) {
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java
index c63280966..70200943c 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/ConfigrationProviderImpl.java
@@ -129,8 +129,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider {
public ExecutorService getExecutorService() {
final String name = getThreadFactoryName(jvmCount, testType);
final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(name);
- final ExecutorService executorService = Executors.newFixedThreadPool(threadCount, threadFactory);
- return executorService;
+ return Executors.newFixedThreadPool(threadCount, threadFactory);
}
/*
@@ -141,8 +140,7 @@ public class ConfigrationProviderImpl implements ConfigrationProvider {
@Override
public ExecutorService getExecutorService(final String threadFactoryName, final int threadPoolSize) {
final IntegrationThreadFactory threadFactory = new IntegrationThreadFactory(threadFactoryName);
- final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize, threadFactory);
- return executorService;
+ return Executors.newFixedThreadPool(threadPoolSize, threadFactory);
}
/*
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java
index 927876e8f..4761bc6f1 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java
@@ -45,7 +45,7 @@ public class Constants {
public static final String EXCEPTION_MESSAGE = "Test should throw an exception";
public static final byte BYTE_VAL = (byte) 0xFF;
public static final double PI_VAL = Math.PI;
- public static final float FLOAT_VAL = 3.14159265359f;
+ public static final float FLOAT_VAL = 3.14159265359F;
public static final String EXTERNAL_CONTEXT = "externalContext";
public static final String GLOBAL_CONTEXT_KEY = "globalContext";
public static final String STRING_GLOBAL_VAL = "This is a global context string";
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java
index 980384043..d26ce955d 100644
--- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java
+++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/NetworkUtils.java
@@ -25,6 +25,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.SortedSet;
import java.util.TreeSet;
/**
@@ -45,8 +46,8 @@ public class NetworkUtils {
* @return Set of IPv4 addresses
* @throws SocketException throw socket exception if error occurs
*/
- public static TreeSet<String> getIPv4NonLoopAddresses() throws SocketException {
- final TreeSet<String> ipAddressSet = new TreeSet<String>();
+ public static SortedSet<String> getIPv4NonLoopAddresses() throws SocketException {
+ final TreeSet<String> ipAddressSet = new TreeSet<>();
final Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (final NetworkInterface netint : Collections.list(nets)) {
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
index 8bfb15025..b275c72ab 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
@@ -127,7 +127,7 @@ public class BatchDeployer {
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException {
engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
}
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
index a1db5ef07..5f0752aa0 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
@@ -41,39 +41,6 @@ public class PeriodicEventManager {
private EngineServiceFacade engineServiceFacade = null;
/**
- * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
- * command line arguments.
- *
- * @param args the arguments that specify the Apex engine and the Apex model file
- */
- public static void main(final String[] args) {
- if (args.length != NUM_ARGUMENTS) {
- String message = "invalid arguments: " + Arrays.toString(args)
- + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
- LOGGER.error(message);
- return;
- }
-
- PeriodicEventManager deployer = null;
- try {
- // Use a Deployer object to handle model deployment
- deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
- deployer.init();
- if (args[2].equalsIgnoreCase("start")) {
- deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
- } else {
- deployer.stopPerioidicEvents();
- }
- } catch (final ApexException e) {
- LOGGER.error("model deployment failed on parameters {}", args, e);
- } finally {
- if (deployer != null) {
- deployer.close();
- }
- }
- }
-
- /**
* Instantiates a new deployer.
*
* @param hostName the host name of the host running the Apex Engine
@@ -121,4 +88,37 @@ public class PeriodicEventManager {
engineServiceFacade.stopPerioidicEvents(engineKey);
}
}
+
+ /**
+ * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
+ * command line arguments.
+ *
+ * @param args the arguments that specify the Apex engine and the Apex model file
+ */
+ public static void main(final String[] args) {
+ if (args.length != NUM_ARGUMENTS) {
+ String message = "invalid arguments: " + Arrays.toString(args)
+ + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
+ LOGGER.error(message);
+ return;
+ }
+
+ PeriodicEventManager deployer = null;
+ try {
+ // Use a Deployer object to handle model deployment
+ deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
+ deployer.init();
+ if ("start".equalsIgnoreCase(args[2])) {
+ deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
+ } else {
+ deployer.stopPerioidicEvents();
+ }
+ } catch (final ApexException e) {
+ LOGGER.error("model deployment failed on parameters {}", args, e);
+ } finally {
+ if (deployer != null) {
+ deployer.close();
+ }
+ }
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
index 32d638aef..12ba12665 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
@@ -29,6 +29,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
* @author Liam Fallon
*
*/
+@FunctionalInterface
public interface EnEventListener {
/**
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
index 7c49af965..58bee8238 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
@@ -58,7 +58,7 @@ public class EnEvent extends HashMap<String, Object> {
private final AxEvent axEvent;
// The event monitor for this event
- private final EventMonitor eventMonitor = new EventMonitor();
+ private final transient EventMonitor eventMonitor = new EventMonitor();
// The stack of execution of this event, used for monitoring
private AxConcept[] userArtifactStack;
@@ -289,7 +289,7 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public void putAll(final Map<? extends String, ? extends Object> incomingMap) {
// Override the generic "putAll()" call as we want to monitor the puts
- for (final java.util.Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
+ for (final Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
put(incomingEntry.getKey(), incomingEntry.getValue());
}
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
index 15fbacf45..a4b221897 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
@@ -45,10 +45,10 @@ public class EnField implements Serializable {
private final AxField axField;
// The schema helper for this field
- private SchemaHelper schemaHelper;
+ private transient SchemaHelper schemaHelper;
// The value of this field
- private final Object value;
+ private final transient Object value;
/**
* Instantiates a new EnField, an Engine Field.
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
index ad5b74c3a..c3617012e 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
@@ -164,7 +164,7 @@ public class ContextAlbumFacade {
contextAlbum.setScope(scope);
}
if (writable != null) {
- if (writable.trim().equalsIgnoreCase("true") || writable.trim().equalsIgnoreCase("t")) {
+ if ("true".equalsIgnoreCase(writable.trim()) || "t".equalsIgnoreCase(writable.trim())) {
contextAlbum.setWritable(true);
} else {
contextAlbum.setWritable(false);
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
index a40a8100f..f1bc4aece 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/PolicyLogicReader.java
@@ -99,7 +99,7 @@ public class PolicyLogicReader implements AxLogicReader {
@Override
public String readLogic(final AxLogic axLogic) {
// Java uses compiled logic, other executor types run scripts
- if (axLogic.getLogicFlavour().equals("JAVA")) {
+ if ("JAVA".equals(axLogic.getLogicFlavour())) {
// Check if we're using the default logic
if (defaultLogic != null) {
// Return the java class name for the default logic
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
index a9418d834..ed2b521c4 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
@@ -210,7 +210,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
private String getJsonString(final Object object, final Object conditionedObject) {
- try (final ByteArrayOutputStream output = new ByteArrayOutputStream();) {
+ try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) {
final DatumWriter<Object> writer = new GenericDatumWriter<>(avroSchema);
final JsonEncoder jsonEncoder = EncoderFactory.get().jsonEncoder(avroSchema, output, true);
writer.write(conditionedObject, jsonEncoder);
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
index de324512b..303165558 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsConsumer.java
@@ -101,7 +101,7 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
// Check if we actually got a connection factory
if (connectionFactory == null) {
- throw new NullPointerException(
+ throw new IllegalArgumentException(
"JMS context lookup of \"" + jmsConsumerProperties.getConnectionFactory() + "\" returned null");
}
} catch (final Exception e) {
@@ -118,7 +118,7 @@ public class ApexJmsConsumer implements MessageListener, ApexEventConsumer, Runn
// Check if we actually got a topic
if (jmsIncomingTopic == null) {
- throw new NullPointerException(
+ throw new IllegalArgumentException(
"JMS context lookup of \"" + jmsConsumerProperties.getConsumerTopic() + "\" returned null");
}
} catch (final Exception e) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
index 0580d7159..83321e432 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/ApexJmsProducer.java
@@ -103,7 +103,7 @@ public class ApexJmsProducer implements ApexEventProducer {
// Check if we actually got a connection factory
if (connectionFactory == null) {
- throw new NullPointerException("JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
+ throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getConnectionFactory()
+ "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
@@ -121,7 +121,7 @@ public class ApexJmsProducer implements ApexEventProducer {
// Check if we actually got a topic
if (jmsOutgoingTopic == null) {
- throw new NullPointerException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic()
+ throw new IllegalArgumentException("JMS context lookup of \"" + jmsProducerProperties.getProducerTopic()
+ "\" returned null for producer (" + this.name + ")");
}
} catch (final Exception e) {
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
index 82c3cf331..5556d0310 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java
@@ -85,8 +85,8 @@ public class ApexRestClientProducer implements ApexEventProducer {
restProducerProperties.setHttpMethod(RestClientCarrierTechnologyParameters.DEFAULT_PRODUCER_HTTP_METHOD);
}
- if (!restProducerProperties.getHttpMethod().equalsIgnoreCase("POST")
- && !restProducerProperties.getHttpMethod().equalsIgnoreCase("PUT")) {
+ if (!"POST".equalsIgnoreCase(restProducerProperties.getHttpMethod())
+ && !"PUT".equalsIgnoreCase(restProducerProperties.getHttpMethod())) {
final String errorMessage = "specified HTTP method of \"" + restProducerProperties.getHttpMethod()
+ "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted "
+ "for event sending on REST client producer (" + this.name + ")";
@@ -183,7 +183,7 @@ public class ApexRestClientProducer implements ApexEventProducer {
*/
public Response sendEventAsRestRequest(final String event) {
// We have already checked that it is a PUT or POST request
- if (restProducerProperties.getHttpMethod().equalsIgnoreCase("POST")) {
+ if ("POST".equalsIgnoreCase(restProducerProperties.getHttpMethod())) {
return client.target(restProducerProperties.getUrl()).request("application/json").post(Entity.json(event));
} else {
return client.target(restProducerProperties.getUrl()).request("application/json").put(Entity.json(event));
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
index 9e9024401..aaccbebab 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyStateFinalizerExecutor.java
@@ -89,7 +89,7 @@ public class JrubyStateFinalizerExecutor extends StateFinalizerExecutor {
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
index d49423486..8019259bd 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskExecutor.java
@@ -89,7 +89,7 @@ public class JrubyTaskExecutor extends TaskExecutor {
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
diff --git a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
index b3ce7e0fd..0e239f7bc 100644
--- a/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
+++ b/plugins/plugins-executor/plugins-executor-jruby/src/main/java/org/onap/policy/apex/plugins/executor/jruby/JrubyTaskSelectExecutor.java
@@ -90,7 +90,7 @@ public class JrubyTaskSelectExecutor extends TaskSelectExecutor {
boolean returnValue = false;
final IRubyObject ret = parsedjruby.run();
if (ret != null) {
- final Boolean retbool = (Boolean) ret.toJava(java.lang.Boolean.class);
+ final Boolean retbool = ret.toJava(java.lang.Boolean.class);
if (retbool != null) {
returnValue = true;
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
index 982044022..9786a3623 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/consumer/HeaderDelimitedTextBlockReader.java
@@ -54,7 +54,7 @@ public class HeaderDelimitedTextBlockReader implements TextBlockReader, Runnable
private boolean blockEndTokenUsed = false;
// The thread used to read the text from the stream
- Thread textConsumputionThread;
+ private Thread textConsumputionThread;
// The input stream for text
private InputStream inputStream;
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/ApexEventListener.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/ApexEventListener.java
index a498bcff8..7e43f036e 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/ApexEventListener.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/ApexEventListener.java
@@ -30,6 +30,7 @@ import org.onap.policy.apex.service.engine.event.ApexEvent;
*
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
*/
+@FunctionalInterface
public interface ApexEventListener {
/**
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineServiceEventInterface.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineServiceEventInterface.java
index 8e4cb82e2..f537b57bc 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineServiceEventInterface.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/EngineServiceEventInterface.java
@@ -29,6 +29,7 @@ import org.onap.policy.apex.service.engine.event.ApexEvent;
* @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com), John Keeney
* (john.keeney@ericsson.com)
*/
+@FunctionalInterface
public interface EngineServiceEventInterface {
/**
* This method forwards an event to the APEX engine.
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
index 883793290..25c7fa16e 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
@@ -215,7 +215,7 @@ public class EvalDomainModelFactory {
final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
.setDefaultLogic("EvalTask_Logic");
- final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", "0.0.1"));
+ final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", DEFAULT_VERSION));
obTask.duplicateInputFields(event0000.getParameterMap());
obTask.duplicateOutputFields(event0001.getParameterMap());
final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
index 5fadb2279..a62414ac6 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
@@ -30,7 +30,7 @@ import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.Map;
-import java.util.TreeSet;
+import java.util.SortedSet;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -106,7 +106,7 @@ public class TestConcurrentContext {
final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE);
System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation);
- final TreeSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
+ final SortedSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
if (ipAddressSet.size() == 0) {
throw new Exception("cound not find real IP address for test");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
index a306b536e..5251cc078 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
@@ -87,9 +87,9 @@ public class EngDepMessagingTest {
contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
ParameterService.register(contextParameters, true);
- ParameterService.register(contextParameters.getDistributorParameters());
- ParameterService.register(contextParameters.getLockManagerParameters());
- ParameterService.register(contextParameters.getPersistorParameters());
+ ParameterService.register(contextParameters.getDistributorParameters(), true);
+ ParameterService.register(contextParameters.getLockManagerParameters(), true);
+ ParameterService.register(contextParameters.getPersistorParameters(), true);
engineServiceParameters = new EngineServiceParameters();
engineServiceParameters.setName("EngDepMessagingTest");
@@ -100,8 +100,8 @@ public class EngDepMessagingTest {
engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL",
new MvelExecutorParameters());
- ParameterService.register(engineServiceParameters);
- ParameterService.register(engineServiceParameters.getEngineParameters());
+ ParameterService.register(engineServiceParameters, true);
+ ParameterService.register(engineServiceParameters.getEngineParameters(), true);
}
/**
diff --git a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java
index 6414fa81a..13610121a 100644
--- a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java
+++ b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
-import java.util.TreeSet;
+import java.util.SortedSet;
import org.junit.BeforeClass;
import org.junit.Rule;
@@ -62,7 +62,7 @@ public class TestMetrics {
final String hazelCastfileLocation = ResourceUtils.getFilePath4Resource(HAZELCAST_XML_FILE);
System.setProperty(HAZELCAST_CONFIG, hazelCastfileLocation);
- final TreeSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
+ final SortedSet<String> ipAddressSet = NetworkUtils.getIPv4NonLoopAddresses();
if (ipAddressSet.size() == 0) {
throw new Exception("cound not find real IP address for test");
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
index aacc22013..267584952 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
@@ -25,8 +25,6 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StrBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.slf4j.ext.XLoggerFactory;
import org.slf4j.helpers.MessageFormatter;