diff options
Diffstat (limited to 'adapters')
19 files changed, 470 insertions, 171 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java index 8da3b212d9..2d6d0271f8 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java @@ -185,12 +185,12 @@ public class CloudConfigFactory implements Serializable { StringBuffer response = new StringBuffer (); response.append ("Cloud Sites:\n"); for (CloudSite site : cloudConfig.getCloudSites ().values ()) { - response.append (site.toString () + "\n"); + response.append(site.toString()).append("\n"); } response.append ("\n\nCloud Identity Services:\n"); for (CloudIdentity identity : cloudConfig.getIdentityServices ().values ()) { - response.append (identity.toString () + "\n"); + response.append(identity.toString()).append("\n"); } return Response.status (200).entity (response).build (); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java index 600985e310..506b62994d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java @@ -67,10 +67,8 @@ public class StackInfo { if (stack.getStackStatus() == null) { this.status = HeatStatus.INIT; - } else if (heatStatusMap.containsKey(stack.getStackStatus())) { - this.status = heatStatusMap.get(stack.getStackStatus()); } else { - this.status = HeatStatus.UNKNOWN; + this.status = heatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN); } if (stack.getOutputs() != null) { this.outputs = new HashMap<>(); 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 da526ae25b..46cfbf1bb8 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 @@ -1214,18 +1214,18 @@ public class MsoHeatUtils extends MsoCommonUtils { } else { for (String key : params.keySet()) { if (params.get(key) instanceof String) { - sb.append("\n" + key + "=" + (String) params.get(key)); + sb.append("\n").append(key).append("=").append((String) params.get(key)); } else if (params.get(key) instanceof JsonNode) { String jsonStringOut = this.convertNode((JsonNode)params.get(key)); - sb.append("\n" + key + "=" + jsonStringOut); + sb.append("\n").append(key).append("=").append(jsonStringOut); } else if (params.get(key) instanceof Integer) { String integerOut = "" + params.get(key); - sb.append("\n" + key + "=" + integerOut); + sb.append("\n").append(key).append("=").append(integerOut); } else { try { String str = params.get(key).toString(); - sb.append("\n" + key + "=" + str); + sb.append("\n").append(key).append("=").append(str); } catch (Exception e) { LOGGER.debug("Exception :",e); } @@ -1269,16 +1269,16 @@ public class MsoHeatUtils extends MsoCommonUtils { int counter = 0; sb.append("OUTPUTS:\n"); for (String key : outputs.keySet()) { - sb.append("outputs[" + counter++ + "]: " + key + "="); + sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); Object obj = outputs.get(key); if (obj instanceof String) { - sb.append((String)obj +" (a string)"); + sb.append((String) obj).append(" (a string)"); } else if (obj instanceof JsonNode) { - sb.append(this.convertNode((JsonNode)obj) + " (a JsonNode)"); + sb.append(this.convertNode((JsonNode) obj)).append(" (a JsonNode)"); } else if (obj instanceof java.util.LinkedHashMap) { try { String str = JSON_MAPPER.writeValueAsString(obj); - sb.append(str + " (a java.util.LinkedHashMap)"); + sb.append(str).append(" (a java.util.LinkedHashMap)"); } catch (Exception e) { LOGGER.debug("Exception :",e); sb.append("(a LinkedHashMap value that would not convert nicely)"); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java index 2465b30eca..0e0b9cb70d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -365,16 +365,16 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { int counter = 0; sb.append("OUTPUTS:\n"); for (String key : outputs.keySet()) { - sb.append("outputs[" + counter++ + "]: " + key + "="); + sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); Object obj = outputs.get(key); if (obj instanceof String) { - sb.append((String)obj +" (a string)"); + sb.append((String) obj).append(" (a string)"); } else if (obj instanceof JsonNode) { - sb.append(this.convertNode((JsonNode)obj) + " (a JsonNode)"); + sb.append(this.convertNode((JsonNode) obj)).append(" (a JsonNode)"); } else if (obj instanceof java.util.LinkedHashMap) { try { String str = JSON_MAPPER.writeValueAsString(obj); - sb.append(str + " (a java.util.LinkedHashMap)"); + sb.append(str).append(" (a java.util.LinkedHashMap)"); } catch (Exception e) { LOGGER.debug("Exception :", e); sb.append("(a LinkedHashMap value that would not convert nicely)"); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java index c227d72f0c..8002087ddd 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java @@ -27,6 +27,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.Map.Entry; @@ -73,33 +74,32 @@ public class MsoYamlEditorWithEnvt { if (resourceMap == null) { return paramSet; } - Iterator <Entry <String, Object>> it = resourceMap.entrySet().iterator(); - - while (it.hasNext()) { - MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter(); - Map.Entry <String, Object> pair = it.next(); - String value; - Object obj = pair.getValue(); - if (obj instanceof java.lang.String) { - value = yaml.dump(obj); - // but this adds an extra '\n' at the end - which won't hurt - but we don't need it - value = value.substring(0, value.length() - 1); - } else if (obj instanceof java.util.LinkedHashMap) { - //Handle that it's json - try { - value = JSON_MAPPER.writeValueAsString(obj); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - value = "_BAD_JSON_MAPPING"; - } - } else { - //this handles integers/longs/floats/etc. - value = String.valueOf(obj); - } - hep.setName((String) pair.getKey()); - hep.setValue(value); - paramSet.add(hep); - } + + for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) { + MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter(); + Entry<String, Object> pair = stringObjectEntry; + String value; + Object obj = pair.getValue(); + if (obj instanceof String) { + value = yaml.dump(obj); + // but this adds an extra '\n' at the end - which won't hurt - but we don't need it + value = value.substring(0, value.length() - 1); + } else if (obj instanceof LinkedHashMap) { + //Handle that it's json + try { + value = JSON_MAPPER.writeValueAsString(obj); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + value = "_BAD_JSON_MAPPING"; + } + } else { + //this handles integers/longs/floats/etc. + value = String.valueOf(obj); + } + hep.setName((String) pair.getKey()); + hep.setValue(value); + paramSet.add(hep); + } return paramSet; } public synchronized Set <MsoHeatEnvironmentResource> getResourceListFromEnvt() { @@ -107,15 +107,14 @@ public class MsoYamlEditorWithEnvt { Set<MsoHeatEnvironmentResource> resourceList = new HashSet<>(); @SuppressWarnings("unchecked") Map<String, Object> resourceMap = (Map<String,Object>) yml.get("resource_registry"); - Iterator<Entry <String,Object>> it = resourceMap.entrySet().iterator(); - - while (it.hasNext()) { - MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource(); - Map.Entry<String, Object> pair = it.next(); - her.setName((String) pair.getKey()); - her.setValue((String) pair.getValue()); - resourceList.add(her); - } + + for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) { + MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource(); + Entry<String, Object> pair = stringObjectEntry; + her.setName((String) pair.getKey()); + her.setValue((String) pair.getValue()); + resourceList.add(her); + } return resourceList; } catch (Exception e) { LOGGER.debug("Exception:", e); @@ -126,35 +125,34 @@ public class MsoYamlEditorWithEnvt { Set <HeatTemplateParam> paramSet = new HashSet <> (); @SuppressWarnings("unchecked") Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters"); - Iterator <Entry <String, Object>> it = resourceMap.entrySet ().iterator (); - while (it.hasNext ()) { - HeatTemplateParam param = new HeatTemplateParam (); - Map.Entry <String, Object> pair = it.next (); + for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) { + HeatTemplateParam param = new HeatTemplateParam(); + Entry<String, Object> pair = stringObjectEntry; @SuppressWarnings("unchecked") - Map <String, String> resourceEntry = (Map <String, String>) pair.getValue (); + Map<String, String> resourceEntry = (Map<String, String>) pair.getValue(); String value = null; try { - value = resourceEntry.get ("default"); - } catch (java.lang.ClassCastException cce) { + value = resourceEntry.get("default"); + } catch (ClassCastException cce) { LOGGER.debug("Exception:", cce); - // This exception only - the value is an integer. For what we're doing - // here - we don't care - so set value to something - and it will - // get marked as not being required - which is correct. - //System.out.println("cce exception!"); - value = "300"; - // okay + // This exception only - the value is an integer. For what we're doing + // here - we don't care - so set value to something - and it will + // get marked as not being required - which is correct. + //System.out.println("cce exception!"); + value = "300"; + // okay } - param.setParamName ((String) pair.getKey ()); + param.setParamName((String) pair.getKey()); if (value != null) { - param.setRequired (false); + param.setRequired(false); } else { - param.setRequired (true); + param.setRequired(true); } - value = resourceEntry.get ("type"); - param.setParamType (value); + value = resourceEntry.get("type"); + param.setParamType(value); - paramSet.add (param); + paramSet.add(param); } return paramSet; diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java index 668f73816d..8cdeaaa9e1 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java @@ -52,34 +52,37 @@ Once the network-level distribution artifacts are defined, similar updates can b import java.util.ArrayList; import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.HEAD; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; -import org.apache.http.HttpStatus; +import javax.ws.rs.core.Response; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; +import org.apache.http.HttpStatus; +import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQuery; import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryException; import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory; -import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQuery; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceVnfs; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceNetworks; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceMacroHolder; import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization; +import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceCsar; +import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceMacroHolder; +import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceNetworks; +import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceVnfs; import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryVfModule; import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; -import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.ToscaCsar; +import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; /** * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1) @@ -466,4 +469,50 @@ public class CatalogDbAdapterRest { } } + /** + * Get the tosca csar info from catalog + * <br> + * + * @param smUuid service model uuid + * @return the tosca csar information of the serivce. + * @since ONAP Beijing Release + */ + @GET + @Path("serviceToscaCsar") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response ServiceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) { + int respStatus = HttpStatus.SC_OK; + CatalogDatabase db = CatalogDatabase.getInstance(); + String entity = ""; + try{ + if(smUuid != null && !"".equals(smUuid)){ + LOGGER.debug ("Query Csar by service model uuid: " + smUuid); + ToscaCsar toscaCsar = db.getToscaCsarByServiceModelUUID(smUuid); + if(toscaCsar != null){ + QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); + entity = serviceCsar.JSON2(false, false); + } + else{ + respStatus = HttpStatus.SC_NOT_FOUND; + } + }else{ + throw(new Exception("Incoming parameter is null or blank")); + } + LOGGER.debug ("Query Csar exit"); + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + }catch(Exception e){ + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, smUuid, "", "ServiceToscaCsar", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query csar by service model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity<CatalogQueryException>(excResp) {}) + .build(); + }finally { + db.close(); + } + } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java index a74cf07b89..4a8233bb03 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java @@ -46,21 +46,21 @@ public abstract class CatalogQuery { } protected String setTemplate(String template, Map<String, String> valueMap) { - LOGGER.debug ("CatalogQuery setTemplate"); + LOGGER.debug("CatalogQuery setTemplate"); StringBuffer result = new StringBuffer(); String pattern = "<.*>"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(template); - LOGGER.debug ("CatalogQuery template:"+ template); - while(m.find()) { - String key = template.substring(m.start()+1, m.end()-1); - LOGGER.debug ("CatalogQuery key:"+ key+ " contains key? "+ valueMap.containsKey(key)); - m.appendReplacement(result, valueMap.containsKey(key)? valueMap.get(key): "\"TBD\""); + LOGGER.debug("CatalogQuery template:" + template); + while (m.find()) { + String key = template.substring(m.start() + 1, m.end() - 1); + LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key)); + m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); } m.appendTail(result); - LOGGER.debug ("CatalogQuery return:"+ result.toString()); + LOGGER.debug("CatalogQuery return:" + result.toString()); return result.toString(); } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java index 9a82ed2c6e..f7758c315c 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -62,30 +62,30 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { @Override public String toString () { - StringBuilder buf = new StringBuilder(); + StringBuilder sb = new StringBuilder(); boolean first = true; int i = 1; for (AllottedResourceCustomization o : allottedResourceCustomization) { - buf.append(i+"\t"); - if (!first) buf.append("\n"); first = false; - buf.append(o); + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); } - return buf.toString(); + return sb.toString(); } @Override public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder buf = new StringBuilder(); - if (!isEmbed && isArray) buf.append("{ "); - if (isArray) buf.append("\"serviceAllottedResources\": ["); + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceAllottedResources\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; if (this.allottedResourceCustomization != null) { for (AllottedResourceCustomization o : allottedResourceCustomization) { - if (first) buf.append("\n"); first = false; + if (first) sb.append("\n"); first = false; boolean arNull = o.getAllottedResource() == null ? true : false; @@ -104,14 +104,14 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUuid()); - buf.append(sep+ this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(template, valueMap)); sep = ",\n"; } } - if (!first) buf.append("\n"); - if (isArray) buf.append("]"); - if (!isEmbed && isArray) buf.append("}"); - return buf.toString(); + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java new file mode 100644 index 0000000000..6b1eb836d9 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java @@ -0,0 +1,72 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.adapters.catalogdb.catalogrest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.mso.db.catalog.beans.ToscaCsar;
+
+/**
+ * serivce csar query support
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Beijing Release 2018-02-28
+ */
+public class QueryServiceCsar extends CatalogQuery{
+
+ private ToscaCsar toscaCsar;
+
+ public QueryServiceCsar(ToscaCsar toscaCsar){
+ this.toscaCsar = toscaCsar;
+ }
+
+ private final String template =
+ "\t{\n"+
+ "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"+
+ "\t\t\"name\" : <NAME>,\n"+
+ "\t\t\"version\" : <VERSION>,\n"+
+ "\t\t\"artifactChecksum\" : <ARTIFACT_CHECK_SUM>,\n"+
+ "\t\t\"url\" : <URL>,\n"+
+ "\t\t\"description\" : <DESCRIPTION>\n"+
+ "\t}";
+
+ @Override
+ public String toString() {
+
+ return toscaCsar.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ Map<String, String> valueMap = new HashMap<>();
+ put(valueMap, "ARTIFACT_UUID", null == toscaCsar ? null : toscaCsar.getArtifactUUID());
+ put(valueMap, "NAME", null == toscaCsar ? null : toscaCsar.getName());
+ put(valueMap, "VERSION", null == toscaCsar ? null : toscaCsar.getVersion());
+ put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum());
+ put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl());
+ put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription());
+ return this.setTemplate(template, valueMap);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java index 59c601ef19..c04068d680 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java @@ -67,30 +67,30 @@ public class QueryServiceNetworks extends CatalogQuery { @Override public String toString () { - StringBuilder buf = new StringBuilder(); + StringBuilder sb = new StringBuilder(); boolean first = true; int i = 1; for (NetworkResourceCustomization o : serviceNetworks) { - buf.append(i+"\t"); - if (!first) buf.append("\n"); first = false; - buf.append(o); + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); } - return buf.toString(); + return sb.toString(); } @Override public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder buf = new StringBuilder(); - if (!isEmbed && isArray) buf.append("{ "); - if (isArray) buf.append("\"serviceNetworks\": ["); - //if (isArray) buf.append("["); + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceNetworks\": ["); + Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (NetworkResourceCustomization o : serviceNetworks) { - if (first) buf.append("\n"); first = false; + if (first) sb.append("\n"); first = false; boolean nrNull = o.getNetworkResource() == null ? true : false; put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); @@ -104,12 +104,12 @@ public class QueryServiceNetworks extends CatalogQuery { put(valueMap, "NETWORK_SCOPE", o.getNetworkScope()); put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology()); - buf.append(sep+ this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(template, valueMap)); sep = ",\n"; } - if (!first) buf.append("\n"); - if (isArray) buf.append("]"); - if (!isEmbed && isArray) buf.append("}"); - return buf.toString(); + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java index cfbb781ae8..f0d4327950 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -72,29 +72,29 @@ public class QueryServiceVnfs extends CatalogQuery { @Override public String toString () { - StringBuilder buf = new StringBuilder(); + StringBuilder sb = new StringBuilder(); boolean first = true; int i = 1; for (VnfResourceCustomization o : serviceVnfs) { - buf.append(i+"\t"); - if (!first) buf.append("\n"); first = false; - buf.append(o); + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); } - return buf.toString(); + return sb.toString(); } @Override public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder buf = new StringBuilder(); - if (!isEmbed && isArray) buf.append("{ "); - if (isArray) buf.append("\"serviceVnfs\": ["); + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceVnfs\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (VnfResourceCustomization o : serviceVnfs) { - if (first) buf.append("\n"); first = false; + if (first) sb.append("\n"); first = false; boolean vrNull = o.getVnfResource() == null ? true : false; @@ -113,12 +113,12 @@ public class QueryServiceVnfs extends CatalogQuery { String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true); valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t")); - buf.append(sep+ this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(template, valueMap)); sep = ",\n"; } - if (!first) buf.append("\n"); - if (isArray) buf.append("]"); - if (!isEmbed && isArray) buf.append("}"); - return buf.toString(); + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java index cb6ba1b3f6..fe0f0cbc17 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -69,28 +69,28 @@ public class QueryVfModule extends CatalogQuery { @Override public String toString () { - StringBuilder buf = new StringBuilder(); + StringBuilder sb = new StringBuilder(); boolean first = true; int i = 1; for (VfModuleCustomization o : vfModules) { - buf.append(i+"\t"); - if (!first) buf.append("\n"); first = false; - buf.append(o); + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); } - return buf.toString(); + return sb.toString(); } @Override public String JSON2(boolean isArray, boolean x) { - StringBuilder buf = new StringBuilder(); - if (isArray) buf.append("\"vfModules\": ["); + StringBuilder sb = new StringBuilder(); + if (isArray) sb.append("\"vfModules\": ["); Map<String, String> valueMap = new HashMap<>(); String sep = ""; boolean first = true; for (VfModuleCustomization o : vfModules) { - if (first) buf.append("\n"); first = false; + if (first) sb.append("\n"); first = false; boolean vfNull = o.getVfModule() == null ? true : false; boolean hasVolumeGroup = false; @@ -104,16 +104,16 @@ public class QueryVfModule extends CatalogQuery { put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUuid()); put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getVersion()); put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); - put(valueMap, "IS_BASE", vfNull ? false : Boolean.valueOf(o.getVfModule().isBase() ? true : false)); + put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().isBase() ? true : false); put(valueMap, "VF_MODULE_LABEL", o.getLabel()); put(valueMap, "INITIAL_COUNT", o.getInitialCount()); - put(valueMap, "HAS_VOLUME_GROUP", Boolean.valueOf(hasVolumeGroup)); + put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup); - buf.append(sep+ this.setTemplate(template, valueMap)); + sb.append(sep).append(this.setTemplate(template, valueMap)); sep = ",\n"; } - if (!first) buf.append("\n"); - if (isArray) buf.append("]"); - return buf.toString(); + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + return sb.toString(); } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java index ff713991f9..00a5cafb29 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java @@ -58,17 +58,17 @@ public class QueryVfModules { @Override public String toString () { - StringBuilder buf = new StringBuilder(); + StringBuilder sb = new StringBuilder(); boolean first = true; int i = 1; for (VfModule o : vfModules) { - buf.append(i+"\t"); - if (!first) buf.append("\n"); + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; - buf.append(o); + sb.append(o); } - return buf.toString(); + return sb.toString(); } public String toJsonString() { diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java index f050882586..82684bd43e 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java @@ -1747,20 +1747,20 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams.put (VLANS, csl); } if (routeTargets != null && !routeTargets.isEmpty()) { - StringBuilder buf = new StringBuilder (); + StringBuilder sb = new StringBuilder (); String sep = ""; for (String rt : routeTargets) { if (!isNullOrEmpty(rt)) { if (aic3template) - buf.append (sep).append ("target:" + rt); + sb.append(sep).append("target:").append(rt); else - buf.append (sep).append (rt); + sb.append (sep).append (rt); sep = ","; } } - String csl = buf.toString (); + String csl = sb.toString (); stackParams.put ("route_targets", csl); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java index 45d5944c7d..55a2156c50 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java @@ -142,7 +142,7 @@ public class SDNCRestClient implements Runnable { DataOutputStream out = null; BufferedReader in = null; SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java new file mode 100644 index 0000000000..88d2b950b9 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java @@ -0,0 +1,47 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============LICENSE_END========================================================= +*/ + +package org.openecomp.mso.adapters.sdnc.client; + +import org.junit.Test; +import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; + +public class CallbackHeaderTest { + + static CallbackHeader cb = new CallbackHeader(); + + @Test + public final void testCallbackHeader() { + cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"); + cb.setResponseCode("200"); + cb.setResponseMessage("OK"); + assert (cb.getRequestId() != null); + assert (cb.getResponseCode() != null); + assert (cb.getResponseMessage() != null); + assert (cb.getRequestId().equals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781")); + assert (cb.getResponseCode().equals("200")); + assert (cb.getResponseMessage().equals("OK")); + } + + @Test + public void testtoString() { + assert (cb.toString() != null); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java new file mode 100644 index 0000000000..63aa49cf54 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.openecomp.mso.adapters.sdnc.client; + +import org.junit.Test; +import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; +import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest; + +public class SDNCAdapterCallbackRequestTest { + + static SDNCAdapterCallbackRequest sdc = new SDNCAdapterCallbackRequest(); + static CallbackHeader ch = new CallbackHeader("413658f4-7f42-482e-b834-23a5c15657da-1474471336781","200","OK"); + + @Test + public void testSDNCAdapterCallbackRequest() + { + sdc.setCallbackHeader(ch); + sdc.setRequestData("data"); + assert(sdc.getCallbackHeader()!=null); + assert(sdc.getRequestData()!=null); + assert(sdc.getCallbackHeader().equals(ch)); + assert(sdc.getRequestData().equals("data")); + + } + + @Test + public void testtoString() + { + assert(ch.toString()!=null); + } + +} + + 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 a292c76825..95e62a0e2d 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 @@ -465,7 +465,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private boolean callHeatbridge(String heatStackId) { String executionDir = "/usr/local/lib/python2.7/dist-packages/heatbridge"; String openstackIdentityUrl = "", username = "", password = "", tenant = "", region = "", owner = ""; - long waitTimeMs = 10000l; + long waitTimeMs = 10000L; try { String[] cmdarray = {"/usr/bin/python", "HeatBridgeMain.py", openstackIdentityUrl, username, password, tenant, region, owner, heatStackId}; String[] envp = null; @@ -508,7 +508,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug("Exception :",e); outputString = "Unable to call toString() on the value for " + str; } - sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'"); + sb.append("\t\nitem ").append(i++).append(": '").append(str).append("'='").append(outputString) + .append("'"); } } LOGGER.debug(sb.toString()); @@ -524,7 +525,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { sb.append("\tEMPTY"); } else { for (String str : inputs.keySet()) { - sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str)); + sb.append("\titem ").append(i++).append(": ").append(str).append("=").append(inputs.get(str)); } } LOGGER.debug(sb.toString()); @@ -1224,7 +1225,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { int cntr = 0; try { for (HeatTemplateParam htp : heatTemplate.getParameters()) { - sb.append("param[" + cntr++ + "]=" + htp.getParamName()); + sb.append("param[").append(cntr++).append("]=").append(htp.getParamName()); parameterNames.add(htp.getParamName()); if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) { aliasToParam.put(htp.getParamAlias(), htp.getParamName()); @@ -1443,16 +1444,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { StringBuilder sbInit = new StringBuilder(); sbInit.append("updateVfModule: \n"); - sbInit.append("cloudSiteId=" + cloudSiteId + "\n"); - sbInit.append("tenantId=" + tenantId + "\n"); - sbInit.append("vnfType=" + vnfType + "\n"); - sbInit.append("vnfVersion=" + vnfVersion + "\n"); - sbInit.append("vnfName=" + vnfName + "\n"); - sbInit.append("requestType=" + requestType + "\n"); - sbInit.append("volumeGroupHeatStackId=" + volumeGroupHeatStackId + "\n"); - sbInit.append("baseVfHeatStackId=" + baseVfHeatStackId + "\n"); - sbInit.append("vfModuleStackId=" + vfModuleStackId + "\n"); - sbInit.append("modelCustomizationUuid=" + modelCustomizationUuid + "\n"); + sbInit.append("cloudSiteId=").append(cloudSiteId).append("\n"); + sbInit.append("tenantId=").append(tenantId).append("\n"); + sbInit.append("vnfType=").append(vnfType).append("\n"); + sbInit.append("vnfVersion=").append(vnfVersion).append("\n"); + sbInit.append("vnfName=").append(vnfName).append("\n"); + sbInit.append("requestType=").append(requestType).append("\n"); + sbInit.append("volumeGroupHeatStackId=").append(volumeGroupHeatStackId).append("\n"); + sbInit.append("baseVfHeatStackId=").append(baseVfHeatStackId).append("\n"); + sbInit.append("vfModuleStackId=").append(vfModuleStackId).append("\n"); + sbInit.append("modelCustomizationUuid=").append(modelCustomizationUuid).append("\n"); LOGGER.debug(sbInit.toString()); String mcu = modelCustomizationUuid; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java new file mode 100644 index 0000000000..21a71ccf61 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.vdu.utils; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.mso.vdu.utils.VduBlueprint; + +import org.junit.Assert; + +public class VduBlueprintTest { + + private VduBlueprint vduBlueprint; + + private Map<String, byte[]> templateFiles; + private Map<String, byte[]> attachedFiles; + + @Before + public void setUp() { + vduBlueprint = new VduBlueprint(); + } + + @Test + public void testGetVduModelId() { + vduBlueprint.setVduModelId("vduModelId"); + Assert.assertNotNull(vduBlueprint.getVduModelId()); + Assert.assertEquals(vduBlueprint.getVduModelId(), "vduModelId"); + } + + @Test + public void testGetMainTemplateName() { + vduBlueprint.setMainTemplateName("MainTemplateName"); + Assert.assertNotNull(vduBlueprint.getMainTemplateName()); + Assert.assertEquals(vduBlueprint.getMainTemplateName(), "MainTemplateName"); + } + + @Test + public void testGetTemplateFiles() { + byte[] templateFileData = "some template file data".getBytes(); + templateFiles = new HashMap<String, byte[]>(); + templateFiles.put("templateKey1", templateFileData); + vduBlueprint.setTemplateFiles(templateFiles); + Assert.assertNotNull(vduBlueprint.getTemplateFiles()); + Assert.assertTrue(vduBlueprint.getTemplateFiles().containsKey("templateKey1")); + Assert.assertTrue(vduBlueprint.getTemplateFiles().containsValue(templateFileData)); + } + + @Test + public void testGetAttachedFiles() { + byte[] attachedFileData = "some file data".getBytes(); + attachedFiles = new HashMap<String, byte[]>(); + attachedFiles.put("attachedKey1", attachedFileData); + vduBlueprint.setAttachedFiles(attachedFiles); + Assert.assertNotNull(vduBlueprint.getAttachedFiles()); + Assert.assertTrue(vduBlueprint.getAttachedFiles().containsKey("attachedKey1")); + Assert.assertTrue(vduBlueprint.getAttachedFiles().containsValue(attachedFileData)); + } +} |