From 0007063cc856483e36dd49718dea5dda80ed6809 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Wed, 3 Apr 2019 21:36:57 -0400 Subject: Improve step data access. Change-Id: I3917905b1e38cebcb26e4422784a5553e2dbac9f Issue-ID: CCSDK-1127 Signed-off-by: Muthuramalingam, Brinda Santh --- .../executor/ComponentNetconfExecutorTest.kt | 43 +++++++++++++--------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'ms/blueprintsprocessor/functions/netconf-executor/src/test') diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt index b84c2d1ae..575117b15 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt @@ -2,6 +2,7 @@ * Copyright © 2017-2018 AT&T Intellectual Property. * * Modifications Copyright © 2019 IBM, Bell Canada. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +20,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor import com.fasterxml.jackson.databind.JsonNode +import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement @@ -41,7 +44,7 @@ import org.springframework.test.context.junit4.SpringRunner @TestPropertySource(properties = ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_netconf,./../../../../components/scripts/python/ccsdk_blueprints", "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_netconf"], - locations = ["classpath:application-test.properties"]) + locations = ["classpath:application-test.properties"]) class ComponentNetconfExecutorTest { @Autowired @@ -51,28 +54,32 @@ class ComponentNetconfExecutorTest { @Test fun testComponentNetconfExecutor() { - val executionServiceInput = JacksonUtils.readValueFromClassPathFile("requests/sample-activate-request.json", - ExecutionServiceInput::class.java)!! + runBlocking { + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("requests/sample-activate-request.json", + ExecutionServiceInput::class.java)!! - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", - "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", + "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration") - val executionContext = bluePrintRuntimeService.getExecutionContext() + val executionContext = bluePrintRuntimeService.getExecutionContext() - componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService + componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService - //TODO("Set Attribute properties") - val stepMetaData: MutableMap = hashMapOf() - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-netconf") - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentNetconfExecutor") - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") - // Set Step Inputs in Blueprint Runtime Service - bluePrintRuntimeService.put("activate-netconf-step-inputs", stepMetaData.asJsonNode()) - - componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService - componentNetconfExecutor.stepName = "activate-netconf" - componentNetconfExecutor.apply(executionServiceInput) + //TODO("Set Attribute properties") + val stepMetaData: MutableMap = hashMapOf() + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-netconf") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentNetconfExecutor") + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") + // Set Step Inputs in Blueprint Runtime Service + componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService + val stepInputData = StepData().apply { + name = "activate-netconf" + properties = stepMetaData + } + executionServiceInput.stepData = stepInputData + componentNetconfExecutor.applyNB(executionServiceInput) + } } } -- cgit 1.2.3-korg