aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-05-02 16:46:14 -0400
committerRob Daugherty <rd472p@att.com>2018-05-04 15:28:51 +0000
commit3ee4ec41ac18e51a16eafa767e090502b1a33fb5 (patch)
tree11a4d7b6c3bc5b88ce8dd67f12c7726c9f7dd80f /adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
parent13999df2b5cbcfd29d479e20970b39ba876725f3 (diff)
Fix CloudConfig junits
...for some definition of the word "fix". There is still a lot that's less than ideal about how CloudConfig is handled, and with how the unit tests are written. Change-Id: Ic8c66c64d336f22c141687cf41a4828810bf1aec Issue-ID: SO-584 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 3f5da19854..f7723b6a8f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -100,9 +100,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// The cache key is "tenantId:cloudId"
private static Map <String, HeatCacheEntry> heatClientCache = new HashMap <> ();
- // Fetch cloud configuration each time (may be cached in CloudConfig class)
- protected CloudConfig cloudConfig;
-
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
protected MsoJavaProperties msoProps = null;
@@ -145,11 +142,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (MsoPropertiesException e) {
LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
}
- cloudConfig = cloudConfigFactory.getCloudConfig ();
LOGGER.debug("MsoHeatUtils:" + msoPropID);
-
}
+ protected CloudConfigFactory getCloudConfigFactory() {
+ return cloudConfigFactory;
+ }
/**
* keep this old method signature here to maintain backwards compatibility. keep others as well.
@@ -325,7 +323,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
// Obtain the cloud site information where we will create the stack
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
LOGGER.debug("Found: " + cloudSite.toString());
// Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
@@ -661,7 +659,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
LOGGER.debug ("Query HEAT stack: " + stackName + " in tenant " + tenantId);
// Obtain the cloud site information where we will create the stack
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
LOGGER.debug("Found: " + cloudSite.toString());
@@ -723,7 +721,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String stackName,
boolean pollForCompletion) throws MsoException {
// Obtain the cloud site information where we will create the stack
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
LOGGER.debug("Found: " + cloudSite.toString());
@@ -863,7 +861,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
*/
public List <StackInfo> queryAllStacks (String tenantId, String cloudSiteId) throws MsoException {
// Obtain the cloud site information where we will create the stack
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
// Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
Heat heatClient = getHeatClient (cloudSite, tenantId);