diff options
Diffstat (limited to 'adapters')
14 files changed, 200 insertions, 101 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 20535e93c8..9fe2d4c786 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 @@ -1217,18 +1217,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); } @@ -1272,16 +1272,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-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/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 b2caa99a39..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; @@ -109,11 +109,11 @@ public class QueryVfModule extends CatalogQuery { put(valueMap, "INITIAL_COUNT", o.getInitialCount()); 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/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 b8a5d9b117..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 @@ -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; |