From 21f91d2c2f857c09f64a67292df2afcd680e6a15 Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Fri, 2 Feb 2018 18:06:01 +0100 Subject: add junit for MsoHeatEnvironmentEntry Change-Id: Ibc2b9562de8fbfdb60ee09add404bd3923431501 Issue-ID: SO-360 Signed-off-by: Lukasz Muszkieta --- .../openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'adapters/mso-vnf-adapter') diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index fb86b8c520..f5a47bce01 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -1200,9 +1200,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (heatEnvironmentString != null && heatEnvironmentString.contains ("parameters:")) { //LOGGER.debug ("Have an Environment argument with a parameters: section - will bypass checking for valid params - but will still check for aliases"); LOGGER.debug("Enhanced environment checking enabled - 1604"); - StringBuilder sb = new StringBuilder(heatEnvironmentString); - //LOGGER.debug("About to create MHEE with " + sb); - mhee = new MsoHeatEnvironmentEntry(sb); + mhee = MsoHeatEnvironmentEntry.create(heatEnvironmentString); StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n"); for (HeatTemplateParam parm : heatTemplate.getParameters()) { sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired()); @@ -1211,7 +1209,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { sb2.append("Environment says it's not valid! " + mhee.getErrorString()); } else { sb2.append("\nEnvironment:"); - sb2.append(mhee.toFullString()); + sb2.append(mhee); } LOGGER.debug(sb2.toString()); } else { @@ -1292,7 +1290,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // and it causes problems with json that has arrays String newEnvironmentString = null; if (mhee != null) { - newEnvironmentString = mhee.getRawEntry().toString(); + newEnvironmentString = mhee.getRawEntry(); } // "Fix" the template if it has CR/LF (getting this from Oracle) @@ -1904,10 +1902,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { MsoHeatEnvironmentEntry mhee = null; if (heatEnvironmentString != null && heatEnvironmentString.toLowerCase ().contains ("parameters:")) { LOGGER.debug("Enhanced environment checking enabled - 1604"); - haveEnvironmentParameters = true; - StringBuilder sb = new StringBuilder(heatEnvironmentString); - //LOGGER.debug("About to create MHEE with " + sb); - mhee = new MsoHeatEnvironmentEntry(sb); + mhee = MsoHeatEnvironmentEntry.create(heatEnvironmentString); StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n"); for (HeatTemplateParam parm : heatTemplate.getParameters()) { sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired()); @@ -1916,7 +1911,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { sb2.append("Environment says it's not valid! " + mhee.getErrorString()); } else { sb2.append("\nEnvironment:"); - sb2.append(mhee.toFullString()); + sb2.append(mhee); } LOGGER.debug(sb2.toString()); } else { @@ -2041,7 +2036,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Just submit the envt entry as received from the database String newEnvironmentString = null; if (mhee != null) { - newEnvironmentString = mhee.getRawEntry().toString(); + newEnvironmentString = mhee.getRawEntry(); } // Remove any extraneous parameters (don't throw an error) -- cgit 1.2.3-korg