Merge "Controller Blueprints Microservice"
authorDan Timoney <dt5972@att.com>
Tue, 4 Sep 2018 15:07:03 +0000 (15:07 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 4 Sep 2018 15:07:03 +0000 (15:07 +0000)
27 files changed:
ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java

index d9380a2..0a403b8 100644 (file)
@@ -29,6 +29,7 @@ import org.springframework.web.context.request.WebRequest;
 \r
 @ControllerAdvice\r
 @RestController\r
+@SuppressWarnings("unused")\r
 public class ApplicationExceptionHandler {\r
     private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationExceptionHandler.class);\r
     @ExceptionHandler(Exception.class)\r
index 5970baf..67e3e5d 100644 (file)
@@ -16,8 +16,6 @@
 \r
 package org.onap.ccsdk.apps.controllerblueprints;\r
 \r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
 import org.springframework.context.annotation.Bean;\r
 import org.springframework.context.annotation.Configuration;\r
 import springfox.documentation.builders.PathSelectors;\r
@@ -27,11 +25,7 @@ import springfox.documentation.service.Contact;
 import springfox.documentation.spi.DocumentationType;\r
 import springfox.documentation.spring.web.plugins.Docket;\r
 import springfox.documentation.swagger2.annotations.EnableSwagger2;\r
-\r
-import java.util.Arrays;\r
 import java.util.Collections;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
 \r
 /**\r
  * SwaggerConfig\r
@@ -40,13 +34,10 @@ import java.util.Set;
  */\r
 @Configuration\r
 @EnableSwagger2\r
+@SuppressWarnings("unused")\r
 public class SwaggerConfig {\r
-    private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =\r
-            new HashSet<String>(Arrays.asList("application/json",\r
-                    "application/xml"));\r
-    private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);\r
-\r
     @Bean\r
+    @SuppressWarnings("unused")\r
     public Docket api() {\r
         return new Docket(DocumentationType.SWAGGER_2)\r
                 .select()\r
index 5a8d542..9ba6313 100644 (file)
@@ -20,13 +20,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
 \r
 import com.fasterxml.jackson.databind.JsonNode\r
 import com.fasterxml.jackson.databind.node.NullNode\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition\r
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
 import org.slf4j.Logger\r
 import org.slf4j.LoggerFactory\r
 /**\r
index 886c3d2..c41124e 100644 (file)
@@ -27,13 +27,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode
 import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper\r
 import org.apache.commons.io.FileUtils\r
 import org.apache.commons.io.IOUtils\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
 import org.onap.ccsdk.apps.controllerblueprints.core.format\r
 import org.slf4j.LoggerFactory\r
 import java.io.File\r
 import java.nio.charset.Charset\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
 \r
 /**\r
  *\r
index bccd946..50d2ce4 100644 (file)
@@ -18,10 +18,11 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
 \r
 import org.junit.Before\r
 import org.junit.Test\r
-import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory\r
 import org.slf4j.Logger\r
 import org.slf4j.LoggerFactory\r
+\r
 /**\r
  *\r
  *\r
index c980a0c..c9b37c2 100644 (file)
@@ -29,15 +29,16 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;\r
 \r
 import java.util.*;\r
+\r
 /**\r
- *\r
  * ResourceAssignmentValidator.java Purpose:\r
+ *\r
  * @author Brinda Santh\r
  */\r
 public class ResourceAssignmentValidator {\r
     private static final Logger log = LoggerFactory.getLogger(ResourceAssignmentValidator.class);\r
     private List<ResourceAssignment> assignments;\r
-    private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap();\r
+    private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap<>();\r
     private StrBuilder validationMessage = new StrBuilder();\r
 \r
     public ResourceAssignmentValidator(List<ResourceAssignment> assignments) {\r
@@ -72,7 +73,7 @@ public class ResourceAssignmentValidator {
      * This is a validateResourceAssignment to validate the Topology Template\r
      *\r
      * @return boolean\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     public boolean validateResourceAssignment() throws BluePrintException {\r
         if (assignments != null && !assignments.isEmpty()) {\r
@@ -142,16 +143,14 @@ public class ResourceAssignmentValidator {
             neighbors.forEach((v, vs) -> {\r
                 if (v == null) {\r
                     s.append("\n    * -> [");\r
-                    List<ResourceAssignment> links = vs;\r
-                    for (ResourceAssignment resourceAssignment : links) {\r
+                    for (ResourceAssignment resourceAssignment : vs) {\r
                         s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()\r
                                 + "),");\r
                     }\r
                     s.append("]");\r
                 } else {\r
                     s.append("\n    (" + v.getDictionaryName() + ":" + v.getName() + ") -> [");\r
-                    List<ResourceAssignment> links = vs;\r
-                    for (ResourceAssignment resourceAssignment : links) {\r
+                    for (ResourceAssignment resourceAssignment : vs) {\r
                         s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()\r
                                 + "),");\r
                     }\r
index 6809831..6a78ac8 100644 (file)
 
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
 
+import org.apache.commons.collections.CollectionUtils
+import org.apache.commons.lang3.StringUtils
 import org.apache.commons.lang3.text.StrBuilder
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.validator.ResourceAssignmentValidator
 import org.slf4j.LoggerFactory
-import org.apache.commons.collections.CollectionUtils
-import org.apache.commons.lang3.StringUtils
 import java.io.Serializable
+
 /**
  * ResourceAssignmentValidationService.
  *
index 2c44378..5eba4fc 100644 (file)
@@ -17,6 +17,7 @@
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service;\r
 \r
+import com.google.common.base.Preconditions;\r
 import org.apache.commons.collections.CollectionUtils;\r
 import org.apache.commons.lang3.StringUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
@@ -45,6 +46,7 @@ import java.util.Map;
  */\r
 \r
 @Service\r
+@SuppressWarnings("unused")\r
 public class AutoResourceMappingService {\r
 \r
     private static Logger log = LoggerFactory.getLogger(AutoResourceMappingService.class);\r
@@ -53,9 +55,8 @@ public class AutoResourceMappingService {
 \r
     /**\r
      * This is a AutoResourceMappingService constructor\r
-     * \r
-     * @param dataDictionaryRepository\r
-     * \r
+     *\r
+     * @param dataDictionaryRepository dataDictionaryRepository\r
      */\r
     public AutoResourceMappingService(ResourceDictionaryRepository dataDictionaryRepository) {\r
         this.dataDictionaryRepository = dataDictionaryRepository;\r
@@ -63,8 +64,8 @@ public class AutoResourceMappingService {
 \r
     /**\r
      * This is a autoMap service to map the template keys automatically to Dictionary fields.\r
-     * \r
-     * @param resourceAssignments\r
+     *\r
+     * @param resourceAssignments resourceAssignments\r
      * @return AutoMapResponse\r
      */\r
     public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {\r
@@ -83,8 +84,6 @@ public class AutoResourceMappingService {
 \r
                         log.info("Mapped Resource : {}", resourceAssignment);\r
 \r
-                    } else {\r
-                        // Do nothins\r
                     }\r
                 }\r
             }\r
@@ -125,7 +124,7 @@ public class AutoResourceMappingService {
         if (CollectionUtils.isNotEmpty(names)) {\r
 \r
             List<ResourceDictionary> dictionaries = dataDictionaryRepository.findByNameIn(names);\r
-            if (CollectionUtils.isNotEmpty( dictionaries)) {\r
+            if (CollectionUtils.isNotEmpty(dictionaries)) {\r
                 for (ResourceDictionary dataDictionary : dictionaries) {\r
                     if (dataDictionary != null && StringUtils.isNotBlank(dataDictionary.getName())) {\r
                         dictionaryMap.put(dataDictionary.getName(), dataDictionary);\r
@@ -167,14 +166,13 @@ public class AutoResourceMappingService {
     private List<ResourceAssignment> getAllAutomapResourceAssignments(List<ResourceAssignment> resourceAssignments) {\r
         List<ResourceDictionary> dictionaries = null;\r
         List<String> names = new ArrayList<>();\r
-        List<ResourceAssignment> resourceAssignmentsWithDepencies = resourceAssignments;\r
         for (ResourceAssignment resourceAssignment : resourceAssignments) {\r
             if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {\r
                 if (resourceAssignment.getDependencies() != null && !resourceAssignment.getDependencies().isEmpty()) {\r
                     List<String> dependencieNames = resourceAssignment.getDependencies();\r
                     for (String dependencieName : dependencieNames) {\r
                         if (StringUtils.isNotBlank(dependencieName) && !names.contains(dependencieName)\r
-                                && !checkAssignmentsExists(resourceAssignmentsWithDepencies, dependencieName)) {\r
+                                && !checkAssignmentsExists(resourceAssignments, dependencieName)) {\r
                             names.add(dependencieName);\r
                         }\r
                     }\r
@@ -188,24 +186,25 @@ public class AutoResourceMappingService {
         if (dictionaries != null) {\r
             for (ResourceDictionary resourcedictionary : dictionaries) {\r
                 ResourceDefinition dictionaryDefinition = JacksonUtils.readValue(resourcedictionary.getDefinition(), ResourceDefinition.class);\r
+                Preconditions.checkNotNull(dictionaryDefinition, "failed to get Resource Definition from dictionary definition");\r
                 PropertyDefinition property = new PropertyDefinition();\r
-                               property.setRequired(true);\r
-                               ResourceAssignment resourceAssignment = new ResourceAssignment();\r
-                               resourceAssignment.setName(resourcedictionary.getName());\r
-                               resourceAssignment.setDictionaryName(resourcedictionary\r
-                                               .getName());\r
-                               resourceAssignment.setVersion(0);\r
-                               resourceAssignment.setProperty(property);\r
+                property.setRequired(true);\r
+                ResourceAssignment resourceAssignment = new ResourceAssignment();\r
+                resourceAssignment.setName(resourcedictionary.getName());\r
+                resourceAssignment.setDictionaryName(resourcedictionary\r
+                        .getName());\r
+                resourceAssignment.setVersion(0);\r
+                resourceAssignment.setProperty(property);\r
                 ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);\r
-                    resourceAssignmentsWithDepencies.add(resourceAssignment);\r
+                resourceAssignments.add(resourceAssignment);\r
             }\r
         }\r
-        return resourceAssignmentsWithDepencies;\r
+        return resourceAssignments;\r
 \r
     }\r
 \r
 \r
-    public boolean checkAssignmentsExists(List<ResourceAssignment> resourceAssignmentsWithDepencies, String resourceName) {\r
+    private boolean checkAssignmentsExists(List<ResourceAssignment> resourceAssignmentsWithDepencies, String resourceName) {\r
         return resourceAssignmentsWithDepencies.stream().anyMatch(names -> names.getName().equalsIgnoreCase(resourceName));\r
     }\r
 \r
index 0cf846c..28be75e 100644 (file)
@@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service;
 \r
 import com.fasterxml.jackson.databind.JsonNode;\r
 import com.google.common.base.Preconditions;\r
+import org.apache.commons.collections.MapUtils;\r
 import org.apache.commons.lang3.StringUtils;\r
 import org.jetbrains.annotations.NotNull;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
@@ -47,7 +48,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
 \r
     private static Logger log = LoggerFactory.getLogger(BluePrintEnhancerService.class);\r
 \r
-    private HashMap<String, DataType> recipeDataTypes = new HashMap<>();\r
+    private Map<String, DataType> recipeDataTypes = new HashMap<>();\r
 \r
     public BluePrintEnhancerService(BluePrintRepoService bluePrintEnhancerRepoDBService) {\r
         super(bluePrintEnhancerRepoDBService);\r
@@ -119,7 +120,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
         if (StringUtils.isNotBlank(recipeName)) {\r
             DataType recipeDataType = this.recipeDataTypes.get(recipeName);\r
             if (recipeDataType == null) {\r
-                log.info("DataType not present for the recipe({})" , recipeName);\r
+                log.info("DataType not present for the recipe({})", recipeName);\r
                 recipeDataType = new DataType();\r
                 recipeDataType.setVersion("1.0.0");\r
                 recipeDataType.setDescription(\r
@@ -129,7 +130,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                 Map<String, PropertyDefinition> dataTypeProperties = new HashMap<>();\r
                 recipeDataType.setProperties(dataTypeProperties);\r
             } else {\r
-                log.info("DataType Already present for the recipe({})" , recipeName);\r
+                log.info("DataType Already present for the recipe({})", recipeName);\r
             }\r
 \r
             // Merge all the Recipe Properties\r
@@ -145,7 +146,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                                                                            NodeTemplate nodeTemplate) {\r
 \r
         Map<String, PropertyDefinition> dataTypeProperties = null;\r
-        if (nodeTemplate != null) {\r
+        if (nodeTemplate != null && MapUtils.isNotEmpty(nodeTemplate.getCapabilities())) {\r
             CapabilityAssignment capability =\r
                     nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);\r
 \r
@@ -182,17 +183,18 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
     private void mergeDataTypeProperties(DataType dataType, Map<String, PropertyDefinition> mergeProperties) {\r
         if (dataType != null && dataType.getProperties() != null && mergeProperties != null) {\r
             // Add the Other Template Properties\r
-            mergeProperties.forEach((mappingKey, propertyDefinition) -> {\r
-                dataType.getProperties().put(mappingKey, propertyDefinition);\r
-            });\r
+            mergeProperties.forEach((mappingKey, propertyDefinition) -> dataType.getProperties().put(mappingKey, propertyDefinition));\r
         }\r
     }\r
 \r
     private void populateRecipeInputs(ServiceTemplate serviceTemplate) {\r
-        if (this.recipeDataTypes != null && !this.recipeDataTypes.isEmpty()) {\r
+        if (serviceTemplate.getTopologyTemplate() != null\r
+                && MapUtils.isNotEmpty(serviceTemplate.getTopologyTemplate().getInputs())\r
+                && MapUtils.isNotEmpty(this.recipeDataTypes)\r
+                && MapUtils.isNotEmpty(serviceTemplate.getDataTypes())) {\r
             this.recipeDataTypes.forEach((recipeName, recipeDataType) -> {\r
-                String dataTypePrifix = recipeName.replace("-action", "") + "-request";\r
-                String dataTypeName = "dt-" + dataTypePrifix;\r
+                String dataTypePrefix = recipeName.replace("-action", "") + "-request";\r
+                String dataTypeName = "dt-" + dataTypePrefix;\r
 \r
                 serviceTemplate.getDataTypes().put(dataTypeName, recipeDataType);\r
 \r
@@ -200,7 +202,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
                 customInputProperty.setDescription("This is Dynamic Data type for the receipe " + recipeName + ".");\r
                 customInputProperty.setRequired(Boolean.FALSE);\r
                 customInputProperty.setType(dataTypeName);\r
-                serviceTemplate.getTopologyTemplate().getInputs().put(dataTypePrifix, customInputProperty);\r
+                serviceTemplate.getTopologyTemplate().getInputs().put(dataTypePrefix, customInputProperty);\r
 \r
             });\r
         }\r
index e40c2cf..f521371 100644 (file)
@@ -197,7 +197,7 @@ public class ConfigModelCreateService {
     private void deleteConfigModelContent(Long dbConfigModelId) {\r
         if (dbConfigModelId != null) {\r
             ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);\r
-            if (dbConfigModel != null && CollectionUtils.isNotEmpty(dbConfigModel.getConfigModelContents())) {\r
+            if (CollectionUtils.isNotEmpty(dbConfigModel.getConfigModelContents())) {\r
                 dbConfigModel.getConfigModelContents().clear();\r
                 log.debug("Configuration Model content deleting : {}", dbConfigModel.getConfigModelContents());\r
                 configModelRepository.saveAndFlush(dbConfigModel);\r
@@ -210,18 +210,15 @@ public class ConfigModelCreateService {
         if (dbConfigModelId != null && configModel != null\r
                 && CollectionUtils.isNotEmpty(configModel.getConfigModelContents())) {\r
             ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);\r
-            if (dbConfigModel != null) {\r
-                for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {\r
-                    if (configModelContent != null) {\r
-                        configModelContent.setId(null);\r
-                        configModelContent.setConfigModel(dbConfigModel);\r
-                        dbConfigModel.getConfigModelContents().add(configModelContent);\r
-                        log.debug("Configuration Model content adding : {}", configModelContent);\r
-                    }\r
+            for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {\r
+                if (configModelContent != null) {\r
+                    configModelContent.setId(null);\r
+                    configModelContent.setConfigModel(dbConfigModel);\r
+                    dbConfigModel.getConfigModelContents().add(configModelContent);\r
+                    log.debug("Configuration Model content adding : {}", configModelContent);\r
                 }\r
-                configModelRepository.saveAndFlush(dbConfigModel);\r
             }\r
-\r
+            configModelRepository.saveAndFlush(dbConfigModel);\r
         }\r
     }\r
 \r
@@ -229,22 +226,19 @@ public class ConfigModelCreateService {
                                           String author) throws BluePrintException {\r
 \r
         ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);\r
-        if (dbConfigModel != null) {\r
-            // Populate tags from metadata\r
-            String tags = getConfigModelTags(dbConfigModel);\r
-            if (StringUtils.isBlank(tags)) {\r
-                throw new BluePrintException("Failed to populate tags for the config model name " + artifactName);\r
-            }\r
-            dbConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);\r
-            dbConfigModel.setArtifactName(artifactName);\r
-            dbConfigModel.setArtifactVersion(artifactVersion);\r
-            dbConfigModel.setUpdatedBy(author);\r
-            dbConfigModel.setPublished(ApplicationConstants.ACTIVE_N);\r
-            dbConfigModel.setTags(tags);\r
-            configModelRepository.saveAndFlush(dbConfigModel);\r
-\r
-            log.info("Config model ({}) saved successfully.", dbConfigModel.getId());\r
+        // Populate tags from metadata\r
+        String tags = getConfigModelTags(dbConfigModel);\r
+        if (StringUtils.isBlank(tags)) {\r
+            throw new BluePrintException("Failed to populate tags for the config model name " + artifactName);\r
         }\r
+        dbConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);\r
+        dbConfigModel.setArtifactName(artifactName);\r
+        dbConfigModel.setArtifactVersion(artifactVersion);\r
+        dbConfigModel.setUpdatedBy(author);\r
+        dbConfigModel.setPublished(ApplicationConstants.ACTIVE_N);\r
+        dbConfigModel.setTags(tags);\r
+        configModelRepository.saveAndFlush(dbConfigModel);\r
+        log.info("Config model ({}) saved successfully.", dbConfigModel.getId());\r
         return dbConfigModel;\r
     }\r
 \r
@@ -282,8 +276,6 @@ public class ConfigModelCreateService {
                                     configModel.getArtifactName());\r
                         }\r
                         tags = String.valueOf(serviceTemplate.getMetadata());\r
-                    } else {\r
-                        // Do Nothing\r
                     }\r
                 }\r
             }\r
index 4b732cc..89d4829 100644 (file)
@@ -55,7 +55,7 @@ import java.util.List;
  */\r
 \r
 @Component\r
-@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true", matchIfMissing = false)\r
+@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true")\r
 public class DataBaseInitService {\r
 \r
     private static Logger log = LoggerFactory.getLogger(DataBaseInitService.class);\r
@@ -77,9 +77,9 @@ public class DataBaseInitService {
     /**\r
      * This is a DataBaseInitService, used to load the initial data\r
      *\r
-     * @param modelTypeService\r
-     * @param resourceDictionaryService\r
-     * @param configModelService\r
+     * @param modelTypeService modelTypeService\r
+     * @param resourceDictionaryService resourceDictionaryService\r
+     * @param configModelService configModelService\r
      */\r
     public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,\r
                                ConfigModelService configModelService) {\r
index 70b7917..70cee3c 100644 (file)
@@ -49,9 +49,9 @@ public class ServiceTemplateService {
     /**\r
      * This is a SchemaGeneratorService constructor\r
      *\r
-     * @param dataDictionaryRepository\r
-     * @param configModelCreateService\r
-     * @param bluePrintEnhancerService\r
+     * @param dataDictionaryRepository dataDictionaryRepository\r
+     * @param configModelCreateService configModelCreateService\r
+     * @param bluePrintEnhancerService bluePrintEnhancerService\r
      */\r
     public ServiceTemplateService(ResourceDictionaryRepository dataDictionaryRepository,\r
                                   ConfigModelCreateService configModelCreateService,\r
@@ -65,9 +65,9 @@ public class ServiceTemplateService {
     /**\r
      * This is a validateServiceTemplate method\r
      *\r
-     * @param serviceTemplate\r
+     * @param serviceTemplate serviceTemplate\r
      * @return ServiceTemplate\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {\r
         return this.configModelCreateService.validateServiceTemplate(serviceTemplate);\r
@@ -76,11 +76,10 @@ public class ServiceTemplateService {
     /**\r
      * This is a enrichServiceTemplate method\r
      *\r
-     * @param serviceTemplate\r
+     * @param serviceTemplate serviceTemplate\r
      * @return ServiceTemplate\r
-     * @throws BluePrintException\r
      */\r
-    public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {\r
+    public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) {\r
         this.bluePrintEnhancerService.enhance(serviceTemplate);\r
         return serviceTemplate;\r
     }\r
@@ -88,22 +87,21 @@ public class ServiceTemplateService {
     /**\r
      * This is a autoMap method to map the template keys\r
      *\r
-     * @param resourceAssignments\r
+     * @param resourceAssignments resourceAssignments\r
      * @return AutoMapResponse\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {\r
         AutoResourceMappingService autoMappingService = new AutoResourceMappingService(dataDictionaryRepository);\r
-        AutoMapResponse autoMapResponse = autoMappingService.autoMap(resourceAssignments);\r
-        return autoMapResponse;\r
+        return autoMappingService.autoMap(resourceAssignments);\r
     }\r
 \r
     /**\r
      * This is a validateResourceAssignments method\r
      *\r
-     * @param resourceAssignments\r
+     * @param resourceAssignments resourceAssignments\r
      * @return List<ResourceAssignment>\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)\r
             throws BluePrintException {\r
@@ -120,7 +118,7 @@ public class ServiceTemplateService {
     /**\r
      * This is a generateResourceAssignments method\r
      *\r
-     * @param templateContent\r
+     * @param templateContent templateContent\r
      * @return List<ResourceAssignment>\r
      */\r
     public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent) {\r
index 4538281..51c9a7c 100644 (file)
@@ -24,7 +24,6 @@ import org.springframework.data.annotation.LastModifiedDate;
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
 import javax.persistence.*;\r
-import javax.validation.constraints.NotNull;\r
 import java.io.Serializable;\r
 import java.util.ArrayList;\r
 import java.util.Date;\r
@@ -81,8 +80,7 @@ public class ConfigModel implements Serializable {
     @Column(name = "artifact_type")\r
     private String artifactType;\r
 \r
-    @NotNull\r
-    @Column(name = "artifact_version")\r
+    @Column(name = "artifact_version", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String artifactVersion;\r
 \r
@@ -99,30 +97,25 @@ public class ConfigModel implements Serializable {
     @Column(name = "creation_date")\r
     private Date createdDate = new Date();\r
 \r
-    @NotNull\r
-    @Column(name = "artifact_name")\r
+    @Column(name = "artifact_name", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String artifactName;\r
 \r
-    @NotNull\r
-    @Column(name = "published")\r
+    @Column(name = "published", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String published;\r
 \r
-    @NotNull\r
-    @Column(name = "updated_by")\r
+    @Column(name = "updated_by", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "tags")\r
+    @Column(name = "tags", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
 \r
     @OneToMany(mappedBy = "configModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)\r
-    @Column(nullable = true)\r
     @JsonManagedReference\r
     private List<ConfigModelContent> configModelContents = new ArrayList<>();\r
 \r
index 0c05ef9..60b3ed6 100644 (file)
@@ -23,7 +23,6 @@ import org.springframework.data.annotation.LastModifiedDate;
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
 import javax.persistence.*;\r
-import javax.validation.constraints.NotNull;\r
 import java.util.Date;\r
 import java.util.Objects;\r
 \r
@@ -45,13 +44,11 @@ public class ConfigModelContent {
     @Column(name = "config_model_content_id")\r
     private Long id;\r
 \r
-    @NotNull\r
-    @Column(name = "name")\r
+    @Column(name = "name", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String name;\r
 \r
-    @NotNull\r
-    @Column(name = "content_type")\r
+    @Column(name = "content_type", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String contentType;\r
 \r
@@ -65,9 +62,8 @@ public class ConfigModelContent {
     @Column(name = "description")\r
     private String description;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "content")\r
+    @Column(name = "content", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String content;\r
 \r
index 2e90188..6ec39ab 100644 (file)
@@ -20,7 +20,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.data.annotation.LastModifiedDate;\r
 \r
 import javax.persistence.*;\r
-import javax.validation.constraints.NotNull;\r
 import java.io.Serializable;\r
 import java.util.Date;\r
 \r
@@ -40,8 +39,7 @@ public class ConfigModelSearch implements Serializable {
     @Column(name = "artifact_type")\r
     private String artifactType;\r
 \r
-    @NotNull\r
-    @Column(name = "artifact_version")\r
+    @Column(name = "artifact_version", nullable = false)\r
     private String artifactVersion;\r
 \r
     @Lob\r
@@ -57,21 +55,17 @@ public class ConfigModelSearch implements Serializable {
     @Column(name = "creation_date")\r
     private Date createdDate = new Date();\r
 \r
-    @NotNull\r
-    @Column(name = "artifact_name")\r
+    @Column(name = "artifact_name", nullable = false)\r
     private String artifactName;\r
 \r
-    @NotNull\r
-    @Column(name = "published")\r
+    @Column(name = "published", nullable = false)\r
     private String published;\r
 \r
-    @NotNull\r
-    @Column(name = "updated_by")\r
+    @Column(name = "updated_by", nullable = false)\r
     private String updatedBy;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "tags")\r
+    @Column(name = "tags", nullable = false)\r
     private String tags;\r
 \r
     public Long getId() {\r
index 61e4d11..eaa335b 100644 (file)
@@ -22,7 +22,6 @@ import org.springframework.data.annotation.LastModifiedDate;
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
 import javax.persistence.*;\r
-import javax.validation.constraints.NotNull;\r
 import java.io.Serializable;\r
 import java.util.Date;\r
 \r
@@ -40,41 +39,34 @@ public class ModelType implements Serializable {
     private static final long serialVersionUID = 1L;\r
 \r
     @Id\r
-    @NotNull\r
     @Column(name = "model_name", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String modelName;\r
 \r
-    @NotNull\r
-    @Column(name = "derived_from")\r
+    @Column(name = "derived_from", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String derivedFrom;\r
 \r
-    @NotNull\r
-    @Column(name = "definition_type")\r
+    @Column(name = "definition_type", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String definitionType;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "definition")\r
+    @Column(name = "definition", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String definition;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "description")\r
+    @Column(name = "description", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String description;\r
 \r
-    @NotNull\r
-    @Column(name = "version")\r
+    @Column(name = "version", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String version;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "tags")\r
+    @Column(name = "tags", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
@@ -84,8 +76,7 @@ public class ModelType implements Serializable {
     @Column(name = "creation_date")\r
     private Date creationDate;\r
 \r
-    @NotNull\r
-    @Column(name = "updated_by")\r
+    @Column(name = "updated_by", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
index 0d5879d..4875868 100644 (file)
@@ -22,7 +22,6 @@ import org.springframework.data.annotation.LastModifiedDate;
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
 import javax.persistence.*;\r
-import javax.validation.constraints.NotNull;\r
 import java.io.Serializable;\r
 import java.util.Date;\r
 \r
@@ -39,23 +38,19 @@ public class ResourceDictionary implements Serializable {
     private static final long serialVersionUID = 1L;\r
 \r
     @Id\r
-    @NotNull\r
-    @Column(name = "name")\r
+    @Column(name = "name", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String name;\r
 \r
-    @NotNull\r
-    @Column(name = "resource_path")\r
+    @Column(name = "resource_path", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String resourcePath;\r
 \r
-    @NotNull\r
-    @Column(name = "resource_type")\r
+    @Column(name = "resource_type", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String resourceType;\r
 \r
-    @NotNull\r
-    @Column(name = "data_type")\r
+    @Column(name = "data_type", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String dataType;\r
 \r
@@ -70,21 +65,18 @@ public class ResourceDictionary implements Serializable {
     @Column(name = "sample_value")\r
     private String sampleValue;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "definition")\r
+    @Column(name = "definition", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String definition;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "description")\r
+    @Column(name = "description", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String description;\r
 \r
-    @NotNull\r
     @Lob\r
-    @Column(name = "tags")\r
+    @Column(name = "tags", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
@@ -94,8 +86,7 @@ public class ResourceDictionary implements Serializable {
     @Column(name = "creation_date")\r
     private Date creationDate;\r
 \r
-    @NotNull\r
-    @Column(name = "updated_by")\r
+    @Column(name = "updated_by", nullable = false)\r
     @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
index ad2584a..733cbbd 100644 (file)
@@ -21,6 +21,7 @@ import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelConten
 import org.springframework.data.jpa.repository.JpaRepository;\r
 import org.springframework.stereotype.Repository;\r
 \r
+import javax.validation.constraints.NotNull;\r
 import java.util.List;\r
 import java.util.Optional;\r
 \r
@@ -36,60 +37,65 @@ public interface ConfigModelContentRepository extends JpaRepository<ConfigModelC
     /**\r
      * This is a findById method\r
      * \r
-     * @param id\r
+     * @param id id\r
      * @return Optional<AsdcArtifacts>\r
      */\r
-    Optional<ConfigModelContent> findById(Long id);\r
+    @NotNull\r
+    Optional<ConfigModelContent> findById(@NotNull Long id);\r
 \r
     /**\r
      * This is a findTopByConfigModelAndContentType method\r
      * \r
-     * @param configModel\r
-     * @param contentType\r
+     * @param configModel  configModel\r
+     * @param contentType contentType\r
      * @return Optional<ConfigModelContent>\r
      */\r
+    @SuppressWarnings("unused")\r
     Optional<ConfigModelContent> findTopByConfigModelAndContentType(ConfigModel configModel, String contentType);\r
 \r
     /**\r
      * This is a findByConfigModelAndContentType method\r
      * \r
-     * @param configModel\r
-     * @param contentType\r
+     * @param configModel configModel\r
+     * @param contentType contentType\r
      * @return Optional<ConfigModelContent>\r
      */\r
+    @SuppressWarnings("unused")\r
     List<ConfigModelContent> findByConfigModelAndContentType(ConfigModel configModel, String contentType);\r
 \r
     /**\r
      * This is a findByConfigModel method\r
      * \r
-     * @param configModel\r
+     * @param configModel configModel\r
      * @return Optional<ConfigModelContent>\r
      */\r
+    @SuppressWarnings("unused")\r
     List<ConfigModelContent> findByConfigModel(ConfigModel configModel);\r
 \r
     /**\r
      * This is a findByConfigModelAndContentTypeAndName method\r
      * \r
-     * @param configModel\r
-     * @param contentType\r
-     * @param name\r
+     * @param configModel configModel\r
+     * @param contentType contentType\r
+     * @param name name\r
      * @return Optional<ConfigModelContent>\r
      */\r
+    @SuppressWarnings("unused")\r
     Optional<ConfigModelContent> findByConfigModelAndContentTypeAndName(ConfigModel configModel,\r
                                                                         String contentType, String name);\r
 \r
     /**\r
      * This is a deleteByMdeleteByConfigModelodelName method\r
      * \r
-     * @param configModel\r
+     * @param configModel configModel\r
      */\r
     void deleteByConfigModel(ConfigModel configModel);\r
 \r
     /**\r
      * This is a deleteById method\r
      * \r
-     * @param id\r
+     * @param  id id\r
      */\r
-    void deleteById(Long id);\r
+    void deleteById(@NotNull Long id);\r
 \r
 }\r
index 4822ee9..0a60ab7 100644 (file)
@@ -20,6 +20,7 @@ import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
 import org.springframework.data.jpa.repository.JpaRepository;\r
 import org.springframework.stereotype.Repository;\r
 \r
+import javax.validation.constraints.NotNull;\r
 import java.util.List;\r
 import java.util.Optional;\r
 \r
@@ -34,16 +35,17 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
     /**\r
      * This is a findById method\r
      * \r
-     * @param id\r
+     * @param id id\r
      * @return Optional<AsdcArtifacts>\r
      */\r
-    Optional<ConfigModel> findById(Long id);\r
+    @NotNull\r
+    Optional<ConfigModel> findById(@NotNull Long id);\r
 \r
     /**\r
      * This is a findByArtifactNameAndArtifactVersion method\r
      * \r
-     * @param artifactName\r
-     * @param artifactVersion\r
+     * @param artifactName artifactName\r
+     * @param artifactVersion artifactVersion\r
      * @return Optional<AsdcArtifacts>\r
      */\r
     Optional<ConfigModel> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);\r
@@ -51,7 +53,7 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
     /**\r
      * This is a findTopByArtifactNameOrderByArtifactIdDesc method\r
      * \r
-     * @param artifactName\r
+     * @param artifactName artifactName\r
      * @return Optional<AsdcArtifacts>\r
      */\r
     Optional<ConfigModel> findTopByArtifactNameOrderByArtifactVersionDesc(String artifactName);\r
@@ -59,15 +61,16 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
     /**\r
      * This is a findTopByArtifactName method\r
      * \r
-     * @param artifactName\r
+     * @param artifactName artifactName\r
      * @return Optional<AsdcArtifacts>\r
      */\r
+    @SuppressWarnings("unused")\r
     List<ConfigModel> findTopByArtifactName(String artifactName);\r
 \r
     /**\r
      * This is a findByTagsContainingIgnoreCase method\r
      * \r
-     * @param tags\r
+     * @param tags tags\r
      * @return Optional<ModelType>\r
      */\r
     List<ConfigModel> findByTagsContainingIgnoreCase(String tags);\r
@@ -75,16 +78,18 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
     /**\r
      * This is a deleteByArtifactNameAndArtifactVersion method\r
      * \r
-     * @param artifactName\r
-     * @param artifactVersion\r
+     * @param artifactName artifactName\r
+     * @param artifactVersion artifactVersion\r
      */\r
+    @SuppressWarnings("unused")\r
     void deleteByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);\r
 \r
     /**\r
      * This is a deleteById method\r
      * \r
-     * @param id\r
+     * @param id id\r
      */\r
-    void deleteById(Long id);\r
+    @SuppressWarnings("unused")\r
+    void deleteById(@NotNull Long id);\r
 \r
 }\r
index f6e5c27..6bcbae9 100644 (file)
@@ -20,8 +20,6 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
 import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
 import org.springframework.http.MediaType;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.stereotype.Service;\r
 import org.springframework.web.bind.annotation.*;\r
 \r
 import java.util.List;\r
index e31b04d..bfc89b4 100644 (file)
@@ -39,9 +39,10 @@ import java.util.List;
 \r
 public class ConfigModelUtils {\r
 \r
-    private ConfigModelUtils(){\r
+    private ConfigModelUtils() {\r
 \r
     }\r
+\r
     private static Logger log = LoggerFactory.getLogger(ConfigModelUtils.class);\r
 \r
     public static ConfigModel getConfigModel(String blueprintPath) throws Exception {\r
@@ -119,6 +120,8 @@ public class ConfigModelUtils {
     public static List<String> getBlueprintNames(String pathName) {\r
         File blueprintDir = new File(pathName);\r
         Preconditions.checkNotNull(blueprintDir, "failed to find the blueprint pathName file");\r
-        return  Arrays.asList(blueprintDir.list(DirectoryFileFilter.INSTANCE));\r
+        String[] dirs = blueprintDir.list(DirectoryFileFilter.INSTANCE);\r
+        Preconditions.checkNotNull(dirs, "failed to find the blueprint directories");\r
+        return Arrays.asList(dirs);\r
     }\r
 }\r
index 1201f6b..aaa445a 100644 (file)
@@ -63,7 +63,6 @@ public class ModelTypeValidator {
      */\r
     public static boolean validateModelTypeDefinition(String definitionType, String definitionContent)\r
             throws BluePrintException {\r
-        boolean valid = true;\r
         if (StringUtils.isNotBlank(definitionContent)) {\r
             if (BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)) {\r
                 DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);\r
@@ -93,7 +92,7 @@ public class ModelTypeValidator {
             }\r
 \r
         }\r
-        return valid;\r
+        return true;\r
     }\r
 \r
     /**\r
index 430401b..848a32f 100644 (file)
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator;
 import com.google.common.base.Preconditions;\r
 import org.apache.commons.lang3.StringUtils;\r
 import org.jetbrains.annotations.NotNull;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
@@ -40,14 +39,14 @@ import java.util.Map;
 public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {\r
 \r
     StringBuilder message = new StringBuilder();\r
-    private Map<String, String> metaData = new HashMap();\r
+    private Map<String, String> metaData = new HashMap<>();\r
 \r
     /**\r
      * This is a validateServiceTemplate\r
      *\r
-     * @param serviceTemplateContent\r
+     * @param serviceTemplateContent serviceTemplateContent\r
      * @return boolean\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     public boolean validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {\r
         if (StringUtils.isNotBlank(serviceTemplateContent)) {\r
@@ -65,7 +64,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
      *\r
      * @param serviceTemplate\r
      * @return boolean\r
-     * @throws BluePrintException\r
+     * @throws BluePrintException BluePrintException\r
      */\r
     @SuppressWarnings("squid:S00112")\r
     public boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {\r
@@ -77,8 +76,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
     /**\r
      * This is a getMetaData to get the key information during the\r
      *\r
-     * @return Map<String                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,\r
-                       *       String>\r
+     * @return Map<String, String>\r
      */\r
     public Map<String, String> getMetaData() {\r
         return metaData;\r
index d328b3e..08bfeb1 100644 (file)
@@ -95,7 +95,7 @@ public class ModelTypeRestTest {
 \r
         List<ModelType> dbModelTypes = modelTypeRest.searchModelTypes(tags);\r
         Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);\r
-        Assert.assertEquals("Failed to search ResourceMapping by tags count", true, dbModelTypes.size() > 0);\r
+        Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size() > 0);\r
 \r
     }\r
 \r
@@ -109,8 +109,7 @@ public class ModelTypeRestTest {
         List<ModelType> dbDatatypeModelTypes =\r
                 modelTypeRest.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);\r
         Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);\r
-        Assert.assertEquals("Failed to find getModelTypeByDefinitionType by count", true,\r
-                dbDatatypeModelTypes.size() > 0);\r
+        Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size() > 0);\r
     }\r
 \r
     @Test\r