Improve javadoc comments and formatting 19/83219/1
authormark.j.leonard <mark.j.leonard@gmail.com>
Mon, 25 Mar 2019 15:50:45 +0000 (15:50 +0000)
committermark.j.leonard <mark.j.leonard@gmail.com>
Mon, 25 Mar 2019 16:20:53 +0000 (16:20 +0000)
Issue-ID: AAI-2281
Change-Id: I0f5cce16ce76113b1fee603ad3c191cb6f9fe80f
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
pom.xml
src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java
src/main/java/org/onap/aai/babel/xml/generator/ArtifactGenerator.java
src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java
src/main/java/org/onap/aai/babel/xml/generator/XmlArtifactGenerationException.java
src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java
src/main/java/org/onap/aai/babel/xml/generator/api/ArtifactGenerator.java
src/test/java/org/onap/aai/babel/TestMicroServiceAuth.java

diff --git a/pom.xml b/pom.xml
index 42c6a12..fccfa93 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -4,8 +4,8 @@
     ============LICENSE_START=======================================================
     org.onap.aai
     ================================================================================
-    Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
-    Copyright © 2017-2018 European Software Marketing Ltd.
+    Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+    Copyright (c) 2017-2019 European Software Marketing Ltd.
     ================================================================================
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
index 49dd19f..5d33bc2 100644 (file)
@@ -129,10 +129,12 @@ public class VnfVendorImageExtractor {
      * "Deployment Flavors" x "ImageInfo"
      * </p>
      *
-     * @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<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplates().stream() //
+        List<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplates().stream()
                 .filter(filterOnType(SdcTypes.VF)).collect(Collectors.toList());
 
         List<NodeTemplate> 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<String, Object> image) {
-        applicationLogger.debug("Finding " + SOFTWARE_VERSION + " from " + image);
+    private String findSoftwareVersion(Map<String, Object> 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);
     }
 }
index d7aca0d..ea267ee 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2017-2019 European Software Marketing Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.babel.xml.generator;
 
 import java.util.List;
@@ -30,8 +31,10 @@ public interface ArtifactGenerator {
     /**
      * Generate a {@link List} of {@link BabelArtifact}s from the Artifacts obtained from the CSAR
      *
-     * @param csarArchive original CSAR file (zip format)
-     * @param csarArtifacts YAML artifacts extracted from the CSAR file
+     * @param csarArchive
+     *            original CSAR file (zip format)
+     * @param csarArtifacts
+     *            YAML artifacts extracted from the CSAR file
      * @return generated {@link BabelArtifact}s
      * @throws XmlArtifactGenerationException
      */
index bbd1ff3..8daa165 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2019 European Software Marketing Ltd.
+ * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2017-2019 European Software Marketing Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,7 +43,6 @@ import org.onap.aai.cl.api.Logger;
  */
 public class ModelGenerator implements ArtifactGenerator {
 
-
     private static final Logger logger = LogHelper.INSTANCE;
 
     private static final String VERSION_DELIMITER = ".";
@@ -55,10 +54,10 @@ public class ModelGenerator implements ArtifactGenerator {
      *
      * @param csarArchive
      * @param csarArtifacts
-     *     the input artifacts
+     *            the input artifacts
      * @return {@link List} of output artifacts
      * @throws XmlArtifactGenerationException
-     *     if there is an error trying to generate XML artifacts
+     *             if there is an error trying to generate XML artifacts
      */
     @Override
     public List<BabelArtifact> generateArtifacts(byte[] csarArchive, List<Artifact> csarArtifacts)
@@ -94,11 +93,11 @@ public class ModelGenerator implements ArtifactGenerator {
      * Creates an instance of an input artifact for the generator.
      *
      * @param payload
-     *     the payload downloaded from SDC
+     *            the payload downloaded from SDC
      * @param artifactName
-     *     name of the artifact to create
+     *            name of the artifact to create
      * @param artifactVersion
-     *     version of the artifact to create
+     *            version of the artifact to create
      * @return an {@link Artifact} object constructed from the payload and artifactInfo
      */
     public static Artifact createArtifact(byte[] payload, String artifactName, String artifactVersion) {
index 5e5304b..ebb6c47 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2017-2019 European Software Marketing Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.babel.xml.generator;
 
-/** This class represents an exception encountered when generating an Artifact. */
+/**
+ * This class represents a fatal exception encountered when generating an Artifact.
+ *
+ */
 public class XmlArtifactGenerationException extends Exception {
 
     private static final long serialVersionUID = 1L;
 
     /**
-     * Constructor for an instance of this exception with just a message.
+     * Constructor for an instance of this exception with a message for the caller.
      *
-     * @param message information about the exception
+     * @param message
+     *            information about the exception
      */
     public XmlArtifactGenerationException(String message) {
         super(message);
index 91eb6a4..0aaf8fc 100644 (file)
@@ -138,8 +138,7 @@ public class AaiModelGenerator {
      * @throws XmlArtifactGenerationException
      */
     private ModelElement createWidgetRelationshipModelElement(Model model) throws XmlArtifactGenerationException {
-        return createRelationshipModelElement(model.getDeleteFlag(), model.getWidgetId(),
-                model.getWidgetInvariantId());
+        return createRelationshipModelElement(model.getDeleteFlag(), model.getWidgetId(), model.getWidgetInvariantId());
     }
 
     /**
index 598fd32..292a7d7 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 European Software Marketing Ltd.
+ * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2017-2019 European Software Marketing Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.babel.xml.generator.api;
 
 import java.util.List;
@@ -25,15 +26,20 @@ import java.util.Map;
 import org.onap.aai.babel.xml.generator.data.Artifact;
 import org.onap.aai.babel.xml.generator.data.GenerationData;
 
-/** Artifact Generation. Note that there is only one implementation of this interface currently. */
-@FunctionalInterface
+/**
+ * Artifact Generation. Note that there is only one implementation of this interface currently.
+ *
+ */
+@FunctionalInterface // for SONAR only
 public interface ArtifactGenerator {
 
     /**
      * Implementation of the method to generate AAI artifacts.
      *
-     * @param csarArchive original CSAR (zip format)
-     * @param input List of input tosca files
+     * @param csarArchive
+     *            original CSAR (zip format)
+     * @param input
+     *            List of input tosca files
      * @param additionalParams
      * @return Translated/Error data as a {@link GenerationData} object
      */
index c45bd0a..431d01f 100644 (file)
@@ -302,9 +302,14 @@ public class TestMicroServiceAuth {
     }
 
     /**
+     * Write String content to a file, flush and close.
+     *
      * @param file
+     *            the file to write to
      * @param text
+     *            the String content to write to the file
      * @throws IOException
+     *             if the file cannot be opened for writing, or an I/O error occurs
      */
     private void writeToFile(File file, String text) throws IOException {
         FileWriter fileWriter = new FileWriter(file);
@@ -314,7 +319,7 @@ public class TestMicroServiceAuth {
     }
 
     /**
-     * Assert authorisation results for an admin user based on the test policy file.
+     * Assert authorization results for an admin user based on the test policy file.
      *
      * @param auth
      *            the Auth Service to test