From 13a13e62b4c01db42c7488f9b36d4667ad3e2321 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Tue, 26 Mar 2019 23:08:06 -0400 Subject: Add Restconf Kotlin script sample Change-Id: Ia6196c7e45b1f3d8a3598f858f0d8380a3463ae9 Issue-ID: CCSDK-1080 Signed-off-by: Muthuramalingam, Brinda Santh --- .../core/FileExtensionFunctionTest.kt | 34 ++++++++++++++++++++++ .../BluePrintNodeTemplateValidatorImpl.kt | 10 ++++--- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt (limited to 'ms/controllerblueprints') 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 new file mode 100644 index 000000000..9a0da6905 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt @@ -0,0 +1,34 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.controllerblueprints.core + +import org.junit.Test +import kotlin.test.assertTrue + +class FileExtensionFunctionTest { + val blueprintBasePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + + @Test + fun testCompress() { + val blueprintFile = normalizedFile(blueprintBasePath) + val targetZip = normalizedFile("target", "compress.zip") + targetZip.deleteRecursively() + 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-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 fb466f7c3..dbcd879ae 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 @@ -19,7 +19,6 @@ package org.onap.ccsdk.cds.controllerblueprints.validation import com.att.eelf.configuration.EELFLogger import com.att.eelf.configuration.EELFManager -import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.* @@ -27,6 +26,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemp 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.springframework.beans.factory.config.ConfigurableBeanFactory import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service @@ -44,7 +44,7 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator var paths: MutableList = arrayListOf() override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) { - log.info("Validating NodeTemplate($name)") + log.debug("Validating NodeTemplate($name)") this.bluePrintRuntimeService = bluePrintRuntimeService this.bluePrintContext = bluePrintRuntimeService.bluePrintContext() @@ -132,7 +132,8 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator @Throws(BluePrintException::class) open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String, requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) { - log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName) + log.debug("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, + requirementAssignmentName) val requirementNodeTemplateName = requirementAssignment.node!! val capabilityName = requirementAssignment.capability val relationship = requirementAssignment.relationship!! @@ -197,7 +198,8 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName) ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)") - log.info("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation ($operationAssignmentName)") + log.debug("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " + + "($operationAssignmentName)") val inputs = operationAssignments.inputs val outputs = operationAssignments.outputs -- cgit 1.2.3-korg