summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt59
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt8
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt8
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt7
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt7
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt28
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt20
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt17
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt22
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt17
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt22
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt13
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt3
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt4
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json20
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json10
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json52
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json51
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json56
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json51
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt10
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt4
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt6
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java19
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java67
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceAssignmentValidationService.java29
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java29
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java1
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java4
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt66
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt103
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java9
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java59
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java72
37 files changed, 323 insertions, 638 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
index adc94c4c..bea790fd 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
@@ -1,14 +1,13 @@
package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
interface BluePrintValidator<T> {
- fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T)
+ fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
}
@@ -37,7 +36,10 @@ interface BluePrintAttributeDefinitionValidator : BluePrintValidator<AttributeDe
interface BluePrintValidatorService {
@Throws(BluePrintException::class)
- fun validateBluePrints(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>) : Boolean
+ fun validateBluePrints(basePath: String): Boolean
+
+ @Throws(BluePrintException::class)
+ fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean
}
@@ -61,66 +63,67 @@ interface BluePrintTypeValidatorService {
fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator>
- fun validateServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) {
+ fun validateServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
val validators = getServiceTemplateValidators()
- doValidation(bluePrintContext, error, name, serviceTemplate, validators)
+ doValidation(bluePrintRuntimeService, name, serviceTemplate, validators)
}
- fun validateArtifactType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) {
+ fun validateArtifactType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
val validators = getArtifactTypeValidators()
- doValidation(bluePrintContext, error, name, artifactType, validators)
+ doValidation(bluePrintRuntimeService, name, artifactType, validators)
}
- fun validateDataType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) {
+ fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) {
val validators = getDataTypeValidators()
- doValidation(bluePrintContext, error, name, dataType, validators)
+ doValidation(bluePrintRuntimeService, name, dataType, validators)
}
- fun validateNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) {
+ fun validateNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
val validators = getNodeTypeValidators()
- doValidation(bluePrintContext, error, name, nodeType, validators)
+ doValidation(bluePrintRuntimeService, name, nodeType, validators)
}
- fun validateTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) {
+ fun validateTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
val validators = getTopologyTemplateValidators()
- doValidation(bluePrintContext, error, name, topologyTemplate, validators)
+ doValidation(bluePrintRuntimeService, name, topologyTemplate, validators)
}
- fun validateNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) {
+ fun validateNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
val validators = getNodeTemplateValidators()
- doValidation(bluePrintContext, error, name, nodeTemplate, validators)
+ doValidation(bluePrintRuntimeService, name, nodeTemplate, validators)
}
- fun validateWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) {
+ fun validateWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) {
val validators = getWorkflowValidators()
- doValidation(bluePrintContext, error, name, workflow, validators)
+ doValidation(bluePrintRuntimeService, name, workflow, validators)
}
- fun validatePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap<String, PropertyDefinition>) {
+ fun validatePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) {
properties.forEach { propertyName, propertyDefinition ->
- validatePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition)
+ validatePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
}
}
- fun validatePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) {
+ fun validatePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
val validators = getPropertyDefinitionValidators()
- doValidation(bluePrintContext, error, name, propertyDefinition, validators)
+ doValidation(bluePrintRuntimeService, name, propertyDefinition, validators)
}
- fun validateAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap<String, AttributeDefinition>) {
+ fun validateAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) {
attributes.forEach { attributeName, attributeDefinition ->
- validateAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition)
+ validateAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
}
}
- fun validateAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) {
+ fun validateAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) {
val validators = getAttributeDefinitionValidators()
- doValidation(bluePrintContext, error, name, attributeDefinition, validators)
+ doValidation(bluePrintRuntimeService, name, attributeDefinition, validators)
}
- private fun <T> doValidation(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, validators: List<BluePrintValidator<T>>) {
+ @Suppress("UNCHECKED_CAST")
+ private fun <T> doValidation(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, validators: List<BluePrintValidator<T>>) {
validators.forEach {
- it.validate(bluePrintContext, error, name, definition as T)
+ it.validate(bluePrintRuntimeService, name, definition as T)
}
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
index 4cb247b5..f9ac8760 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
@@ -90,22 +90,22 @@ class BluePrintFileUtils {
}
blueprintContext.serviceTemplate.dataTypes?.let {
- val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it, true)
+ val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it.toSortedMap(), true)
writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent)
}
blueprintContext.serviceTemplate.artifactTypes?.let {
- val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it, true)
+ val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it.toSortedMap(), true)
writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent)
}
blueprintContext.serviceTemplate.nodeTypes?.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it, true)
+ val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it.toSortedMap(), true)
writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent)
}
blueprintContext.serviceTemplate.policyTypes?.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it, true)
+ val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it.toSortedMap(), true)
writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent)
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt
index 3fd31854..e383588e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintArtifactTypeValidatorImpl.kt
@@ -16,17 +16,17 @@
package org.onap.ccsdk.apps.controllerblueprints.core.validation
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator {
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, artifactType: ArtifactType) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
+
artifactType.properties?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, artifactType.properties!!)
+ bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!)
}
// TODO ("Files Present ")
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt
index 98abc1e2..53a27b53 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintAttributeDefinitionValidatorImpl.kt
@@ -16,15 +16,14 @@
package org.onap.ccsdk.apps.controllerblueprints.core.validation
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.AttributeDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
+open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: AttributeDefinition) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: AttributeDefinition) {
//TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
} \ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt
index 1241aa6d..980302bf 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintDataTypeValidatorImpl.kt
@@ -18,21 +18,20 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintDataTypeValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintDataTypeValidatorImpl::class.toString())
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, dataType: DataType) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) {
log.trace("Validating DataType($name)")
dataType.properties?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, dataType.properties!!)
+ bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!)
}
}
} \ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt
index 26a246dd..1449e63d 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTemplateValidatorImpl.kt
@@ -21,13 +21,13 @@ import com.att.eelf.configuration.EELFManager
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.format
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintExpressionService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
@@ -35,14 +35,15 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var bluePrintContext: BluePrintContext
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
- log.trace("Validating NodeTemplate($nodeTemplateName)")
- this.bluePrintContext = bluePrintContext
- this.error = error
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ log.info("Validating NodeTemplate($nodeTemplateName)")
+
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
paths.add(nodeTemplateName)
@@ -156,7 +157,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
throw BluePrintException("Failed to get relationship type ($relationship) for NodeTemplate($nodeTemplateName)'s requirement($requirementAssignmentName)")
}
- val relationShipNodeTemplate = bluePrintContext!!.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
+ val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
"for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)")
@@ -212,16 +213,15 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
- log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
- interfaceAssignmentName, operationAssignmentName)
+ log.info("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation ($operationAssignmentName)")
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate(nodeTemplateName) operation " +
- "definition (operationAssignmentName) property definition(propertyName)")
+ ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " +
+ "definition ($operationAssignmentName) property definition($propertyName)")
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
@@ -241,7 +241,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
- val artifactType = bluePrintContext!!.serviceTemplate.artifactTypes?.get(artifactTypeName)
+ val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
@@ -282,7 +282,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
- val dataType = bluePrintContext!!.serviceTemplate.dataTypes?.get(dataTypeName)
+ val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
index e15724ae..2e4a733a 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -20,26 +20,26 @@ import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.checkNotEmptyNThrow
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var bluePrintContext: BluePrintContext
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, nodeTypeName: String, nodeType: NodeType) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTypeName: String, nodeType: NodeType) {
log.trace("Validating NodeType($nodeTypeName)")
- this.bluePrintContext = bluePrintContext
- this.error = error
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
paths.add(nodeTypeName)
@@ -52,7 +52,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
}
- nodeType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext, error, nodeType.properties!!) }
+ nodeType.properties?.let { bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, nodeType.properties!!) }
nodeType.capabilities?.let { validateCapabilityDefinitions(nodeTypeName, nodeType) }
nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) }
nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
@@ -111,7 +111,7 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
throw BluePrintException("failed to get relationship($relationship) for NodeType($nodeTypeName)'s requirement($requirementDefinitionName)")
}
- val relationShipNodeType = bluePrintContext!!.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
+ val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
relationShipNodeType.capabilities?.get(capabilityName)
@@ -137,11 +137,11 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
operationDefinition.implementation?.let { validateImplementation(operationDefinition.implementation!!) }
operationDefinition.inputs?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, operationDefinition.inputs!!)
+ bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.inputs!!)
}
operationDefinition.outputs?.let {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, operationDefinition.outputs!!)
+ bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, operationDefinition.outputs!!)
}
paths.removeAt(paths.lastIndex)
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt
index f7a1cbf4..ca156190 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintPropertyDefinitionValidatorImpl.kt
@@ -20,23 +20,22 @@ import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.format
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+
+
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
+ this.bluePrintRuntimeService = bluePrintRuntimeService
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) {
- this.bluePrintContext = bluePrintContext
- this.error = error
log.trace("Validating PropertyDefinition($name)")
@@ -66,14 +65,14 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
- val dataType = bluePrintContext!!.serviceTemplate.dataTypes?.get(dataTypeName)
+ val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
private fun checkDataType(key: String): Boolean {
- return bluePrintContext!!.serviceTemplate.dataTypes?.containsKey(key) ?: false
+ return bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.containsKey(key) ?: false
}
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt
index 848dcc5f..61159cf8 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintServiceTemplateValidatorImpl.kt
@@ -25,21 +25,22 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var error: BluePrintError
+
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
log.trace("Validating Service Template..")
try {
- this.bluePrintContext = bluePrintContext
- this.error = error
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.error = bluePrintRuntimeService.getBluePrintError()
serviceTemplate.metadata?.let { validateMetadata(serviceTemplate.metadata!!) }
serviceTemplate.dataTypes?.let { validateDataTypes(serviceTemplate.dataTypes!!) }
@@ -47,6 +48,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
serviceTemplate.nodeTypes?.let { validateNodeTypes(serviceTemplate.nodeTypes!!) }
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!!)
}
}
@@ -74,7 +76,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.add(BluePrintConstants.PATH_DATA_TYPES)
dataTypes.forEach { dataTypeName, dataType ->
// Validate Single Data Type
- bluePrintTypeValidatorService.validateDataType(bluePrintContext!!, error!!, dataTypeName, dataType)
+ bluePrintTypeValidatorService.validateDataType(bluePrintRuntimeService, dataTypeName, dataType)
}
paths.removeAt(paths.lastIndex)
}
@@ -83,7 +85,7 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.add(BluePrintConstants.PATH_ARTIFACT_TYPES)
artifactTypes.forEach { artifactName, artifactType ->
// Validate Single Artifact Type
- bluePrintTypeValidatorService.validateArtifactType(bluePrintContext!!, error!!, artifactName, artifactType)
+ bluePrintTypeValidatorService.validateArtifactType(bluePrintRuntimeService, artifactName, artifactType)
}
paths.removeAt(paths.lastIndex)
}
@@ -92,14 +94,14 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.add(BluePrintConstants.PATH_NODE_TYPES)
nodeTypes.forEach { nodeTypeName, nodeType ->
// Validate Single Node Type
- bluePrintTypeValidatorService.validateNodeType(bluePrintContext!!, error!!, nodeTypeName, nodeType)
+ bluePrintTypeValidatorService.validateNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
}
paths.removeAt(paths.lastIndex)
}
fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) {
paths.add(BluePrintConstants.PATH_TOPOLOGY_TEMPLATE)
- bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintContext!!, error!!, "topologyTemplate", topologyTemplate)
+ bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate)
paths.removeAt(paths.lastIndex)
}
} \ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt
index 2783e14e..b87666d2 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintTopologyTemplateValidatorImpl.kt
@@ -19,26 +19,23 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.data.TopologyTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
log.trace("Validating Topology Template..")
- this.bluePrintContext = bluePrintContext
- this.error = error
+ this.bluePrintRuntimeService = bluePrintRuntimeService
// Validate Inputs
topologyTemplate.inputs?.let { validateInputs(topologyTemplate.inputs!!) }
@@ -50,7 +47,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
@Throws(BluePrintException::class)
fun validateInputs(inputs: MutableMap<String, PropertyDefinition>) {
- bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintContext!!, error!!, inputs)
+ bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs)
}
@@ -59,7 +56,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
nodeTemplates.forEach { nodeTemplateName, nodeTemplate ->
// Validate Single Node Template
- bluePrintTypeValidatorService.validateNodeTemplate(bluePrintContext!!, error!!, nodeTemplateName, nodeTemplate)
+ bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeTemplate)
}
}
@@ -68,7 +65,7 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
workflows.forEach { workflowName, workflow ->
// Validate Single workflow
- bluePrintTypeValidatorService.validateWorkflow(bluePrintContext!!, error!!, workflowName, workflow)
+ bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow)
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt
index 4ddf76b2..4f68342e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImpl.kt
@@ -19,21 +19,29 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import java.util.*
open class BluePrintValidatorServiceImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintValidatorService {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintValidatorServiceImpl::class.toString())
- override fun validateBluePrints(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>): Boolean {
- val error = BluePrintError()
- bluePrintTypeValidatorService.validateServiceTemplate(bluePrintContext, error, "default", bluePrintContext.serviceTemplate)
- if (error.errors.size > 0) {
- throw BluePrintException("failed in blueprint validation : ${error.errors.joinToString("\n")}")
+ override fun validateBluePrints(basePath: String): Boolean {
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath)
+ return validateBluePrints(bluePrintRuntimeService)
+ }
+
+ override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
+
+ bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
+ bluePrintRuntimeService.bluePrintContext().serviceTemplate)
+ if (bluePrintRuntimeService.getBluePrintError().errors.size > 0) {
+ throw BluePrintException("failed in blueprint validation : ${bluePrintRuntimeService.getBluePrintError().errors.joinToString("\n")}")
}
return true
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt
index f4434a54..1a138c3a 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintWorkflowValidatorImpl.kt
@@ -19,24 +19,23 @@ package org.onap.ccsdk.apps.controllerblueprints.core.validation
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator {
private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
- var bluePrintContext: BluePrintContext? = null
- var error: BluePrintError? = null
+ lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintContext: BluePrintContext, error: BluePrintError, workflowName: String, workflow: Workflow) {
+ override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, workflowName: String, workflow: Workflow) {
log.info("Validating Workflow($workflowName)")
- this.bluePrintContext = bluePrintContext
- this.error = error
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+
paths.add(workflowName)
paths.joinToString(BluePrintConstants.PATH_DIVIDER)
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index cbcadeb3..7ecf44b6 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -72,8 +72,7 @@ class BluePrintRuntimeServiceTest {
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- assertEquals(inContext["template-content"], jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name")
- }
+ }
@Test
fun testResolveNodeTemplateInterfaceOperationOutputs() {
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt
index ca238db5..c98f2ac3 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt
@@ -28,13 +28,13 @@ class BluePrintValidatorServiceImplTest {
@Test
fun testValidateOfType() {
- val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath)
+ val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService()
val defaultBluePrintValidatorService = BluePrintValidatorServiceImpl(mockBluePrintTypeValidatorService)
- val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintContext, hashMapOf())
+ val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime)
assertTrue(valid, "failed in blueprint Validation")
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index ec229df2..7d3a17a6 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -104,9 +104,6 @@
},
"resource-assignment": {
"type": "component-resource-assignment",
- "properties": {
- "request-id": "1234"
- },
"interfaces": {
"ResourceAssignmentComponent": {
"operations": {
@@ -124,19 +121,7 @@
},
"artifact-prefix-names": [
"baseconfig"
- ],
- "template-content": {
- "get_artifact": [
- "SELF",
- "baseconfig-template"
- ]
- },
- "mapping-content": {
- "get_artifact": [
- "SELF",
- "baseconfig-mapping"
- ]
- }
+ ]
},
"outputs": {
"resource-assignment-params": {
@@ -164,9 +149,6 @@
},
"resource-assignment-py": {
"type": "component-resource-assignment",
- "properties": {
- "request-id": "1234"
- },
"interfaces": {
"ResourceAssignmentComponent": {
"operations": {
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
index 8f242efb..7330663c 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
@@ -75,16 +75,6 @@
"entry_schema": {
"type": "string"
}
- },
- "template-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- },
- "mapping-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
}
},
"outputs": {
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json b/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json
deleted file mode 100644
index 57667de9..00000000
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-activate-netconf.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "description": "This is Download Netconf Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-netconf-executor",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ActivateNetconf": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
-
- "derived_from": "tosca.nodes.DG"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json b/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json
deleted file mode 100644
index e59c34b6..00000000
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-config-generator.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "description": "This is Activate DG for Config Generator Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-config-generator",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "GenerateConfiguration": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json
deleted file mode 100644
index ca703a79..00000000
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assign-activate.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "description": "This is Resource Assign and Activate Netconf Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "ra-component": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- },
- "netconf-component": {
- "capability": "component-node",
- "node": "component-netconf-executor",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignAndActivate": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
-} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json b/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json
deleted file mode 100644
index 9cce82a9..00000000
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-resource-assignment.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "description": "This is Resource Assignment Directed Graph",
- "version": "1.0.0",
- "properties": {
- "mode": {
- "required": false,
- "type": "string",
- "default": "sync"
- },
- "version": {
- "required": false,
- "type": "string",
- "default": "LATEST"
- },
- "is-start-flow": {
- "required": false,
- "type": "boolean",
- "default": false
- }
- },
- "capabilities": {
- "dg-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
-} \ No newline at end of file
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index fc7f1092..d71fbbf8 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -18,14 +18,14 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
import com.att.eelf.configuration.EELFLogger
+import com.att.eelf.configuration.EELFManager
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.format
import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.core.format
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
import java.io.Serializable
@@ -41,12 +41,12 @@ interface ResourceAssignmentValidationService : Serializable {
}
/**
- * ResourceAssignmentValidationDefaultService.
+ * ResourceAssignmentValidationServiceImpl.
*
* @author Brinda Santh
*/
-open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValidationService {
- private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationDefaultService::class.java)
+open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService {
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentValidationServiceImpl::class.java)
open var resourceAssignmentMap: Map<String, ResourceAssignment> = hashMapOf()
open val validationMessage = StrBuilder()
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
index 2c66ff19..9541a7b8 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationService.kt
@@ -50,7 +50,7 @@ interface ResourceDefinitionValidationService : Serializable {
*
* @author Brinda Santh
*/
-open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService {
+open class ResourceDefinitionValidationServiceImpl(private val bluePrintRepoService: BluePrintRepoService) : ResourceDefinitionValidationService {
private val log: EELFLogger = EELFManager.getInstance().getLogger(ResourceDefinitionValidationService::class.java)
@@ -58,7 +58,7 @@ open class ResourceDefinitionDefaultValidationService(private val bluePrintRepoS
Preconditions.checkNotNull(resourceDefinition, "Failed to get Resource Definition")
log.trace("Validating Resource Dictionary Definition {}", resourceDefinition.name)
- resourceDefinition.sources.forEach { (name, nodeTemplate) ->
+ resourceDefinition.sources.forEach { name, nodeTemplate ->
val sourceType = nodeTemplate.type
val sourceNodeType = bluePrintRepoService.getNodeType(sourceType)
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
index 87ebb700..191f568f 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
@@ -43,7 +43,7 @@ class ResourceAssignmentValidationServiceTest {
fun testValidateSuccess() {
log.info("**************** testValidateSuccess *****************")
val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
val result = resourceAssignmentValidator.validate(assignments!!)
Assert.assertTrue("Failed to Validate", result)
}
@@ -52,7 +52,7 @@ class ResourceAssignmentValidationServiceTest {
fun testValidateDuplicate() {
log.info(" **************** testValidateDuplicate *****************")
val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidator.validate(assignments!!)
}
@@ -60,7 +60,7 @@ class ResourceAssignmentValidationServiceTest {
fun testValidateCyclic() {
log.info(" **************** testValidateCyclic *****************")
val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java)
- val resourceAssignmentValidator = ResourceAssignmentValidationDefaultService()
+ val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidator.validate(assignments!!)
}
} \ No newline at end of file
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
index ef305627..2b68585f 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionValidationServiceTest.java
@@ -49,7 +49,7 @@ public class ResourceDefinitionValidationServiceTest {
Assert.assertNotNull("Failed to populate dictionaryDefinition for type", resourceDefinition);
ResourceDefinitionValidationService resourceDictionaryValidationService =
- new ResourceDefinitionDefaultValidationService(bluePrintRepoFileService);
+ new ResourceDefinitionValidationServiceImpl(bluePrintRepoFileService);
resourceDictionaryValidationService.validate(resourceDefinition);
Assert.assertNotNull(String.format("Failed to populate dictionaryDefinition for : %s", fileName), resourceDefinition);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
index 1875a802..fa8e32b6 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
@@ -17,6 +17,8 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.common.base.Preconditions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
@@ -31,8 +33,6 @@ import org.onap.ccsdk.apps.controllerblueprints.service.common.ApplicationConsta
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
import org.onap.ccsdk.apps.controllerblueprints.service.repository.ConfigModelRepository;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import org.springframework.stereotype.Service;
import java.io.IOException;
@@ -48,25 +48,21 @@ import java.util.Optional;
* @author Brinda Santh
* @version 1.0
*/
-
+@Deprecated
@Service
public class ConfigModelCreateService {
private static EELFLogger log = EELFManager.getInstance().getLogger(ConfigModelCreateService.class);
private ConfigModelRepository configModelRepository;
- private ConfigModelValidatorService configModelValidatorService;
/**
* This is a ConfigModelCreateService
*
- * @param configModelRepository ConfigModelRepository
- * @param configModelValidatorService ConfigModelValidatorService
+ * @param configModelRepository ConfigModelRepository
*/
- public ConfigModelCreateService(ConfigModelRepository configModelRepository,
- ConfigModelValidatorService configModelValidatorService) {
+ public ConfigModelCreateService(ConfigModelRepository configModelRepository) {
this.configModelRepository = configModelRepository;
- this.configModelValidatorService = configModelValidatorService;
}
/**
@@ -127,7 +123,7 @@ public class ConfigModelCreateService {
String artifactName = configModel.getArtifactName();
String artifactVersion = configModel.getArtifactVersion();
String author = configModel.getUpdatedBy();
-
+
if (StringUtils.isBlank(author)) {
throw new BluePrintException("Artifact Author is missing in the Service Template");
@@ -326,6 +322,7 @@ public class ConfigModelCreateService {
* @throws BluePrintException BluePrintException
*/
public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- return this.configModelValidatorService.validateServiceTemplate(serviceTemplate);
+ // FIXME("Plug right Validator")
+ return serviceTemplate;
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java
deleted file mode 100644
index 3abdc04d..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelValidatorService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.validator.ServiceTemplateValidator;
-import org.springframework.stereotype.Service;
-
-/**
- * ServiceTemplateValidatorService.java Purpose: Provide Service to Validate Service Model Template
- *
- * @author Brinda Santh
- * @version 1.0
- */
-@Deprecated
-@Service
-public class ConfigModelValidatorService {
-
- /**
- * This is a validateServiceTemplate
- *
- * @param serviceTemplateContent
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- public ServiceTemplate validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {
- Preconditions.checkArgument(StringUtils.isNotBlank(serviceTemplateContent), "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
- ServiceTemplate serviceTemplate =
- JacksonUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
- return validateServiceTemplate(serviceTemplate);
- }
-
- /**
- * This is a enhanceServiceTemplate
- *
- * @param serviceTemplate
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- @SuppressWarnings("squid:S00112")
- public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- Preconditions.checkNotNull(serviceTemplate, "Service Template is not defined.");
- ServiceTemplateValidator validator = new ServiceTemplateValidator();
- validator.validateServiceTemplate(serviceTemplate);
- return serviceTemplate;
- }
-
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceAssignmentValidationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceAssignmentValidationService.java
deleted file mode 100644
index 1228e2ee..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceAssignmentValidationService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationDefaultService;
-import org.springframework.stereotype.Service;
-/**
- * ResourceAssignmentValidationService.
- *
- * @author Brinda Santh
- */
-@Service
-public class ResourceAssignmentValidationService extends ResourceAssignmentValidationDefaultService {
-
-} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java
deleted file mode 100644
index 48589662..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDefinitionValidationService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionDefaultValidationService;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ResourceDefinitionValidationService extends ResourceDefinitionDefaultValidationService {
-
- public ResourceDefinitionValidationService(BluePrintRepoService bluePrintRepoService) {
- super(bluePrintRepoService);
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
index fd73db3b..eacc9025 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java
@@ -25,6 +25,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceSourceMapping;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionValidationService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;
import org.onap.ccsdk.apps.controllerblueprints.service.validator.ResourceDictionaryValidator;
@@ -104,7 +105,7 @@ public class ResourceDictionaryService {
* @param resourceDictionary resourceDictionary
* @return DataDictionary
*/
- public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary) {
+ public ResourceDictionary saveResourceDictionary(ResourceDictionary resourceDictionary) throws BluePrintException {
Preconditions.checkNotNull(resourceDictionary, "Resource Dictionary information is missing");
Preconditions.checkNotNull(resourceDictionary.getDefinition(), "Resource Dictionary definition information is missing");
@@ -157,7 +158,6 @@ public class ResourceDictionaryService {
/**
* This is a getResourceSourceMapping service
- *
*/
public ResourceSourceMapping getResourceSourceMapping() {
return ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
index 57096c7f..60a83f9b 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
@@ -20,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
import org.onap.ccsdk.apps.controllerblueprints.service.repository.ResourceDictionaryRepository;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
index 932cdfac..50442042 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
@@ -48,7 +48,7 @@ public class ResourceDictionaryRest {
@PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
- ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary) {
+ ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary) throws BluePrintException {
return resourceDictionaryService.saveResourceDictionary(dataDictionary);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
index 42adf1a3..c5e9e86f 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
@@ -29,7 +29,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintValidatorDefaultService;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationDefaultService;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationService;
import java.util.HashMap;
@@ -114,7 +114,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
if (BluePrintConstants.MODEL_TYPE_NODE_ARTIFACT.equals(derivedFrom)) {
List<ResourceAssignment> resourceAssignment = getResourceAssignments(nodeTemplate);
- ResourceAssignmentValidationService resourceAssignmentValidationService = new ResourceAssignmentValidationDefaultService();
+ ResourceAssignmentValidationService resourceAssignmentValidationService = new ResourceAssignmentValidationServiceImpl();
resourceAssignmentValidationService.validate(resourceAssignment);
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt
new file mode 100644
index 00000000..9d4797ff
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintTypeValidatorServiceImpl.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.validator
+
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.stereotype.Service
+
+@Service
+class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
+
+ @Autowired
+ private lateinit var context: ApplicationContext
+
+ override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
+ return context.getBeansOfType(BluePrintServiceTemplateValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
+ return context.getBeansOfType(BluePrintDataTypeValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
+ return context.getBeansOfType(BluePrintArtifactTypeValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
+ return context.getBeansOfType(BluePrintNodeTypeValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
+ return context.getBeansOfType(BluePrintTopologyTemplateValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
+ return context.getBeansOfType(BluePrintNodeTemplateValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
+ return context.getBeansOfType(BluePrintWorkflowValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
+ return context.getBeansOfType(BluePrintPropertyDefinitionValidator::class.java).mapNotNull { it.value }
+ }
+
+ override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
+ return context.getBeansOfType(BluePrintAttributeDefinitionValidator::class.java).mapNotNull { it.value }
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt
new file mode 100644
index 00000000..89f4d9e3
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/validator/BluePrintValidatorDefaultService.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.validator
+
+import com.att.eelf.configuration.EELFLogger
+import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintRepoService
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.validation.*
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.service.ResourceDefinitionValidationServiceImpl
+import org.springframework.stereotype.Service
+import java.util.*
+
+@Service
+class BluePrintTypeValidatorDefaultService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintValidatorService {
+
+ private val log: EELFLogger = EELFManager.getInstance().getLogger(BluePrintValidatorServiceImpl::class.toString())
+
+ override fun validateBluePrints(basePath: String): Boolean {
+
+ log.info("validating blueprint($basePath)")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath)
+ return validateBluePrints(bluePrintRuntimeService)
+ }
+
+ override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
+
+ bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
+ bluePrintRuntimeService.bluePrintContext().serviceTemplate)
+
+ if (bluePrintRuntimeService.getBluePrintError().errors.size > 0) {
+ throw BluePrintException("failed in blueprint validation : ${bluePrintRuntimeService.getBluePrintError().errors.joinToString("\n")}")
+ }
+ return true
+ }
+}
+
+// Core Validator Services
+
+@Service
+class DefaultBluePrintServiceTemplateValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintServiceTemplateValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintDataTypeValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintDataTypeValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintArtifactTypeValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintArtifactTypeValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintNodeTypeValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintNodeTypeValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintTopologyTemplateValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintTopologyTemplateValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaulBluePrintNodeTemplateValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintNodeTemplateValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintWorkflowValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintWorkflowValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaulBluePrintPropertyDefinitionValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintPropertyDefinitionValidatorImpl(bluePrintTypeValidatorService)
+
+@Service
+class DefaultBluePrintAttributeDefinitionValidator(bluePrintTypeValidatorService: BluePrintTypeValidatorService)
+ : BluePrintAttributeDefinitionValidatorImpl(bluePrintTypeValidatorService)
+
+// Resource Dictionary Validation Services
+
+@Service
+class DefaultResourceAssignmentValidationService : ResourceAssignmentValidationServiceImpl()
+
+@Service
+class DefalutResourceDefinitionValidationService(bluePrintRepoService: BluePrintRepoService)
+ : ResourceDefinitionValidationServiceImpl(bluePrintRepoService) \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java
index abc3d56f..7d9c2e1a 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.java
@@ -22,6 +22,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService;
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService;
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext;
import org.onap.ccsdk.apps.controllerblueprints.service.load.ModelTypeLoadService;
import org.onap.ccsdk.apps.controllerblueprints.service.load.ResourceDictionaryLoadService;
@@ -29,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
+
import java.nio.file.Paths;
@RunWith(SpringRunner.class)
@@ -45,6 +47,9 @@ public class BluePrintEnhancerServiceImplTest {
@Autowired
private BluePrintEnhancerService bluePrintEnhancerService;
+ @Autowired
+ private BluePrintValidatorService bluePrintValidatorService;
+
@Before
public void init() {
modelTypeLoadService.loadModelType("./../../../../components/model-catalog/definition-type/starter-type");
@@ -52,7 +57,7 @@ public class BluePrintEnhancerServiceImplTest {
}
@Test
- public void testEnhancement() throws Exception {
+ public void testEnhancementAndValidation() throws Exception {
String basePath = "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration";
@@ -61,6 +66,8 @@ public class BluePrintEnhancerServiceImplTest {
BluePrintContext bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath);
Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext);
+ // Validate the Generated BluePrints
+ bluePrintValidatorService.validateBluePrints(targetPath);
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
deleted file mode 100644
index b6e31318..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.enhancer;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.junit.Assert;
-import org.junit.Before;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;
-
-import java.util.List;
-
-/**
- * ResourceAssignmentEnhancerService.
- *
- * @author Brinda Santh
- */
-public class ResourceAssignmentEnhancerServiceTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ResourceAssignmentEnhancerServiceTest.class);
-
- @Before
- public void setUp() {
- // Setup dummy Source Instance Mapping
- ResourceDictionaryTestUtils.setUpResourceSourceMapping();
- }
-
- //@Test
- public void testEnhanceBluePrint() throws BluePrintException {
-
-
- List<ResourceAssignment> resourceAssignments = JacksonUtils.getListFromClassPathFile("enhance/enhance-resource-assignment.json", ResourceAssignment.class);
- Assert.assertNotNull("Failed to get Resource Assignment", resourceAssignments);
-
-// ResourceDefinitionRepoService resourceDefinitionRepoService = new ResourceDefinitionFileRepoService("./../../../../components/model-catalog");
-// ResourceAssignmentEnhancerService resourceAssignmentEnhancerService = new ResourceAssignmentEnhancerServiceImpl(resourceDefinitionRepoService);
-// ServiceTemplate serviceTemplate = resourceAssignmentEnhancerService.enhanceBluePrint(resourceAssignments);
-// Assert.assertNotNull("Failed to get Enriched service Template", serviceTemplate);
-// log.trace("Enhanced Service Template : {}", JacksonUtils.getJson(serviceTemplate, true));
-
- }
-}
-
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
deleted file mode 100644
index d5638ec2..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.validator;
-
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.List;
-
-public class ServiceTemplateValidationTest {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);
-
- @Before
- public void setUp(){
- // Setup dummy Source Instance Mapping
- ResourceDictionaryTestUtils.setUpResourceSourceMapping();
- }
-
- @Test
- public void testBluePrintDirs() {
- List<String> dirs = ConfigModelUtils.getBlueprintNames("./../../../../components/model-catalog/blueprint-model/starter-blueprint");
- Assert.assertNotNull("Failed to get blueprint directories", dirs);
- //Assert.assertEquals("Failed to get actual directories", 1, dirs.size());
- }
-
- @Test
- public void validateServiceTemplate() throws Exception {
- validateServiceTemplate("load/blueprints/vrr-test/Definitions/vrr-test.json");
- }
-
- //@Test FIXME("Enable once Complete Enhancement Service Implemented")
- public void validateEnhancedServiceTemplate() throws Exception {
- ServiceTemplate serviceTemplate = JacksonUtils
- .readValueFromClassPathFile("enhance/enhanced-template.json", ServiceTemplate.class);
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- Boolean valid = serviceTemplateValidator.validateServiceTemplate(serviceTemplate);
- Assert.assertTrue("Failed to validate blueprints", valid);
- }
-
- private void validateServiceTemplate(String fileName) throws Exception {
- String serviceTemplateContent =
- FileUtils.readFileToString(new File(fileName), Charset.defaultCharset());
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
- Assert.assertNotNull("Failed to validate blueprints", serviceTemplateValidator);
- }
-}