From f694937fb10128b1a3fad4f4a37c5f3bc7267d45 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 27 Nov 2018 16:48:39 -0500 Subject: Add Validator Junit test case Change-Id: I785e8cb2d3705f5650512ecc27517d2edd9df683 Issue-ID: CCSDK-757 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/mock/MockBluePrintTypeValidatorService.kt | 59 ++++++++++++++++++++++ .../BluePrintValidatorServiceImplTest.kt | 43 ++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/mock/MockBluePrintTypeValidatorService.kt create mode 100644 components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt (limited to 'components/core/src/test') diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/mock/MockBluePrintTypeValidatorService.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/mock/MockBluePrintTypeValidatorService.kt new file mode 100644 index 00000000..4c174f92 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/mock/MockBluePrintTypeValidatorService.kt @@ -0,0 +1,59 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.mock + +import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.* +import org.onap.ccsdk.apps.controllerblueprints.core.validation.* + +class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService { + + override fun getServiceTemplateValidators(): List { + return listOf(BluePrintServiceTemplateValidatorImpl(this)) + } + + override fun getDataTypeValidators(): List { + return listOf(BluePrintDataTypeValidatorImpl(this)) + } + + override fun getArtifactTypeValidators(): List { + return listOf(BluePrintArtifactTypeValidatorImpl(this)) + } + + override fun getNodeTypeValidators(): List { + return listOf(BluePrintNodeTypeValidatorImpl(this)) + } + + override fun getTopologyTemplateValidators(): List { + return listOf(BluePrintTopologyTemplateValidatorImpl(this)) + } + + override fun getNodeTemplateValidators(): List { + return listOf(BluePrintNodeTemplateValidatorImpl(this)) + } + + override fun getWorkflowValidators(): List { + return listOf(BluePrintWorkflowValidatorImpl(this)) + } + + override fun getPropertyDefinitionValidators(): List { + return listOf(BluePrintPropertyDefinitionValidatorImpl(this)) + } + + override fun getAttributeDefinitionValidators(): List { + return listOf(BluePrintAttributeDefinitionValidatorImpl(this)) + } +} \ No newline at end of file diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt new file mode 100644 index 00000000..ca238db5 --- /dev/null +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/validation/BluePrintValidatorServiceImplTest.kt @@ -0,0 +1,43 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints.core.validation + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.mock.MockBluePrintTypeValidatorService +import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils +import kotlin.test.assertTrue + +class BluePrintValidatorServiceImplTest { + + val blueprintBasePath: String = ("./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration") + + + @Test + fun testValidateOfType() { + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(blueprintBasePath) + + val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService() + + val defaultBluePrintValidatorService = BluePrintValidatorServiceImpl(mockBluePrintTypeValidatorService) + + val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintContext, hashMapOf()) + + assertTrue(valid, "failed in blueprint Validation") + + } +} + -- cgit 1.2.3-korg