diff options
author | 2021-07-26 12:00:59 -0400 | |
---|---|---|
committer | 2021-07-28 15:44:01 -0400 | |
commit | daab14bd058de198c80b71d63e108fd788b7f5ee (patch) | |
tree | 252cfdef5b2e1500e5bd152f3f5c52602b6b0deb /ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src | |
parent | 82e396d6917519468376d177dd6a2710e84fa23a (diff) |
Revert "Renaming Files having BluePrint to have Blueprint"
The renaming in CCSDK-3098 caused breaking changes to the grpc api and
compile issues for kotlin scripts.
Issue-ID: CCSDK-3385
Change-Id: I0d745cb858371678eabcb2284671c1fd76a1ab6d
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src')
18 files changed, 322 insertions, 322 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintArtifactDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt index d9f4db728..73504314b 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintArtifactDefinitionValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt @@ -16,13 +16,13 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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 -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintArtifactDefinitionValidator -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.core.interfaces.BluePrintArtifactDefinitionValidator +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 @@ -31,18 +31,18 @@ import java.io.File @Service("default-artifact-definition-validator") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -open class BlueprintArtifactDefinitionValidatorImpl( - private val bluePrintTypeValidatorService: BlueprintTypeValidatorService -) : BlueprintArtifactDefinitionValidator { +open class BluePrintArtifactDefinitionValidatorImpl( + 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 + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintContext: BluePrintContext var paths: MutableList<String> = arrayListOf() override fun validate( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition ) { @@ -61,7 +61,7 @@ open class BlueprintArtifactDefinitionValidatorImpl( val completePath = bluePrintContext.rootPath.plus(File.separator).plus(file) check(File(completePath).exists()) { - throw BlueprintException("couldn't find file ($completePath)") + throw BluePrintException("couldn't find file ($completePath)") } // Perform Extension Validation @@ -73,22 +73,22 @@ 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) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) { - check(BlueprintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition") + check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException("failed to get artifactType($artifactTypeName)'s derivedFrom($derivedFrom) definition") } } 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 -> diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintArtifactTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt index ebcdf9f52..b31211e2d 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintArtifactTypeValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt @@ -18,16 +18,16 @@ package org.onap.ccsdk.cds.controllerblueprints.validation import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintArtifactTypeValidator -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService 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) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) { artifactType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintAttributeDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt index ef02e84c3..9a4650104 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintAttributeDefinitionValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt @@ -17,13 +17,13 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition import org.onap.ccsdk.cds.controllerblueprints.core.format -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintAttributeDefinitionValidator -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator +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 @@ -31,15 +31,15 @@ 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<*> + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> override fun validate( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition ) { @@ -49,15 +49,15 @@ open class BlueprintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa val dataType: String = attributeDefinition.type when { - BlueprintTypes.validPrimitiveTypes().contains(dataType) -> { + BluePrintTypes.validPrimitiveTypes().contains(dataType) -> { // Do Nothing } - BlueprintTypes.validComplexTypes().contains(dataType) -> { + BluePrintTypes.validComplexTypes().contains(dataType) -> { // Do Nothing } - BlueprintTypes.validCollectionTypes().contains(dataType) -> { + 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) @@ -65,17 +65,17 @@ open class BlueprintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa } private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean { - if (BlueprintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { + if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { return true } else { - throw BlueprintException("DataType($dataType) for the attribute($propertyName) is not valid") + throw BluePrintException("DataType($dataType) for the attribute($propertyName) is not valid") } } 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) } @@ -85,8 +85,8 @@ open class BlueprintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa } open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { - check(BlueprintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") + check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDataTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt index 35680c2ac..dab6a78bc 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDataTypeValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt @@ -18,15 +18,15 @@ package org.onap.ccsdk.cds.controllerblueprints.validation import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintDataTypeValidator -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.springframework.stereotype.Service @Service("default-data-type-validator") -open class BlueprintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BlueprintTypeValidatorService) : BlueprintDataTypeValidator { +open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintDataTypeValidator { - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, dataType: DataType) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) { dataType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt index aac1c2e97..ac5773c76 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt @@ -18,12 +18,12 @@ package org.onap.ccsdk.cds.controllerblueprints.validation import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants @@ -34,21 +34,21 @@ import java.io.File import java.util.UUID @Service("bluePrintDesignTimeValidatorService") -open class BlueprintDesignTimeValidatorService( - private val bluePrintTypeValidatorService: BlueprintTypeValidatorService, +open class BluePrintDesignTimeValidatorService( + private val bluePrintTypeValidatorService: BluePrintTypeValidatorService, private val resourceDefinitionValidator: ResourceDefinitionValidator ) : - BlueprintValidatorService { + BluePrintValidatorService { - private val log = LoggerFactory.getLogger(BlueprintDesignTimeValidatorService::class.toString()) + private val log = LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString()) - override suspend fun validateBlueprints(basePath: String): Boolean { + override suspend fun validateBluePrints(basePath: String): Boolean { - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(UUID.randomUUID().toString(), basePath) - return validateBlueprints(bluePrintRuntimeService) + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath) + return validateBluePrints(bluePrintRuntimeService) } - override suspend fun validateBlueprints(bluePrintRuntimeService: BlueprintRuntimeService<*>): Boolean { + override suspend fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean { bluePrintTypeValidatorService.validateServiceTemplate( bluePrintRuntimeService, "service_template", @@ -58,19 +58,19 @@ open class BlueprintDesignTimeValidatorService( // Validate Resource Definitions validateResourceDefinitions(bluePrintRuntimeService) - bluePrintRuntimeService.getBlueprintError().allErrors().ifNotEmpty { - throw BlueprintException("failed in blueprint validation : ${this.joinToString("\n")}") + bluePrintRuntimeService.getBluePrintError().allErrors().ifNotEmpty { + throw BluePrintException("failed in blueprint validation : ${this.joinToString("\n")}") } return true } - private fun validateResourceDefinitions(bluePrintRuntimeService: BlueprintRuntimeService<*>) { + private fun validateResourceDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>) { // Validate Resource Dictionary val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath val resourceDefinitionsPath = blueprintBasePath.plus(File.separator) - .plus(BlueprintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator) + .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator) .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json") val resourceDefinitionFile = File(resourceDefinitionsPath) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintNodeTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt index 0374424e8..6fa83119e 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintNodeTemplateValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt @@ -17,8 +17,8 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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 import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition @@ -28,10 +28,10 @@ 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.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 @@ -40,17 +40,17 @@ 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 + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintContext: BluePrintContext lateinit var propertyAssignmentValidationUtils: PropertyAssignmentValidationUtils var paths: MutableList<String> = arrayListOf() - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { log.debug("Validating NodeTemplate($name)") this.bluePrintRuntimeService = bluePrintRuntimeService @@ -63,7 +63,7 @@ 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 @@ -80,7 +80,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.removeAt(paths.lastIndex) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) { paths.add("artifacts") artifacts.forEach { artifactDefinitionName, artifactDefinition -> @@ -92,7 +92,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.removeAt(paths.lastIndex) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val capabilities = nodeTemplate.capabilities paths.add("capabilities") @@ -100,7 +100,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.add(capabilityName) val capabilityDefinition = nodeType.capabilities?.get(capabilityName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " + "from NodeType(${nodeTemplate.type})" ) @@ -112,7 +112,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.removeAt(paths.lastIndex) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateCapabilityAssignment( nodeTemplateName: String, capabilityName: String, @@ -126,14 +126,14 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator } } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val requirements = nodeTemplate.requirements paths.add("requirements") requirements?.forEach { requirementName, requirementAssignment -> paths.add(requirementName) val requirementDefinition = nodeType.requirements?.get(requirementName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" + " NodeType(${nodeTemplate.type})" ) @@ -144,7 +144,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.removeAt(paths.lastIndex) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateRequirementAssignment( nodeTemplateName: String, requirementAssignmentName: String, @@ -159,24 +159,24 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator val capabilityName = requirementAssignment.capability val relationship = requirementAssignment.relationship!! - check(BlueprintTypes.validRelationShipDerivedFroms.contains(relationship)) { - throw BlueprintException("Failed to get relationship type ($relationship) for NodeTemplate($nodeTemplateName)'s requirement($requirementAssignmentName)") + check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) { + throw BluePrintException("Failed to get relationship type ($relationship) for NodeTemplate($nodeTemplateName)'s requirement($requirementAssignmentName)") } val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " + "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)" ) relationShipNodeTemplate.capabilities?.get(capabilityName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " + "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)" ) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateInterfaceAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) { val interfaces = nodeTemplate.interfaces @@ -184,7 +184,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator interfaces?.forEach { interfaceAssignmentName, interfaceAssignment -> paths.add(interfaceAssignmentName) val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" + " NodeType(${nodeTemplate.type})" ) @@ -198,7 +198,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator paths.removeAt(paths.lastIndex) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateInterfaceAssignment( nodeTemplateName: String, interfaceAssignmentName: String, @@ -215,7 +215,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator } } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateInterfaceOperationsAssignment( nodeTemplateName: String, interfaceAssignmentName: String, @@ -228,7 +228,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator 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 " + @@ -240,7 +240,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator inputs?.forEach { propertyName, propertyAssignment -> val propertyDefinition = operationDefinition.inputs?.get(propertyName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get NodeTemplate($nodeTemplateName) operation " + "definition ($operationAssignmentName) property definition($propertyName)" ) @@ -251,7 +251,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator outputs?.forEach { propertyName, propertyAssignment -> val propertyDefinition = operationDefinition.outputs?.get(propertyName) - ?: throw BlueprintException( + ?: throw BluePrintException( "Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " + "output property definition($propertyName)" ) @@ -265,7 +265,7 @@ open class BlueprintNodeTemplateValidatorImpl(private val bluePrintTypeValidator 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) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintNodeTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt index b7ec2d150..04a3fd046 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintNodeTypeValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt @@ -17,8 +17,8 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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.CapabilityDefinition import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation @@ -26,10 +26,10 @@ 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.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 @@ -37,15 +37,15 @@ import org.springframework.stereotype.Service @Service("default-node-type-validator") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -open class BlueprintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BlueprintTypeValidatorService) : BlueprintNodeTypeValidator { +open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator { - private val log = LoggerFactory.getLogger(BlueprintServiceTemplateValidatorImpl::class.toString()) + private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) - lateinit var bluePrintRuntimeService: BlueprintRuntimeService<*> - lateinit var bluePrintContext: BlueprintContext + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var bluePrintContext: BluePrintContext var paths: MutableList<String> = arrayListOf() - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, nodeTypeName: String, nodeType: NodeType) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTypeName: String, nodeType: NodeType) { log.trace("Validating NodeType($nodeTypeName)") this.bluePrintRuntimeService = bluePrintRuntimeService this.bluePrintContext = bluePrintRuntimeService.bluePrintContext() @@ -56,9 +56,9 @@ open class BlueprintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ // Check Derived From checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom) - if (!BlueprintTypes.rootNodeTypes().contains(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 { @@ -77,8 +77,8 @@ open class BlueprintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ } fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) { - check(BlueprintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException("Failed to get node type ($nodeTypeName)'s derivedFrom($derivedFrom) definition ") + check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException("Failed to get node type ($nodeTypeName)'s derivedFrom($derivedFrom) definition ") } } @@ -102,8 +102,8 @@ open class BlueprintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ capabilityDefinition: CapabilityDefinition ) { val capabilityType = capabilityDefinition.type - check(BlueprintTypes.validCapabilityTypes.contains(capabilityType)) { - throw BlueprintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)") + check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) { + throw BluePrintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)") } } @@ -131,15 +131,15 @@ open class BlueprintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ val capabilityName = requirementDefinition.capability val relationship = requirementDefinition.relationship!! - check(BlueprintTypes.validRelationShipDerivedFroms.contains(relationship)) { - throw BlueprintException("failed to get relationship($relationship) for NodeType($nodeTypeName)'s requirement($requirementDefinitionName)") + check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) { + throw BluePrintException("failed to get relationship($relationship) for NodeType($nodeTypeName)'s requirement($requirementDefinitionName)") } 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( + ?: throw BluePrintException( "failed to get requirement NodeType($requirementNodeTypeName)'s " + "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) " ) diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintPropertyDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt index 4d69d3acd..5683c0170 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintPropertyDefinitionValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt @@ -17,13 +17,13 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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 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.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 @@ -31,14 +31,14 @@ 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<*> + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) { this.bluePrintRuntimeService = bluePrintRuntimeService log.trace("Validating PropertyDefinition($name)") @@ -46,15 +46,15 @@ open class BlueprintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal val dataType: String = propertyDefinition.type when { - BlueprintTypes.validPrimitiveTypes().contains(dataType) -> { + BluePrintTypes.validPrimitiveTypes().contains(dataType) -> { // Do Nothing } - BlueprintTypes.validComplexTypes().contains(dataType) -> { + BluePrintTypes.validComplexTypes().contains(dataType) -> { // Do Nothing } - BlueprintTypes.validCollectionTypes().contains(dataType) -> { + 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) @@ -62,17 +62,17 @@ open class BlueprintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal } private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean { - if (BlueprintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { + if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) { return true } else { - throw BlueprintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName)) + throw BluePrintException(format("DataType({}) for the property({}) is not valid", dataType, propertyName)) } } 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) } @@ -82,8 +82,8 @@ open class BlueprintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal } open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) { - check(BlueprintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) + check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom)) } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt index 137e6e6b9..b01116fcb 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt @@ -18,16 +18,16 @@ package org.onap.ccsdk.cds.controllerblueprints.validation 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.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError 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.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 @@ -35,21 +35,21 @@ 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 + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> + lateinit var error: BluePrintError var paths: MutableList<String> = arrayListOf() - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) { log.trace("Validating Service Template..") try { this.bluePrintRuntimeService = bluePrintRuntimeService - this.error = bluePrintRuntimeService.getBlueprintError() + this.error = bluePrintRuntimeService.getBluePrintError() serviceTemplate.metadata?.let { validateMetadata(serviceTemplate.metadata!!) } serviceTemplate.dataTypes?.let { validateDataTypes(serviceTemplate.dataTypes!!) } @@ -58,18 +58,18 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida serviceTemplate.topologyTemplate?.let { validateTopologyTemplate(serviceTemplate.topologyTemplate!!) } } catch (e: Exception) { log.error("failed in blueprint service template validation", e) - error.addError(BlueprintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!, "BlueprintServiceTemplateValidator") + error.addError(BluePrintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!, "BlueprintServiceTemplateValidator") } } fun validateMetadata(metaDataMap: MutableMap<String, String>) { - paths.add(BlueprintConstants.PATH_METADATA) + paths.add(BluePrintConstants.PATH_METADATA) - val templateName = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_NAME] - val templateVersion = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_VERSION] - val templateTags = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_TAGS] - val templateAuthor = metaDataMap[BlueprintConstants.METADATA_TEMPLATE_AUTHOR] + val templateName = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_NAME] + val templateVersion = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_VERSION] + val templateTags = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_TAGS] + val templateAuthor = metaDataMap[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] Preconditions.checkArgument(StringUtils.isNotBlank(templateName), "failed to get template name metadata") Preconditions.checkArgument(StringUtils.isNotBlank(templateVersion), "failed to get template version metadata") @@ -81,7 +81,7 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida fun validateDataTypes(dataTypes: MutableMap<String, DataType>) { - paths.add(BlueprintConstants.PATH_DATA_TYPES) + paths.add(BluePrintConstants.PATH_DATA_TYPES) dataTypes.forEach { dataTypeName, dataType -> // Validate Single Data Type bluePrintTypeValidatorService.validateDataType(bluePrintRuntimeService, dataTypeName, dataType) @@ -90,7 +90,7 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida } fun validateArtifactTypes(artifactTypes: MutableMap<String, ArtifactType>) { - paths.add(BlueprintConstants.PATH_ARTIFACT_TYPES) + paths.add(BluePrintConstants.PATH_ARTIFACT_TYPES) artifactTypes.forEach { artifactName, artifactType -> // Validate Single Artifact Type bluePrintTypeValidatorService.validateArtifactType(bluePrintRuntimeService, artifactName, artifactType) @@ -99,7 +99,7 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida } fun validateNodeTypes(nodeTypes: MutableMap<String, NodeType>) { - paths.add(BlueprintConstants.PATH_NODE_TYPES) + paths.add(BluePrintConstants.PATH_NODE_TYPES) nodeTypes.forEach { nodeTypeName, nodeType -> // Validate Single Node Type bluePrintTypeValidatorService.validateNodeType(bluePrintRuntimeService, nodeTypeName, nodeType) @@ -108,7 +108,7 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida } fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) { - paths.add(BlueprintConstants.PATH_TOPOLOGY_TEMPLATE) + paths.add(BluePrintConstants.PATH_TOPOLOGY_TEMPLATE) bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate) paths.removeAt(paths.lastIndex) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintTopologyTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt index d9bd51619..a7fb3d57e 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintTopologyTemplateValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt @@ -17,14 +17,14 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException +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 import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate 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.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 @@ -32,14 +32,14 @@ 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<*> + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) { log.trace("Validating Topology Template..") this.bluePrintRuntimeService = bluePrintRuntimeService @@ -51,12 +51,12 @@ open class BlueprintTopologyTemplateValidatorImpl(private val bluePrintTypeValid topologyTemplate.workflows?.let { validateWorkflows(topologyTemplate.workflows!!) } } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) fun validateInputs(inputs: MutableMap<String, PropertyDefinition>) { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs) } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) { nodeTemplates.forEach { nodeTemplateName, nodeTemplate -> @@ -65,7 +65,7 @@ open class BlueprintTopologyTemplateValidatorImpl(private val bluePrintTypeValid } } - @Throws(BlueprintException::class) + @Throws(BluePrintException::class) open fun validateWorkflows(workflows: MutableMap<String, Workflow>) { workflows.forEach { workflowName, workflow -> diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintTypeValidatorServiceImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt index 4e5f0da16..db7d91a22 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintTypeValidatorServiceImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt @@ -17,25 +17,25 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException -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.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +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 @Service -class BlueprintTypeValidatorServiceImpl : BlueprintTypeValidatorService { +class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService { companion object { @@ -45,7 +45,7 @@ class BlueprintTypeValidatorServiceImpl : BlueprintTypeValidatorService { @Autowired private lateinit var context: ApplicationContext - override fun <T : BlueprintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { + override fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { return if (context.containsBean(referenceName)) { context.getBean(referenceName, classType) } else { @@ -53,63 +53,63 @@ class BlueprintTypeValidatorServiceImpl : BlueprintTypeValidatorService { } } - override fun <T : BlueprintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { + override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { return context.getBeansOfType(classType) .filter { it.key.startsWith(referenceNamePrefix) } .mapNotNull { it.value } } - override fun <T : BlueprintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { + override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { return context.getBeansOfType(classType).mapNotNull { it.value } } - override fun getServiceTemplateValidators(): List<BlueprintServiceTemplateValidator> { - return bluePrintValidators(PREFIX_DEFAULT, BlueprintServiceTemplateValidator::class.java) - ?: throw BlueprintProcessorException("failed to get default ServiceTemplate validators") + override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintServiceTemplateValidator::class.java) + ?: 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") + override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintDataTypeValidator::class.java) + ?: 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") + override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactTypeValidator::class.java) + ?: 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") + override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactDefinitionValidator::class.java) + ?: 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") + override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTypeValidator::class.java) + ?: 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") + override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintTopologyTemplateValidator::class.java) + ?: 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") + override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTemplateValidator::class.java) + ?: 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") + override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintWorkflowValidator::class.java) + ?: 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") + override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintPropertyDefinitionValidator::class.java) + ?: 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") + override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> { + return bluePrintValidators(PREFIX_DEFAULT, BluePrintAttributeDefinitionValidator::class.java) + ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators") } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintValidationConfiguration.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt index b4d2372d0..a1a9eb913 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintValidationConfiguration.kt +++ b/ms/blueprintsprocessor/modules/blueprints/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 +open class BluePrintValidationConfiguration diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt index bff09fc83..21923d1f9 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt @@ -17,11 +17,11 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +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.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 @@ -30,20 +30,20 @@ import org.springframework.stereotype.Service @Service("default-workflow-validator") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -open class BlueprintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BlueprintTypeValidatorService) : BlueprintWorkflowValidator { +open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator { - private val log = LoggerFactory.getLogger(BlueprintServiceTemplateValidatorImpl::class.toString()) - lateinit var bluePrintRuntimeService: BlueprintRuntimeService<*> + private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString()) + lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*> var paths: MutableList<String> = arrayListOf() - override fun validate(bluePrintRuntimeService: BlueprintRuntimeService<*>, workflowName: String, workflow: Workflow) { + override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, workflowName: String, workflow: Workflow) { log.info("Validating Workflow($workflowName)") this.bluePrintRuntimeService = bluePrintRuntimeService paths.add(workflowName) - paths.joinToString(BlueprintConstants.PATH_DIVIDER) + paths.joinToString(BluePrintConstants.PATH_DIVIDER) // Validate Workflow Inputs validateInputs(workflow) @@ -55,7 +55,7 @@ open class BlueprintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ paths.add("steps") workflow.steps?.forEach { stepName, step -> paths.add(stepName) - paths.joinToString(BlueprintConstants.PATH_DIVIDER) + paths.joinToString(BluePrintConstants.PATH_DIVIDER) // Validate target step.target?.let { @@ -65,18 +65,18 @@ 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 + 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}'" + "'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'" } } catch (e: Exception) { - bluePrintRuntimeService.getBlueprintError() + bluePrintRuntimeService.getBluePrintError() .addError( "Failed to validate Workflow($workflowName)'s step($stepName)'s " + "definition", - paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!, + paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!, "BlueprintWorkflowValidatorImpl" ) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt index d7dcd9713..78a5d379e 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt @@ -17,9 +17,9 @@ package org.onap.ccsdk.cds.controllerblueprints.validation.extension 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 -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService 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 @@ -28,13 +28,13 @@ 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()) override fun validate( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition ) { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt index 044c5296b..dc5da2669 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt @@ -16,25 +16,25 @@ package org.onap.ccsdk.cds.controllerblueprints.validation.extension -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.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 -interface ResourceDefinitionValidator : BlueprintValidator<ResourceDefinition> +interface ResourceDefinitionValidator : BluePrintValidator<ResourceDefinition> @Service @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BlueprintTypeValidatorService) : ResourceDefinitionValidator { +open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : ResourceDefinitionValidator { private val log = LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java) override fun validate( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, resourceDefinition: ResourceDefinition ) { diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt index 91d01c6a0..63aa7e537 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt @@ -18,15 +18,15 @@ package org.onap.ccsdk.cds.controllerblueprints.validation.utils import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +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 import org.onap.ccsdk.cds.controllerblueprints.core.format -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintExpressionService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintExpressionService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueprintContext) { +open class PropertyAssignmentValidationUtils(private val bluePrintContext: BluePrintContext) { // Property Definition holds both Definitons and Expression in same construct open fun validatePropertyDefinitionNAssignments(propertyDefinitions: MutableMap<String, PropertyDefinition>) { @@ -39,10 +39,10 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep open fun validatePropertyDefinitionNAssignment(propertyName: String, propertyDefinition: PropertyDefinition) { // Check and Validate if Expression Node checkNotNull(propertyDefinition.value) { - throw BlueprintException("couldn't get 'value' property from PropertyDefinition($propertyName)") + throw BluePrintException("couldn't get 'value' property from PropertyDefinition($propertyName)") } val propertyAssignment = propertyDefinition.value!! - val expressionData = BlueprintExpressionService.getExpressionData(propertyAssignment) + val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) if (!expressionData.isExpression) { checkPropertyValue(propertyName, propertyDefinition, propertyAssignment) } @@ -54,7 +54,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep ) { 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) } @@ -66,7 +66,7 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep propertyAssignment: JsonNode ) { // Check and Validate if Expression Node - val expressionData = BlueprintExpressionService.getExpressionData(propertyAssignment) + val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment) if (!expressionData.isExpression) { checkPropertyValue(propertyName, propertyDefinition, propertyAssignment) } @@ -76,16 +76,16 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep val propertyType = propertyDefinition.type val isValid: Boolean - if (BlueprintTypes.validPrimitiveTypes().contains(propertyType)) { + if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) { isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment) - } else if (BlueprintTypes.validComplexTypes().contains(propertyType)) { + } else if (BluePrintTypes.validComplexTypes().contains(propertyType)) { isValid = true - } else if (BlueprintTypes.validCollectionTypes().contains(propertyType)) { + } 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)) { + if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) { checkPropertyDataType(entrySchemaType, propertyName) } isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment) @@ -95,21 +95,21 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: Bluep } check(isValid) { - throw BlueprintException("property($propertyName) defined of type($propertyType) is not compatible with the value ($propertyAssignment)") + throw BluePrintException("property($propertyName) defined of type($propertyType) is not compatible with the value ($propertyAssignment)") } } 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) { - check(BlueprintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { - throw BlueprintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") + check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) { + throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ") } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt index dd82ec5da..fd39f8f95 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt @@ -21,34 +21,34 @@ import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.runBlocking import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError 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.Step import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefinitionValidator import kotlin.test.assertEquals import kotlin.test.assertTrue -class BlueprintDesignTimeValidatorServiceTest { +class BluePrintDesignTimeValidatorServiceTest { private val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - private val bluePrintRuntime = BlueprintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath) - private val mockBlueprintTypeValidatorService = MockBlueprintTypeValidatorService() + private val bluePrintRuntime = BluePrintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath) + private val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService() private val resourceDefinitionValidator = mockk<ResourceDefinitionValidator>() - private val defaultBlueprintValidatorService = - BlueprintDesignTimeValidatorService(mockBlueprintTypeValidatorService, resourceDefinitionValidator) - private val workflowValidator = BlueprintWorkflowValidatorImpl(mockBlueprintTypeValidatorService) + private val defaultBluePrintValidatorService = + BluePrintDesignTimeValidatorService(mockBluePrintTypeValidatorService, resourceDefinitionValidator) + private val workflowValidator = BluePrintWorkflowValidatorImpl(mockBluePrintTypeValidatorService) @Test fun testValidateOfType() { runBlocking { every { resourceDefinitionValidator.validate(bluePrintRuntime, any(), any()) } returns Unit - val valid = defaultBlueprintValidatorService.validateBlueprints(bluePrintRuntime) + val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime) assertTrue(valid, "failed in blueprint Validation") } } @@ -63,10 +63,10 @@ class BlueprintDesignTimeValidatorServiceTest { workflow.steps = mutableMapOf("test" to step) workflowValidator.validate(bluePrintRuntime, workflowName, workflow) - assertEquals(1, bluePrintRuntime.getBlueprintError().allErrors().size) + assertEquals(1, bluePrintRuntime.getBluePrintError().allErrors().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().allErrors()[0] + bluePrintRuntime.getBluePrintError().allErrors()[0] ) } @@ -81,13 +81,13 @@ class BlueprintDesignTimeValidatorServiceTest { val nodeType = mockk<NodeType>() every { nodeType.derivedFrom } returns "tosca.nodes.TEST" - val blueprintContext = mockk<BlueprintContext>() + val blueprintContext = mockk<BluePrintContext>() every { blueprintContext.nodeTemplateByName(nodeTemplateName) } returns nodeTemplate every { blueprintContext.nodeTemplateNodeType(nodeTemplateName) } returns nodeType - val bluePrintRuntime = mockk<DefaultBlueprintRuntimeService>("1234") + val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234") - every { bluePrintRuntime.getBlueprintError() } returns BlueprintError() + every { bluePrintRuntime.getBluePrintError() } returns BluePrintError() every { bluePrintRuntime.bluePrintContext() } returns blueprintContext val step = Step() @@ -96,12 +96,12 @@ class BlueprintDesignTimeValidatorServiceTest { workflow.steps = mutableMapOf("test" to step) workflowValidator.validate(bluePrintRuntime, workflowName, workflow) - assertEquals(1, bluePrintRuntime.getBlueprintError().allErrors().size) + assertEquals(1, bluePrintRuntime.getBluePrintError().allErrors().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().allErrors()[0] + bluePrintRuntime.getBluePrintError().allErrors()[0] ) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBlueprintTypeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt index 69f57a0b9..11c6c037c 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBlueprintTypeValidatorService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt @@ -17,70 +17,70 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -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 { - - override fun <T : BlueprintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { +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 { + + override fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { return null } - override fun <T : BlueprintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { + override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { return null } - override fun <T : BlueprintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { + override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { return null } - override fun getServiceTemplateValidators(): List<BlueprintServiceTemplateValidator> { - return listOf(BlueprintServiceTemplateValidatorImpl(this)) + override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> { + return listOf(BluePrintServiceTemplateValidatorImpl(this)) } - override fun getDataTypeValidators(): List<BlueprintDataTypeValidator> { - return listOf(BlueprintDataTypeValidatorImpl(this)) + override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> { + return listOf(BluePrintDataTypeValidatorImpl(this)) } - override fun getArtifactTypeValidators(): List<BlueprintArtifactTypeValidator> { - return listOf(BlueprintArtifactTypeValidatorImpl(this)) + override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> { + return listOf(BluePrintArtifactTypeValidatorImpl(this)) } - override fun getArtifactDefinitionsValidators(): List<BlueprintArtifactDefinitionValidator> { - return listOf(BlueprintArtifactDefinitionValidatorImpl(this)) + override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> { + return listOf(BluePrintArtifactDefinitionValidatorImpl(this)) } - override fun getNodeTypeValidators(): List<BlueprintNodeTypeValidator> { - return listOf(BlueprintNodeTypeValidatorImpl(this)) + override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> { + return listOf(BluePrintNodeTypeValidatorImpl(this)) } - override fun getTopologyTemplateValidators(): List<BlueprintTopologyTemplateValidator> { - return listOf(BlueprintTopologyTemplateValidatorImpl(this)) + override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> { + return listOf(BluePrintTopologyTemplateValidatorImpl(this)) } - override fun getNodeTemplateValidators(): List<BlueprintNodeTemplateValidator> { - return listOf(BlueprintNodeTemplateValidatorImpl(this)) + override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> { + return listOf(BluePrintNodeTemplateValidatorImpl(this)) } - override fun getWorkflowValidators(): List<BlueprintWorkflowValidator> { - return listOf(BlueprintWorkflowValidatorImpl(this)) + override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> { + return listOf(BluePrintWorkflowValidatorImpl(this)) } - override fun getPropertyDefinitionValidators(): List<BlueprintPropertyDefinitionValidator> { - return listOf(BlueprintPropertyDefinitionValidatorImpl(this)) + override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> { + return listOf(BluePrintPropertyDefinitionValidatorImpl(this)) } - override fun getAttributeDefinitionValidators(): List<BlueprintAttributeDefinitionValidator> { - return listOf(BlueprintAttributeDefinitionValidatorImpl(this)) + override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> { + return listOf(BluePrintAttributeDefinitionValidatorImpl(this)) } } |