aboutsummaryrefslogtreecommitdiffstats
path: root/appc-oam/appc-oam-bundle/src/main
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2018-12-19 14:15:04 +0000
committerTakamune Cho <takamune.cho@att.com>2018-12-19 17:46:34 +0000
commit8b1be00c0642f1f167cd3d136aa8215e40deb142 (patch)
treeb7a21c499f98d98a071cfe3d6eda8014b6fd57d4 /appc-oam/appc-oam-bundle/src/main
parent3eb1c34bba8e1073467ac772adfb61d31fb25862 (diff)
Fix for test coverage in oam.utils package
Removed 'PrepareForTest' annotations which were preventing test coverage of classes in appc.oam.utils package. Added unit tests for untested code. Increased line coverage of the package from 49% to 83%. Issue-ID: APPC-1287 Change-Id: I893de5281f8c46e92269be895ef304bbf87c88b9 Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-oam/appc-oam-bundle/src/main')
-rw-r--r--appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/BundleHelper.java8
-rw-r--r--appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/StateHelper.java7
2 files changed, 13 insertions, 2 deletions
diff --git a/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/BundleHelper.java b/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/BundleHelper.java
index b862ed3a7..7639c4075 100644
--- a/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/BundleHelper.java
+++ b/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/BundleHelper.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2018 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -166,7 +168,7 @@ public class BundleHelper {
String[] bundlesToStop = readPropsFromPropListName(PROP_BUNDLE_TO_STOP);
String[] regExBundleNotStop = readPropsFromPropListName(PROP_BUNDLES_TO_NOT_STOP);
- BundleFilter bundleList = new BundleFilter(bundlesToStop, regExBundleNotStop, getBundleList());
+ BundleFilter bundleList = getBundleFilter(bundlesToStop, regExBundleNotStop, getBundleList());
logger.info(String.format("(%d) APPC bundles to Stop/Start: %s.", bundleList.getBundlesToStop().size(),
bundleList.getBundlesToStop().toString()));
@@ -220,6 +222,10 @@ public class BundleHelper {
}
}
+ protected BundleFilter getBundleFilter(String[] stopRegexes, String[] exceptRegexes, Bundle[] bundles) {
+ return new BundleFilter(stopRegexes, exceptRegexes, bundles);
+ }
+
/**
* Runnable to execute bundle operations: start or stop
*/
diff --git a/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/StateHelper.java b/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/StateHelper.java
index 0d24b5e8a..6ed50dbe6 100644
--- a/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/StateHelper.java
+++ b/appc-oam/appc-oam-bundle/src/main/java/org/onap/appc/oam/util/StateHelper.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2018 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +124,7 @@ public class StateHelper {
* @return AppcOamStates
*/
public AppcOamStates getBundlesState() {
- BundleHelper bundleHelper = new BundleHelper(logger, configurationHelper, this);
+ BundleHelper bundleHelper = getBundleHelper(logger, configurationHelper);
Map<String, Bundle> lcmBundleMap = bundleHelper.getAppcLcmBundles();
if (lcmBundleMap == null || lcmBundleMap.isEmpty()) {
return AppcOamStates.Unknown;
@@ -140,4 +142,7 @@ public class StateHelper {
return AppcOamStates.getOamStateFromBundleState(currentState);
}
+ protected BundleHelper getBundleHelper(EELFLogger logger, ConfigurationHelper configurationHelper) {
+ return new BundleHelper(logger, configurationHelper, this);
+ }
}