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")
}
}
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]
)
}
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()
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]
)
}