summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2019-11-22 18:06:08 -0500
committerKAPIL SINGAL <ks220y@att.com>2019-11-26 21:32:38 +0000
commit341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch)
tree113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/controllerblueprints/modules
parentd274e5fc552cf9ae25500f504f0434981cf3accf (diff)
Formatting Code base with ktlint
No Business logic change, just the code format. Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3 To format run: mvn process-sources -P format Issue-ID: CCSDK-1947 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/controllerblueprints/modules')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt50
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt100
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt20
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt31
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt61
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt61
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt39
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt45
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt)7
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt210
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt175
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt12
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt71
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt17
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt89
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt161
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt8
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt20
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt9
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt10
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt18
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt32
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt40
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt21
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt31
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt38
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt88
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt108
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt9
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt46
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt28
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt165
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt)25
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt277
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt18
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt25
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt83
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt89
-rwxr-xr-xms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt76
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt52
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt19
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt38
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt7
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt13
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt12
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt23
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt34
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt8
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt129
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt72
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt34
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt21
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt27
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt87
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt13
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt82
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt4
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt9
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt14
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt20
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt21
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt5
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt20
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt23
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt153
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt42
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt38
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt26
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt17
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt13
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt22
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt15
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt19
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt1
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt26
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt19
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt18
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java9
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java7
112 files changed, 2373 insertions, 1435 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
index 509b8ca3a..b97cb026a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
@@ -203,4 +203,4 @@ object BluePrintConstants {
const val MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN = "artifact-script-kotlin"
const val MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH = "artifact-directed-graph"
const val MODEL_TYPE_ARTIFACT_COMPONENT_JAR = "artifact-component-jar"
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
index 22b452ab9..66d54f52e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
@@ -26,4 +26,4 @@ class BluePrintError {
fun addError(error: String) {
this.errors.add(error)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
index 22be37278..a2435da13 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
@@ -15,6 +15,7 @@
*/
package org.onap.ccsdk.cds.controllerblueprints.core
+
/**
*
*
@@ -41,9 +42,8 @@ class BluePrintException : Exception {
this.code = code
}
- constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
- : super(String.format(message, *args), cause) {
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?) :
+ super(String.format(message, *args), cause) {
this.code = code
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
index dafd076fb..daf833494 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
@@ -16,12 +16,26 @@
package org.onap.ccsdk.cds.controllerblueprints.core
-import org.onap.ccsdk.cds.controllerblueprints.core.annotations.*
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsConstrain
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsDataType
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsProperty
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.DSLExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.InputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.PropertyDefaultValue
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.PropertyExpression
import org.onap.ccsdk.cds.controllerblueprints.core.data.ConstraintClause
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.cds.controllerblueprints.core.dsl.*
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.dslExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getInput
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateArtifact
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateAttribute
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateOperationOutput
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateProperty
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.KType
@@ -58,7 +72,7 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
property.entrySchema = this.returnType.entitySchema()
}
this.annotations.forEach { fieldAnnotation ->
- //println("Field : ${this.name} : Annotation : $fieldAnnotation")
+ // println("Field : ${this.name} : Annotation : $fieldAnnotation")
when (fieldAnnotation) {
is BluePrintsProperty ->
property.description = fieldAnnotation.description
@@ -72,20 +86,28 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
property.value = getInput(fieldAnnotation.propertyName)
}
is PropertyExpression -> {
- property.value = getNodeTemplateProperty(fieldAnnotation.modelableEntityName,
- fieldAnnotation.propertyName, fieldAnnotation.subPropertyName)
+ property.value = getNodeTemplateProperty(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.propertyName, fieldAnnotation.subPropertyName
+ )
}
is AttributeExpression -> {
- property.value = getNodeTemplateAttribute(fieldAnnotation.modelableEntityName,
- fieldAnnotation.attributeName, fieldAnnotation.subAttributeName)
+ property.value = getNodeTemplateAttribute(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.attributeName, fieldAnnotation.subAttributeName
+ )
}
is ArtifactExpression -> {
- property.value = getNodeTemplateArtifact(fieldAnnotation.modelableEntityName,
- fieldAnnotation.artifactName)
+ property.value = getNodeTemplateArtifact(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.artifactName
+ )
}
is OperationOutputExpression -> {
- property.value = getNodeTemplateOperationOutput(fieldAnnotation.modelableEntityName,
- fieldAnnotation.interfaceName, fieldAnnotation.propertyName, fieldAnnotation.subPropertyName)
+ property.value = getNodeTemplateOperationOutput(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.interfaceName, fieldAnnotation.propertyName, fieldAnnotation.subPropertyName
+ )
}
is DSLExpression -> {
property.value = dslExpression(fieldAnnotation.propertyName)
@@ -111,16 +133,16 @@ internal fun <T : KType> T.entitySchema(): EntrySchema {
internal fun <T : KType> T.asBluePrintsDataType(propertyName: String): String {
val simpleName = (this.classifier as? KClass<*>)?.java?.simpleName
- ?: throw BluePrintException("filed to get simple name.")
+ ?: throw BluePrintException("filed to get simple name.")
return when (simpleName) {
"String", "Date" -> BluePrintConstants.DATA_TYPE_STRING
"int" -> BluePrintConstants.DATA_TYPE_INTEGER
"Boolean" -> BluePrintConstants.DATA_TYPE_BOOLEAN
"Float" -> BluePrintConstants.DATA_TYPE_FLOAT
"Double" -> BluePrintConstants.DATA_TYPE_DOUBLE
- "List" -> BluePrintConstants.DATA_TYPE_LIST
+ "List" -> BluePrintConstants.DATA_TYPE_LIST
"Map" -> BluePrintConstants.DATA_TYPE_MAP
"Object", "JsonNode", "ObjectNode", "ArrayNode" -> BluePrintConstants.DATA_TYPE_JSON
else -> simpleName
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
index 0a530708f..b0b217051 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
@@ -23,6 +23,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core
* @author Brinda Santh
*/
class BluePrintProcessorException : RuntimeException {
+
var code: Int = 100
constructor(message: String, cause: Throwable) : super(message, cause)
@@ -42,8 +43,8 @@ class BluePrintProcessorException : RuntimeException {
this.code = code
}
- constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
- : super(String.format(message, *args), cause) {
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?) :
+ super(String.format(message, *args), cause) {
this.code = code
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
index 30ac68abd..0e4279a3a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
@@ -28,60 +28,60 @@ object BluePrintTypes {
@JvmStatic
val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
- BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- BluePrintConstants.MODEL_TYPE_NODE_VNF,
- BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
+ BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
+ BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ BluePrintConstants.MODEL_TYPE_NODE_VNF,
+ BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
)
@JvmStatic
val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
- BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
+ BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
+ BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
)
@JvmStatic
val validDataTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
- BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
+ BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
+ BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
)
@JvmStatic
val validRelationShipDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
)
@JvmStatic
val validCapabilityTypes: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
+ BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
)
@JvmStatic
@@ -135,19 +135,21 @@ object BluePrintTypes {
@JvmStatic
fun validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean {
val entrySchema = propertyDefinition.entrySchema?.type ?: BluePrintConstants.DATA_TYPE_NULL
- return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type)
- && BluePrintTypes.validPrimitiveTypes().contains(entrySchema)
+ return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type) &&
+ BluePrintTypes.validPrimitiveTypes().contains(entrySchema)
}
@JvmStatic
fun validCommands(): List<String> {
- return listOf(BluePrintConstants.EXPRESSION_DSL_REFERENCE,
- BluePrintConstants.EXPRESSION_GET_INPUT,
- BluePrintConstants.EXPRESSION_GET_ATTRIBUTE,
- BluePrintConstants.EXPRESSION_GET_PROPERTY,
- BluePrintConstants.EXPRESSION_GET_ARTIFACT,
- BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT,
- BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE)
+ return listOf(
+ BluePrintConstants.EXPRESSION_DSL_REFERENCE,
+ BluePrintConstants.EXPRESSION_GET_INPUT,
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE,
+ BluePrintConstants.EXPRESSION_GET_PROPERTY,
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT,
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT,
+ BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE
+ )
}
@JvmStatic
@@ -159,6 +161,4 @@ object BluePrintTypes {
fun rootDataTypes(): List<String> {
return listOf(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 7aa2fc86c..5189d0758 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -18,13 +18,20 @@
package org.onap.ccsdk.cds.controllerblueprints.core
import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.*
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.DoubleNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import org.apache.commons.lang3.ObjectUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JsonParserUtils
import org.slf4j.LoggerFactory
import org.slf4j.helpers.MessageFormatter
-import java.util.*
+import java.util.UUID
import kotlin.reflect.KClass
/**
@@ -50,8 +57,8 @@ fun <T : Any> T.bpClone(): T {
}
fun String.isJson(): Boolean {
- return ((this.trim().startsWith("{") && this.trim().endsWith("}"))
- || (this.trim().startsWith("[") && this.trim().endsWith("]")))
+ return ((this.trim().startsWith("{") && this.trim().endsWith("}")) ||
+ (this.trim().startsWith("[") && this.trim().endsWith("]")))
}
fun Any.asJsonString(intend: Boolean? = false): String {
@@ -183,7 +190,7 @@ fun ArrayNode.asListOfString(): List<String> {
fun <T> JsonNode.asType(clazzType: Class<T>): T {
return JacksonUtils.readValue(this, clazzType)
- ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType")
+ ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType")
}
fun JsonNode.asListOfString(): List<String> {
@@ -228,7 +235,6 @@ fun JsonNode.removeNullNode() {
}
}
-
fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) {
val convertedValue = value.asJsonType()
this[key] = convertedValue
@@ -325,5 +331,3 @@ fun JsonNode.jsonPaths(expression: String): List<String> {
check(this.isComplexType()) { "$this is not complex or array node to apply expression" }
return JsonParserUtils.paths(this, expression)
}
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
index 793bdc455..5995a8a9e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
@@ -50,16 +50,16 @@ fun Graph.toAdjacencyList(): Graph.AdjacencyList<String, EdgeLabel> {
fun Graph.findAllPaths(from: String, to: String, path: List<String> = emptyList()): List<List<String>> {
if (from == to) return listOf(path + to)
return nodes[from]!!.neighbors()
- .filter { !path.contains(it.id) }
- .flatMap { findAllPaths(it.id, to, path + from) }
+ .filter { !path.contains(it.id) }
+ .flatMap { findAllPaths(it.id, to, path + from) }
}
fun Graph.findCycles(node: String): List<List<String>> {
fun findCycles(path: List<String>): List<List<String>> {
if (path.size > 3 && path.first() == path.last()) return listOf(path)
return nodes[path.last()]!!.neighbors()
- .filterNot { path.tail().contains(it.id) }
- .flatMap { findCycles(path + it.id) }
+ .filterNot { path.tail().contains(it.id) }
+ .flatMap { findCycles(path + it.id) }
}
return findCycles(listOf(node))
}
@@ -76,41 +76,40 @@ fun Graph.endNodes(): Set<Graph.Node> = this.nodes.values.filter {
fun Graph.node(node: String) = this.nodes[node]
fun Graph.edge(label: EdgeLabel) =
- this.edges.filter { it.label == label }
+ this.edges.filter { it.label == label }
fun Graph.incomingEdges(node: String) =
- this.edges.filter { it.target.id == node }
+ this.edges.filter { it.target.id == node }
fun Graph.incomingNodes(node: String) =
- this.incomingEdges(node).map { it.source }
+ this.incomingEdges(node).map { it.source }
fun Graph.outgoingEdges(node: String) =
- this.edges.filter { it.source.id == node }
+ this.edges.filter { it.source.id == node }
fun Graph.outgoingNodes(node: String) =
- this.outgoingEdges(node).map { it.target }
+ this.outgoingEdges(node).map { it.target }
fun Graph.outgoingEdges(node: String, label: EdgeLabel) =
- this.edges.filter { it.source.id == node && it.label == label }
+ this.edges.filter { it.source.id == node && it.label == label }
fun Graph.outgoingNodes(node: String, label: EdgeLabel) =
- this.outgoingEdges(node, label).map { it.target }
+ this.outgoingEdges(node, label).map { it.target }
fun Graph.outgoingNodesNotInEdgeLabels(node: String, labels: List<EdgeLabel>) =
- this.outgoingEdgesNotInLabels(node, labels).map { it.target }
+ this.outgoingEdgesNotInLabels(node, labels).map { it.target }
fun Graph.outgoingEdges(node: String, labels: List<EdgeLabel>) =
- this.edges.filter { it.source.id == node && labels.contains(it.label) }
+ this.edges.filter { it.source.id == node && labels.contains(it.label) }
fun Graph.outgoingEdgesNotInLabels(node: String, labels: List<EdgeLabel>) =
- this.edges.filter { it.source.id == node && !labels.contains(it.label) }
+ this.edges.filter { it.source.id == node && !labels.contains(it.label) }
fun Graph.outgoingNodes(node: String, labels: List<EdgeLabel>) =
- this.outgoingEdges(node, labels).map { it.target }
+ this.outgoingEdges(node, labels).map { it.target }
fun Graph.isEndNode(node: Graph.Node): Boolean {
return this.endNodes().contains(node)
}
fun <T> List<T>.tail(): List<T> = drop(1)
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
index 001ec751e..9d81f13e3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
@@ -24,7 +24,8 @@ import kotlin.coroutines.CoroutineContext
typealias MDCContextMap = Map<String, String>?
class MDCContext(private val contextMap: MDCContextMap = MDC.getCopyOfContextMap()) :
- ThreadContextElement<MDCContextMap>, AbstractCoroutineContextElement(Key) {
+ ThreadContextElement<MDCContextMap>, AbstractCoroutineContextElement(Key) {
+
/**
* Key of [MDCContext] in [CoroutineContext].
*/
@@ -47,4 +48,4 @@ class MDCContext(private val contextMap: MDCContextMap = MDC.getCopyOfContextMap
MDC.setContextMap(contextMap)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
index 94392b992..c39442976 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
@@ -16,16 +16,15 @@
package org.onap.ccsdk.cds.controllerblueprints.core.annotations
-
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS)
annotation class BluePrintsDataType(
- val name: String,
- val version: String = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- val description: String,
- val derivedFrom: String = "tosca.datatypes.root"
+ val name: String,
+ val version: String = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ val description: String,
+ val derivedFrom: String = "tosca.datatypes.root"
)
@Target(AnnotationTarget.CLASS)
@@ -35,13 +34,17 @@ annotation class BluePrintsWorkflowInput
annotation class BluePrintsWorkflowOutput
@Target(AnnotationTarget.CLASS)
-annotation class BluePrintsNodeType(val propertiesType: KClass<*>, val attributesType: KClass<*>,
- val inputsType: KClass<*>, val outputsType: KClass<*>)
+annotation class BluePrintsNodeType(
+ val propertiesType: KClass<*>,
+ val attributesType: KClass<*>,
+ val inputsType: KClass<*>,
+ val outputsType: KClass<*>
+)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class BluePrintsProperty(
- val name: String = "",
- val description: String = ""
+ val name: String = "",
+ val description: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
@@ -55,43 +58,43 @@ annotation class PropertyValidValue(val value: String)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class InputExpression(
- val propertyName: String
+ val propertyName: String
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class PropertyExpression(
- val modelableEntityName: String = "SELF",
- val reqOrCapEntityName: String = "",
- val propertyName: String,
- val subPropertyName: String = ""
+ val modelableEntityName: String = "SELF",
+ val reqOrCapEntityName: String = "",
+ val propertyName: String,
+ val subPropertyName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class AttributeExpression(
- val modelableEntityName: String = "SELF",
- val reqOrCapEntityName: String = "",
- val attributeName: String,
- val subAttributeName: String = ""
+ val modelableEntityName: String = "SELF",
+ val reqOrCapEntityName: String = "",
+ val attributeName: String,
+ val subAttributeName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class ArtifactExpression(
- val modelableEntityName: String = "SELF",
- val artifactName: String,
- val location: String = "LOCAL_FILE",
- val remove: Boolean = false
+ val modelableEntityName: String = "SELF",
+ val artifactName: String,
+ val location: String = "LOCAL_FILE",
+ val remove: Boolean = false
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class OperationOutputExpression(
- val modelableEntityName: String = "SELF",
- val interfaceName: String,
- val operationName: String,
- val propertyName: String,
- val subPropertyName: String = ""
+ val modelableEntityName: String = "SELF",
+ val interfaceName: String,
+ val operationName: String,
+ val propertyName: String,
+ val subPropertyName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class DSLExpression(
- val propertyName: String
-) \ No newline at end of file
+ val propertyName: String
+)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
index 10b902f2b..0128f64a5 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
@@ -17,13 +17,12 @@
package org.onap.ccsdk.cds.controllerblueprints.core.config
-
open class BluePrintLoadConfiguration {
lateinit var blueprintDeployPath: String
lateinit var blueprintArchivePath: String
lateinit var blueprintWorkingPath: String
-
+
var loadBluePrintPaths: String? = null
var loadModeTypePaths: String? = null
var loadResourceDictionaryPaths: String? = null
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
index d3013402b..37c128714 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
@@ -20,59 +20,58 @@ package org.onap.ccsdk.cds.controllerblueprints.core.data
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ObjectNode
+
/**
*
*
* @author Brinda Santh
*/
data class ExpressionData(
- var isExpression: Boolean = false,
- var valueNode: JsonNode,
- var expressionNode: ObjectNode? = null,
- var dslExpression: DSLExpression? = null,
- var inputExpression: InputExpression? = null,
- var propertyExpression: PropertyExpression? = null,
- var attributeExpression: AttributeExpression? = null,
- var artifactExpression: ArtifactExpression? = null,
- var operationOutputExpression: OperationOutputExpression? = null,
- var command: String? = null
+ var isExpression: Boolean = false,
+ var valueNode: JsonNode,
+ var expressionNode: ObjectNode? = null,
+ var dslExpression: DSLExpression? = null,
+ var inputExpression: InputExpression? = null,
+ var propertyExpression: PropertyExpression? = null,
+ var attributeExpression: AttributeExpression? = null,
+ var artifactExpression: ArtifactExpression? = null,
+ var operationOutputExpression: OperationOutputExpression? = null,
+ var command: String? = null
)
data class InputExpression(
- var propertyName: String
+ var propertyName: String
)
data class PropertyExpression(
- var modelableEntityName: String = "SELF",
- var reqOrCapEntityName: String? = null,
- var propertyName: String,
- var subPropertyName: String? = null
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var propertyName: String,
+ var subPropertyName: String? = null
)
data class AttributeExpression(
- var modelableEntityName: String = "SELF",
- var reqOrCapEntityName: String? = null,
- var attributeName: String,
- var subAttributeName: String? = null
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var attributeName: String,
+ var subAttributeName: String? = null
)
data class ArtifactExpression(
- val modelableEntityName: String = "SELF",
- val artifactName: String,
- val location: String? = "LOCAL_FILE",
- val remove: Boolean? = false
+ val modelableEntityName: String = "SELF",
+ val artifactName: String,
+ val location: String? = "LOCAL_FILE",
+ val remove: Boolean? = false
)
data class OperationOutputExpression(
- val modelableEntityName: String = "SELF",
- val interfaceName: String,
- val operationName: String,
- val propertyName: String,
- var subPropertyName: String? = null
+ val modelableEntityName: String = "SELF",
+ val interfaceName: String,
+ val operationName: String,
+ val propertyName: String,
+ var subPropertyName: String? = null
)
data class DSLExpression(
- val propertyName: String
+ val propertyName: String
)
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
index fc796c9ed..9c9b1f9bf 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
@@ -98,7 +98,7 @@ class Graph {
fun neighbors(): List<Node> = edges.map { edge -> edge.target(this) }
fun neighbors(label: EdgeLabel): List<Node> = edges.filter { it.label == label }
- .map { edge -> edge.target(this) }
+ .map { edge -> edge.target(this) }
fun labelEdges(label: EdgeLabel): List<Edge> = edges.filter { it.label == label }
@@ -106,19 +106,20 @@ class Graph {
}
data class Edge(
- val source: Node,
- val target: Node,
- val label: EdgeLabel,
- var status: EdgeStatus = EdgeStatus.NOT_STARTED) {
+ val source: Node,
+ val target: Node,
+ val label: EdgeLabel,
+ var status: EdgeStatus = EdgeStatus.NOT_STARTED
+ ) {
fun target(node: Node): Node = target
fun equivalentTo(other: Edge) =
- (source == other.source && target == other.target)
- || (source == other.target && target == other.source)
+ (source == other.source && target == other.target) ||
+ (source == other.target && target == other.source)
override fun toString() =
- "${source.id}>${target.id}/$label($status)"
+ "${source.id}>${target.id}/$label($status)"
}
data class TermForm(val nodes: Collection<String>, val edges: List<Term>) {
@@ -147,23 +148,27 @@ class Graph {
companion object {
fun labeledDirectedTerms(termForm: TermForm): Graph =
- createFromTerms(termForm) { graph, n1, n2, value -> graph.addEdge(n1, n2, value) }
+ createFromTerms(termForm) { graph, n1, n2, value -> graph.addEdge(n1, n2, value) }
fun labeledDirectedAdjacent(adjacencyList: AdjacencyList<String, EdgeLabel>): Graph =
- fromAdjacencyList(adjacencyList) { graph, n1, n2, value ->
- graph.addEdge(n1, n2, value)
- }
+ fromAdjacencyList(adjacencyList) { graph, n1, n2, value ->
+ graph.addEdge(n1, n2, value)
+ }
- private fun createFromTerms(termForm: TermForm,
- addFunction: (Graph, String, String, EdgeLabel) -> Unit): Graph {
+ private fun createFromTerms(
+ termForm: TermForm,
+ addFunction: (Graph, String, String, EdgeLabel) -> Unit
+ ): Graph {
val graph = Graph()
termForm.nodes.forEach { graph.addNode(it) }
termForm.edges.forEach { addFunction(graph, it.source, it.target, it.label) }
return graph
}
- private fun fromAdjacencyList(adjacencyList: AdjacencyList<String, EdgeLabel>,
- addFunction: (Graph, String, String, EdgeLabel) -> Unit): Graph {
+ private fun fromAdjacencyList(
+ adjacencyList: AdjacencyList<String, EdgeLabel>,
+ addFunction: (Graph, String, String, EdgeLabel) -> Unit
+ ): Graph {
val graph = Graph()
adjacencyList.entries.forEach { graph.addNode(it.node) }
adjacencyList.entries.forEach { (node, links) ->
@@ -172,4 +177,4 @@ class Graph {
return graph
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
index a2cba95d9..71a31dcca 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
@@ -31,6 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
* @author Brinda Santh
*/
open class EntityType {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -48,6 +49,7 @@ open class EntityType {
authorization credentials used to access network accessible resources.
*/
class Credential {
+
@get:JsonIgnore
var id: String? = null
var protocol: String? = null
@@ -63,6 +65,7 @@ class Credential {
A constraint clause defines an operation along with one or more compatible values that can be used to define a constraint on a property or parameter’s allowed values when it is defined in a TOSCA Service Template or one of its entities.
*/
class ConstraintClause {
+
var equal: JsonNode? = null
@get:JsonProperty("greater_than")
var greaterThan: JsonNode? = null
@@ -101,6 +104,7 @@ class NodeFilterDefinition {
and implementation artifacts that are referenced within the TOSCA Service Template.
*/
class RepositoryDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -108,13 +112,13 @@ class RepositoryDefinition {
var credential: Credential? = null
}
-
/*
3.5.6 Artifact definition
An artifact definition defines a named, typed file that can be associated with Node Type
or Node Template and used by orchestration engine to facilitate deployment and implementation of interface operations.
*/
class ArtifactDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -126,7 +130,6 @@ class ArtifactDefinition {
var properties: MutableMap<String, JsonNode>? = null
}
-
/*
3.5.7 Import definition
An import definition is used within a TOSCA Service Template to locate and uniquely name
@@ -134,6 +137,7 @@ another TOSCA Service Template file which has type and template definitions to b
and referenced within another Service Template.
*/
class ImportDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var file: String
@@ -151,6 +155,7 @@ Properties are used by template authors to provide input values to TOSCA entitie
instantiated. The value of a property can be retrieved using the get_property function within TOSCA Service Templates.
*/
class PropertyDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -170,7 +175,6 @@ class PropertyDefinition {
var value: JsonNode? = null
}
-
/*
3.5.10 Attribute definition
@@ -203,6 +207,7 @@ class AttributeDefinition {
An operation definition defines a named function or procedure that can be bound to an implementation artifact (e.g., a script).
*/
class OperationDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -216,7 +221,7 @@ class Implementation {
var dependencies: MutableList<String>? = null
@get:JsonProperty("operation_host")
var operationHost: String = BluePrintConstants.PROPERTY_SELF
- //Timeout value in seconds
+ // Timeout value in seconds
var timeout: Int = 180
}
@@ -225,6 +230,7 @@ class Implementation {
An interface definition defines a named interface that can be associated with a Node or Relationship Type
*/
class InterfaceDefinition {
+
@get:JsonIgnore
var id: String? = null
var type: String? = null
@@ -237,6 +243,7 @@ class InterfaceDefinition {
An event filter definition defines criteria for selection of an attribute, for the purpose of monitoring it, within a TOSCA entity, or one its capabilities.
*/
class EventFilterDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var node: String
@@ -249,6 +256,7 @@ class EventFilterDefinition {
A trigger definition defines the event, condition and action that is used to “trigger” a policy it is associated with.
*/
class TriggerDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -271,6 +279,7 @@ class TriggerDefinition {
· Inline another workflow defined in the topology (to allow reusability)
*/
class Activity {
+
var delegate: String? = null
@get:JsonProperty("set_state")
var setState: String? = null
@@ -284,6 +293,7 @@ class Activity {
A workflow condition can be used as a filter or precondition to check if a workflow can be processed or not based on the state of the instances of a TOSCA topology deployment. When not met, the workflow will not be triggered.
*/
class PreConditionDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var target: String
@@ -297,6 +307,7 @@ class PreConditionDefinition {
A workflow step allows to define one or multiple sequenced activities in a workflow and how they are connected to other steps in the workflow. They are the building blocks of a declarative workflow.
*/
class Step {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -333,6 +344,7 @@ class CapabilityDefinition {
The Requirement definition describes a named requirement (dependencies) of a TOSCA Node Type or Node template which needs to be fulfilled by a matching Capability definition declared by another TOSCA modelable entity. The requirement definition may itself include the specific name of the fulfilling entity (explicitly) or provide an abstract type, along with additional filtering characteristics, that a TOSCA orchestrator can use to fulfill the capability at runtime (implicitly).
*/
class RequirementDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -347,11 +359,11 @@ class RequirementDefinition {
An Artifact Type is a reusable entity that defines the type of one or more files that are used to define implementation or deployment artifacts that are referenced by nodes or relationships on their operations.
*/
class ArtifactType : EntityType() {
+
@get:JsonProperty("mime_type")
var mimeType: String? = null
@get:JsonProperty("file_ext")
var fileExt: MutableList<String>? = null
-
}
/*
@@ -415,7 +427,6 @@ class GroupType : EntityType() {
var requirements: ArrayList<RequirementDefinition>? = null
var capabilities: MutableMap<String, CapabilityDefinition>? = null
var interfaces: MutableMap<String, InterfaceDefinition>? = null
-
}
/*
@@ -425,6 +436,7 @@ class GroupType : EntityType() {
(i.e., it does not prevent the application or service from being deployed or run if it did not exist).
*/
class PolicyType : EntityType() {
+
lateinit var targets: MutableList<String>
}
@@ -433,6 +445,7 @@ class PolicyType : EntityType() {
A capability assignment allows node template authors to assign values to properties and attributes for a named capability definition that is part of a Node Template’s type definition.
*/
class CapabilityAssignment {
+
@get:JsonIgnore
var id: String? = null
var attributes: MutableMap<String, JsonNode>? = null
@@ -444,6 +457,7 @@ class CapabilityAssignment {
A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
*/
class GroupDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -459,6 +473,7 @@ class GroupDefinition {
A policy definition defines a policy that can be associated with a TOSCA topology or top-level entity definition (e.g., group definition, node template, etc.).
*/
class PolicyDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -468,12 +483,12 @@ class PolicyDefinition {
var targets: MutableList<String>? = null
}
-
/*
3.8 Topology Template definition
This section defines the topology template of a cloud application. The main ingredients of the topology template are node templates representing components of the application and relationship templates representing links between the components. These elements are defined in the nested node_templates section and the nested relationship_templates sections, respectively. Furthermore, a topology template allows for defining input parameters, output parameters as well as grouping of node templates.
*/
class TopologyTemplate {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -520,7 +535,7 @@ open class NodeTemplate {
lateinit var type: String
var metadata: MutableMap<String, String>? = null
var directives: MutableList<String>? = null
- //@get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
+ // @get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
var properties: MutableMap<String, JsonNode>? = null
var attributes: MutableMap<String, JsonNode>? = null
var capabilities: MutableMap<String, CapabilityAssignment>? = null
@@ -566,11 +581,10 @@ class RequirementAssignment {
var id: String? = null
var capability: String? = null
var node: String? = null
- //Relationship Type or Relationship Template
+ // Relationship Type or Relationship Template
var relationship: String? = null
}
-
class Workflow {
@get:JsonIgnore
var id: String? = null
@@ -581,7 +595,6 @@ class Workflow {
var outputs: MutableMap<String, PropertyDefinition>? = null
}
-
class ConditionClause {
var and: ArrayList<MutableMap<String, Any>>? = null
var or: ArrayList<MutableMap<String, Any>>? = null
@@ -594,9 +607,12 @@ class ConditionClause {
A TOSCA Service Template (YAML) document contains element definitions of building blocks for cloud application, or complete models of cloud applications. This section describes the top-level structural elements (TOSCA keynames) along with their grammars, which are allowed to appear in a TOSCA Service Template document.
*/
-@JsonPropertyOrder(value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
- "topologyTemplate"])
+@JsonPropertyOrder(
+ value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
+ "topologyTemplate"]
+)
class ServiceTemplate : Cloneable {
+
@get:JsonIgnore
var id: String? = null
@get:JsonProperty("tosca_definitions_version")
@@ -620,7 +636,7 @@ class ServiceTemplate : Cloneable {
@get:JsonProperty("topology_template")
var topologyTemplate: TopologyTemplate? = null
- override public fun clone(): ServiceTemplate {
+ public override fun clone(): ServiceTemplate {
return super.clone() as ServiceTemplate
}
}
@@ -634,4 +650,3 @@ class ToscaMetaData {
var templateVersion: String? = null
var templateTags: String? = null
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
index 51d088ee1..8bdedd429 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
@@ -23,11 +23,12 @@ import java.util.HashMap
* @author Steve Siani
* @version 1.0
*/
-enum class ErrorCode (val value: Int, val httpCode: Int) {
+enum class ErrorCode(val value: Int, val httpCode: Int) {
- /// TODO: Add more attribute for each needed application protocol
+ // / TODO: Add more attribute for each needed application protocol
// TODO: Example: INVALID_FILE_EXTENSION(2, 415, 25)
GENERIC_FAILURE(1, 500) {
+
override fun message(detailMsg: String): String {
return "Generic failure. Details : {$detailMsg}"
}
@@ -99,4 +100,4 @@ enum class ErrorCode (val value: Int, val httpCode: Int) {
return if (map.containsKey(value)) map[value] else map[1]
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
index 182d9a050..13e9f0e5a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
@@ -18,8 +18,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignmentBuilder,
In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
- id: String, type: String, private val interfaceName: String, description: String
-) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
+ id: String,
+ type: String,
+ private val interfaceName: String,
+ description: String
+ ) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
open fun definedOperation(description: String, block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
typedOperation<In, Out>(interfaceName, description, block)
@@ -27,7 +30,9 @@ abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignm
}
abstract class AbstractNodeTemplatePropertyImplBuilder<Prop : PropertiesAssignmentBuilder>(
- id: String, type: String, description: String
+ id: String,
+ type: String,
+ description: String
) : NodeTemplateBuilder(id, type, description) {
open fun definedProperties(block: Prop.() -> Unit) {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
index 01c6a13be..9964687a6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
@@ -20,47 +20,87 @@ import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
// CDS DSLs
-fun blueprint(name: String, version: String, author: String, tags: String,
- block: DSLBluePrintBuilder.() -> Unit): DSLBluePrint {
+fun blueprint(
+ name: String,
+ version: String,
+ author: String,
+ tags: String,
+ block: DSLBluePrintBuilder.() -> Unit
+): DSLBluePrint {
return DSLBluePrintBuilder(name, version, author, tags).apply(block).build()
}
// TOSCA DSLs
-fun serviceTemplate(name: String, version: String, author: String, tags: String,
- block: ServiceTemplateBuilder.() -> Unit): ServiceTemplate {
- return ServiceTemplateBuilder(name, version, author, tags).apply(block).build()
+fun serviceTemplate(
+ name: String,
+ version: String,
+ author: String,
+ tags: String,
+ block: BluePrintServiceDSLBuilder.() -> Unit
+): ServiceTemplate {
+ return BluePrintServiceDSLBuilder(name, version, author, tags).apply(block).build()
}
fun workflow(id: String, description: String, block: WorkflowBuilder.() -> Unit): Workflow {
return WorkflowBuilder(id, description).apply(block).build()
}
-fun nodeTemplate(id: String, type: String, description: String,
- block: NodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun nodeTemplate(
+ id: String,
+ type: String,
+ description: String,
+ block: NodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return NodeTemplateBuilder(id, type, description).apply(block).build()
}
-fun nodeType(id: String, version: String, derivedFrom: String, description: String,
- block: NodeTypeBuilder.() -> Unit): NodeType {
+fun nodeType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: NodeTypeBuilder.() -> Unit
+): NodeType {
return NodeTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
-fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit): DataType {
+fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+): DataType {
return DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
-fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit): ArtifactType {
+fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+): ArtifactType {
return ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
-fun relationshipType(id: String, version: String, derivedFrom: String, description: String,
- block: RelationshipTypeBuilder.() -> Unit): RelationshipType {
+fun relationshipType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: RelationshipTypeBuilder.() -> Unit
+): RelationshipType {
return RelationshipTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
@@ -120,106 +160,132 @@ fun getNodeTemplateArtifact(nodeTemplateName: String, artifactId: String): JsonN
// Operation Function
-fun getNodeTemplateOperationOutput(nodeTemplateName: String, interfaceName: String, propertyId: String,
- jsonPath: String? = null): JsonNode {
+fun getNodeTemplateOperationOutput(
+ nodeTemplateName: String,
+ interfaceName: String,
+ propertyId: String,
+ jsonPath: String? = null
+): JsonNode {
return """{"get_operation_output": ["$nodeTemplateName", "$interfaceName", "process","$propertyId","$jsonPath" ]}""".trimMargin().jsonAsJsonType()
}
/** Blueprint Type Extensions */
fun BluePrintTypes.nodeTypeComponent(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Component Node") {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Component Node"
+ ) {
}
}
fun BluePrintTypes.nodeTypeWorkflow(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Workflow Node") {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Workflow Node"
+ ) {
}
}
fun BluePrintTypes.nodeTypeVnf(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_VNF,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default VNF Node") {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_VNF,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default VNF Node"
+ ) {
}
}
fun BluePrintTypes.nodeTypeResourceSource(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Resource Source Node") {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Resource Source Node"
+ ) {
}
}
/** Artifacts */
fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Velocity Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Velocity Artifact"
+ ) {
fileExt("vtl")
}
}
fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Jinja Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Jinja Artifact"
+ ) {
fileExt("jinja")
}
}
fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Mapping Resource Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Mapping Resource Artifact"
+ ) {
fileExt("json")
}
}
fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Jython Script Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Jython Script Artifact"
+ ) {
fileExt("py")
}
}
fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Kotlin Script Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Kotlin Script Artifact"
+ ) {
fileExt("kts")
}
}
fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Directed Graph Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Directed Graph Artifact"
+ ) {
fileExt("xml", "json")
}
}
fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Component Artifact") {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Component Artifact"
+ ) {
fileExt("jar")
}
}
@@ -227,17 +293,21 @@ fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType {
/** Relationship Types */
fun BluePrintTypes.relationshipTypeConnectsTo(): RelationshipType {
- return relationshipType(id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- description = "Relationship connects to") {
+ return relationshipType(
+ id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ description = "Relationship connects to"
+ ) {
}
}
fun BluePrintTypes.relationshipTypeDependsOn(): RelationshipType {
- return relationshipType(id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- description = "Relationship depends on") {
+ return relationshipType(
+ id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ description = "Relationship depends on"
+ ) {
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
index d46d478a8..f2e964a1d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
@@ -19,15 +19,23 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
/**
* @author Brinda Santh
*/
-class DSLBluePrintBuilder(private val name: String,
- private val version: String,
- private val author: String,
- private val tags: String) {
+class DSLBluePrintBuilder(
+ private val name: String,
+ private val version: String,
+ private val author: String,
+ private val tags: String
+) {
private var dslBluePrint = DSLBluePrint()
private var metadata: MutableMap<String, String> = hashMapOf()
@@ -59,8 +67,13 @@ class DSLBluePrintBuilder(private val name: String,
dataTypes[dataType.id!!] = dataType
}
- fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit) {
+ fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+ ) {
dataTypes[id] = DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
@@ -68,20 +81,36 @@ class DSLBluePrintBuilder(private val name: String,
artifactTypes[artifactType.id!!] = artifactType
}
- fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit) {
+ fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+ ) {
artifactTypes[id] = ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun component(id: String, type: String, version: String, description: String,
- block: DSLComponentBuilder.() -> Unit) {
+ fun component(
+ id: String,
+ type: String,
+ version: String,
+ description: String,
+ block: DSLComponentBuilder.() -> Unit
+ ) {
components[id] = DSLComponentBuilder(id, type, version, description).apply(block).build()
}
- fun registryComponent(id: String, type: String, version: String, interfaceName: String, description: String,
- block: DSLRegistryComponentBuilder.() -> Unit) {
+ fun registryComponent(
+ id: String,
+ type: String,
+ version: String,
+ interfaceName: String,
+ description: String,
+ block: DSLRegistryComponentBuilder.() -> Unit
+ ) {
registryComponents[id] = DSLRegistryComponentBuilder(id, type, version, interfaceName, description)
- .apply(block).build()
+ .apply(block).build()
}
fun workflow(id: String, description: String, block: DSLWorkflowBuilder.() -> Unit) {
@@ -101,8 +130,13 @@ class DSLBluePrintBuilder(private val name: String,
}
}
-class DSLComponentBuilder(private val id: String, private val type: String,
- private val version: String, private val description: String) {
+class DSLComponentBuilder(
+ private val id: String,
+ private val type: String,
+ private val version: String,
+ private val description: String
+) {
+
private val dslComponent = DSLComponent()
var properties: MutableMap<String, PropertyDefinition>? = null
var attributes: MutableMap<String, AttributeDefinition>? = null
@@ -119,12 +153,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
attributes!![id] = attribute
}
- fun attribute(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLAttributeDefinitionBuilder.() -> Unit) {
+ fun attribute(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLAttributeDefinitionBuilder.() -> Unit
+ ) {
if (attributes == null)
attributes = hashMapOf()
val attribute = DSLAttributeDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
attributes!![id] = attribute
}
@@ -135,12 +175,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
properties!![id] = property
}
- fun property(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (properties == null)
properties = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
properties!![id] = property
}
@@ -163,7 +209,6 @@ class DSLComponentBuilder(private val id: String, private val type: String,
artifacts!![id] = ArtifactDefinitionBuilder(id, type, file).apply(block).build()
}
-
fun input(id: String, type: String, required: Boolean, expression: Any, description: String? = "") {
if (inputs == null)
inputs = hashMapOf()
@@ -171,12 +216,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
inputs!![id] = property.build()
}
- fun input(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun input(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (inputs == null)
inputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
inputs!![id] = property
}
@@ -187,12 +238,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
outputs!![id] = property.build()
}
- fun output(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun output(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (outputs == null)
outputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
outputs!![id] = property
}
@@ -212,10 +269,14 @@ class DSLComponentBuilder(private val id: String, private val type: String,
}
}
-class DSLRegistryComponentBuilder(private val id: String, private val type: String,
- private val version: String,
- private val interfaceName: String,
- private val description: String) {
+class DSLRegistryComponentBuilder(
+ private val id: String,
+ private val type: String,
+ private val version: String,
+ private val interfaceName: String,
+ private val description: String
+) {
+
private val dslComponent = DSLRegistryComponent()
var properties: MutableMap<String, JsonNode>? = null
@@ -289,8 +350,14 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
inputs!![id] = property.build()
}
- fun input(id: String, type: String, required: Boolean, description: String, defaultValue: Any?,
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun input(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String,
+ defaultValue: Any?,
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
if (inputs == null)
inputs = hashMapOf()
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -306,12 +373,18 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
outputs!![id] = property.build()
}
- fun output(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun output(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (outputs == null)
outputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
outputs!![id] = property
}
@@ -337,11 +410,13 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
}
}
-class DSLAttributeDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val expression: JsonNode,
- private val description: String? = "") {
+class DSLAttributeDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val expression: JsonNode,
+ private val description: String? = ""
+) {
private var attributeDefinition = AttributeDefinition()
@@ -368,11 +443,13 @@ class DSLAttributeDefinitionBuilder(private val id: String,
}
}
-class DSLPropertyDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val expression: JsonNode,
- private val description: String? = "") {
+class DSLPropertyDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val expression: JsonNode,
+ private val description: String? = ""
+) {
private var propertyDefinition: PropertyDefinition = PropertyDefinition()
@@ -397,4 +474,4 @@ class DSLPropertyDefinitionBuilder(private val id: String,
propertyDefinition.description = description
return propertyDefinition
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
index 61b52a6f9..8b5c4151a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
@@ -18,7 +18,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
/**
* This is simplified version of DSL, which is used for generating the Service template
@@ -26,6 +32,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.*
*/
class DSLBluePrint {
+
var metadata: MutableMap<String, String> = hashMapOf()
var properties: MutableMap<String, JsonNode>? = null
var dataTypes: MutableMap<String, DataType> = hashMapOf()
@@ -59,7 +66,6 @@ class DSLComponent {
var outputs: MutableMap<String, PropertyDefinition>? = null
}
-
class DSLRegistryComponent {
lateinit var id: String
lateinit var type: String
@@ -71,4 +77,4 @@ class DSLRegistryComponent {
var artifacts: MutableMap<String, ArtifactDefinition>? = null
var inputs: MutableMap<String, JsonNode>? = null
var outputs: MutableMap<String, JsonNode>? = null
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
index 259efbf0b..ca4d56338 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
@@ -17,14 +17,28 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
import kotlin.reflect.KClass
-class ServiceTemplateBuilder(private val name: String,
- private val version: String,
- private val author: String,
- private val tags: String) {
+class BluePrintServiceDSLBuilder(
+ private val name: String,
+ private val version: String,
+ private val author: String,
+ private val tags: String
+) {
+
private var serviceTemplate = ServiceTemplate()
private var topologyTemplate: TopologyTemplate? = null
private var metadata: MutableMap<String, String> = hashMapOf()
@@ -138,36 +152,61 @@ class ServiceTemplateBuilder(private val name: String,
nodeTypes!![nodeType.id!!] = nodeType
}
- fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit) {
+ fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+ ) {
if (dataTypes == null)
dataTypes = hashMapOf()
dataTypes!![id] = DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit) {
+ fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+ ) {
if (artifactTypes == null)
artifactTypes = hashMapOf()
artifactTypes!![id] = ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun relationshipType(id: String, version: String, derivedFrom: String, description: String,
- block: RelationshipTypeBuilder.() -> Unit) {
+ fun relationshipType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: RelationshipTypeBuilder.() -> Unit
+ ) {
if (relationshipTypes == null)
relationshipTypes = hashMapOf()
relationshipTypes!![id] = RelationshipTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun policyType(id: String, version: String, derivedFrom: String, description: String,
- block: PolicyTypeBuilder.() -> Unit) {
+ fun policyType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: PolicyTypeBuilder.() -> Unit
+ ) {
if (policyTypes == null)
policyTypes = hashMapOf()
policyTypes!![id] = PolicyTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun nodeType(id: String, version: String, derivedFrom: String, description: String,
- block: NodeTypeBuilder.() -> Unit) {
+ fun nodeType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: NodeTypeBuilder.() -> Unit
+ ) {
if (nodeTypes == null)
nodeTypes = hashMapOf()
nodeTypes!![id] = NodeTypeBuilder(id, version, derivedFrom, description).apply(block).build()
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
index a4a5e05ec..d07fc9c71 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
@@ -20,7 +20,19 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.bpClone
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
/**
* Generate Service Template for the simplified DSL.
@@ -88,7 +100,6 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint)
return nodeTemplates
}
-
private fun populateWorkflow(): MutableMap<String, Workflow>? {
var workflows: MutableMap<String, Workflow>? = null
if (dslBluePrint.workflows.isNotEmpty()) {
@@ -197,4 +208,4 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint)
}
return assignments
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index 7f49a99c6..df4d2d849 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -19,7 +19,15 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import kotlin.reflect.KClass
import kotlin.reflect.full.createInstance
import kotlin.reflect.jvm.reflect
@@ -41,9 +49,14 @@ class TopologyTemplateBuilder {
nodeTemplates!![nodeTemplate.id!!] = nodeTemplate
}
- fun nodeTemplateOperation(nodeTemplateName: String, type: String, interfaceName: String, description: String,
- operationBlock: OperationAssignmentBuilder<PropertiesAssignmentBuilder,
- PropertiesAssignmentBuilder>.() -> Unit) {
+ fun nodeTemplateOperation(
+ nodeTemplateName: String,
+ type: String,
+ interfaceName: String,
+ description: String,
+ operationBlock: OperationAssignmentBuilder<PropertiesAssignmentBuilder,
+ PropertiesAssignmentBuilder>.() -> Unit
+ ) {
if (nodeTemplates == null)
nodeTemplates = hashMapOf()
@@ -64,9 +77,13 @@ class TopologyTemplateBuilder {
workflows!![workflow.id!!] = workflow
}
- //TODO("populate inputs, outputs")
- fun workflowNodeTemplate(actionName: String,
- nodeTemplateType: String, description: String, block: NodeTemplateBuilder.() -> Unit) {
+ // TODO("populate inputs, outputs")
+ fun workflowNodeTemplate(
+ actionName: String,
+ nodeTemplateType: String,
+ description: String,
+ block: NodeTemplateBuilder.() -> Unit
+ ) {
if (nodeTemplates == null)
nodeTemplates = hashMapOf()
@@ -88,9 +105,12 @@ class TopologyTemplateBuilder {
}
}
-open class NodeTemplateBuilder(private val id: String,
- private val type: String,
- private val description: String? = "") {
+open class NodeTemplateBuilder(
+ private val id: String,
+ private val type: String,
+ private val description: String? = ""
+) {
+
private var nodeTemplate: NodeTemplate = NodeTemplate()
private var properties: MutableMap<String, JsonNode>? = null
private var interfaces: MutableMap<String, InterfaceAssignment>? = null
@@ -116,8 +136,10 @@ open class NodeTemplateBuilder(private val id: String,
}
open fun <In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder> typedOperation(
- interfaceName: String, description: String = "",
- block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
+ interfaceName: String,
+ description: String = "",
+ block: OperationAssignmentBuilder<In, Out>.() -> Unit
+ ) {
if (interfaces == null)
interfaces = hashMapOf()
@@ -125,12 +147,15 @@ open class NodeTemplateBuilder(private val id: String,
val defaultOperationName = BluePrintConstants.DEFAULT_STEP_OPERATION
interfaceAssignment.operations = hashMapOf()
interfaceAssignment.operations!![defaultOperationName] =
- OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build()
+ OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build()
interfaces!![interfaceName] = interfaceAssignment
}
- fun operation(interfaceName: String, description: String,
- block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
+ fun operation(
+ interfaceName: String,
+ description: String,
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit
+ ) {
typedOperation<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(interfaceName, description, block)
}
@@ -235,9 +260,13 @@ open class CapabilityAssignmentBuilder(private val id: String) {
}
}
-open class RequirementAssignmentBuilder(private val id: String, private val capability: String,
- private val node: String,
- private val relationship: String) {
+open class RequirementAssignmentBuilder(
+ private val id: String,
+ private val capability: String,
+ private val node: String,
+ private val relationship: String
+) {
+
private var requirementAssignment: RequirementAssignment = RequirementAssignment()
fun build(): RequirementAssignment {
@@ -254,12 +283,16 @@ class InterfaceAssignmentBuilder(private val id: String) {
private var interfaceAssignment: InterfaceAssignment = InterfaceAssignment()
private var operations: MutableMap<String, OperationAssignment>? = null
- fun operation(id: String, description: String? = "",
- block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
+ fun operation(
+ id: String,
+ description: String? = "",
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit
+ ) {
if (operations == null)
operations = hashMapOf()
operations!![id] = OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(
- id, description).apply(block).build()
+ id, description
+ ).apply(block).build()
}
fun build(): InterfaceAssignment {
@@ -270,8 +303,9 @@ class InterfaceAssignmentBuilder(private val id: String) {
}
class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
- private val id: String,
- private val description: String? = "") {
+ private val id: String,
+ private val description: String? = ""
+) {
private var operationAssignment: OperationAssignment = OperationAssignment()
@@ -286,8 +320,11 @@ class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : Propert
}
}
- fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF,
- block: ImplementationBuilder.() -> Unit) {
+ fun implementation(
+ timeout: Int,
+ operationHost: String? = BluePrintConstants.PROPERTY_SELF,
+ block: ImplementationBuilder.() -> Unit
+ ) {
operationAssignment.implementation = ImplementationBuilder(timeout, operationHost!!).apply(block).build()
}
@@ -368,4 +405,4 @@ open class AttributesAssignmentBuilder {
fun build(): MutableMap<String, JsonNode> {
return attributes
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
index 8d96e7110..e183b8090 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
@@ -18,14 +18,34 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ConstraintClause
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntityType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
+
+open class EntityTypeBuilder(
+ private val id: String,
+ private val version: String,
+ private val derivedFrom: String,
+ private val description: String? = ""
+) {
-
-open class EntityTypeBuilder(private val id: String,
- private val version: String,
- private val derivedFrom: String,
- private val description: String? = "") {
var metadata: MutableMap<String, String>? = null
var properties: MutableMap<String, PropertyDefinition>? = null
var attributes: MutableMap<String, AttributeDefinition>? = null
@@ -43,8 +63,13 @@ open class EntityTypeBuilder(private val id: String,
attributes!![id] = attribute
}
- fun attribute(id: String, type: String, required: Boolean, description: String? = "",
- block: AttributeDefinitionBuilder.() -> Unit) {
+ fun attribute(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String? = "",
+ block: AttributeDefinitionBuilder.() -> Unit
+ ) {
if (attributes == null)
attributes = hashMapOf()
val attribute = AttributeDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -58,8 +83,13 @@ open class EntityTypeBuilder(private val id: String,
properties!![id] = property
}
- fun property(id: String, type: String, required: Boolean, description: String? = "",
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String? = "",
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
if (properties == null)
properties = hashMapOf()
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -77,8 +107,13 @@ open class EntityTypeBuilder(private val id: String,
}
}
-class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class NodeTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var nodeType = NodeType()
private var capabilities: MutableMap<String, CapabilityDefinition>? = null
private var requirements: MutableMap<String, RequirementDefinition>? = null
@@ -97,12 +132,18 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
requirements!![id] = RequirementDefinitionBuilder(id, capability, node, relationship, description).build()
}
- fun requirement(id: String, capability: String, node: String, relationship: String, description: String,
- block: RequirementDefinitionBuilder.() -> Unit) {
+ fun requirement(
+ id: String,
+ capability: String,
+ node: String,
+ relationship: String,
+ description: String,
+ block: RequirementDefinitionBuilder.() -> Unit
+ ) {
if (requirements == null)
requirements = hashMapOf()
requirements!![id] = RequirementDefinitionBuilder(id, capability, node, relationship, description)
- .apply(block).build()
+ .apply(block).build()
}
fun artifact(id: String, type: String, file: String) {
@@ -125,7 +166,7 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
val defaultOperationName = "process"
interfaceDefinition.operations = hashMapOf()
interfaceDefinition.operations!![defaultOperationName] =
- OperationDefinitionBuilder(defaultOperationName, description).apply(block).build()
+ OperationDefinitionBuilder(defaultOperationName, description).apply(block).build()
interfaces!![interfaceName] = interfaceDefinition
}
@@ -139,8 +180,13 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class ArtifactTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class ArtifactTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var artifactType = ArtifactType()
private var fileExt: MutableList<String>? = null
@@ -159,8 +205,13 @@ class ArtifactTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class PolicyTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class PolicyTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var policyType = PolicyType()
fun targets(targetsStr: String) {
@@ -178,9 +229,13 @@ class PolicyTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class RelationshipTypeBuilder(private val id: String, private val version: String,
- derivedFrom: String, private val description: String?)
- : EntityTypeBuilder(id, version, derivedFrom, description) {
+class RelationshipTypeBuilder(
+ private val id: String,
+ private val version: String,
+ derivedFrom: String,
+ private val description: String?
+) :
+ EntityTypeBuilder(id, version, derivedFrom, description) {
private var relationshipType = RelationshipType()
@@ -202,8 +257,13 @@ class RelationshipTypeBuilder(private val id: String, private val version: Strin
}
}
-class DataTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class DataTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var dataType = DataType()
fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
@@ -239,8 +299,14 @@ class CapabilityDefinitionBuilder(private val id: String, private val type: Stri
}
}
-class RequirementDefinitionBuilder(private val id: String, private val capability: String, private val node: String,
- private val relationship: String, private val description: String? = "") {
+class RequirementDefinitionBuilder(
+ private val id: String,
+ private val capability: String,
+ private val node: String,
+ private val relationship: String,
+ private val description: String? = ""
+) {
+
private var requirementDefinition = RequirementDefinition()
fun build(): RequirementDefinition {
@@ -271,8 +337,11 @@ class InterfaceDefinitionBuilder(private val id: String) {
}
}
-class OperationDefinitionBuilder(private val id: String,
- private val description: String? = "") {
+class OperationDefinitionBuilder(
+ private val id: String,
+ private val description: String? = ""
+) {
+
private var operationDefinition: OperationDefinition = OperationDefinition()
fun inputs(block: PropertiesDefinitionBuilder.() -> Unit) {
@@ -290,10 +359,12 @@ class OperationDefinitionBuilder(private val id: String,
}
}
-class AttributeDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val description: String? = "") {
+class AttributeDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val description: String? = ""
+) {
private var attributeDefinition: AttributeDefinition = AttributeDefinition()
@@ -342,8 +413,13 @@ class PropertiesDefinitionBuilder {
properties[id] = property
}
- fun property(id: String, type: String?, required: Boolean?, description: String? = "",
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String?,
+ required: Boolean?,
+ description: String? = "",
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
properties[id] = property
}
@@ -353,10 +429,12 @@ class PropertiesDefinitionBuilder {
}
}
-class PropertyDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val description: String? = "") {
+class PropertyDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val description: String? = ""
+) {
private var propertyDefinition: PropertyDefinition = PropertyDefinition()
@@ -485,7 +563,6 @@ class ConstraintClauseBuilder {
}
}
-
class EntrySchemaBuilder(private val type: String) {
private var entrySchema: EntrySchema = EntrySchema()
@@ -501,4 +578,4 @@ class EntrySchemaBuilder(private val type: String) {
entrySchema.type = type
return entrySchema
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
index 6d46ac7ad..8a1a9d63c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
@@ -72,11 +72,13 @@ class WorkflowBuilder(private val id: String, private val description: String) {
workflow.outputs = outputs
return workflow
}
-
}
-class StepBuilder(private val id: String, private val target: String,
- private val description: String) {
+class StepBuilder(
+ private val id: String,
+ private val target: String,
+ private val description: String
+) {
private var step = Step()
private var activities: ArrayList<Activity> = arrayListOf()
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
index 9b4f6b56e..bd45bed06 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
@@ -54,4 +54,4 @@ interface BluePrintCatalogService {
@Throws(BluePrintException::class)
suspend fun deleteFromDatabase(name: String, version: String)
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
index 8267e5dcc..fcc9bf2d7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
@@ -57,5 +57,4 @@ abstract class AbstractBluePrintDefinitions : BluePrintDefinitions {
override fun otherDefinitions(): MutableMap<String, Any> {
return otherDefinitionMap
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
index d0b5ea743..80c91ca28 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
@@ -18,7 +18,15 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
@@ -44,7 +52,6 @@ interface BluePrintPropertyDefinitionEnhancer : BluePrintEnhancer<PropertyDefini
interface BluePrintAttributeDefinitionEnhancer : BluePrintEnhancer<AttributeDefinition>
-
interface BluePrintEnhancerService {
@Throws(BluePrintException::class)
@@ -132,11 +139,16 @@ interface BluePrintTypeEnhancerService {
}
@Suppress("UNCHECKED_CAST")
- private fun <T> doEnhancement(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, enhancers: List<BluePrintEnhancer<T>>) {
+ private fun <T> doEnhancement(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ definition: Any,
+ enhancers: List<BluePrintEnhancer<T>>
+ ) {
if (enhancers.isNotEmpty()) {
enhancers.forEach {
it.enhance(bluePrintRuntimeService, name, definition as T)
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
index 3a6d35f4e..8d04e5489 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
@@ -18,7 +18,11 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import java.io.Serializable
/**
@@ -43,5 +47,4 @@ interface BluePrintRepoService : Serializable {
@Throws(BluePrintException::class)
fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
index 7912e781a..aa61b0c4d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
@@ -23,12 +23,17 @@ interface BluePrintScriptsService {
suspend fun <T> scriptInstance(bluePrintSourceCode: BluePrintSourceCode, scriptClassName: String): T
- suspend fun <T> scriptInstance(blueprintBasePath: String, artifactName: String, artifactVersion: String,
- scriptClassName: String, reCompile: Boolean): T
+ suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ artifactName: String,
+ artifactVersion: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T
suspend fun <T> scriptInstance(blueprintBasePath: String, scriptClassName: String, reCompile: Boolean): T
suspend fun <T> scriptInstance(cacheKey: String, scriptClassName: String): T
suspend fun <T> scriptInstance(scriptClassName: String): T
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
index 92be6753c..70c797326 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
@@ -20,7 +20,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
interface BluePrintWorkflowExecutionService<Input, Output> {
- suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: Input,
- properties: MutableMap<String, Any> = hashMapOf()): Output
-} \ No newline at end of file
+ suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: Input,
+ properties: MutableMap<String, Any> = hashMapOf()
+ ): Output
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
index 932b9a09f..b56fac541 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
@@ -21,7 +21,6 @@ import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import java.util.function.Function
-
interface BlueprintFunctionNode<T, R> : Function<T, R> {
fun getName(): String
@@ -70,4 +69,4 @@ interface BlueprintFunctionNode<T, R> : Function<T, R> {
@Throws(BluePrintProcessorException::class)
suspend fun applyNB(t: T): R
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
index 98abf8987..6f6979772 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
@@ -34,18 +34,21 @@ interface BlueprintTemplateService {
* @return Content result
*
**/
- suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- nodeTemplateName: String,
- artifactName: String,
- jsonData: String = "",
- ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String
+ suspend fun generateContent(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactName: String,
+ jsonData: String = "",
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String
}
/**
* Customise JsonNodeFactory and TextNode, Since it introduces quotes for string data.
*/
open class BluePrintJsonNodeFactory : JsonNodeFactory() {
+
override fun textNode(text: String): TextNode {
return BluePrintTextNode(text)
}
@@ -59,5 +62,4 @@ open class BluePrintTextNode(v: String) : TextNode(v) {
CharTypes.appendQuoted(sb, this._value)
return sb.toString()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
index 6076f5503..c6339f449 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
@@ -18,17 +18,23 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-
interface BluePrintValidator<T> {
fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
-
}
-
interface BluePrintServiceTemplateValidator : BluePrintValidator<ServiceTemplate>
interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTemplate>
@@ -61,7 +67,6 @@ interface BluePrintValidatorService {
fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean
}
-
interface BluePrintTypeValidatorService {
fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T?
@@ -100,8 +105,11 @@ interface BluePrintTypeValidatorService {
doValidation(bluePrintRuntimeService, name, artifactType, validators)
}
- fun validateArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ fun validateArtifactDefinition(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
val validators = getArtifactDefinitionsValidators()
doValidation(bluePrintRuntimeService, name, artifactDefinition, validators)
}
@@ -154,12 +162,14 @@ interface BluePrintTypeValidatorService {
}
@Suppress("UNCHECKED_CAST")
- private fun <T> doValidation(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, validators: List<BluePrintValidator<T>>) {
+ private fun <T> doValidation(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ definition: Any,
+ validators: List<BluePrintValidator<T>>
+ ) {
validators.forEach {
it.validate(bluePrintRuntimeService, name, definition as T)
}
}
}
-
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
index baae3372d..b2857c6ce 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
@@ -30,12 +30,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import java.io.File
import java.net.URLClassLoader
-import java.util.*
+import java.util.ArrayList
import kotlin.script.experimental.api.SourceCode
import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
import kotlin.system.measureTimeMillis
-
open class BluePrintCompileService {
val log = logger(BluePrintCompileService::class)
@@ -46,8 +45,11 @@ open class BluePrintCompileService {
}
/** Compile the [bluePrintSourceCode] and get the [kClassName] instance for the constructor [args] */
- suspend fun <T> eval(bluePrintSourceCode: BluePrintSourceCode, kClassName: String,
- args: ArrayList<Any?>?): T {
+ suspend fun <T> eval(
+ bluePrintSourceCode: BluePrintSourceCode,
+ kClassName: String,
+ args: ArrayList<Any?>?
+ ): T {
/** Compile the source code */
compile(bluePrintSourceCode)
/** Get the class loader with compiled jar */
@@ -58,15 +60,17 @@ open class BluePrintCompileService {
/** Compile [bluePrintSourceCode] and put into cache */
suspend fun compile(bluePrintSourceCode: BluePrintSourceCode) {
- //TODO("Include Multiple folders")
+ // TODO("Include Multiple folders")
val sourcePath = bluePrintSourceCode.blueprintKotlinSources.first()
val compiledJarFile = bluePrintSourceCode.targetJarFile
/** Check cache is present for the blueprint scripts */
val hasCompiledCache = BluePrintCompileCache.hasClassLoader(bluePrintSourceCode.cacheKey)
- log.debug("Jar Exists : ${compiledJarFile.exists()}, Regenerate : ${bluePrintSourceCode.regenerate}," +
- " Compiled hash(${bluePrintSourceCode.cacheKey}) : $hasCompiledCache")
+ log.debug(
+ "Jar Exists : ${compiledJarFile.exists()}, Regenerate : ${bluePrintSourceCode.regenerate}," +
+ " Compiled hash(${bluePrintSourceCode.cacheKey}) : $hasCompiledCache"
+ )
if (!compiledJarFile.exists() || bluePrintSourceCode.regenerate || !hasCompiledCache) {
log.info("compiling for cache key(${bluePrintSourceCode.cacheKey})")
@@ -94,8 +98,7 @@ open class BluePrintCompileService {
val exitCode: ExitCode = k2jvmCompiler.exec(messageCollector, Services.EMPTY, arguments)
when (exitCode) {
ExitCode.OK -> {
- checkFileExists(compiledJarFile)
- { "couldn't generate compiled jar(${compiledJarFile.absolutePath})" }
+ checkFileExists(compiledJarFile) { "couldn't generate compiled jar(${compiledJarFile.absolutePath})" }
}
else -> {
throw BluePrintException("$exitCode :${messageCollector.errors().joinToString("\n")}")
@@ -112,13 +115,13 @@ open class BluePrintCompileService {
/** create class [kClassName] instance from [classLoader] */
fun <T> instance(classLoader: URLClassLoader, kClassName: String, args: ArrayList<Any?>? = arrayListOf()): T {
val kClazz = classLoader.loadClass(kClassName)
- ?: throw BluePrintException("failed to load class($kClassName) from current class loader.")
+ ?: throw BluePrintException("failed to load class($kClassName) from current class loader.")
val instance = if (args.isNullOrEmpty()) {
kClazz.newInstance()
} else {
kClazz.constructors
- .single().newInstance(*args.toArray())
+ .single().newInstance(*args.toArray())
} ?: throw BluePrintException("failed to create class($kClassName) instance for constructor argument($args).")
return instance as T
}
@@ -126,6 +129,7 @@ open class BluePrintCompileService {
/** Compile source code information */
open class BluePrintSourceCode : SourceCode {
+
lateinit var blueprintKotlinSources: MutableList<String>
lateinit var moduleName: String
lateinit var targetJarFile: File
@@ -143,9 +147,9 @@ open class BluePrintSourceCode : SourceCode {
/** Class to collect compilation Data */
data class CompiledMessageData(
- val severity: CompilerMessageSeverity,
- val message: String,
- val location: CompilerMessageLocation?
+ val severity: CompilerMessageSeverity,
+ val message: String,
+ val location: CompilerMessageLocation?
)
/** Class to collect compilation results */
@@ -160,9 +164,9 @@ class CompilationMessageCollector : MessageCollector {
}
override fun hasErrors() =
- synchronized(compiledMessages) {
- compiledMessages.any { it.severity.isError }
- }
+ synchronized(compiledMessages) {
+ compiledMessages.any { it.severity.isError }
+ }
override fun clear() {
synchronized(compiledMessages) {
@@ -171,4 +175,4 @@ class CompilationMessageCollector : MessageCollector {
}
fun errors(): List<CompiledMessageData> = compiledMessages.filter { it.severity == CompilerMessageSeverity.ERROR }
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
index f90e27f4d..fbfcfb94f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
@@ -25,27 +25,26 @@ import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import java.net.URL
import java.net.URLClassLoader
-
object BluePrintCompileCache {
val log = logger(BluePrintCompileCache::class)
private val classLoaderCache: LoadingCache<String, URLClassLoader> = CacheBuilder.newBuilder()
- .maximumSize(50)
- .build(BluePrintClassLoader)
+ .maximumSize(50)
+ .build(BluePrintClassLoader)
fun classLoader(key: String): URLClassLoader {
return classLoaderCache.get(key)
}
fun cleanClassLoader(key: String) {
- if(hasClassLoader(key)){
+ if (hasClassLoader(key)) {
// Make sure to close all classloader loaded resources before we let go of it.
// This fixes a Delete failure message on filesystem that keeps locks on opened jars;
// like Windows and NFS.
classLoaderCache.get(key).close()
classLoaderCache.invalidate(key)
log.info("Cleaned compiled cache($key)")
- }else{
+ } else {
log.warn("No compiled cache($key) present to clean.")
}
}
@@ -67,11 +66,11 @@ object BluePrintClassLoader : CacheLoader<String, URLClassLoader>() {
}
val urls = arrayListOf<URL>()
keyPath.walkTopDown()
- .filter { it.name.endsWith("cba-kts.jar") }
- .forEach {
- log.debug("Adding (${it.absolutePath}) to cache($key)")
- urls.add(it.toURI().toURL())
- }
+ .filter { it.name.endsWith("cba-kts.jar") }
+ .forEach {
+ log.debug("Adding (${it.absolutePath}) to cache($key)")
+ urls.add(it.toURI().toURL())
+ }
return URLClassLoader(urls.toTypedArray(), this.javaClass.classLoader)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
index c067bf3d9..f3eb1a2b9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
@@ -23,8 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
-import java.util.*
-
+import java.util.ArrayList
open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
@@ -35,8 +34,13 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
return bluePrintCompileService.eval(bluePrintSourceCode, scriptClassName, null)
}
- override suspend fun <T> scriptInstance(blueprintBasePath: String, artifactName: String, artifactVersion: String,
- scriptClassName: String, reCompile: Boolean): T {
+ override suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ artifactName: String,
+ artifactVersion: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T {
val sources: MutableList<String> = arrayListOf()
sources.add(normalizedPathName(blueprintBasePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR))
@@ -50,24 +54,29 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
return scriptInstance(scriptSource, scriptClassName)
}
- override suspend fun <T> scriptInstance(blueprintBasePath: String, scriptClassName: String,
- reCompile: Boolean): T {
+ override suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T {
val toscaMetaData = BluePrintMetadataUtils.toscaMetaData(blueprintBasePath)
checkNotNull(toscaMetaData.templateName) { "couldn't find 'Template-Name' key in TOSCA.meta" }
checkNotNull(toscaMetaData.templateVersion) { "couldn't find 'Template-Version' key in TOSCA.meta" }
- return scriptInstance(blueprintBasePath, toscaMetaData.templateName!!, toscaMetaData.templateVersion!!,
- scriptClassName, reCompile)
+ return scriptInstance(
+ blueprintBasePath, toscaMetaData.templateName!!, toscaMetaData.templateVersion!!,
+ scriptClassName, reCompile
+ )
}
override suspend fun <T> scriptInstance(cacheKey: String, scriptClassName: String): T {
val args = ArrayList<Any?>()
return BluePrintCompileCache.classLoader(cacheKey).loadClass(scriptClassName).constructors
- .single().newInstance(*args.toArray()) as T
+ .single().newInstance(*args.toArray()) as T
}
override suspend fun <T> scriptInstance(scriptClassName: String): T {
val args = ArrayList<Any?>()
return Thread.currentThread().contextClassLoader.loadClass(scriptClassName).constructors
- .single().newInstance(*args.toArray()) as T
+ .single().newInstance(*args.toArray()) as T
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
index 159743487..7d85963dc 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
@@ -17,16 +17,25 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+
/**
*
*
* @author Brinda Santh
*/
class BluePrintChainedService {
- var bpc : BluePrintContext
- constructor(bpc : BluePrintContext){
+ var bpc: BluePrintContext
+
+ constructor(bpc: BluePrintContext) {
this.bpc = bpc
}
@@ -42,30 +51,30 @@ class BluePrintChainedService {
recNodeTypesChained(nodeTypeName).forEach { nodeType ->
- val subAttributes = bpc.nodeTypeByName(nodeType.id!!).attributes
+ val subAttributes = bpc.nodeTypeByName(nodeType.id!!).attributes
if (subAttributes != null) {
attributes.putAll(subAttributes)
}
- val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
if (subProperties != null) {
properties.putAll(subProperties)
}
- val subRequirements = bpc.nodeTypeByName(nodeType.id!!).requirements
+ val subRequirements = bpc.nodeTypeByName(nodeType.id!!).requirements
if (subRequirements != null) {
requirements.putAll(subRequirements)
}
- val subCapabilities = bpc.nodeTypeByName(nodeType.id!!).capabilities
+ val subCapabilities = bpc.nodeTypeByName(nodeType.id!!).capabilities
if (subCapabilities != null) {
capabilities.putAll(subCapabilities)
}
- val subInterfaces = bpc.nodeTypeByName(nodeType.id!!).interfaces
+ val subInterfaces = bpc.nodeTypeByName(nodeType.id!!).interfaces
if (subInterfaces != null) {
interfaces.putAll(subInterfaces)
}
- val subArtifacts = bpc.nodeTypeByName(nodeType.id!!).artifacts
+ val subArtifacts = bpc.nodeTypeByName(nodeType.id!!).artifacts
if (subArtifacts != null) {
artifacts.putAll(subArtifacts)
}
@@ -80,11 +89,11 @@ class BluePrintChainedService {
}
fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
- val nodeType = bpc.nodeTypeByName(nodeTypeName)
+ val nodeType = bpc.nodeTypeByName(nodeTypeName)
val properties = hashMapOf<String, PropertyDefinition>()
recNodeTypesChained(nodeTypeName).forEach { nodeType ->
- val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
if (subProperties != null) {
properties.putAll(subProperties)
}
@@ -93,7 +102,7 @@ class BluePrintChainedService {
}
private fun recNodeTypesChained(nodeTypeName: String, nodeTypes: MutableList<NodeType>? = arrayListOf()): MutableList<NodeType> {
- val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
+ val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
nodeType.id = nodeTypeName
val derivedFrom: String = nodeType.derivedFrom
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
@@ -104,7 +113,7 @@ class BluePrintChainedService {
}
private fun recDataTypesChained(dataTypeName: String, dataTypes: MutableList<DataType>? = arrayListOf()): MutableList<DataType> {
- val dataType: DataType = bpc.dataTypeByName(dataTypeName)!!
+ val dataType: DataType = bpc.dataTypeByName(dataTypeName)!!
dataType.id = dataTypeName
val derivedFrom: String = dataType.derivedFrom
if (!BluePrintTypes.rootDataTypes().contains(derivedFrom)) {
@@ -113,5 +122,4 @@ class BluePrintChainedService {
dataTypes!!.add(dataType)
return dataTypes
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
index 99c80f8e6..47cd62ea1 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
@@ -21,7 +21,24 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
@@ -67,46 +84,46 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
}
fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME)
- ?: throw BluePrintException("could't get template name from meta data")
+ ?: throw BluePrintException("could't get template name from meta data")
fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION)
- ?: throw BluePrintException("could't get template version from meta data")
+ ?: throw BluePrintException("could't get template version from meta data")
fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)
- ?: throw BluePrintException("could't get template author from meta data")
+ ?: throw BluePrintException("could't get template author from meta data")
// Workflow
fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName)
- ?: throw BluePrintException("could't get workflow($workFlowName)")
+ ?: throw BluePrintException("could't get workflow($workFlowName)")
fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
fun workflowStepByName(workFlowName: String, stepName: String): Step {
return workflowByName(workFlowName).steps?.get(stepName)
- ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
+ ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
}
fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String {
return workflowStepByName(workFlowName, stepName).target
- ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
+ ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
}
fun workflowFirstStepNodeTemplate(workFlowName: String): String {
val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
- ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
+ ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
return workflowStepNodeTemplate(workFlowName, firstStepName)
}
fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String {
return workflowStepByName(workFlowName, stepName).activities?.filter { it.callOperation != null }?.single()?.callOperation
- ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
+ ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
}
// DSL
fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
- ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
+ ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
// Data Type
fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
@@ -118,7 +135,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName)
- ?: throw BluePrintException("could't get policy type for the name($policyName)")
+ ?: throw BluePrintException("could't get policy type for the name($policyName)")
fun policyTypesDerivedFrom(name: String): MutableMap<String, PolicyType>? {
return policyTypes()?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap()
@@ -138,8 +155,8 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypes(): MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
fun nodeTypeByName(name: String): NodeType =
- nodeTypes()?.get(name)
- ?: throw BluePrintException("could't get node type for the name($name)")
+ nodeTypes()?.get(name)
+ ?: throw BluePrintException("could't get node type for the name($name)")
fun nodeTypeDerivedFrom(name: String): MutableMap<String, NodeType>? {
return nodeTypes()?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap()
@@ -147,24 +164,32 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition {
return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
+ ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
}
fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition {
return nodeTypeInterface(nodeTypeName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
+ ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
}
fun interfaceNameForNodeType(nodeTypeName: String): String {
return nodeTypeByName(nodeTypeName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
+ ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
}
- fun nodeTypeInterfaceOperationInputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ fun nodeTypeInterfaceOperationInputs(
+ nodeTypeName: String,
+ interfaceName: String,
+ operationName: String
+ ): MutableMap<String, PropertyDefinition>? {
return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName).inputs
}
- fun nodeTypeInterfaceOperationOutputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ fun nodeTypeInterfaceOperationOutputs(
+ nodeTypeName: String,
+ interfaceName: String,
+ operationName: String
+ ): MutableMap<String, PropertyDefinition>? {
return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName).outputs
}
@@ -172,7 +197,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplates(): MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
fun nodeTemplateByName(name: String): NodeTemplate =
- nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
+ nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {
return nodeTemplates()?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()
@@ -193,31 +218,31 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition {
return nodeTemplateArtifacts(nodeTemplateName)?.get(artifactName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
}
fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition {
return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
}
fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment {
return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
}
fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String {
return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
}
fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String {
return nodeTemplateFirstInterface(nodeTemplateName).operations?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
}
- fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String)
- : Implementation? {
+ fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String):
+ Implementation? {
return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).implementation
}
@@ -231,27 +256,27 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment {
return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
}
fun nodeTemplateInterfaceOperation(nodeTemplateName: String, interfaceName: String, operationName: String): OperationAssignment {
return nodeTemplateInterface(nodeTemplateName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
}
fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment {
return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
}
fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment {
return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
}
fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
val filteredNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
- ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
+ ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
return nodeTemplateByName(filteredNodeTemplateName)
}
@@ -268,5 +293,4 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
}
-
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
index 776e0411e..df3bde1b4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
@@ -38,16 +38,16 @@ object BluePrintDependencyService {
inline fun <reified T> instance(name: String): T {
return applicationContext.getBean(name) as? T
- ?: throw BluePrintProcessorException("failed to get instance($name)")
+ ?: throw BluePrintProcessorException("failed to get instance($name)")
}
inline fun <reified T> instance(type: Class<T>): T {
return applicationContext.getBean(type)
- ?: throw BluePrintProcessorException("failed to get instance($type)")
+ ?: throw BluePrintProcessorException("failed to get instance($type)")
}
inline fun <reified T> instance(type: KClass<*>): T {
return applicationContext.getBean(type.java) as? T
- ?: throw BluePrintProcessorException("failed to get instance($type)")
+ ?: throw BluePrintProcessorException("failed to get instance($type)")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
index fbf911664..6a3c64650 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
@@ -25,7 +24,14 @@ import com.fasterxml.jackson.databind.node.TextNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DSLExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ExpressionData
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyExpression
+import org.slf4j.LoggerFactory
/**
*
@@ -33,16 +39,16 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.*
* @author Brinda Santh
*/
object BluePrintExpressionService {
- val log= LoggerFactory.getLogger(this::class.toString())
+
+ val log = LoggerFactory.getLogger(this::class.toString())
@JvmStatic
fun checkContainsExpression(propertyAssignmentNode: JsonNode): Boolean {
val json = propertyAssignmentNode.toString()
// FIXME("Check if any Optimisation needed")
- return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT)
- || json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE)
- || json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
-
+ return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT) ||
+ json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE) ||
+ json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
}
@JvmStatic
@@ -74,8 +80,9 @@ object BluePrintExpressionService {
}
}
}
- } else if (propertyAssignmentNode is TextNode
- && propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE)) {
+ } else if (propertyAssignmentNode is TextNode &&
+ propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE)
+ ) {
expressionData.isExpression = true
expressionData.command = BluePrintConstants.EXPRESSION_DSL_REFERENCE
expressionData.dslExpression = populateDSLExpression(propertyAssignmentNode)
@@ -85,8 +92,10 @@ object BluePrintExpressionService {
@JvmStatic
fun populateDSLExpression(jsonNode: TextNode): DSLExpression {
- return DSLExpression(propertyName = jsonNode.textValue()
- .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE))
+ return DSLExpression(
+ propertyName = jsonNode.textValue()
+ .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE)
+ )
}
@JvmStatic
@@ -98,9 +107,13 @@ object BluePrintExpressionService {
fun populatePropertyExpression(jsonNode: JsonNode): PropertyExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing property expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
- "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing property expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
+ "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode
+ )
+ )
}
var reqOrCapEntityName: String? = null
var propertyName = ""
@@ -121,10 +134,11 @@ object BluePrintExpressionService {
}
}
- return PropertyExpression(modelableEntityName = arrayNode[0].asText(),
- reqOrCapEntityName = reqOrCapEntityName,
- propertyName = propertyName,
- subPropertyName = subProperty
+ return PropertyExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ propertyName = propertyName,
+ subPropertyName = subProperty
)
}
@@ -132,9 +146,13 @@ object BluePrintExpressionService {
fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing attribute expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
- " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing attribute expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
+ " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode
+ )
+ )
}
var reqOrCapEntityName: String? = null
@@ -155,10 +173,11 @@ object BluePrintExpressionService {
subAttributeName = propertyPaths.joinToString("/")
}
}
- return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
- reqOrCapEntityName = reqOrCapEntityName,
- attributeName = attributeName,
- subAttributeName = subAttributeName
+ return AttributeExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ attributeName = attributeName,
+ subAttributeName = subAttributeName
)
}
@@ -167,19 +186,25 @@ object BluePrintExpressionService {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 4) {
- throw BluePrintException(String.format("missing operation output expression, " +
- "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing operation output expression, " +
+ "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}",
+ jsonNode
+ )
+ )
}
var subPropertyName: String? = null
if (arrayNode.size() == 5)
subPropertyName = arrayNode[4].asText()
- return OperationOutputExpression(modelableEntityName = arrayNode[0].asText(),
- interfaceName = arrayNode[1].asText(),
- operationName = arrayNode[2].asText(),
- propertyName = arrayNode[3].asText(),
- subPropertyName = subPropertyName
+ return OperationOutputExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ interfaceName = arrayNode[1].asText(),
+ operationName = arrayNode[2].asText(),
+ propertyName = arrayNode[3].asText(),
+ subPropertyName = subPropertyName
)
}
@@ -188,13 +213,18 @@ object BluePrintExpressionService {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing artifact expression, " +
- "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing artifact expression, " +
+ "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode
+ )
+ )
}
- return ArtifactExpression(modelableEntityName = arrayNode[0].asText(),
- artifactName = arrayNode[1].asText(),
- location = arrayNode[2]?.asText() ?: "LOCAL_FILE",
- remove = arrayNode[3]?.asBoolean() ?: false
+ return ArtifactExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ artifactName = arrayNode[1].asText(),
+ location = arrayNode[2]?.asText() ?: "LOCAL_FILE",
+ remove = arrayNode[3]?.asBoolean() ?: false
)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
index 5f6505309..24b7e261c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
@@ -37,7 +37,6 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
private var importServiceTemplateMap: MutableMap<String, ServiceTemplate> = hashMapOf()
-
suspend fun getImportResolvedServiceTemplate(): ServiceTemplate {
// Populate Imported Service Templates
traverseSchema(PARENT_SERVICE_TEMPLATE, parentServiceTemplate)
@@ -70,13 +69,13 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
val decodedSystemId: String = URLDecoder.decode(file, Charset.defaultCharset().toString())
log.trace("file ({}), decodedSystemId ({}) ", file, decodedSystemId)
try {
- if (decodedSystemId.startsWith("http", true)
- || decodedSystemId.startsWith("https", true)) {
+ if (decodedSystemId.startsWith("http", true) ||
+ decodedSystemId.startsWith("https", true)
+ ) {
val givenUrl: String = URL(decodedSystemId).toString()
val systemUrl: String = File(".").toURI().toURL().toString()
log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
if (givenUrl.startsWith(systemUrl)) {
-
}
} else {
if (!decodedSystemId.startsWith("/")) {
@@ -92,6 +91,4 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
}
return serviceTemplate
}
-
-
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
index 78997fe52..fdc348bf7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
@@ -39,41 +39,56 @@ object BluePrintJinjaTemplateService {
/**
* To enable inheritance within CBA, we need Jinja runtime to know where to load the templates.
*/
- class BlueprintRelatedTemplateLocator(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val artifactName: String,
- private val artifactVersion: String) : ResourceLocator {
+ class BlueprintRelatedTemplateLocator(
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val artifactName: String,
+ private val artifactVersion: String
+ ) : ResourceLocator {
@Throws(IOException::class)
override fun getString(fullName: String, encoding: Charset, interpreter: JinjavaInterpreter): String {
try {
val deployFile =
- normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath,
+ normalizedPathName(
+ bluePrintLoadConfiguration.blueprintDeployPath,
artifactName,
artifactVersion,
- fullName)
+ fullName
+ )
return String(readAllBytes(Paths.get(deployFile)))
} catch (var5: IllegalArgumentException) {
throw ResourceNotFoundException("Couldn't find resource: $fullName")
}
-
}
}
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
- additionalContext: MutableMap<String, Any>,
- bluePrintLoadConfiguration: BluePrintLoadConfiguration, artifactName: String,
- artifactVersion: String): String {
-
- return generateContent(template,
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>,
+ bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ artifactName: String,
+ artifactVersion: String
+ ): String {
+
+ return generateContent(
+ template,
json,
ignoreJsonNull,
additionalContext,
- BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion))
+ BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion)
+ )
}
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
- additionalContext: MutableMap<String, Any>, resourceLocator: ResourceLocator? = null): String {
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>,
+ resourceLocator: ResourceLocator? = null
+ ): String {
val jinJava = Jinjava(JinjavaConfig())
if (resourceLocator != null) {
jinJava.resourceLocator = resourceLocator
@@ -98,4 +113,3 @@ object BluePrintJinjaTemplateService {
return jinJava.render(template, additionalContext)
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
index 4b02492da..1f71495a3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
@@ -16,27 +16,33 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService {
- private val log= LoggerFactory.getLogger(BluePrintRepoFileService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintRepoFileService::class.toString())
private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
- private val capabilityTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
- private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
+ private val capabilityTypePath =
+ modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
+ private val relationshipTypePath =
+ modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
private val extension = ".json"
override fun getDataType(dataTypeName: String): DataType {
val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(dataTypeName).plus(extension)
+ .plus(dataTypeName).plus(extension)
return getModelType(fileName, DataType::class.java)
}
@@ -47,24 +53,24 @@ open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoServic
override fun getArtifactType(artifactTypeName: String): ArtifactType {
val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(artifactTypeName).plus(extension)
+ .plus(artifactTypeName).plus(extension)
return getModelType(fileName, ArtifactType::class.java)
}
override fun getRelationshipType(relationshipTypeName: String): RelationshipType {
val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(relationshipTypeName).plus(extension)
+ .plus(relationshipTypeName).plus(extension)
return getModelType(fileName, RelationshipType::class.java)
}
override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition {
val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(capabilityDefinitionName).plus(extension)
+ .plus(capabilityDefinitionName).plus(extension)
return getModelType(fileName, CapabilityDefinition::class.java)
}
private fun <T> getModelType(fileName: String, valueType: Class<T>): T {
return JacksonUtils.readValueFromFile(fileName, valueType)
- ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}")
+ ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index f7b512153..a6d2de476 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -17,15 +17,20 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
import java.io.File
@@ -68,11 +73,11 @@ interface BluePrintRuntimeService<T> {
propertyAssignments: MutableMap<String, JsonNode>
): MutableMap<String, JsonNode>
- fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode>
+ fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>):
+ MutableMap<String, JsonNode>
- fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode>
+ fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>):
+ MutableMap<String, JsonNode>
fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
@@ -80,12 +85,14 @@ interface BluePrintRuntimeService<T> {
JsonNode>
fun resolveNodeTemplateInterfaceOperationInputs(
- nodeTemplateName: String, interfaceName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
operationName: String
): MutableMap<String, JsonNode>
fun resolveNodeTemplateInterfaceOperationOutputs(
- nodeTemplateName: String, interfaceName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
operationName: String
): MutableMap<String, JsonNode>
@@ -98,7 +105,9 @@ interface BluePrintRuntimeService<T> {
fun setInputValue(propertyName: String, value: JsonNode)
fun setWorkflowInputValue(
- workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition,
+ workflowName: String,
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
value: JsonNode
)
@@ -107,25 +116,36 @@ interface BluePrintRuntimeService<T> {
fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode)
fun setNodeTemplateOperationPropertyValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun setNodeTemplateOperationInputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun setNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun getInputValue(propertyName: String): JsonNode
fun getNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String
): JsonNode
fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode?
@@ -163,7 +183,6 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator)
.plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath)
-
}
override fun id(): String {
@@ -240,8 +259,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
nodeTemplateName: String,
propertyDefinitions: MutableMap<String, PropertyDefinition>,
propertyAssignments: MutableMap<String, JsonNode>
- )
- : MutableMap<String, JsonNode> {
+ ):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
@@ -254,7 +273,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(
- nodeTemplateName, nodeTypePropertyName, propertyAssignment)
+ nodeTemplateName, nodeTypePropertyName, propertyAssignment
+ )
}
// Set default value if null
@@ -268,8 +288,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
- override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode> {
+ override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
propertyDefinitions.forEach { propertyName, propertyDefinition ->
@@ -283,8 +303,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
- override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode> {
+ override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
propertyAssignments.forEach { (propertyName, propertyExpression) ->
@@ -333,8 +353,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
interfaceName: String,
operationName: String
): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName), " +
- "interface name($interfaceName), operationName($operationName)")
+ log.info(
+ "resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName), " +
+ "interface name($interfaceName), operationName($operationName)"
+ )
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
@@ -352,10 +374,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Input Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs, propertyAssignments)
-
}
-
override fun resolveNodeTemplateInterfaceOperationOutputs(
nodeTemplateName: String,
interfaceName: String,
@@ -379,7 +399,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Output Assignment Values.
*/
val propertyAssignmentValue =
- resolveNodeTemplatePropertyAssignments(nodeTemplateName,nodeTypeInterfaceOperationOutputs, propertyAssignments)
+ resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationOutputs, propertyAssignments)
// Store operation output values into context
propertyAssignmentValue.forEach { (key, value) ->
@@ -403,7 +423,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return nodeTemplate.artifacts?.get(artifactName)
?: throw BluePrintProcessorException(
- "failed to get artifact definition($artifactName) from the node template")
+ "failed to get artifact definition($artifactName) from the node template"
+ )
}
/**
@@ -412,8 +433,9 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
*/
override fun resolveDSLExpression(dslPropertyName: String): JsonNode {
val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName)
- return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments)
- && propertyAssignments is ObjectNode) {
+ return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments) &&
+ propertyAssignments is ObjectNode
+ ) {
val rootKeyMap = propertyAssignments.rootFieldsToMap()
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
@@ -429,14 +451,16 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setInputValue(propertyName: String, value: JsonNode) {
- val path = """${BluePrintConstants.PATH_INPUTS}${BluePrintConstants.PATH_DIVIDER}${propertyName}"""
+ val path = """${BluePrintConstants.PATH_INPUTS}${BluePrintConstants.PATH_DIVIDER}$propertyName"""
log.trace("setting input path ({}), values ({})", path, value)
put(path, value)
}
override fun setWorkflowInputValue(
- workflowName: String, propertyName: String,
- propertyDefinition: PropertyDefinition, value: JsonNode
+ workflowName: String,
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
.append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
@@ -463,8 +487,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationPropertyValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -480,8 +506,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationInputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -497,8 +525,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -513,7 +543,6 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
put(path, value)
}
-
override fun getInputValue(propertyName: String): JsonNode {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -521,8 +550,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun getNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String
): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
.append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
@@ -563,31 +594,31 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
- log.info("For workflow ($workflowName) driving input data from (${jsonNode})")
+ log.info("For workflow ($workflowName) driving input data from ($jsonNode)")
val dynamicInputPropertiesName = "$workflowName-properties"
- bluePrintContext.workflowByName(workflowName).inputs?.
- forEach { propertyName, property ->
- if (propertyName != dynamicInputPropertiesName) {
- val valueNode: JsonNode =
- jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
- ?: property.defaultValue
- ?: NullNode.getInstance()
- log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
- setInputValue(propertyName, valueNode)
+ bluePrintContext.workflowByName(workflowName).inputs
+ ?.forEach { propertyName, property ->
+ if (propertyName != dynamicInputPropertiesName) {
+ val valueNode: JsonNode =
+ jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
+ log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
+ setInputValue(propertyName, valueNode)
+ }
}
- }
// Load Dynamic data Types
jsonNode.get(dynamicInputPropertiesName)?.let {
- bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.
- forEach { propertyName, property ->
- val valueNode: JsonNode =
- it.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
- ?: property.defaultValue
- ?: NullNode.getInstance()
- log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
- setInputValue(propertyName, valueNode)
- }
+ bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties
+ ?.forEach { propertyName, property ->
+ val valueNode: JsonNode =
+ it.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
+ log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
+ setInputValue(propertyName, valueNode)
+ }
}
}
@@ -615,6 +646,4 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
return jsonNode
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
index 2c928e288..db733bda1 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
@@ -25,9 +25,14 @@ import org.springframework.stereotype.Service
class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) :
BlueprintTemplateService {
- override suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- nodeTemplateName: String, artifactName: String, jsonData: String,
- ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>): String {
+ override suspend fun generateContent(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactName: String,
+ jsonData: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>
+ ): String {
val artifactDefinition =
bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
@@ -36,21 +41,25 @@ class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrint
return when (templateType) {
BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME -> {
- BluePrintJinjaTemplateService.generateContent(template,
+ BluePrintJinjaTemplateService.generateContent(
+ template,
jsonData,
ignoreJsonNull,
additionalContext,
bluePrintLoadConfiguration,
bluePrintRuntimeService.bluePrintContext().name(),
- bluePrintRuntimeService.bluePrintContext().version())
+ bluePrintRuntimeService.bluePrintContext().version()
+ )
}
BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME -> {
BluePrintVelocityTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext)
}
else -> {
- throw BluePrintProcessorException("Unknown Artifact type, expecting ${BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME}" +
- "or ${BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME}")
+ throw BluePrintProcessorException(
+ "Unknown Artifact type, expecting ${BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME}" +
+ "or ${BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME}"
+ )
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
index d3dd30224..f492c2bc6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -17,13 +17,33 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
+import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
import java.io.Serializable
/**
@@ -43,7 +63,7 @@ interface BluePrintValidatorService : Serializable {
@Deprecated("Decomposed implementation moved to blueprint-validation module")
open class BluePrintValidatorDefaultService : BluePrintValidatorService {
- val log= LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString())
+ val log = LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString())
lateinit var bluePrintContext: BluePrintContext
lateinit var serviceTemplate: ServiceTemplate
@@ -72,9 +92,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
} catch (e: Exception) {
log.error("validation failed in the path : {}", paths.joinToString(separator), e)
log.error("validation trace message :{} ", message)
- throw BluePrintException(e,
- format("failed to validate blueprint on path ({}) with message {}"
- , paths.joinToString(separator), e.message))
+ throw BluePrintException(
+ e,
+ format("failed to validate blueprint on path ({}) with message {}", paths.joinToString(separator), e.message)
+ )
}
}
@@ -133,13 +154,17 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(nodeTypeName)
message.appendln("--> Node Type :" + paths.joinToString(separator))
val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
+ // Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
- derivedFrom, nodeTypeName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
+ derivedFrom, nodeTypeName
+ )
+ )
}
nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
@@ -190,7 +215,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
val type: String = nodeTemplate.type
val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
+ ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
@@ -207,12 +232,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(artifactDefinitionName)
message.appendln("Validating artifact " + paths.joinToString(separator))
val type: String = artifactDefinition.type
- ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
+ ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
// Check Artifact Type
checkValidArtifactType(artifactDefinitionName, type)
val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
+ ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
paths.removeAt(paths.lastIndex)
}
@@ -258,7 +283,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
checkPrimitiveOrComplex(entrySchemaType, propertyName)
}
else -> checkPropertyDataType(dataType, propertyName)
@@ -270,20 +295,24 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
- properties: MutableMap<String, JsonNode>) {
+ open fun validatePropertyAssignments(
+ nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>
+ ) {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
- ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
+ ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
}
}
@Throws(BluePrintException::class)
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
+ open fun validatePropertyAssignment(
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode
+ ) {
// Check and Validate if Expression Node
val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
if (!expressionData.isExpression) {
@@ -299,8 +328,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(capabilityName)
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) capability definition ({}) " +
- "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) capability definition ({}) " +
+ "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type
+ )
+ )
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -310,11 +343,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+ open fun validateCapabilityAssignment(
+ nodeTemplateName: String,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition,
+ capabilityAssignment: CapabilityAssignment
+ ) {
capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
-
}
@Throws(BluePrintException::class)
@@ -324,38 +360,55 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
requirements?.forEach { requirementName, requirementAssignment ->
paths.add(requirementName)
val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) requirement definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) requirement definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type
+ )
+ )
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
+ open fun validateRequirementAssignment(
+ nodeTemplateName: String,
+ requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition,
+ requirementAssignment: RequirementAssignment
+ ) {
log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
val requirementNodeTemplateName = requirementAssignment.node!!
val capabilityName = requirementAssignment.capability
val relationship = requirementAssignment.relationship!!
check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
- relationship, nodeTemplateName, requirementAssignmentName))
+ throw BluePrintException(
+ format(
+ "Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
+ relationship, nodeTemplateName, requirementAssignmentName
+ )
+ )
}
val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
- requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
+ requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName
+ )
+ )
relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
- requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName))
-
-
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
+ requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName
+ )
+ )
}
@Throws(BluePrintException::class)
@@ -366,70 +419,93 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) interface definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) interface definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type
+ )
+ )
+
+ validateInterfaceAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ validateInterfaceOperationsAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
}
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceOperationsAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) ",
- nodeTemplateName, operationAssignmentName))
-
- log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
- interfaceAssignmentName, operationAssignmentName)
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) ",
+ nodeTemplateName, operationAssignmentName
+ )
+ )
+
+ log.info(
+ "Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
+ interfaceAssignmentName, operationAssignmentName
+ )
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "property definition({})", nodeTemplateName, operationAssignmentName, propertyName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) " +
+ "property definition({})", nodeTemplateName, operationAssignmentName, propertyName
+ )
+ )
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
outputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "output property definition({})", nodeTemplateName, operationAssignmentName,
- propertyName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) " +
+ "output property definition({})", nodeTemplateName, operationAssignmentName,
+ propertyName
+ )
+ )
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
-
}
}
-
}
@Throws(BluePrintException::class)
@@ -447,12 +523,20 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
+ open fun validateCapabilityDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition
+ ) {
val capabilityType = capabilityDefinition.type
check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
- throw BluePrintException(format("Failed to get CapabilityType({}) for NodeType({})",
- capabilityType, nodeTypeName))
+ throw BluePrintException(
+ format(
+ "Failed to get CapabilityType({}) for NodeType({})",
+ capabilityType, nodeTypeName
+ )
+ )
}
}
@@ -471,8 +555,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
+ open fun validateRequirementDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition
+ ) {
log.info("Validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
val requirementNodeTypeName = requirementDefinition.node!!
@@ -480,21 +568,31 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
val relationship = requirementDefinition.relationship!!
check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship({}) for NodeType({})'s requirement({}) ",
- relationship, nodeTypeName, requirementDefinitionName))
+ throw BluePrintException(
+ format(
+ "Failed to get relationship({}) for NodeType({})'s requirement({}) ",
+ relationship, nodeTypeName, requirementDefinitionName
+ )
+ )
}
val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s for requirement({}) ",
- requirementNodeTypeName, requirementDefinitionName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeType({})'s for requirement({}) ",
+ requirementNodeTypeName, requirementDefinitionName
+ )
+ )
relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
- requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName))
-
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
+ requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName
+ )
+ )
}
-
@Throws(BluePrintException::class)
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
paths.add("interfaces")
@@ -530,7 +628,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
+ ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -562,11 +660,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -578,18 +675,21 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
check(isValid) {
- throw BluePrintException(format("property({}) defined of type({}) is not comptable with the value ({})",
- propertyName, propertyType, propertyAssignment))
+ throw BluePrintException(
+ format(
+ "property({}) defined of type({}) is not comptable with the value ({})",
+ propertyName, propertyType, propertyAssignment
+ )
+ )
}
}
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
}
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
@@ -603,5 +703,4 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
private fun checkDataType(key: String): Boolean {
return serviceTemplate.dataTypes?.containsKey(key) ?: false
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
index 2d3c35de7..43e27d047 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
@@ -34,8 +34,12 @@ object BluePrintVelocityTemplateService {
/**
* Generate Content from Velocity Template and JSON Content with injected API
*/
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String {
// Customized Object Mapper to remove String double quotes
val mapper = ObjectMapper()
@@ -44,7 +48,7 @@ object BluePrintVelocityTemplateService {
val jsonNode: JsonNode? = if (json.isNotEmpty()) {
mapper.readValue(json, JsonNode::class.java)
- ?: throw BluePrintProcessorException("couldn't get json node from json")
+ ?: throw BluePrintProcessorException("couldn't get json node from json")
} else {
null
}
@@ -54,8 +58,12 @@ object BluePrintVelocityTemplateService {
/**
* Generate Content from Velocity Template and JSON Node with injected API
*/
- fun generateContent(template: String, jsonNode: JsonNode?, ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+ fun generateContent(
+ template: String,
+ jsonNode: JsonNode?,
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String {
/*
* create a new instance of the velocity engine
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
index 5cec3c947..98e5e5aec 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
@@ -16,15 +16,27 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import kotlinx.coroutines.*
+import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.CoroutineName
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.consumeEach
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import kotlinx.coroutines.launch
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeStatus
import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeStatus
+import org.onap.ccsdk.cds.controllerblueprints.core.incomingEdges
+import org.onap.ccsdk.cds.controllerblueprints.core.isEndNode
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.outgoingEdges
+import org.onap.ccsdk.cds.controllerblueprints.core.outgoingEdgesNotInLabels
+import org.onap.ccsdk.cds.controllerblueprints.core.startNodes
import kotlin.coroutines.CoroutineContext
interface BluePrintWorkFlowService<In, Out> {
@@ -49,7 +61,6 @@ interface BluePrintWorkFlowService<In, Out> {
suspend fun cancelNode(node: Graph.Node, nodeInput: In, nodeOutput: Out): EdgeLabel
suspend fun restartNode(node: Graph.Node, nodeInput: In, nodeOutput: Out): EdgeLabel
-
}
/** Workflow Message Types */
@@ -155,7 +166,6 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
}
-
private suspend fun nodeActor() = actor<NodeMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
/** Send message to process from one state to other state */
@@ -225,8 +235,9 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
suspend fun executeNodeWorker(message: NodeExecuteMessage<In, Out>) {
val node = message.node
node.status = NodeStatus.EXECUTING
- val nodeState = if (node.id == BluePrintConstants.GRAPH_START_NODE_NAME
- || node.id == BluePrintConstants.GRAPH_END_NODE_NAME) {
+ val nodeState = if (node.id == BluePrintConstants.GRAPH_START_NODE_NAME ||
+ node.id == BluePrintConstants.GRAPH_END_NODE_NAME
+ ) {
EdgeLabel.SUCCESS
} else {
log.debug("##### Processing workflow($workflowId) node($node) #####")
@@ -339,4 +350,4 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
index e5788a936..2dc8b5cf7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -17,14 +17,25 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ExpressionData
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.format
+import org.onap.ccsdk.cds.controllerblueprints.core.isComplexType
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonPathParse
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ResourceResolverUtils
+import org.slf4j.LoggerFactory
/**
*
@@ -32,19 +43,23 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.ResourceResolverUtils
* @author Brinda Santh
*/
class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>>) {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
private var bluePrintContext: BluePrintContext = bluePrintRuntimeService.bluePrintContext()
-/*
+ /*
-If Property Assignment is Expression.
- Get the Expression
- Recursively resolve the expression
- */
+ If Property Assignment is Expression.
+ Get the Expression
+ Recursively resolve the expression
+ */
- fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
- assignment: JsonNode): JsonNode {
+ fun resolveAssignmentExpression(
+ nodeTemplateName: String,
+ assignmentName: String,
+ assignment: JsonNode
+ ): JsonNode {
val valueNode: JsonNode
log.trace("Assignment ({})", assignment)
val expressionData = BluePrintExpressionService.getExpressionData(assignment)
@@ -84,7 +99,6 @@ If Property Assignment is Expression.
valueNode = bluePrintRuntimeService.resolveDSLExpression(expressionData.dslExpression!!.propertyName)
}
BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE -> {
-
}
else -> {
throw BluePrintException(format("for property ({}), command ({}) is not supported ", propName, command))
@@ -122,7 +136,7 @@ If Property Assignment is Expression.
}
BluePrintConstants.PROPERTY_BPP -> {
valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(BluePrintConstants.PROPERTY_BPP, attributeName)
- ?: throw BluePrintException("failed to get env attribute name ($attributeName) ")
+ ?: throw BluePrintException("failed to get env attribute name ($attributeName) ")
}
else -> {
if (!attributeExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) {
@@ -130,13 +144,12 @@ If Property Assignment is Expression.
}
var attributeDefinition: AttributeDefinition = bluePrintContext
- .nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)
- ?: throw BluePrintException("failed to get attribute definitions for node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
+ .nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)
+ ?: throw BluePrintException("failed to get attribute definitions for node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(attributeNodeTemplateName, attributeName)
- ?: throw BluePrintException("failed to get node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
+ ?: throw BluePrintException("failed to get node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
}
-
}
if (subAttributeName != null) {
if (valueNode.isComplexType())
@@ -162,11 +175,22 @@ If Property Assignment is Expression.
}
val nodeTemplatePropertyExpression = bluePrintContext.nodeTemplateByName(propertyNodeTemplateName).properties?.get(propertyName)
- ?: throw BluePrintException(format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, propertyName))
+ ?: throw BluePrintException(
+ format(
+ "failed to get property definitions for node template ({})'s property name ({}) ",
+ nodeTemplateName,
+ propertyName
+ )
+ )
var propertyDefinition: PropertyDefinition = bluePrintContext.nodeTemplateNodeType(propertyNodeTemplateName).properties?.get(propertyName)!!
- log.info("node template name ({}), property Name ({}) resolved value ({})", propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
+ log.info(
+ "node template name ({}), property Name ({}) resolved value ({})",
+ propertyNodeTemplateName,
+ propertyName,
+ nodeTemplatePropertyExpression
+ )
// Check it it is a nested expression
valueNode = resolveAssignmentExpression(propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
@@ -187,9 +211,11 @@ If Property Assignment is Expression.
outputNodeTemplateName = operationOutputExpression.modelableEntityName
}
- var valueNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(outputNodeTemplateName,
- operationOutputExpression.interfaceName, operationOutputExpression.operationName,
- operationOutputExpression.propertyName)
+ var valueNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ outputNodeTemplateName,
+ operationOutputExpression.interfaceName, operationOutputExpression.operationName,
+ operationOutputExpression.propertyName
+ )
val subPropertyName: String? = operationOutputExpression.subPropertyName
if (subPropertyName != null) {
@@ -209,9 +235,13 @@ If Property Assignment is Expression.
artifactNodeTemplateName = artifactExpression.modelableEntityName
}
val artifactDefinition: ArtifactDefinition = bluePrintContext.nodeTemplateByName(artifactNodeTemplateName)
- .artifacts?.get(artifactExpression.artifactName)
- ?: throw BluePrintException(format("failed to get artifact definitions for node template ({})'s " +
- "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName))
+ .artifacts?.get(artifactExpression.artifactName)
+ ?: throw BluePrintException(
+ format(
+ "failed to get artifact definitions for node template ({})'s " +
+ "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName
+ )
+ )
return JacksonUtils.jsonNodeFromObject(artifactContent(artifactDefinition))
}
@@ -227,4 +257,3 @@ If Property Assignment is Expression.
return ""
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
index 097967313..9ccf856b5 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
@@ -21,12 +21,23 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
import com.google.common.base.Predicates
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
-import java.io.*
-import java.nio.charset.*
-import java.nio.file.*
-import java.nio.file.attribute.*
-import java.util.function.*
-import java.util.zip.*
+import java.io.BufferedInputStream
+import java.io.ByteArrayOutputStream
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+import java.io.OutputStream
+import java.nio.charset.Charset
+import java.nio.file.FileVisitResult
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.SimpleFileVisitor
+import java.nio.file.attribute.BasicFileAttributes
+import java.util.function.Predicate
+import java.util.zip.Deflater
+import java.util.zip.ZipEntry
+import java.util.zip.ZipFile
+import java.util.zip.ZipOutputStream
class BluePrintArchiveUtils {
@@ -42,7 +53,7 @@ class BluePrintArchiveUtils {
*/
fun compress(source: File, destination: File): Boolean {
try {
- if(!destination.parentFile.exists()) {
+ if (!destination.parentFile.exists()) {
destination.parentFile.mkdirs()
}
destination.createNewFile()
@@ -62,7 +73,7 @@ class BluePrintArchiveUtils {
*/
fun compressToBytes(baseDir: Path, compressionLevel: Int = Deflater.NO_COMPRESSION): ByteArray {
return compressFolder(baseDir, ByteArrayOutputStream(), compressionLevel = compressionLevel)
- .toByteArray()
+ .toByteArray()
}
/**
@@ -75,42 +86,45 @@ class BluePrintArchiveUtils {
* @param fixedModificationTime to force every entry to have this modification time.
* Useful for reproducible operations, like tests, for example.
*/
- private fun <T> compressFolder(baseDir: Path, output: T,
- pathFilter: Predicate<Path> = Predicates.alwaysTrue(),
- compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
- fixedModificationTime: Long? = null): T
+ private fun <T> compressFolder(
+ baseDir: Path,
+ output: T,
+ pathFilter: Predicate<Path> = Predicates.alwaysTrue(),
+ compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
+ fixedModificationTime: Long? = null
+ ): T
where T : OutputStream {
ZipOutputStream(output)
- .apply { setLevel(compressionLevel) }
- .use { zos ->
- Files.walkFileTree(baseDir, object : SimpleFileVisitor<Path>() {
- @Throws(IOException::class)
- override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
- if (pathFilter.test(file)) {
- val zipEntry = ZipEntry(baseDir.relativize(file).toString())
- fixedModificationTime?.let {
- zipEntry.time = it
- }
- zipEntry.time = 0;
- zos.putNextEntry(zipEntry)
- Files.copy(file, zos)
- zos.closeEntry()
- }
- return FileVisitResult.CONTINUE
- }
-
- @Throws(IOException::class)
- override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
- val zipEntry = ZipEntry(baseDir.relativize(dir).toString() + "/")
+ .apply { setLevel(compressionLevel) }
+ .use { zos ->
+ Files.walkFileTree(baseDir, object : SimpleFileVisitor<Path>() {
+ @Throws(IOException::class)
+ override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
+ if (pathFilter.test(file)) {
+ val zipEntry = ZipEntry(baseDir.relativize(file).toString())
fixedModificationTime?.let {
zipEntry.time = it
}
+ zipEntry.time = 0
zos.putNextEntry(zipEntry)
+ Files.copy(file, zos)
zos.closeEntry()
- return FileVisitResult.CONTINUE
}
- })
- }
+ return FileVisitResult.CONTINUE
+ }
+
+ @Throws(IOException::class)
+ override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
+ val zipEntry = ZipEntry(baseDir.relativize(dir).toString() + "/")
+ fixedModificationTime?.let {
+ zipEntry.time = it
+ }
+ zos.putNextEntry(zipEntry)
+ zos.closeEntry()
+ return FileVisitResult.CONTINUE
+ }
+ })
+ }
return output
}
@@ -141,5 +155,4 @@ class BluePrintArchiveUtils {
return destinationDir
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
index 06f6f1d17..6605e8eca 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
@@ -32,8 +32,10 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.slf4j.LoggerFactory
import java.io.File
import java.io.FileFilter
-import java.nio.file.*
-
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+import java.nio.file.StandardOpenOption
class BluePrintFileUtils {
companion object {
@@ -50,8 +52,12 @@ class BluePrintFileUtils {
val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR))
Files.createDirectories(metaDataDir.toPath())
- val metaFile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants
- .TOSCA_METADATA_ENTRY_DEFINITION_FILE))
+ val metaFile = File(
+ blueprintDir.absolutePath.plus(File.separator).plus(
+ BluePrintConstants
+ .TOSCA_METADATA_ENTRY_DEFINITION_FILE
+ )
+ )
Files.write(metaFile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW)
val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR))
@@ -65,7 +71,6 @@ class BluePrintFileUtils {
val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_TEMPLATES_DIR))
Files.createDirectories(templatesDir.toPath())
-
}
fun copyBluePrint(sourcePath: String, targetPath: String) {
@@ -95,7 +100,6 @@ class BluePrintFileUtils {
populateDefaultImports(blueprintContext)
// Rewrite the Entry Definition Files
writeEntryDefinitionFile(blueprintContext)
-
}
fun writeBluePrintTypes(blueprintContext: BluePrintContext) {
@@ -105,8 +109,10 @@ class BluePrintFileUtils {
val definitionDir = File(definitionPath)
check(definitionDir.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${definitionDir.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
+ "path(${definitionDir.absolutePath})"
+ )
}
blueprintContext.serviceTemplate.dataTypes?.let {
@@ -137,9 +143,11 @@ class BluePrintFileUtils {
private fun populateDefaultImports(blueprintContext: BluePrintContext) {
// Get the Default Types
- val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES,
- BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES,
- BluePrintConstants.PATH_POLICY_TYPES)
+ val types = arrayListOf(
+ BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES,
+ BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES,
+ BluePrintConstants.PATH_POLICY_TYPES
+ )
// Clean Type Imports
cleanImportTypes(blueprintContext.serviceTemplate)
@@ -193,8 +201,10 @@ class BluePrintFileUtils {
Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(definitionFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
- "path(${definitionFile.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
+ "path(${definitionFile.absolutePath})"
+ )
}
}
@@ -203,8 +213,10 @@ class BluePrintFileUtils {
Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(typeFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
- "path(${typeFile.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
+ "path(${typeFile.absolutePath})"
+ )
}
}
@@ -213,26 +225,29 @@ class BluePrintFileUtils {
"\nCSAR-Version: <VERSION>" +
"\nCreated-By: <AUTHOR NAME>" +
"\nEntry-Definitions: Definitions/<BLUEPRINT_NAME>.json" +
- "\nTemplate-Name: <BLUEPRINT_NAME>"+
- "\nTemplate-Tags: <BLUEPRINT_VERSION>"+
+ "\nTemplate-Name: <BLUEPRINT_NAME>" +
+ "\nTemplate-Tags: <BLUEPRINT_VERSION>" +
"\nTemplate-Tags: <TAGS>"
}
-
fun getBluePrintFile(fileName: String, targetPath: Path): File {
val filePath = targetPath.resolve(fileName).toString()
val file = File(filePath)
check(file.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${file.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
+ "path(${file.absolutePath})"
+ )
}
return file
}
fun getCbaStorageDirectory(path: String): Path {
check(StringUtils.isNotBlank(path)) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
- "Blueprint folder under path($path)")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
+ "Blueprint folder under path($path)"
+ )
}
val fileStorageLocation = Paths.get(path).toAbsolutePath().normalize()
@@ -252,13 +267,19 @@ class BluePrintFileUtils {
}
fun compileJarFilePathName(basePath: String, artifactName: String, artifactVersion: String): String {
- return normalizedPathName(basePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR,
- compileJarFileName(artifactName, artifactVersion))
+ return normalizedPathName(
+ basePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR,
+ compileJarFileName(artifactName, artifactVersion)
+ )
}
fun compileJarFile(basePath: String, artifactName: String, artifactVersion: String): File {
- return normalizedFile(compileJarFilePathName(basePath,
- artifactName, artifactVersion))
+ return normalizedFile(
+ compileJarFilePathName(
+ basePath,
+ artifactName, artifactVersion
+ )
+ )
}
fun stripFileExtension(fileName: String): String {
@@ -267,6 +288,5 @@ class BluePrintFileUtils {
// In case dot is in first position, we are dealing with a hidden file rather than an extension
return if (dotIndexe > 0) fileName.substring(0, dotIndexe) else fileName
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
index 226c62d48..d29fed0d9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
@@ -18,8 +18,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
object BluePrintIOUtils {
- suspend fun <T> retry(times: Int = 1, initialDelay: Long = 0, delay: Long = 1000,
- block: suspend (Int) -> T, exceptionBlock: (e: Exception) -> Unit): T {
+ suspend fun <T> retry(
+ times: Int = 1,
+ initialDelay: Long = 0,
+ delay: Long = 1000,
+ block: suspend (Int) -> T,
+ exceptionBlock: (e: Exception) -> Unit
+ ): T {
var currentDelay = initialDelay
val currentTimes = times - 1
repeat(currentTimes) { count ->
@@ -33,4 +38,4 @@ object BluePrintIOUtils {
}
return block(currentTimes)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
index 55424ada8..4d7647f47 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -17,12 +17,16 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDefinitions
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintImportService
@@ -30,28 +34,27 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.slf4j.LoggerFactory
import java.io.File
-import java.util.*
+import java.util.Properties
class BluePrintMetadataUtils {
companion object {
private val log = LoggerFactory.getLogger(this::class.toString())
-
suspend fun toscaMetaData(basePath: String): ToscaMetaData {
val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
+ .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
return toscaMetaDataFromMetaFile(toscaMetaPath)
}
suspend fun entryDefinitionFile(basePath: String): String {
val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
+ .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
return toscaMetaDataFromMetaFile(toscaMetaPath).entityDefinitions
}
fun bluePrintEnvProperties(basePath: String): Properties {
val blueprintsEnvFilePath = basePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
+ .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
return environmentFileProperties(blueprintsEnvFilePath)
}
@@ -60,14 +63,14 @@ class BluePrintMetadataUtils {
val envDir = normalizedFile(pathName)
// Verify if the environment directory exists
if (envDir.exists() && envDir.isDirectory) {
- //Find all available environment files
+ // Find all available environment files
envDir.listFiles()!!
- .filter { it.name.endsWith(".properties") }
- .forEach {
- val istream = it.inputStream()
- properties.load(istream)
- istream.close()
- }
+ .filter { it.name.endsWith(".properties") }
+ .forEach {
+ val istream = it.inputStream()
+ properties.load(istream)
+ istream.close()
+ }
}
return properties
}
@@ -91,19 +94,18 @@ class BluePrintMetadataUtils {
}
}
}
-
}
return toscaMetaData
}
- fun getBluePrintRuntime(id: String, blueprintBasePath: String)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ fun getBluePrintRuntime(id: String, blueprintBasePath: String):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
return getBluePrintRuntime(id, bluePrintContext)
}
- fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
checkNotEmpty(bluePrintContext.rootPath) { "blueprint context root path is missing." }
checkNotEmpty(bluePrintContext.entryDefinition) { "blueprint context entry definition is missing." }
val blueprintBasePath = bluePrintContext.rootPath
@@ -113,8 +115,8 @@ class BluePrintMetadataUtils {
return bluePrintRuntimeService
}
- suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath)
@@ -191,8 +193,10 @@ class BluePrintMetadataUtils {
val bluePrintScriptsService = BluePrintScriptsServiceImpl()
val bluePrintDefinitions = bluePrintScriptsService
- .scriptInstance<BluePrintDefinitions>(normalizedBasePath, toscaMetaData.templateName!!,
- toscaMetaData.templateVersion!!, definitionClassName, false)
+ .scriptInstance<BluePrintDefinitions>(
+ normalizedBasePath, toscaMetaData.templateName!!,
+ toscaMetaData.templateVersion!!, definitionClassName, false
+ )
// Get the Service Template
val serviceTemplate = bluePrintDefinitions.serviceTemplate()
@@ -206,4 +210,4 @@ class BluePrintMetadataUtils {
return blueprintContext
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
index 3dd756763..c44355070 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -16,11 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.slf4j.LoggerFactory
/**
*
@@ -28,15 +28,20 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
* @author Brinda Santh
*/
object BluePrintRuntimeUtils {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
fun assignInputsFromFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String, JsonNode>) {
val jsonNode: JsonNode = JacksonUtils.jsonNodeFromFile(fileName)
return assignInputs(bluePrintContext, jsonNode, context)
}
- fun assignInputsFromClassPathFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String,
- JsonNode>) {
+ fun assignInputsFromClassPathFile(
+ bluePrintContext: BluePrintContext,
+ fileName: String,
+ context: MutableMap<String,
+ JsonNode>
+ ) {
val jsonNode = JacksonUtils.jsonNodeFromClassPathFile(fileName)
return assignInputs(bluePrintContext, jsonNode, context)
}
@@ -56,5 +61,4 @@ object BluePrintRuntimeUtils {
context[path] = valueNode
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
index 9fbc38507..6645ff7b4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
@@ -17,34 +17,36 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.slf4j.LoggerFactory
import java.io.File
import java.nio.charset.Charset
class JacksonReactorUtils {
companion object {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
suspend fun getContent(fileName: String): String {
- //log.info("Reading File($fileName)")
+ // log.info("Reading File($fileName)")
return getContent(normalizedFile(fileName))
}
- suspend fun getContent(file: File): String = withContext(Dispatchers.IO) {
+ suspend fun getContent(file: File): String = withContext(Dispatchers.IO) {
// log.info("Reading File(${file.absolutePath})")
file.readText(Charsets.UTF_8)
}
suspend fun getClassPathFileContent(fileName: String): String = withContext(Dispatchers.IO) {
- //log.trace("Reading Classpath File($fileName)")
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
+ // log.trace("Reading Classpath File($fileName)")
+ IOUtils.toString(
+ JacksonUtils::class.java.classLoader
+ .getResourceAsStream(fileName), Charset.defaultCharset()
+ )
}
suspend fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
@@ -86,6 +88,5 @@ class JacksonReactorUtils {
val content: String = getClassPathFileContent(fileName)
return JacksonUtils.getMapFromJson(content, valueType)
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
index 1f1345327..945f300af 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
@@ -19,13 +19,26 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.SerializationFeature
-import com.fasterxml.jackson.databind.node.*
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.DoubleNode
+import com.fasterxml.jackson.databind.node.FloatNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBText
import java.io.File
import java.io.InputStream
import java.nio.charset.Charset
@@ -36,15 +49,16 @@ import java.nio.charset.Charset
* @author Brinda Santh
*/
class JacksonUtils {
+
companion object {
val objectMapper = jacksonObjectMapper()
inline fun <reified T : Any> readValue(content: String): T =
- objectMapper.readValue(content, T::class.java)
+ objectMapper.readValue(content, T::class.java)
inline fun <reified T : Any> readValue(stream: InputStream): T =
- objectMapper.readValue(stream, T::class.java)
+ objectMapper.readValue(stream, T::class.java)
fun <T> readValue(content: String, valueType: Class<T>): T? {
return objectMapper.readValue(content, valueType)
@@ -69,8 +83,10 @@ class JacksonUtils {
fun getClassPathFileContent(fileName: String): String {
return runBlocking {
withContext(Dispatchers.Default) {
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
+ IOUtils.toString(
+ JacksonUtils::class.java.classLoader
+ .getResourceAsStream(fileName), Charset.defaultCharset()
+ )
}
}
}
@@ -170,7 +186,7 @@ class JacksonUtils {
fun <T> getInstanceFromMap(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
return readValue(getJson(properties), classType)
- ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
+ ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
}
fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
@@ -265,14 +281,14 @@ class JacksonUtils {
}
fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
- val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) ?:
- throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)")
+ val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType)
+ ?: throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)")
objectNode.set(key, defaultValue)
}
fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
- val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) ?:
- throw BluePrintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)")
+ val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType)
+ ?: throw BluePrintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)")
arrayNode.add(defaultValue)
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
index 19686b5df..0e3d4f93d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import com.fasterxml.jackson.databind.JsonNode
import com.jayway.jsonpath.Configuration
import com.jayway.jsonpath.JsonPath
@@ -29,9 +28,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
class JsonParserUtils {
companion object {
- //TODO("Optimise this")
+ // TODO("Optimise this")
val JACKSON_JSON_NODE_CONFIGURATION = Configuration.builder()
- .mappingProvider(JacksonMappingProvider()).jsonProvider(JacksonJsonNodeJsonProvider()).build()
+ .mappingProvider(JacksonMappingProvider()).jsonProvider(JacksonJsonNodeJsonProvider()).build()
val PATH_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST).build()
@@ -60,4 +59,4 @@ class JsonParserUtils {
return parseNSet(jsonNode.asJsonString(), expression, valueNode)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
index f06cc107d..c0204af8d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
@@ -29,19 +29,20 @@ import java.net.URL
* @author Brinda Santh
*/
object ResourceResolverUtils {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
fun getFileContent(filename: String, basePath: String?): String {
log.trace("file ({}), basePath ({}) ", filename, basePath)
try {
var resolvedFileName: String = filename
- if (filename.startsWith("http", true)
- || filename.startsWith("https", true)) {
+ if (filename.startsWith("http", true) ||
+ filename.startsWith("https", true)
+ ) {
val givenUrl: String = URL(filename).toString()
val systemUrl: String = File(".").toURI().toURL().toString()
log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
if (givenUrl.startsWith(systemUrl)) {
-
}
} else {
if (!filename.startsWith("/")) {
@@ -52,10 +53,10 @@ object ResourceResolverUtils {
}
}
}
- //FIXME("Convert into reactive")
+ // FIXME("Convert into reactive")
return JacksonUtils.getContent(resolvedFileName)
} catch (e: Exception) {
throw BluePrintException(e, "failed to file (%s), basePath (%s) ", filename, basePath)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
index 091e85659..a74722f31 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
@@ -76,33 +76,33 @@ object ServiceTemplateUtils {
toMerge.topologyTemplate?.inputs?.let {
parentServiceTemplate.topologyTemplate?.inputs = parentServiceTemplate.topologyTemplate?.inputs
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.inputs?.putAll(parentServiceTemplate.topologyTemplate?.inputs as MutableMap)
}
toMerge.topologyTemplate?.nodeTemplates?.let {
parentServiceTemplate.topologyTemplate?.nodeTemplates = parentServiceTemplate.topologyTemplate?.nodeTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.nodeTemplates?.putAll(parentServiceTemplate.topologyTemplate?.nodeTemplates as MutableMap)
}
toMerge.topologyTemplate?.relationshipTemplates?.let {
parentServiceTemplate.topologyTemplate?.relationshipTemplates = parentServiceTemplate.topologyTemplate?.relationshipTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.relationshipTemplates?.putAll(parentServiceTemplate.topologyTemplate?.relationshipTemplates as MutableMap)
}
toMerge.topologyTemplate?.policies?.let {
parentServiceTemplate.topologyTemplate?.policies = parentServiceTemplate.topologyTemplate?.policies
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.policies?.putAll(parentServiceTemplate.topologyTemplate?.policies as MutableMap)
}
toMerge.topologyTemplate?.workflows?.let {
parentServiceTemplate.topologyTemplate?.workflows = parentServiceTemplate.topologyTemplate?.workflows
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.workflows?.putAll(parentServiceTemplate.topologyTemplate?.workflows as MutableMap)
}
return parentServiceTemplate
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
index 0b76130a3..fb990c486 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
@@ -16,7 +16,10 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import java.util.*
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.LinkedList
+import java.util.Stack
/**
*
@@ -70,14 +73,13 @@ class TopologicalSortingUtils<V> {
return result
}
-
fun inDegree(): MutableMap<V, Int> {
val result = HashMap<V, Int>()
for (v in neighbors.keys)
- result[v] = 0 // All in-degrees are 0
+ result[v] = 0 // All in-degrees are 0
for (from in neighbors.keys) {
for (to in neighbors[from]!!) {
- result[to] = result[to]!! + 1 // Increment in-degree
+ result[to] = result[to]!! + 1 // Increment in-degree
}
}
return result
@@ -86,15 +88,15 @@ class TopologicalSortingUtils<V> {
fun topSort(): List<V>? {
val degree = inDegree()
// Determine all vertices with zero in-degree
- val zeroVerts = Stack<V>() // Stack as good as any here
+ val zeroVerts = Stack<V>() // Stack as good as any here
for (v in degree.keys) {
if (degree[v] == 0) zeroVerts.push(v)
}
// Determine the topological order
val result = ArrayList<V>()
while (!zeroVerts.isEmpty()) {
- val v = zeroVerts.pop() // Choose a vertex with zero in-degree
- result.add(v) // Vertex v is next in topol order
+ val v = zeroVerts.pop() // Choose a vertex with zero in-degree
+ result.add(v) // Vertex v is next in topol order
// "Remove" vertex v by updating its neighbors
for (neighbor in neighbors[v]!!) {
degree[neighbor] = degree[neighbor]!! - 1
@@ -106,7 +108,6 @@ class TopologicalSortingUtils<V> {
return if (result.size != neighbors.size) null else result
}
-
fun bfsDistance(start: V): Map<*, *> {
val distance: MutableMap<V, Int> = hashMapOf()
// Initially, all distance are infinity, except start node
@@ -115,17 +116,17 @@ class TopologicalSortingUtils<V> {
distance[start] = 0
// Process nodes in queue order
val queue = LinkedList<V>()
- queue.offer(start) // Place start node in queue
+ queue.offer(start) // Place start node in queue
while (!queue.isEmpty()) {
val v = queue.remove()
val vDist = distance[v]!!
// Update neighbors
for (neighbor in neighbors[v]!!) {
- if (distance[neighbor] != null) continue // Ignore if already done
+ if (distance[neighbor] != null) continue // Ignore if already done
distance[neighbor] = vDist + 1
queue.offer(neighbor)
}
}
return distance
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
index ef765ab86..fea637f61 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
@@ -43,4 +43,4 @@ object WorkflowGraphUtils {
}
return graph
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
index e3e5c26a3..6a028d36f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
@@ -30,4 +30,4 @@ class BluePrintErrorTest {
assertEquals("error", bluePrintError.errors[0])
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
index 76be647f1..3ae87b32d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
@@ -18,9 +18,20 @@ package org.onap.ccsdk.cds.controllerblueprints.core
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.*
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.JsonNodeType
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import org.junit.Test
-import kotlin.test.*
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertNotNull
+import kotlin.test.assertNull
+import kotlin.test.assertTrue
/**
*
@@ -28,12 +39,13 @@ import kotlin.test.*
* @author Brinda Santh
*/
class CustomFunctionsTest {
+
@Test
fun testFormat() {
- val returnValue : String = format("This is {} for times {}", "test", 2)
+ val returnValue: String = format("This is {} for times {}", "test", 2)
assertEquals("This is test for times 2", returnValue, "Failed to format String")
- val returnValue1 : String = format("This is test for times 2")
+ val returnValue1: String = format("This is test for times 2")
assertEquals("This is test for times 2", returnValue1, "Failed to format empty args")
}
@@ -198,23 +210,23 @@ class CustomFunctionsTest {
@Test(expected = BluePrintException::class)
fun testCheckEquals() {
- assertTrue(checkEquals("hello", "hello", { -> "error"}))
+ assertTrue(checkEquals("hello", "hello", { -> "error" }))
- checkEquals("hello", "test", { -> "error"})
+ checkEquals("hello", "test", { -> "error" })
}
@Test(expected = IllegalStateException::class)
fun testCheckNotEmpty() {
- assertEquals("hello", checkNotEmpty("hello", { -> "error"}))
+ assertEquals("hello", checkNotEmpty("hello", { -> "error" }))
- checkNotEmpty("", { -> "error"})
+ checkNotEmpty("", { -> "error" })
}
@Test(expected = IllegalStateException::class)
fun testCheckNotBlank() {
- assertEquals("hello", checkNotBlank("hello", { -> "error"}))
+ assertEquals("hello", checkNotBlank("hello", { -> "error" }))
- checkNotBlank(" ", { -> "error"})
+ checkNotBlank(" ", { -> "error" })
}
@Test
@@ -223,4 +235,4 @@ class CustomFunctionsTest {
assertEquals("hello", nullToEmpty("hello"))
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
index 9a0da6905..81f4a0091 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
@@ -30,5 +30,4 @@ class FileExtensionFunctionTest {
blueprintFile.compress(targetZip)
assertTrue(blueprintFile.exists(), "failed to create compressed file(${targetZip.absolutePath} ")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
index 6c92d1815..498a85239 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
@@ -45,12 +45,14 @@ class MDCContextTest {
assertEquals(null, MDC.get(BluePrintConstants.ONAP_REQUEST_ID))
}
launch(MDCContext()) {
- assertEquals("12345", MDC.get(BluePrintConstants.ONAP_REQUEST_ID),
- "couldn't get request id")
+ assertEquals(
+ "12345", MDC.get(BluePrintConstants.ONAP_REQUEST_ID),
+ "couldn't get request id"
+ )
MDC.put("client_id", "client-1")
assertEquals("client-1", MDC.get("client_id"), "couldn't get client id")
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
index c24ed0327..a75262f96 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
@@ -27,90 +27,93 @@ class BluePrintsAnnotationsTest {
@Test
fun testBluePrintWorkflowData() {
val wfInput = TestBluePrintsWorkflowInput::class.asPropertyDefinitionMap()
- //println(wfInput.asJsonString(true))
+ // println(wfInput.asJsonString(true))
assertNotNull(wfInput, "failed to generate wfInput property map")
val wfOutput = TestBluePrintsWorkflowOutput::class.asPropertyDefinitionMap()
- //println(wfOutput.asJsonString(true))
+ // println(wfOutput.asJsonString(true))
assertNotNull(wfInput, "failed to generate wfOutput property map")
}
@Test
fun testBluePrintDataType() {
val dataTypes = TestBluePrintsDataType::class.asBluePrintsDataTypes()
- //println(dataTypes.asJsonString(true))
+ // println(dataTypes.asJsonString(true))
assertNotNull(dataTypes, "failed to generate dataTypes definition")
}
}
-@BluePrintsDataType(name = "dt-test-datatype", description = "I am test",
- version = "1.0.0", derivedFrom = "tosca.datatypes.root")
+@BluePrintsDataType(
+ name = "dt-test-datatype", description = "I am test",
+ version = "1.0.0", derivedFrom = "tosca.datatypes.root"
+)
data class TestBluePrintsDataType(
- @BluePrintsProperty(description = "this stringData")
- var stringData: String,
- @BluePrintsProperty(description = "this stringDataWithValue")
- @PropertyDefaultValue(value = "USA")
- val stringDataWithValue: String,
- @BluePrintsProperty(description = "this intDataWithValue")
- @PropertyDefaultValue(value = "30")
- val intDataWithValue: Int,
- @BluePrintsProperty(description = "this booleanDataWithValue")
- @PropertyDefaultValue(value = "true")
- val booleanDataWithValue: Boolean,
- @BluePrintsProperty(description = "this anyData")
- val anyData: Any,
- @BluePrintsProperty(description = "this jsonDataWithValue")
- @PropertyDefaultValue(value = """{"data" : "1234"}""")
- val jsonDataWithValue: JsonNode?,
- @BluePrintsProperty(description = "listData")
- val listData: MutableList<String>,
- @BluePrintsProperty(description = "this mapData")
- val mapData: MutableMap<String, String> = hashMapOf(),
- @BluePrintsProperty(description = "this complexData")
- val complexData: TestBluePrintsChildDataType?,
- @BluePrintsProperty(description = "this complexDataList")
- val complexDataList: MutableList<TestBluePrintsChildDataType>
+ @BluePrintsProperty(description = "this stringData")
+ var stringData: String,
+ @BluePrintsProperty(description = "this stringDataWithValue")
+ @PropertyDefaultValue(value = "USA")
+ val stringDataWithValue: String,
+ @BluePrintsProperty(description = "this intDataWithValue")
+ @PropertyDefaultValue(value = "30")
+ val intDataWithValue: Int,
+ @BluePrintsProperty(description = "this booleanDataWithValue")
+ @PropertyDefaultValue(value = "true")
+ val booleanDataWithValue: Boolean,
+ @BluePrintsProperty(description = "this anyData")
+ val anyData: Any,
+ @BluePrintsProperty(description = "this jsonDataWithValue")
+ @PropertyDefaultValue(value = """{"data" : "1234"}""")
+ val jsonDataWithValue: JsonNode?,
+ @BluePrintsProperty(description = "listData")
+ val listData: MutableList<String>,
+ @BluePrintsProperty(description = "this mapData")
+ val mapData: MutableMap<String, String> = hashMapOf(),
+ @BluePrintsProperty(description = "this complexData")
+ val complexData: TestBluePrintsChildDataType?,
+ @BluePrintsProperty(description = "this complexDataList")
+ val complexDataList: MutableList<TestBluePrintsChildDataType>
)
data class TestBluePrintsChildDataType(val name: String)
-
@BluePrintsWorkflowInput
data class TestBluePrintsWorkflowInput(
- @BluePrintsProperty(description = "this sample name")
- @PropertyDefaultValue(value = "Brinda")
- var name: String,
- @BluePrintsProperty(description = "this sample name")
- val place: String
+ @BluePrintsProperty(description = "this sample name")
+ @PropertyDefaultValue(value = "Brinda")
+ var name: String,
+ @BluePrintsProperty(description = "this sample name")
+ val place: String
)
@BluePrintsWorkflowOutput
data class TestBluePrintsWorkflowOutput(
- @BluePrintsProperty(description = "this is dslExpression")
- @DSLExpression("field1")
- var dslExpression: String,
-
- @BluePrintsProperty(description = "this is withNodeAttributeExpression")
- @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data")
- var withNodeAttributeExpression: String,
-
- @BluePrintsProperty(description = "this is withNodeAttributeExpressionSubAttribute")
- @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data",
- subAttributeName = ".\$field1")
- var withNodeAttributeExpressionSubAttribute: String,
-
- @BluePrintsProperty(description = "this is withAttributeExpressionSubAttribute")
- @AttributeExpression(attributeName = "response-data", subAttributeName = ".\$field1")
- var withAttributeExpressionSubAttribute: String,
-
- @BluePrintsProperty(description = "this is withAttributeExpression")
- @AttributeExpression(attributeName = "response-data")
- var withAttributeExpression: String,
-
- @BluePrintsProperty(description = "this is withAArtifactExpression")
- @ArtifactExpression(modelableEntityName = "test-node", artifactName = "content-template")
- var withAArtifactExpression: String,
-
- @BluePrintsProperty(description = "this status")
- val status: String = "success"
-) \ No newline at end of file
+ @BluePrintsProperty(description = "this is dslExpression")
+ @DSLExpression("field1")
+ var dslExpression: String,
+
+ @BluePrintsProperty(description = "this is withNodeAttributeExpression")
+ @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data")
+ var withNodeAttributeExpression: String,
+
+ @BluePrintsProperty(description = "this is withNodeAttributeExpressionSubAttribute")
+ @AttributeExpression(
+ modelableEntityName = "sample-node", attributeName = "response-data",
+ subAttributeName = ".\$field1"
+ )
+ var withNodeAttributeExpressionSubAttribute: String,
+
+ @BluePrintsProperty(description = "this is withAttributeExpressionSubAttribute")
+ @AttributeExpression(attributeName = "response-data", subAttributeName = ".\$field1")
+ var withAttributeExpressionSubAttribute: String,
+
+ @BluePrintsProperty(description = "this is withAttributeExpression")
+ @AttributeExpression(attributeName = "response-data")
+ var withAttributeExpression: String,
+
+ @BluePrintsProperty(description = "this is withAArtifactExpression")
+ @ArtifactExpression(modelableEntityName = "test-node", artifactName = "content-template")
+ var withAArtifactExpression: String,
+
+ @BluePrintsProperty(description = "this status")
+ val status: String = "success"
+)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index ec8f24d85..c2d764bd6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -29,14 +29,18 @@ class BluePrintDSLTest {
@Test
fun testOperationDSLWorkflow() {
- val blueprint = blueprint("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val blueprint = blueprint(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
// For New Component Definition
- component("resource-resolution", "component-script-executor", "1.0.0",
- "Resource Resolution component.") {
+ component(
+ "resource-resolution", "component-script-executor", "1.0.0",
+ "Resource Resolution component."
+ ) {
implementation(180)
// Attributes ( Properties which will be set during execution)
attribute("template1-data", "string", true, "")
@@ -54,8 +58,10 @@ class BluePrintDSLTest {
}
// Already definitions Registered Components
- registryComponent("activate-restconf", "component-resource-resolution", "1.0.0",
- "RestconfExecutor", "Resource Resolution component.") {
+ registryComponent(
+ "activate-restconf", "component-resource-resolution", "1.0.0",
+ "RestconfExecutor", "Resource Resolution component."
+ ) {
implementation(180)
// Properties
property("string-value1", "data")
@@ -65,7 +71,6 @@ class BluePrintDSLTest {
output("self-attribute-expression", getAttribute("template1-data"))
// Artifacts
artifact("template2", "artifact-template-velocity", "Templates/template1.vtl")
-
}
workflow("resource-resolution-process", "Resource Resolution wf") {
@@ -77,25 +82,29 @@ class BluePrintDSLTest {
}
assertNotNull(blueprint.components, "failed to get components")
assertNotNull(blueprint.workflows, "failed to get workflows")
- //println(blueprint.asJsonString(true))
+ // println(blueprint.asJsonString(true))
val serviceTemplateGenerator = BluePrintServiceTemplateGenerator(blueprint)
val serviceTemplate = serviceTemplateGenerator.serviceTemplate()
assertNotNull(serviceTemplate.topologyTemplate, "failed to get service topology template")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
fun testServiceTemplate() {
- val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val serviceTemplate = serviceTemplate(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
metadata("release", "1806")
import("Definition/data_types.json")
dsl("rest-endpoint", """{ "selector" : "odl-selector"}""")
dsl("db-endpoint", """{ "selector" : "db-selector"}""")
topologyTemplate {
- nodeTemplateOperation(nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
- description = "sample activation") {
+ nodeTemplateOperation(
+ nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
+ description = "sample activation"
+ ) {
implementation(360, "SELF") {
primary("Scripts/sample.py")
dependencies("one", "two")
@@ -156,7 +165,7 @@ class BluePrintDSLTest {
assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates, "failed to get nodeTypes")
assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates!!["activate"], "failed to get nodeTypes(activate)")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
@@ -170,7 +179,6 @@ class BluePrintDSLTest {
maxLength(20)
minLength(10)
}
-
}
property("disk-space", "string", true, "") {
defaultValue(10)
@@ -196,8 +204,10 @@ class BluePrintDSLTest {
@Test
fun testServiceTemplateWorkflow() {
- val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val serviceTemplate = serviceTemplate(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
topologyTemplate {
workflowNodeTemplate("activate", "component-resource-resolution", "") {
operation("ResourceResolutionExecutor", "") {
@@ -210,14 +220,16 @@ class BluePrintDSLTest {
}
assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
assertNotNull(serviceTemplate.topologyTemplate?.workflows?.get("activate"), "failed to get workflow(activate)")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
fun testNodeTemplateOperationTypes() {
- val testNodeTemplateInstance = BluePrintTypes.nodeTemplateComponentTestExecutor(id = "test-node-template",
- description = "") {
+ val testNodeTemplateInstance = BluePrintTypes.nodeTemplateComponentTestExecutor(
+ id = "test-node-template",
+ description = ""
+ ) {
definedProperties {
prop1("i am property1")
prop2("i am property2")
@@ -233,21 +245,25 @@ class BluePrintDSLTest {
}
}
assertNotNull(testNodeTemplateInstance, "failed to get test node template")
- //println(testNodeTemplateInstance.asJsonString(true))
+ // println(testNodeTemplateInstance.asJsonString(true))
}
}
-fun BluePrintTypes.nodeTemplateComponentTestExecutor(id: String,
- description: String,
- block: TestNodeTemplateOperationImplBuilder.() -> Unit)
- : NodeTemplate {
+fun BluePrintTypes.nodeTemplateComponentTestExecutor(
+ id: String,
+ description: String,
+ block: TestNodeTemplateOperationImplBuilder.() -> Unit
+):
+ NodeTemplate {
return TestNodeTemplateOperationImplBuilder(id, description).apply(block).build()
}
class TestNodeTemplateOperationImplBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<TestProperty, TestInput, TestOutput>(id, "component-test-executor",
- "ComponentTestExecutor",
- description)
+ AbstractNodeTemplateOperationImplBuilder<TestProperty, TestInput, TestOutput>(
+ id, "component-test-executor",
+ "ComponentTestExecutor",
+ description
+ )
class TestProperty : PropertiesAssignmentBuilder() {
fun prop1(prop1: String) {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
index 66fec7553..60bef8a8d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.scripts
-
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
@@ -34,17 +33,19 @@ class BluePrintScriptsServiceImplTest {
private fun viewClassPathInfo() {
println(" *********** classpathFromClass *********** ")
- classpathFromClass(BluePrintScriptsServiceImplTest::class.java.classLoader,
- BluePrintScriptsServiceImplTest::class)!!
- .forEach(::println)
+ classpathFromClass(
+ BluePrintScriptsServiceImplTest::class.java.classLoader,
+ BluePrintScriptsServiceImplTest::class
+ )!!
+ .forEach(::println)
println(" *********** classpathFromClassloader *********** ")
classpathFromClassloader(BluePrintScriptsServiceImplTest::class.java.classLoader)!!
- .forEach(::println)
+ .forEach(::println)
println(" *********** classpathFromClasspathProperty *********** ")
classpathFromClasspathProperty()!!
- .forEach(::println)
+ .forEach(::println)
}
@Test
@@ -56,8 +57,10 @@ class BluePrintScriptsServiceImplTest {
val basePath = normalizedPathName("src/test/resources/compile")
/** Load the Definitions */
val bluePrintDefinitions = bluePrintScriptsService
- .scriptInstance<BluePrintDefinitions>(basePath,
- "cba.scripts.ActivateBlueprintDefinitions", true)
+ .scriptInstance<BluePrintDefinitions>(
+ basePath,
+ "cba.scripts.ActivateBlueprintDefinitions", true
+ )
assertNotNull(bluePrintDefinitions, "failed to get blueprint definitions")
val serviceTemplate = bluePrintDefinitions.serviceTemplate()
@@ -67,15 +70,18 @@ class BluePrintScriptsServiceImplTest {
assertNotNull(customDataType, "failed to get custom definitions")
val instance = bluePrintScriptsService
- .scriptInstance<BlueprintFunctionNode<String, String>>(basePath,
- "cba.scripts.SampleBlueprintFunctionNode", false)
+ .scriptInstance<BlueprintFunctionNode<String, String>>(
+ basePath,
+ "cba.scripts.SampleBlueprintFunctionNode", false
+ )
assertNotNull(instance, "failed to get compiled instance")
val cachedInstance = bluePrintScriptsService
- .scriptInstance<BlueprintFunctionNode<String, String>>(basePath,
- "cba.scripts.SampleBlueprintFunctionNode", false)
+ .scriptInstance<BlueprintFunctionNode<String, String>>(
+ basePath,
+ "cba.scripts.SampleBlueprintFunctionNode", false
+ )
assertNotNull(cachedInstance, "failed to get cached compile instance")
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
index 33890277f..6dcb4eb1c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
@@ -17,15 +17,28 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-
import com.fasterxml.jackson.databind.ObjectMapper
-import org.slf4j.LoggerFactory
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Activity
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
@@ -38,7 +51,7 @@ import kotlin.test.assertTrue
*/
class BluePrintContextTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
index d2363ab9d..f8cad990d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
@@ -31,6 +31,7 @@ import kotlin.test.assertNotNull
* @author Brinda Santh
*/
class BluePrintExpressionServiceTest {
+
@Test
fun testInputExpression() {
val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_input\" : \"input-name\" }")
@@ -58,7 +59,11 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData1.propertyExpression, " Failed to populate nested property expression data")
assertEquals("SELF", expressionData1.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("property-name", expressionData1.propertyExpression?.propertyName, " Failed to get expected propertyName")
- assertEquals("resource/name", expressionData1.propertyExpression?.subPropertyName, " Failed to populate nested subPropertyName expression data")
+ assertEquals(
+ "resource/name",
+ expressionData1.propertyExpression?.subPropertyName,
+ " Failed to populate nested subPropertyName expression data"
+ )
}
@Test
@@ -78,13 +83,17 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")
assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")
- assertEquals("resource/name", expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
+ assertEquals(
+ "resource/name",
+ expressionData1.attributeExpression?.subAttributeName,
+ " Failed to populate nested subAttributeName expression data"
+ )
}
-
@Test
fun testOutputOperationExpression() {
- val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }")
+ val node: JsonNode =
+ jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }")
val expressionData: ExpressionData = BluePrintExpressionService.getExpressionData(node)
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
@@ -95,7 +104,6 @@ class BluePrintExpressionServiceTest {
assertEquals("output-property-name", expressionData.operationOutputExpression?.propertyName, " Failed to get expected propertyName")
}
-
@Test
fun testArtifactExpression() {
val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\"] }")
@@ -106,7 +114,6 @@ class BluePrintExpressionServiceTest {
assertEquals("SELF", expressionData.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("artifact-template", expressionData.artifactExpression?.artifactName, " Failed to get expected artifactName")
-
val node1: JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\", \"location\", true] }")
val expressionData1: ExpressionData = BluePrintExpressionService.getExpressionData(node1)
assertNotNull(expressionData1, " Failed to populate expression data")
@@ -125,7 +132,9 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
assertNotNull(expressionData.dslExpression, " Failed to populate dsl expression data")
- assertEquals("dynamic-rest-source", expressionData.dslExpression!!.propertyName,
- " Failed to populate dsl property name")
+ assertEquals(
+ "dynamic-rest-source", expressionData.dslExpression!!.propertyName,
+ " Failed to populate dsl property name"
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
index 47b4f2179..2fbd26040 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
@@ -54,4 +54,4 @@ class BluePrintRepoFileServiceTest {
val dataType = bluePrintRepoFileService.getDataType("dt-not-found")
assertNotNull(dataType, "Failed to get DataType from repo")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index bef1c4570..ddb67706c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.node.NullNode
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintRuntimeUtils
@@ -37,6 +36,7 @@ import kotlin.test.assertNotNull
* @author Brinda Santh
*/
class BluePrintRuntimeServiceTest {
+
private val log = LoggerFactory.getLogger(this::class.toString())
@Test
@@ -51,7 +51,7 @@ class BluePrintRuntimeServiceTest {
bluePrintRuntimeService.assignInputs(inputNode)
val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateProperties("activate-process")
+ .resolveNodeTemplateProperties("activate-process")
assertNotNull(propContext, "Failed to populate interface property values")
}
@@ -63,19 +63,25 @@ class BluePrintRuntimeServiceTest {
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext
+ )
val assignmentParams = "{\n" +
" \"ipAddress\": \"127.0.0.1\",\n" +
" \"hostName\": \"vnf-host\"\n" +
" }"
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams)
+ )
- val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device",
- "netconf")
+ val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(
+ "sample-netconf-device",
+ "netconf"
+ )
assertNotNull(capProperties, "Failed to populate capability property values")
assertEquals(capProperties["target-ip-address"], "127.0.0.1".asJsonPrimitive(), "Failed to populate parameter target-ip-address")
assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
@@ -89,12 +95,16 @@ class BluePrintRuntimeServiceTest {
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext
+ )
val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "ResourceResolutionComponent", "process")
+ .resolveNodeTemplateInterfaceOperationInputs(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process"
+ )
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
@@ -109,17 +119,22 @@ class BluePrintRuntimeServiceTest {
bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance())
- bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
- "ResourceResolutionComponent", "process")
+ bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process"
+ )
- val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "status")
+ val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process", "status"
+ )
assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status")
- val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "resource-assignment-params")
+ val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process", "resource-assignment-params"
+ )
assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params")
-
}
@Test
@@ -127,17 +142,20 @@ class BluePrintRuntimeServiceTest {
log.info("************************ testNodeTemplateContextProperty **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",
- JacksonUtils.jsonNodeFromObject("context1-value"))
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",
- JacksonUtils.jsonNodeFromObject("context2-value"))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment-ra-component", "context1",
+ JacksonUtils.jsonNodeFromObject("context1-value")
+ )
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment-ra-component", "context2",
+ JacksonUtils.jsonNodeFromObject("context2-value")
+ )
val keys = listOf("context1", "context2")
val jsonValueNode = bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
assertNotNull(jsonValueNode, "Failed to get Json for Node Template Context Properties")
log.info("JSON Prepared Value Context {}", jsonValueNode)
-
}
@Test
@@ -159,8 +177,10 @@ class BluePrintRuntimeServiceTest {
val assignmentParams = "{\"ipAddress\": \"127.0.0.1\", \"hostName\": \"vnf-host\"}"
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams)
+ )
val resolvedJsonNode = bluePrintRuntimeService.resolveWorkflowOutputs("resource-assignment")
assertNotNull(resolvedJsonNode, "Failed to populate workflow output property values")
@@ -172,12 +192,15 @@ class BluePrintRuntimeServiceTest {
val checkProcessId = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID)
val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
- assertEquals("1234".asJsonPrimitive(),
- checkProcessId, "Failed to get process id after runtime creation")
- assertEquals(blueprintBasePath.asJsonPrimitive(),
- checkBasePath, "Failed to get base path after runtime creation")
+ assertEquals(
+ "1234".asJsonPrimitive(),
+ checkProcessId, "Failed to get process id after runtime creation"
+ )
+ assertEquals(
+ blueprintBasePath.asJsonPrimitive(),
+ checkBasePath, "Failed to get base path after runtime creation"
+ )
return blueprintRuntime
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
index ce41cfa1f..fd3dec4b3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
@@ -46,7 +46,6 @@ class BluePrintTemplateServiceTest {
val content = BluePrintVelocityTemplateService.generateContent(template, json)
assertNotNull(content, "failed to generate content for velocity template")
}
-
}
@Test
@@ -56,16 +55,16 @@ class BluePrintTemplateServiceTest {
val json = JacksonUtils.getClassPathFileContent("templates/base-config-data-jinja.json")
val element: MutableMap<String, Any> = mutableMapOf()
- element["additional_array"] = arrayListOf(hashMapOf("name" to "Element1", "location" to "Region0"),
- hashMapOf("name" to "Element2", "location" to "Region1"))
+ element["additional_array"] = arrayListOf(
+ hashMapOf("name" to "Element1", "location" to "Region0"),
+ hashMapOf("name" to "Element2", "location" to "Region1")
+ )
val content = BluePrintJinjaTemplateService.generateContent(template, json, false, element)
assertNotNull(content, "failed to generate content for velocity template")
}
-
}
-
@Test
fun `no value variable should evaluate to default value - standalone template mesh test`() {
runBlocking {
@@ -74,12 +73,10 @@ class BluePrintTemplateServiceTest {
val json = JacksonUtils.getClassPathFileContent("templates/default-variable-value-data.json")
val content = BluePrintVelocityTemplateService.generateContent(template, json)
- //first line represents a variable whose value was successfully retrieved, second line contains a variable
+ // first line represents a variable whose value was successfully retrieved, second line contains a variable
// whose value could not be evaluated
val expected = "sample-hostname\n\${node0_backup_router_address}"
assertEquals(expected, content, "No value variable should use default value")
}
}
-
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
index 4d97f8bc3..72fa3e1eb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
@@ -18,7 +18,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import io.mockk.every
import io.mockk.mockk
-import kotlinx.coroutines.*
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.withTimeout
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
@@ -33,7 +38,7 @@ class BluePrintWorkflowServiceTest {
fun testSimpleFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>E/SUCCESS, E>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -49,7 +54,7 @@ class BluePrintWorkflowServiceTest {
val wfs = listOf("12345", "12346").map {
async {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(it), it)
@@ -65,7 +70,7 @@ class BluePrintWorkflowServiceTest {
fun testMissingEdgeForBFailureState() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), arrayListOf("B"))
val input = "123456"
@@ -78,7 +83,7 @@ class BluePrintWorkflowServiceTest {
fun testBExceptionFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), null)
val input = "123456"
@@ -91,7 +96,7 @@ class BluePrintWorkflowServiceTest {
fun testTimeoutExceptionFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>TO/SUCCESS, TO>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "TO", "C", "D", "E"), null)
val input = "123456"
@@ -104,7 +109,7 @@ class BluePrintWorkflowServiceTest {
fun testConditionalFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -118,10 +123,12 @@ class BluePrintWorkflowServiceTest {
runBlocking {
// Failure Flow
val failurePatGraph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val failurePathWorkflow = TestBluePrintWorkFlowService()
- failurePathWorkflow.simulatedState = prepareSimulation(arrayListOf("B", "C", "D", "E"),
- arrayListOf("A"))
+ failurePathWorkflow.simulatedState = prepareSimulation(
+ arrayListOf("B", "C", "D", "E"),
+ arrayListOf("A")
+ )
val failurePathWorkflowInput = "123456"
val failurePathResponse = failurePathWorkflow.executeWorkflow(failurePatGraph, mockBluePrintRuntimeService(), failurePathWorkflowInput)
assertNotNull(failurePathResponse, "failed to get response")
@@ -132,7 +139,7 @@ class BluePrintWorkflowServiceTest {
fun testMultipleSkipFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, C>D/SUCCESS, D>E/SUCCESS, B>E/SUCCESS, E>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -145,7 +152,7 @@ class BluePrintWorkflowServiceTest {
fun testParallelFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/SUCCESS, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
val input = "123456"
@@ -176,8 +183,9 @@ class BluePrintWorkflowServiceTest {
}
}
-class TestBluePrintWorkFlowService
- : AbstractBluePrintWorkFlowService<String, String>() {
+class TestBluePrintWorkFlowService :
+ AbstractBluePrintWorkFlowService<String, String>() {
+
val log = logger(TestBluePrintWorkFlowService::class)
lateinit var simulatedState: MutableMap<String, EdgeLabel>
@@ -201,17 +209,20 @@ class TestBluePrintWorkFlowService
return startMessage.output.await()
}
- override suspend fun prepareNodeExecutionMessage(node: Graph.Node)
- : NodeExecuteMessage<String, String> {
+ override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
+ NodeExecuteMessage<String, String> {
return NodeExecuteMessage(node, "$node Input", "")
}
- override suspend fun executeNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
-// val random = (1..10).random() * 100
-// log.info("workflow($workflowId) node(${node.id}) will reply in $random ms")
-// kotlinx.coroutines.delay(random.toLong())
-// //Simulation for timeout
+ override suspend fun executeNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ // val random = (1..10).random() * 100
+ // log.info("workflow($workflowId) node(${node.id}) will reply in $random ms")
+ // kotlinx.coroutines.delay(random.toLong())
+ // //Simulation for timeout
if (node.id == "TO") {
withTimeout(1) {
kotlinx.coroutines.delay(2)
@@ -225,19 +236,28 @@ class TestBluePrintWorkFlowService
return NodeSkipMessage(node, "$node Skip Input", nodeOutput)
}
- override suspend fun skipNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
+ override suspend fun skipNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
}
- override suspend fun cancelNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun cancelNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
- override suspend fun restartNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun restartNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun prepareWorkflowOutput(): String {
@@ -248,4 +268,4 @@ class TestBluePrintWorkFlowService
}
return "Final Response"
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
index 8517e7536..6413fb5fe 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
@@ -23,14 +23,12 @@ import java.io.File
import java.nio.file.Paths
import kotlin.test.assertTrue
-
class BluePrintFileUtilsTest {
@Test
fun testNewBlueprint() = runBlocking {
val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test")
BluePrintFileUtils.createEmptyBluePrint(targetPath)
-
}
@Test
@@ -54,7 +52,5 @@ class BluePrintFileUtilsTest {
bluePrintContext.rootPath = targetDir.absolutePath
BluePrintFileUtils.writeBluePrintTypes(bluePrintContext)
-
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
index 2aea4bc2d..62bb0afcb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
@@ -20,7 +20,6 @@ import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintRetryException
-
class BluePrintIOUtilsTest {
@Test
@@ -39,4 +38,4 @@ class BluePrintIOUtilsTest {
BluePrintIOUtils.retry<String>(4, 0, 500, executionBlock, exceptionBlock)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
index 6c0c30e3d..c29332d4f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData
@@ -44,7 +43,6 @@ class BluePrintMetadataUtilsTest {
assertNotNull(toscaMetaData.entityDefinitions, "Missing Tosca Entity Definition")
assertNotNull(toscaMetaData.templateTags, "Missing Template Tags")
}
-
}
@Test
@@ -78,4 +76,4 @@ class BluePrintMetadataUtilsTest {
assertEquals(properties.getProperty("blueprintsprocessor.database.alt2.password"), "password2", "failed 4")
assertNull(properties.getProperty("blueprintsprocessor.database.alt3.password"), "failed 5")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
index d0e971ad7..aa4008759 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
@@ -16,13 +16,13 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import kotlinx.coroutines.runBlocking
import org.junit.Test
+import org.slf4j.LoggerFactory
class JacksonReactorUtilsTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
@Test
fun testJsonNodeFromClassPathFile() {
@@ -39,4 +39,4 @@ class JacksonReactorUtilsTest {
JacksonReactorUtils.jsonNodeFromFile(filePath)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
index faa198faf..5facad7ef 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
@@ -17,9 +17,9 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.slf4j.LoggerFactory
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@@ -30,7 +30,7 @@ import kotlin.test.assertTrue
*/
class JacksonUtilsTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
@Test
fun testJsonNodeFromClassPathFile() {
@@ -51,7 +51,6 @@ class JacksonUtilsTest {
assertNotNull(nodeType, "Failed to get String array from content")
}
-
@Test
fun testJsonValue() {
val filePath = "data/alltype-data.json"
@@ -71,7 +70,5 @@ class JacksonUtilsTest {
assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_MAP, mapValue), "Failed to get as Map value")
assertTrue(!JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, stringValue), "Negative type failed")
-
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
index 8a37a4b19..336e47604 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
@@ -55,4 +55,4 @@ class JsonParserUtilsTest {
val parsedPath = jsonNode.jsonPaths("$..prop1")
assertNotNull(parsedPath, "failed to get parsed path")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
index 5da43484c..fc11947de 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
@@ -35,4 +35,4 @@ class TopologicalSortingUtilsTest {
log.debug("Out-degrees: " + graph.outDegree())
log.debug("A topological sort of the vertices: " + graph.topSort())
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
index fb0a1a63d..66272d61a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
@@ -39,4 +39,4 @@ class WorkflowGraphUtilsTest {
val graph = WorkflowGraphUtils.workFlowToGraph(workflow)
assertNotNull(graph, "failed to create graph")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
index 4f4d210ca..5dd1937f8 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
@@ -26,8 +26,10 @@ class ActivateBlueprintDefinitions : AbstractBluePrintDefinitions() {
override fun serviceTemplate(): ServiceTemplate {
- return serviceTemplate("sample-blue-print", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ return serviceTemplate(
+ "sample-blue-print", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
topologyTemplate {
workflowNodeTemplate("activate", "component-resource-resolution", "") {
operation("ResourceResolutionExecutor", "") {
@@ -42,12 +44,14 @@ class ActivateBlueprintDefinitions : AbstractBluePrintDefinitions() {
override fun loadOtherDefinitions() {
/** Sample Definitions */
- val customDataType = dataType("custom-datatype", "1.0.0",
- BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, "") {
+ val customDataType = dataType(
+ "custom-datatype", "1.0.0",
+ BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, ""
+ ) {
property("name", BluePrintConstants.DATA_TYPE_STRING, true, "")
property("value", BluePrintConstants.DATA_TYPE_STRING, true, "")
}
/** Loading to definitions */
addOtherDefinition("datatype-custom-datatype", customDataType)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
index aa77bc30b..8bd060e17 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
@@ -25,19 +25,19 @@ open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String> {
}
override fun prepareRequest(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun process(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun recover(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun prepareResponse(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun apply(t: String): String {
@@ -45,22 +45,22 @@ open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String> {
}
override suspend fun prepareRequestNB(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun processNB(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun prepareResponseNB(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun applyNB(t: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
index 182c22ce9..73504314b 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
@@ -24,6 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifact
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,16 +32,20 @@ import java.io.File
@Service("default-artifact-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintArtifactDefinitionValidatorImpl(
- private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactDefinitionValidator {
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService
+) : BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
this.bluePrintRuntimeService = bluePrintRuntimeService
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -69,7 +73,7 @@ open class BluePrintArtifactDefinitionValidatorImpl(
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
+ ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -84,13 +88,12 @@ open class BluePrintArtifactDefinitionValidatorImpl(
private fun validateExtension(referencePrefix: String, name: String, artifactDefinition: ArtifactDefinition) {
val customValidators = bluePrintTypeValidatorService
- .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
+ .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
customValidators?.let {
it.forEach { validator ->
validator.validate(bluePrintRuntimeService, name, artifactDefinition)
}
-
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
index aa2cdb1df..b31211e2d 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
@@ -24,7 +24,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.springframework.stereotype.Service
@Service("default-artifact-type-validator")
-open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator {
+open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactTypeValidator {
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
@@ -32,4 +33,4 @@ open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidator
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
index 5a9736bc8..9a4650104 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
@@ -31,16 +31,18 @@ import org.springframework.stereotype.Service
@Service("default-attribute-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
+open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintAttributeDefinitionValidator {
-
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- attributeDefinition: AttributeDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ attributeDefinition: AttributeDefinition
+ ) {
log.trace("Validating AttributeDefinition($name)")
this.bluePrintRuntimeService = bluePrintRuntimeService
@@ -55,7 +57,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = attributeDefinition.entrySchema?.type
- ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
+ ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
@@ -73,7 +75,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -87,4 +89,4 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
index e62de4a22..dab6a78bc 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
@@ -32,4 +32,4 @@ open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
index 9ffd78f9e..5df2decdb 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
@@ -30,15 +30,16 @@ import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefi
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
-import java.util.*
-
+import java.util.UUID
@Service("bluePrintDesignTimeValidatorService")
-open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- private val resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintValidatorService {
+open class BluePrintDesignTimeValidatorService(
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
+ private val resourceDefinitionValidator: ResourceDefinitionValidator
+) :
+ BluePrintValidatorService {
- private val log= LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
override fun validateBluePrints(basePath: String): Boolean {
@@ -48,8 +49,10 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
- bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
- bluePrintRuntimeService.bluePrintContext().serviceTemplate)
+ bluePrintTypeValidatorService.validateServiceTemplate(
+ bluePrintRuntimeService, "service_template",
+ bluePrintRuntimeService.bluePrintContext().serviceTemplate
+ )
// Validate Resource Definitions
validateResourceDefinitions(bluePrintRuntimeService)
@@ -65,8 +68,8 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath
val resourceDefinitionsPath = blueprintBasePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
- .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
+ .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
+ .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionFile = File(resourceDefinitionsPath)
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
index 48f1b2155..2dfc09be6 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
@@ -17,25 +17,33 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTemplateValidator {
+open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintNodeTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -55,11 +63,11 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val type: String = nodeTemplate.type
val nodeType: NodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
+ ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
nodeTemplate.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
+ .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
}
nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, name, nodeTemplate) }
nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, name, nodeTemplate) }
@@ -76,8 +84,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
paths.add("artifacts")
artifacts.forEach { artifactDefinitionName, artifactDefinition ->
- bluePrintTypeValidatorService.validateArtifactDefinition(bluePrintRuntimeService,
- artifactDefinitionName, artifactDefinition)
+ bluePrintTypeValidatorService.validateArtifactDefinition(
+ bluePrintRuntimeService,
+ artifactDefinitionName, artifactDefinition
+ )
}
paths.removeAt(paths.lastIndex)
}
@@ -90,8 +100,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
paths.add(capabilityName)
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
- "from NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
+ "from NodeType(${nodeTemplate.type})"
+ )
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -101,14 +113,17 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+ open fun validateCapabilityAssignment(
+ nodeTemplateName: String,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition,
+ capabilityAssignment: CapabilityAssignment
+ ) {
capabilityAssignment.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
+ .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
}
-
}
@Throws(BluePrintException::class)
@@ -118,21 +133,28 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
requirements?.forEach { requirementName, requirementAssignment ->
paths.add(requirementName)
val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
- " NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
- log.debug("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
- requirementAssignmentName)
+ open fun validateRequirementAssignment(
+ nodeTemplateName: String,
+ requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition,
+ requirementAssignment: RequirementAssignment
+ ) {
+ log.debug(
+ "Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
+ requirementAssignmentName
+ )
val requirementNodeTemplateName = requirementAssignment.node!!
val capabilityName = requirementAssignment.capability
val relationship = requirementAssignment.relationship!!
@@ -142,14 +164,16 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)")
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)"
+ )
relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)")
-
-
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)"
+ )
}
@Throws(BluePrintException::class)
@@ -160,80 +184,91 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
- " NodeType(${nodeTemplate.type})")
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
+
+ validateInterfaceAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ validateInterfaceOperationsAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
}
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceOperationsAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
+ ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
- log.debug("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
- "($operationAssignmentName)")
+ log.debug(
+ "Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
+ "($operationAssignmentName)"
+ )
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " +
- "definition ($operationAssignmentName) property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation " +
+ "definition ($operationAssignmentName) property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
outputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
- "output property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
+ "output property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
-
}
}
-
}
-
private fun validateExtension(referencePrefix: String, name: String, nodeTemplate: NodeTemplate) {
val customValidator = bluePrintTypeValidatorService
- .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
+ .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
customValidator?.let {
it.validate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
index 3d3122c61..5384744ee 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -17,20 +17,24 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-type-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator {
@@ -49,12 +53,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.add(nodeTypeName)
val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
+ // Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
bluePrintContext.serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
+ ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
}
nodeType.attributes?.let {
@@ -91,8 +95,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
+ open fun validateCapabilityDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition
+ ) {
val capabilityType = capabilityDefinition.type
check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
throw BluePrintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)")
@@ -111,8 +119,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
+ open fun validateRequirementDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition
+ ) {
log.info("validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
val requirementNodeTypeName = requirementDefinition.node!!
@@ -124,12 +136,13 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
}
val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
+ ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s " +
- "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) ")
-
+ ?: throw BluePrintException(
+ "failed to get requirement NodeType($requirementNodeTypeName)'s " +
+ "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) "
+ )
}
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
@@ -163,5 +176,4 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
open fun validateImplementation(implementation: Implementation) {
checkNotEmpty(implementation.primary) { "couldn't get implementation" }
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
index c2c80d7f7..5683c0170 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -25,23 +24,23 @@ import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-property-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator {
+open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintPropertyDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
this.bluePrintRuntimeService = bluePrintRuntimeService
-
log.trace("Validating PropertyDefinition($name)")
val dataType: String = propertyDefinition.type
@@ -55,14 +54,13 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
}
}
-
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
@@ -74,7 +72,7 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -88,4 +86,4 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
index 0e76be49e..d71e78c43 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
@@ -16,24 +16,29 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-service-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator {
+open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintServiceTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var error: BluePrintError
@@ -74,7 +79,6 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.removeAt(paths.lastIndex)
}
-
fun validateDataTypes(dataTypes: MutableMap<String, DataType>) {
paths.add(BluePrintConstants.PATH_DATA_TYPES)
@@ -108,4 +112,4 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate)
paths.removeAt(paths.lastIndex)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
index 406f8dec0..a7fb3d57e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -26,15 +25,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-topology-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator {
+open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintTopologyTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
@@ -55,7 +56,6 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs)
}
-
@Throws(BluePrintException::class)
fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) {
@@ -73,5 +73,4 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
index d9f19d489..1fb70503f 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
@@ -18,7 +18,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
@@ -43,8 +54,8 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
return context.getBeansOfType(classType)
- .filter { it.key.startsWith(referenceNamePrefix) }
- .mapNotNull { it.value }
+ .filter { it.key.startsWith(referenceNamePrefix) }
+ .mapNotNull { it.value }
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
@@ -53,52 +64,51 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintServiceTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
}
override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintDataTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default DataType validators")
+ ?: throw BluePrintProcessorException("failed to get default DataType validators")
}
override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
}
override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
}
override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeType validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeType validators")
}
override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintTopologyTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
}
override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
}
override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintWorkflowValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default Workflow validators")
+ ?: throw BluePrintProcessorException("failed to get default Workflow validators")
}
override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintPropertyDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
}
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintAttributeDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
index a59bcb2f8..a1a9eb913 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
@@ -21,4 +21,4 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan
-open class BluePrintValidationConfiguration \ No newline at end of file
+open class BluePrintValidationConfiguration
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
index e705808c9..a2b598017 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
@@ -17,13 +17,13 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
-import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
var paths: MutableList<String> = arrayListOf()
@@ -42,7 +42,6 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
this.bluePrintRuntimeService = bluePrintRuntimeService
-
paths.add(workflowName)
paths.joinToString(BluePrintConstants.PATH_DIVIDER)
@@ -65,18 +64,21 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
val nodeTypeDerivedFrom = bluePrintRuntimeService.bluePrintContext().nodeTemplateNodeType(it).derivedFrom
- check(nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW
- || nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT) {
+ check(
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW ||
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT
+ ) {
"NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected " +
"'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
}
} catch (e: Exception) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed to validate Workflow($workflowName)'s step($stepName)'s " +
- "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
+ .addError(
+ "Failed to validate Workflow($workflowName)'s step($stepName)'s " +
+ "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!
+ )
}
}
-
}
paths.removeAt(paths.lastIndex)
// Step Validation Ends
@@ -97,12 +99,10 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, workflow.outputs!!)
PropertyAssignmentValidationUtils(bluePrintRuntimeService.bluePrintContext())
- .validatePropertyDefinitionNAssignments(workflow.outputs!!)
+ .validatePropertyDefinitionNAssignments(workflow.outputs!!)
}
// Validate Value or Expression
workflow.outputs?.forEach { propertyName, propertyDefinition ->
-
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
index 03183e624..78a5d379e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
@@ -24,17 +23,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
@Service("artifact-mapping-resource-artifact-definition-validator")
-open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService)
- : BluePrintArtifactDefinitionValidator {
+open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
+ private val log = LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val file: String = artifactDefinition.file
@@ -44,4 +47,4 @@ open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorSe
val resourceAssignmentValidationService = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidationService.validate(resourceAssignment)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
index 608de4f0c..dc5da2669 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
@@ -16,11 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -31,13 +31,16 @@ interface ResourceDefinitionValidator : BluePrintValidator<ResourceDefinition>
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : ResourceDefinitionValidator {
- private val log= LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- resourceDefinition: ResourceDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ resourceDefinition: ResourceDefinition
+ ) {
log.trace("validating resource definition($name)")
resourceDefinition.sources.forEach { name, nodeTemplate ->
bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
index d49348152..63aa7e537 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
@@ -48,19 +48,23 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
}
}
- open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
- properties: MutableMap<String, JsonNode>) {
+ open fun validatePropertyAssignments(
+ nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>
+ ) {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
- ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
+ ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
}
}
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
+ open fun validatePropertyAssignment(
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode
+ ) {
// Check and Validate if Expression Node
val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
if (!expressionData.isExpression) {
@@ -74,13 +78,12 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
} else if (BluePrintTypes.validComplexTypes().contains(propertyType)) {
isValid = true
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -99,10 +102,9 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
open fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
+ ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
}
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
index 9dbd19e22..375bd8eae 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
@@ -60,7 +60,10 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)",
+ bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -90,9 +93,11 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
- "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
- "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
+ "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
+ "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -100,6 +105,4 @@ class BluePrintDesignTimeValidatorServiceTest {
val workflowName = "resource-assignment"
workflowValidator.validate(bluePrintRuntime, workflowName, bluePrintRuntime.bluePrintContext().workflowByName(workflowName))
}
-
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
index 169715295..11c6c037c 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
+++ b/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
@@ -17,7 +17,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
@@ -26,11 +37,11 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
@@ -72,4 +83,4 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return listOf(BluePrintAttributeDefinitionValidatorImpl(this))
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
index f1e0d2c86..10930ffab 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import java.io.Serializable
-import java.util.*
+import java.util.Date
open class ResourceDefinition {
@@ -103,7 +103,6 @@ open class ResourceAssignment {
*/
interface ResourceSource : Serializable
-
open class ResourceSourceMapping {
lateinit var resourceSourceMappings: MutableMap<String, String>
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
index 25b161e47..366a4dcd4 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -22,6 +22,7 @@ package org.onap.ccsdk.cds.controllerblueprints.resource.dict
* @author Brinda Santh
*/
object ResourceDictionaryConstants {
+
const val SOURCE_INPUT = "input"
const val SOURCE_DEFAULT = "default"
const val PROCESSOR_DB = "processor-db"
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
index 6f2b9bae7..f8dea9871 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
@@ -35,7 +35,7 @@ object ResourceSourceMappingFactory {
fun getRegisterSourceMapping(sourceInstance: String): String {
return resourceSourceMappings[sourceInstance]
- ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))
+ ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))
}
fun getRegisterSourceMapping(): ResourceSourceMapping {
@@ -44,4 +44,3 @@ object ResourceSourceMappingFactory {
return resourceSourceMapping
}
}
-
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index 08b9d0560..a5171d25c 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -17,13 +17,13 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.service
-import org.slf4j.LoggerFactory
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
import java.io.Serializable
/**
@@ -43,7 +43,8 @@ interface ResourceAssignmentValidationService : Serializable {
* @author Brinda Santh
*/
open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService {
- private val log= LoggerFactory.getLogger(ResourceAssignmentValidationServiceImpl::class.java)
+
+ private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceImpl::class.java)
open var resourceAssignmentMap: Map<String, ResourceAssignment> = hashMapOf()
open val validationMessage = StrBuilder()
@@ -61,15 +62,14 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio
return true
}
-
open fun validateTemplateNDictionaryKeys(resourceAssignments: List<ResourceAssignment>) {
resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap()
// Check the Resource Assignment has Duplicate Key Names
val duplicateKeyNames = resourceAssignments.groupBy { it.name }
- .filter { it.value.size > 1 }
- .map { it.key }
+ .filter { it.value.size > 1 }
+ .map { it.key }
if (duplicateKeyNames.isNotEmpty()) {
validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames))
@@ -120,21 +120,23 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio
if (v.name == "*") {
s.append("\n * -> [")
for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
+ s.append(
+ "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name +
+ "),"
+ )
}
s.append("]")
} else {
s.append("\n (" + v.dictionaryName + ":" + v.name + ") -> [")
for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
+ s.append(
+ "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name +
+ "),"
+ )
}
s.append("]")
}
}
return s.toString()
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
index cd887bf54..9a5523113 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
@@ -21,7 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString
import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
-import java.util.*
+import java.util.ArrayList
/**
* BulkResourceSequencingUtils.
@@ -29,6 +29,7 @@ import java.util.*
* @author Brinda Santh
*/
object BulkResourceSequencingUtils {
+
private val log = LoggerFactory.getLogger(BulkResourceSequencingUtils::class.java)
@JvmStatic
@@ -83,12 +84,15 @@ object BulkResourceSequencingUtils {
dependencyPresence = CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.dependencies)
}
- log.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name,
- batchAssignmentName, resourceAssignment.dependencies, dependencyPresence)
+ log.trace(
+ "({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name,
+ batchAssignmentName, resourceAssignment.dependencies, dependencyPresence
+ )
- if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null
- && resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true)
- && !dependencyPresence) {
+ if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null &&
+ resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true) &&
+ !dependencyPresence
+ ) {
batchResourceAssignment!!.add(resourceAssignment)
batchAssignmentName!!.add(resourceAssignment.name)
} else {
@@ -112,5 +116,4 @@ object BulkResourceSequencingUtils {
return sequenceBatchResourceAssignment
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
index cd5470953..f26c5098f 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.apache.commons.collections.MapUtils
@@ -29,15 +28,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
+import org.slf4j.LoggerFactory
import java.io.File
-
object ResourceDictionaryUtils {
- private val log= LoggerFactory.getLogger(ResourceDictionaryUtils::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDictionaryUtils::class.java)
@JvmStatic
- fun populateSourceMapping(resourceAssignment: ResourceAssignment,
- resourceDefinition: ResourceDefinition) {
+ fun populateSourceMapping(
+ resourceAssignment: ResourceAssignment,
+ resourceDefinition: ResourceDefinition
+ ) {
if (StringUtils.isBlank(resourceAssignment.dictionarySource)) {
@@ -81,19 +82,18 @@ object ResourceDictionaryUtils {
fun getResourceAssignmentFromFile(filePath: String): List<ResourceAssignment> {
return JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
+ ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
}
fun writeResourceDefinitionTypes(basePath: String, resourceDefinitions: List<ResourceDefinition>) {
val resourceDefinitionMap = resourceDefinitions.map { it.name to it }.toMap()
writeResourceDefinitionTypes(basePath, resourceDefinitionMap)
-
}
fun writeResourceDefinitionTypes(basePath: String, resourceDefinitionMap: Map<String, ResourceDefinition>) {
val typePath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)
- .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
+ .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionContent = JacksonUtils.getJson(resourceDefinitionMap.toSortedMap(), true)
BluePrintFileUtils.writeDefinitionFile(typePath, resourceDefinitionContent)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
index fd38db0bf..111476b5e 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
@@ -28,7 +28,7 @@ public class ResourceDefinitionTest {
private String basePath = "./../../../../components/model-catalog/resource-dictionary/starter-dictionary";
@Test
- public void testDictionaryDefinitionInputSource(){
+ public void testDictionaryDefinitionInputSource() {
String fileName = basePath + "/input-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -36,7 +36,7 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionDefaultSource(){
+ public void testDictionaryDefinitionDefaultSource() {
String fileName = basePath + "/default-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -44,7 +44,7 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionDBSource(){
+ public void testDictionaryDefinitionDBSource() {
String fileName = basePath + "/db-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -52,9 +52,10 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionMDSALSource(){
+ public void testDictionaryDefinitionMDSALSource() {
String fileName = basePath + "/mdsal-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
}
+
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
index b891f9ec6..77af5dbe0 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
@@ -17,11 +17,11 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.service
import org.junit.Assert
+import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.junit.Before
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils
import org.slf4j.LoggerFactory
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory
* @author Brinda Santh
*/
class ResourceAssignmentValidationServiceTest {
+
private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceTest::class.java)
@Before
fun setUp() {
@@ -62,4 +63,4 @@ class ResourceAssignmentValidationServiceTest {
val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidator.validate(assignments!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
index 3413868ee..30b4d4544 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
@@ -20,7 +20,9 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment;
+
import java.util.List;
+
/**
* BulkResourceSequencingUtils.
*
@@ -29,9 +31,10 @@ import java.util.List;
public class BulkResourceSequencingUtilsTest {
@Test
- public void testProcess(){
+ public void testProcess() {
List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);
BulkResourceSequencingUtils.process(assignments);
}
+
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index 16b02d86c..8004d2ca2 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -56,7 +56,9 @@ public class ResourceDictionaryUtilsTest {
resourceAssignment.setDictionarySource(null);
sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate());
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
+ Assert.assertEquals("Expected First source Default, but.",
+ ResourceDictionaryConstants.SOURCE_DEFAULT,
+ resourceAssignment.getDictionarySource());
// To Check Assigned Source
resourceAssignment.setDictionarySource(ResourceDictionaryConstants.PROCESSOR_DB);
@@ -91,9 +93,8 @@ public class ResourceDictionaryUtilsTest {
ResourceDictionaryUtils.assignInputs(data, context);
String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
log.info("populated context {}", context);
- Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
+ Assert.assertTrue(String.format("failed to get variable : %s", path), context.containsKey(path));
}
-
}