import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.junit.Test
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintRuntimeUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintRuntimeUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import kotlin.test.assertEquals
*
* @author Brinda Santh
*/
-class BluePrintRuntimeServiceTest {
+class BlueprintRuntimeServiceTest {
private val log = LoggerFactory.getLogger(this::class.toString())
fun `test Resolve NodeTemplate Properties`() {
log.info("************************ testResolveNodeTemplateProperties **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
val inputDataPath = "src/test/resources/data/default-context.json"
fun `test Resolve Relationship Properties`() {
log.info("************************ testResolveRelationshipTemplateProperties **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
val inputDataPath = "src/test/resources/data/default-context.json"
@Test
fun `test resolve NodeTemplate Capability Properties`() {
log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ BlueprintRuntimeUtils.assignInputsFromClassPathFile(
bluePrintRuntimeService.bluePrintContext(),
"data/default-context.json", executionContext
)
fun `test Resolve NodeTemplate Interface Operation Inputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ BlueprintRuntimeUtils.assignInputsFromClassPathFile(
bluePrintRuntimeService.bluePrintContext(),
"data/default-context.json", executionContext
)
fun `test Resolve NodeTemplate Interface Operation Outputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
bluePrintRuntimeService.setNodeTemplateAttributeValue(
"resource-assignment",
@Test
fun `test NodeTemplate Context Property`() {
log.info("************************ testNodeTemplateContextProperty **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
bluePrintRuntimeService.setNodeTemplateAttributeValue(
"resource-assignment-ra-component", "context1",
fun `test Resolve DSL Properties`() {
log.info("************************ resolveDSLExpression **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
bluePrintRuntimeService.setInputValue("rest-user-name", "sample-username".asJsonPrimitive())
@Test
fun `test Resolve Workflow Outputs`() {
log.info("************************ resolvePropertyAssignments **********************")
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
val assignmentParams = "{\"ipAddress\": \"127.0.0.1\", \"hostName\": \"vnf-host\"}"
@Test
fun `test resolvePropertyDefinitions using sub attributes`() {
- val bluePrintRuntimeService = getBluePrintRuntimeService()
+ val bluePrintRuntimeService = getBlueprintRuntimeService()
bluePrintRuntimeService.setNodeTemplateAttributeValue(
"resource-assignment", "assignment-map",
assertEquals("123", result["resolution"]!!.asText())
}
- private fun getBluePrintRuntimeService(): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ private fun getBlueprintRuntimeService(): BlueprintRuntimeService<MutableMap<String, JsonNode>> {
val blueprintBasePath = normalizedPathName(TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG)
- val blueprintRuntime = BluePrintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath)
- val checkProcessId = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID)
- val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
+ val blueprintRuntime = BlueprintMetadataUtils.bluePrintRuntime("1234", blueprintBasePath)
+ val checkProcessId = blueprintRuntime.get(BlueprintConstants.PROPERTY_BLUEPRINT_PROCESS_ID)
+ val checkBasePath = blueprintRuntime.get(BlueprintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
assertEquals(
"1234".asJsonPrimitive(),