package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
import java.util.UUID
@Service("bluePrintDesignTimeValidatorService")
-open class BluePrintDesignTimeValidatorService(
- private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
+open class BlueprintDesignTimeValidatorService(
+ private val bluePrintTypeValidatorService: BlueprintTypeValidatorService,
private val resourceDefinitionValidator: ResourceDefinitionValidator
) :
- BluePrintValidatorService {
+ BlueprintValidatorService {
- private val log = LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
+ private val log = LoggerFactory.getLogger(BlueprintDesignTimeValidatorService::class.toString())
- override suspend fun validateBluePrints(basePath: String): Boolean {
+ override suspend fun validateBlueprints(basePath: String): Boolean {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(UUID.randomUUID().toString(), basePath)
- return validateBluePrints(bluePrintRuntimeService)
+ val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(UUID.randomUUID().toString(), basePath)
+ return validateBlueprints(bluePrintRuntimeService)
}
- override suspend fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
+ override suspend fun validateBlueprints(bluePrintRuntimeService: BlueprintRuntimeService<*>): Boolean {
bluePrintTypeValidatorService.validateServiceTemplate(
bluePrintRuntimeService, "service_template",
// Validate Resource Definitions
validateResourceDefinitions(bluePrintRuntimeService)
- if (bluePrintRuntimeService.getBluePrintError().errors.size > 0) {
- throw BluePrintException("failed in blueprint validation : ${bluePrintRuntimeService.getBluePrintError().errors.joinToString("\n")}")
+ if (bluePrintRuntimeService.getBlueprintError().errors.size > 0) {
+ throw BlueprintException("failed in blueprint validation : ${bluePrintRuntimeService.getBlueprintError().errors.joinToString("\n")}")
}
return true
}
- private fun validateResourceDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
+ private fun validateResourceDefinitions(bluePrintRuntimeService: BlueprintRuntimeService<*>) {
// Validate Resource Dictionary
val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath
val resourceDefinitionsPath = blueprintBasePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
+ .plus(BlueprintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
.plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionFile = File(resourceDefinitionsPath)