summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-02-22 10:14:24 -0500
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-02-25 16:11:52 -0500
commit86dc3b395c89773968d2737d52318a2f2090d8ce (patch)
tree12cd59c6a13fb82d352468ba14d52596ae171d67 /ms/controllerblueprints/modules/blueprint-core
parent75dbd90df01e107c28083b9db72f78eb2fcddfd5 (diff)
Add extension validation framework
Change-Id: I5674e8da70cc4d20899f6fe2163a595b28861036 Issue-ID: CCSDK-1103 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt7
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt33
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt9
3 files changed, 39 insertions, 10 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
index 2647083f4..aab4e7c78 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
@@ -118,16 +118,13 @@ or Node Template and used by orchestration engine to facilitate deployment and i
class ArtifactDefinition {
@get:JsonIgnore
var id: String? = null
- var type: String? = null
- var file: String? = null
+ lateinit var type: String
+ lateinit var file: String
var repository: String? = null
var description: String? = null
@get:JsonProperty("deploy_Path")
var deployPath: String? = null
var properties: MutableMap<String, JsonNode>? = null
- var content: String? = null
- @Deprecated("Mapping content is define by the Type")
- var mappingContent: String? = null
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
index bea790fd3..a485c677e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BlueprintValidator.kt
@@ -1,3 +1,20 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications 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.core.interfaces
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
@@ -18,6 +35,8 @@ interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTempla
interface BluePrintArtifactTypeValidator : BluePrintValidator<ArtifactType>
+interface BluePrintArtifactDefinitionValidator : BluePrintValidator<ArtifactDefinition>
+
interface BluePrintDataTypeValidator : BluePrintValidator<DataType>
interface BluePrintNodeTypeValidator : BluePrintValidator<NodeType>
@@ -45,12 +64,20 @@ interface BluePrintValidatorService {
interface BluePrintTypeValidatorService {
+ fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T?
+
+ fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>?
+
+ fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>?
+
fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator>
fun getDataTypeValidators(): List<BluePrintDataTypeValidator>
fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator>
+ fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator>
+
fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator>
fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator>
@@ -73,6 +100,12 @@ interface BluePrintTypeValidatorService {
doValidation(bluePrintRuntimeService, name, artifactType, validators)
}
+ fun validateArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
+ artifactDefinition: ArtifactDefinition) {
+ val validators = getArtifactDefinitionsValidators()
+ doValidation(bluePrintRuntimeService, name, artifactDefinition, validators)
+ }
+
fun validateDataType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, dataType: DataType) {
val validators = getDataTypeValidators()
doValidation(bluePrintRuntimeService, name, dataType, validators)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
index 76f3f329f..1bc250053 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.controllerblueprints.core.utils
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
import com.fasterxml.jackson.annotation.JsonInclude
-import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.databind.node.ArrayNode
@@ -148,22 +147,22 @@ class JacksonUtils {
return objectMapper.valueToTree(any)
}
- fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {
+ fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T> {
return getListFromJson(node.toString(), valueType)
}
- fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {
+ fun <T> getListFromJson(content: String, valueType: Class<T>): List<T> {
val objectMapper = jacksonObjectMapper()
val javaType = objectMapper.typeFactory.constructCollectionType(List::class.java, valueType)
return objectMapper.readValue<List<T>>(content, javaType)
}
- fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T>? {
+ fun <T> getListFromFile(fileName: String, valueType: Class<T>): List<T> {
val content: String = getContent(fileName)
return getListFromJson(content, valueType)
}
- fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T>? {
+ fun <T> getListFromClassPathFile(fileName: String, valueType: Class<T>): List<T> {
val content: String = getClassPathFileContent(fileName)
return getListFromJson(content, valueType)
}