diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-11-27 16:48:39 -0500 |
---|---|---|
committer | Brinda Santh Muthuramalingam <bs2796@att.com> | 2018-11-30 21:10:54 +0000 |
commit | f694937fb10128b1a3fad4f4a37c5f3bc7267d45 (patch) | |
tree | 5c51a3c9a177beea41b33d3ec60d932f4d2b590c /components/core/src/test | |
parent | 1b05064f471e70a0ddfc8f7e588ee6390bb340ff (diff) |
Add Validator Junit test case
Change-Id: I785e8cb2d3705f5650512ecc27517d2edd9df683
Issue-ID: CCSDK-757
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/core/src/test')
2 files changed, 102 insertions, 0 deletions
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<BluePrintServiceTemplateValidator> { + return listOf(BluePrintServiceTemplateValidatorImpl(this)) + } + + override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> { + return listOf(BluePrintDataTypeValidatorImpl(this)) + } + + override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> { + return listOf(BluePrintArtifactTypeValidatorImpl(this)) + } + + override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> { + return listOf(BluePrintNodeTypeValidatorImpl(this)) + } + + override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> { + return listOf(BluePrintTopologyTemplateValidatorImpl(this)) + } + + override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> { + return listOf(BluePrintNodeTemplateValidatorImpl(this)) + } + + override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> { + return listOf(BluePrintWorkflowValidatorImpl(this)) + } + + override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> { + return listOf(BluePrintPropertyDefinitionValidatorImpl(this)) + } + + override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> { + 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") + + } +} + |