X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fbabel.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2Fcsar%2Fvnfcatalog%2FVnfVendorImageExtractor.java;h=5d33bc293c4974c846e14829da64206f7736dcaa;hp=49dd19fa81365953a5cb1c12f57421d731777d3f;hb=d2215b5d8b6c8976a9540a9e4706c7bebca80aa2;hpb=6c585913c11b2e1973bfcd0d7671d4114e1c3e66 diff --git a/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java b/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java index 49dd19f..5d33bc2 100644 --- a/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java +++ b/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java @@ -129,10 +129,12 @@ public class VnfVendorImageExtractor { * "Deployment Flavors" x "ImageInfo" *

* - * @param csar compressed format that stores multiple TOSCA files and in particular a vnfConfiguration + * @param csar + * compressed format that stores multiple TOSCA files and in particular a vnfConfiguration * @return BabelArtifact VendorImageConfiguration objects created during processing represented as the Babel service * public data structure - * @throws ToscaToCatalogException if the CSAR content is not valid + * @throws ToscaToCatalogException + * if the CSAR content is not valid */ public BabelArtifact extract(byte[] csar) throws ToscaToCatalogException { StopWatch stopwatch = new StopWatch(); @@ -165,9 +167,11 @@ public class VnfVendorImageExtractor { /** * Creates a temporary file to store the CSAR content. * - * @param bytes the CSAR content + * @param bytes + * the CSAR content * @return Path to a temporary file containing the CSAR bytes - * @throws IOException if an I/O error occurs or the temporary-file directory does not exist + * @throws IOException + * if an I/O error occurs or the temporary-file directory does not exist */ private Path createTempFile(byte[] bytes) throws IOException { Path path = Files.createTempFile("temp", ".csar"); @@ -191,7 +195,7 @@ public class VnfVendorImageExtractor { throws SdcToscaParserException, InvalidNumberOfNodesException { ISdcCsarHelper csarHelper = SdcToscaParserFactory.getInstance().getSdcCsarHelper(csarFilepath); - List serviceVfList = csarHelper.getServiceNodeTemplates().stream() // + List serviceVfList = csarHelper.getServiceNodeTemplates().stream() .filter(filterOnType(SdcTypes.VF)).collect(Collectors.toList()); List vnfConfigs = serviceVfList.stream() @@ -301,16 +305,18 @@ public class VnfVendorImageExtractor { } /** - * Get the first software version value from the properties Map. + * Get the first software_version value from the properties Map. * - * @param image the properties Map - * @return the software version value as a String + * @param properties + * the properties map containing the software_version key + * @return the software_version value as a String, or else null */ - private String findSoftwareVersion(Map image) { - applicationLogger.debug("Finding " + SOFTWARE_VERSION + " from " + image); + private String findSoftwareVersion(Map properties) { + applicationLogger.debug("Finding " + SOFTWARE_VERSION + " from " + properties); - return (String) image.entrySet().stream()// + return properties.entrySet().stream() // .filter(entry -> SOFTWARE_VERSION.equals(entry.getKey())) // - .map(Entry::getValue).findFirst().orElse(null); + .map(Entry::getValue).findFirst() // + .map(Object::toString).orElse(null); } }