diff options
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin')
-rw-r--r-- | ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt (renamed from ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt) | 36 | ||||
-rw-r--r-- | ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBlueprintTypeValidatorService.kt (renamed from ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt) | 76 |
2 files changed, 56 insertions, 56 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt index dcf352927..49c12b95f 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt @@ -21,34 +21,34 @@ import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.runBlocking import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError 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.Step 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.DefaultBluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefinitionValidator import kotlin.test.assertEquals import kotlin.test.assertTrue -class BluePrintDesignTimeValidatorServiceTest { +class BlueprintDesignTimeValidatorServiceTest { private val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - private val bluePrintRuntime = BluePrintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath) - private val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService() + private val bluePrintRuntime = BlueprintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath) + private val mockBlueprintTypeValidatorService = MockBlueprintTypeValidatorService() private val resourceDefinitionValidator = mockk<ResourceDefinitionValidator>() - private val defaultBluePrintValidatorService = - BluePrintDesignTimeValidatorService(mockBluePrintTypeValidatorService, resourceDefinitionValidator) - private val workflowValidator = BluePrintWorkflowValidatorImpl(mockBluePrintTypeValidatorService) + private val defaultBlueprintValidatorService = + BlueprintDesignTimeValidatorService(mockBlueprintTypeValidatorService, resourceDefinitionValidator) + private val workflowValidator = BlueprintWorkflowValidatorImpl(mockBlueprintTypeValidatorService) @Test fun testValidateOfType() { runBlocking { every { resourceDefinitionValidator.validate(bluePrintRuntime, any(), any()) } returns Unit - val valid = defaultBluePrintValidatorService.validateBluePrints(bluePrintRuntime) + val valid = defaultBlueprintValidatorService.validateBlueprints(bluePrintRuntime) assertTrue(valid, "failed in blueprint Validation") } } @@ -63,10 +63,10 @@ class BluePrintDesignTimeValidatorServiceTest { workflow.steps = mutableMapOf("test" to step) workflowValidator.validate(bluePrintRuntime, workflowName, workflow) - assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size) + 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] + bluePrintRuntime.getBlueprintError().errors[0] ) } @@ -81,13 +81,13 @@ class BluePrintDesignTimeValidatorServiceTest { val nodeType = mockk<NodeType>() every { nodeType.derivedFrom } returns "tosca.nodes.TEST" - val blueprintContext = mockk<BluePrintContext>() + val blueprintContext = mockk<BlueprintContext>() every { blueprintContext.nodeTemplateByName(nodeTemplateName) } returns nodeTemplate every { blueprintContext.nodeTemplateNodeType(nodeTemplateName) } returns nodeType - val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234") + val bluePrintRuntime = mockk<DefaultBlueprintRuntimeService>("1234") - every { bluePrintRuntime.getBluePrintError() } returns BluePrintError() + every { bluePrintRuntime.getBlueprintError() } returns BlueprintError() every { bluePrintRuntime.bluePrintContext() } returns blueprintContext val step = Step() @@ -96,12 +96,12 @@ class BluePrintDesignTimeValidatorServiceTest { workflow.steps = mutableMapOf("test" to step) workflowValidator.validate(bluePrintRuntime, workflowName, workflow) - assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size) + 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] + bluePrintRuntime.getBlueprintError().errors[0] ) } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBlueprintTypeValidatorService.kt index 11c6c037c..69f57a0b9 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBlueprintTypeValidatorService.kt @@ -17,70 +17,70 @@ package org.onap.ccsdk.cds.controllerblueprints.validation -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 { - - override fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { +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 { + + override fun <T : BlueprintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T? { return null } - override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { + override fun <T : BlueprintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? { return null } - override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { + override fun <T : BlueprintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? { return null } - override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> { - return listOf(BluePrintServiceTemplateValidatorImpl(this)) + override fun getServiceTemplateValidators(): List<BlueprintServiceTemplateValidator> { + return listOf(BlueprintServiceTemplateValidatorImpl(this)) } - override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> { - return listOf(BluePrintDataTypeValidatorImpl(this)) + override fun getDataTypeValidators(): List<BlueprintDataTypeValidator> { + return listOf(BlueprintDataTypeValidatorImpl(this)) } - override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> { - return listOf(BluePrintArtifactTypeValidatorImpl(this)) + override fun getArtifactTypeValidators(): List<BlueprintArtifactTypeValidator> { + return listOf(BlueprintArtifactTypeValidatorImpl(this)) } - override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> { - return listOf(BluePrintArtifactDefinitionValidatorImpl(this)) + override fun getArtifactDefinitionsValidators(): List<BlueprintArtifactDefinitionValidator> { + return listOf(BlueprintArtifactDefinitionValidatorImpl(this)) } - override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> { - return listOf(BluePrintNodeTypeValidatorImpl(this)) + override fun getNodeTypeValidators(): List<BlueprintNodeTypeValidator> { + return listOf(BlueprintNodeTypeValidatorImpl(this)) } - override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> { - return listOf(BluePrintTopologyTemplateValidatorImpl(this)) + override fun getTopologyTemplateValidators(): List<BlueprintTopologyTemplateValidator> { + return listOf(BlueprintTopologyTemplateValidatorImpl(this)) } - override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> { - return listOf(BluePrintNodeTemplateValidatorImpl(this)) + override fun getNodeTemplateValidators(): List<BlueprintNodeTemplateValidator> { + return listOf(BlueprintNodeTemplateValidatorImpl(this)) } - override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> { - return listOf(BluePrintWorkflowValidatorImpl(this)) + override fun getWorkflowValidators(): List<BlueprintWorkflowValidator> { + return listOf(BlueprintWorkflowValidatorImpl(this)) } - override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> { - return listOf(BluePrintPropertyDefinitionValidatorImpl(this)) + override fun getPropertyDefinitionValidators(): List<BlueprintPropertyDefinitionValidator> { + return listOf(BlueprintPropertyDefinitionValidatorImpl(this)) } - override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> { - return listOf(BluePrintAttributeDefinitionValidatorImpl(this)) + override fun getAttributeDefinitionValidators(): List<BlueprintAttributeDefinitionValidator> { + return listOf(BlueprintAttributeDefinitionValidatorImpl(this)) } } |