summaryrefslogtreecommitdiffstats
path: root/controlloop/common/feature-controlloop-management/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-27 10:52:06 -0400
committerJim Hahn <jrh3@att.com>2019-06-27 18:00:21 -0400
commitd0932a1a2339a02dab04eedefa0480535e68d31c (patch)
treedc6bcde6b279e5dd7a4a332b0494ab108096f173 /controlloop/common/feature-controlloop-management/src/main
parentd8118c6638bb2440f89eae9d3f979bdfb0e013c3 (diff)
Fix some sonar issues in drools-applications
Added coverage to: - feature-controlloop-management Fixed sonar issues, but didn't add coverage to: - feature-controlloop-trans - eventmanager - guard Change-Id: I12f09c4a533e838c6fb9762ba56194e51ce864eb Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/feature-controlloop-management/src/main')
-rw-r--r--controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
index 800971a61..d78545a2d 100644
--- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
+++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/apps/controlloop/feature/management/ControlLoopManagementFeature.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,6 +34,12 @@ public class ControlLoopManagementFeature implements PolicyEngineFeatureAPI {
private static final int SEQNO = 1000;
/**
+ * Factory for various objects. May be overridden by junit tests.
+ */
+ private static Factory factory = new Factory();
+
+
+ /**
* retrieves control loops.
*
* @param controllerName controller name.
@@ -41,7 +47,7 @@ public class ControlLoopManagementFeature implements PolicyEngineFeatureAPI {
* @return control loops.
*/
public static Stream<ControlLoopParams> controlLoops(String controllerName, String sessionName) {
- PolicyController controller = PolicyController.factory.get(controllerName);
+ PolicyController controller = factory.getController(controllerName);
if (controller == null) {
throw new IllegalArgumentException("Invalid Controller Name");
}
@@ -89,4 +95,12 @@ public class ControlLoopManagementFeature implements PolicyEngineFeatureAPI {
return FEATURE_NAME;
}
+ /**
+ * Factory that can be overridden by junit tests.
+ */
+ public static class Factory {
+ public PolicyController getController(String controllerName) {
+ return PolicyController.factory.get(controllerName);
+ }
+ }
}