aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-validation/src
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2019-11-22 18:06:08 -0500
committerKAPIL SINGAL <ks220y@att.com>2019-11-26 21:32:38 +0000
commit341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch)
tree113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/controllerblueprints/modules/blueprint-validation/src
parentd274e5fc552cf9ae25500f504f0434981cf3accf (diff)
Formatting Code base with ktlint
No Business logic change, just the code format. Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3 To format run: mvn process-sources -P format Issue-ID: CCSDK-1947 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-validation/src')
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt21
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt20
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt23
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt153
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt42
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt38
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt26
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt17
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt13
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt22
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt15
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt19
18 files changed, 275 insertions, 186 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
index 182c22ce9..73504314b 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
@@ -24,6 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifact
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,16 +32,20 @@ import java.io.File
@Service("default-artifact-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintArtifactDefinitionValidatorImpl(
- private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactDefinitionValidator {
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService
+) : BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
this.bluePrintRuntimeService = bluePrintRuntimeService
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -69,7 +73,7 @@ open class BluePrintArtifactDefinitionValidatorImpl(
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
+ ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -84,13 +88,12 @@ open class BluePrintArtifactDefinitionValidatorImpl(
private fun validateExtension(referencePrefix: String, name: String, artifactDefinition: ArtifactDefinition) {
val customValidators = bluePrintTypeValidatorService
- .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
+ .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
customValidators?.let {
it.forEach { validator ->
validator.validate(bluePrintRuntimeService, name, artifactDefinition)
}
-
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
index aa2cdb1df..b31211e2d 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
@@ -24,7 +24,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.springframework.stereotype.Service
@Service("default-artifact-type-validator")
-open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator {
+open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactTypeValidator {
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
@@ -32,4 +33,4 @@ open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidator
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
index 5a9736bc8..9a4650104 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
@@ -31,16 +31,18 @@ import org.springframework.stereotype.Service
@Service("default-attribute-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
+open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintAttributeDefinitionValidator {
-
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- attributeDefinition: AttributeDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ attributeDefinition: AttributeDefinition
+ ) {
log.trace("Validating AttributeDefinition($name)")
this.bluePrintRuntimeService = bluePrintRuntimeService
@@ -55,7 +57,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = attributeDefinition.entrySchema?.type
- ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
+ ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
@@ -73,7 +75,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -87,4 +89,4 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
index e62de4a22..dab6a78bc 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
@@ -32,4 +32,4 @@ open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
index 9ffd78f9e..5df2decdb 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
@@ -30,15 +30,16 @@ import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefi
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
-import java.util.*
-
+import java.util.UUID
@Service("bluePrintDesignTimeValidatorService")
-open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- private val resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintValidatorService {
+open class BluePrintDesignTimeValidatorService(
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
+ private val resourceDefinitionValidator: ResourceDefinitionValidator
+) :
+ BluePrintValidatorService {
- private val log= LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
override fun validateBluePrints(basePath: String): Boolean {
@@ -48,8 +49,10 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
- bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
- bluePrintRuntimeService.bluePrintContext().serviceTemplate)
+ bluePrintTypeValidatorService.validateServiceTemplate(
+ bluePrintRuntimeService, "service_template",
+ bluePrintRuntimeService.bluePrintContext().serviceTemplate
+ )
// Validate Resource Definitions
validateResourceDefinitions(bluePrintRuntimeService)
@@ -65,8 +68,8 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath
val resourceDefinitionsPath = blueprintBasePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
- .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
+ .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
+ .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionFile = File(resourceDefinitionsPath)
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
index 48f1b2155..2dfc09be6 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
@@ -17,25 +17,33 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTemplateValidator {
+open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintNodeTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -55,11 +63,11 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val type: String = nodeTemplate.type
val nodeType: NodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
+ ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
nodeTemplate.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
+ .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
}
nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, name, nodeTemplate) }
nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, name, nodeTemplate) }
@@ -76,8 +84,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
paths.add("artifacts")
artifacts.forEach { artifactDefinitionName, artifactDefinition ->
- bluePrintTypeValidatorService.validateArtifactDefinition(bluePrintRuntimeService,
- artifactDefinitionName, artifactDefinition)
+ bluePrintTypeValidatorService.validateArtifactDefinition(
+ bluePrintRuntimeService,
+ artifactDefinitionName, artifactDefinition
+ )
}
paths.removeAt(paths.lastIndex)
}
@@ -90,8 +100,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
paths.add(capabilityName)
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
- "from NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
+ "from NodeType(${nodeTemplate.type})"
+ )
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -101,14 +113,17 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+ open fun validateCapabilityAssignment(
+ nodeTemplateName: String,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition,
+ capabilityAssignment: CapabilityAssignment
+ ) {
capabilityAssignment.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
+ .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
}
-
}
@Throws(BluePrintException::class)
@@ -118,21 +133,28 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
requirements?.forEach { requirementName, requirementAssignment ->
paths.add(requirementName)
val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
- " NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
- log.debug("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
- requirementAssignmentName)
+ open fun validateRequirementAssignment(
+ nodeTemplateName: String,
+ requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition,
+ requirementAssignment: RequirementAssignment
+ ) {
+ log.debug(
+ "Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
+ requirementAssignmentName
+ )
val requirementNodeTemplateName = requirementAssignment.node!!
val capabilityName = requirementAssignment.capability
val relationship = requirementAssignment.relationship!!
@@ -142,14 +164,16 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)")
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)"
+ )
relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)")
-
-
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)"
+ )
}
@Throws(BluePrintException::class)
@@ -160,80 +184,91 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
- " NodeType(${nodeTemplate.type})")
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
+
+ validateInterfaceAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ validateInterfaceOperationsAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
}
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceOperationsAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
+ ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
- log.debug("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
- "($operationAssignmentName)")
+ log.debug(
+ "Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
+ "($operationAssignmentName)"
+ )
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " +
- "definition ($operationAssignmentName) property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation " +
+ "definition ($operationAssignmentName) property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
outputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
- "output property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
+ "output property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
-
}
}
-
}
-
private fun validateExtension(referencePrefix: String, name: String, nodeTemplate: NodeTemplate) {
val customValidator = bluePrintTypeValidatorService
- .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
+ .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
customValidator?.let {
it.validate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
index 3d3122c61..5384744ee 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -17,20 +17,24 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-type-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator {
@@ -49,12 +53,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.add(nodeTypeName)
val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
+ // Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
bluePrintContext.serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
+ ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
}
nodeType.attributes?.let {
@@ -91,8 +95,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
+ open fun validateCapabilityDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition
+ ) {
val capabilityType = capabilityDefinition.type
check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
throw BluePrintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)")
@@ -111,8 +119,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
+ open fun validateRequirementDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition
+ ) {
log.info("validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
val requirementNodeTypeName = requirementDefinition.node!!
@@ -124,12 +136,13 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
}
val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
+ ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s " +
- "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) ")
-
+ ?: throw BluePrintException(
+ "failed to get requirement NodeType($requirementNodeTypeName)'s " +
+ "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) "
+ )
}
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
@@ -163,5 +176,4 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
open fun validateImplementation(implementation: Implementation) {
checkNotEmpty(implementation.primary) { "couldn't get implementation" }
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
index c2c80d7f7..5683c0170 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -25,23 +24,23 @@ import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-property-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator {
+open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintPropertyDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
this.bluePrintRuntimeService = bluePrintRuntimeService
-
log.trace("Validating PropertyDefinition($name)")
val dataType: String = propertyDefinition.type
@@ -55,14 +54,13 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
}
}
-
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
@@ -74,7 +72,7 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -88,4 +86,4 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
index 0e76be49e..d71e78c43 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
@@ -16,24 +16,29 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-service-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator {
+open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintServiceTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var error: BluePrintError
@@ -74,7 +79,6 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.removeAt(paths.lastIndex)
}
-
fun validateDataTypes(dataTypes: MutableMap<String, DataType>) {
paths.add(BluePrintConstants.PATH_DATA_TYPES)
@@ -108,4 +112,4 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate)
paths.removeAt(paths.lastIndex)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
index 406f8dec0..a7fb3d57e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -26,15 +25,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-topology-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator {
+open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintTopologyTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
@@ -55,7 +56,6 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs)
}
-
@Throws(BluePrintException::class)
fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) {
@@ -73,5 +73,4 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
index d9f19d489..1fb70503f 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
@@ -18,7 +18,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
@@ -43,8 +54,8 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
return context.getBeansOfType(classType)
- .filter { it.key.startsWith(referenceNamePrefix) }
- .mapNotNull { it.value }
+ .filter { it.key.startsWith(referenceNamePrefix) }
+ .mapNotNull { it.value }
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
@@ -53,52 +64,51 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintServiceTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
}
override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintDataTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default DataType validators")
+ ?: throw BluePrintProcessorException("failed to get default DataType validators")
}
override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
}
override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
}
override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeType validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeType validators")
}
override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintTopologyTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
}
override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
}
override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintWorkflowValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default Workflow validators")
+ ?: throw BluePrintProcessorException("failed to get default Workflow validators")
}
override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintPropertyDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
}
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintAttributeDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
index a59bcb2f8..a1a9eb913 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
@@ -21,4 +21,4 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan
-open class BluePrintValidationConfiguration \ No newline at end of file
+open class BluePrintValidationConfiguration
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
index e705808c9..a2b598017 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
@@ -17,13 +17,13 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
-import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
var paths: MutableList<String> = arrayListOf()
@@ -42,7 +42,6 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
this.bluePrintRuntimeService = bluePrintRuntimeService
-
paths.add(workflowName)
paths.joinToString(BluePrintConstants.PATH_DIVIDER)
@@ -65,18 +64,21 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
val nodeTypeDerivedFrom = bluePrintRuntimeService.bluePrintContext().nodeTemplateNodeType(it).derivedFrom
- check(nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW
- || nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT) {
+ check(
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW ||
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT
+ ) {
"NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected " +
"'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
}
} catch (e: Exception) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed to validate Workflow($workflowName)'s step($stepName)'s " +
- "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
+ .addError(
+ "Failed to validate Workflow($workflowName)'s step($stepName)'s " +
+ "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!
+ )
}
}
-
}
paths.removeAt(paths.lastIndex)
// Step Validation Ends
@@ -97,12 +99,10 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, workflow.outputs!!)
PropertyAssignmentValidationUtils(bluePrintRuntimeService.bluePrintContext())
- .validatePropertyDefinitionNAssignments(workflow.outputs!!)
+ .validatePropertyDefinitionNAssignments(workflow.outputs!!)
}
// Validate Value or Expression
workflow.outputs?.forEach { propertyName, propertyDefinition ->
-
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
index 03183e624..78a5d379e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
@@ -24,17 +23,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
@Service("artifact-mapping-resource-artifact-definition-validator")
-open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService)
- : BluePrintArtifactDefinitionValidator {
+open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
+ private val log = LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val file: String = artifactDefinition.file
@@ -44,4 +47,4 @@ open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorSe
val resourceAssignmentValidationService = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidationService.validate(resourceAssignment)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
index 608de4f0c..dc5da2669 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
@@ -16,11 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -31,13 +31,16 @@ interface ResourceDefinitionValidator : BluePrintValidator<ResourceDefinition>
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : ResourceDefinitionValidator {
- private val log= LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- resourceDefinition: ResourceDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ resourceDefinition: ResourceDefinition
+ ) {
log.trace("validating resource definition($name)")
resourceDefinition.sources.forEach { name, nodeTemplate ->
bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
index d49348152..63aa7e537 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
@@ -48,19 +48,23 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
}
}
- open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
- properties: MutableMap<String, JsonNode>) {
+ open fun validatePropertyAssignments(
+ nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>
+ ) {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
- ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
+ ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
}
}
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
+ open fun validatePropertyAssignment(
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode
+ ) {
// Check and Validate if Expression Node
val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
if (!expressionData.isExpression) {
@@ -74,13 +78,12 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
} else if (BluePrintTypes.validComplexTypes().contains(propertyType)) {
isValid = true
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -99,10 +102,9 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
open fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
+ ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
}
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
index 9dbd19e22..375bd8eae 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
@@ -60,7 +60,10 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)",
+ bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -90,9 +93,11 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
- "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
- "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
+ "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
+ "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -100,6 +105,4 @@ class BluePrintDesignTimeValidatorServiceTest {
val workflowName = "resource-assignment"
workflowValidator.validate(bluePrintRuntime, workflowName, bluePrintRuntime.bluePrintContext().workflowByName(workflowName))
}
-
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
index 169715295..11c6c037c 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
@@ -17,7 +17,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
@@ -26,11 +37,11 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
@@ -72,4 +83,4 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return listOf(BluePrintAttributeDefinitionValidatorImpl(this))
}
-} \ No newline at end of file
+}