aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2019-11-19 14:23:44 -0500
committerBrinda Santh <bs2796@att.com>2019-12-11 12:54:25 -0500
commita30e1864fadad70c797ca1248a3c1272300a6e2b (patch)
tree65b2ae886a767f1d4dbe3578524d234529c7d710 /ms/blueprintsprocessor/functions/resource-resolution/src
parent32416f7624757c87260671d74124ea3e0a122331 (diff)
Separate jython implementation and dependencies.
Refactored cds python capabilities to python-executor function, so that it will easy to disable and deprecation This change is not jython depreciation, just separating out Issue-ID: CCSDK-1865 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: I3727d72d7195c49d670c30a6fc4245f5a8599e3a
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt37
1 files changed, 15 insertions, 22 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
index 8f6ac9fd5..d84488d76 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
@@ -24,46 +24,25 @@ import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.junit.Test
-import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignment
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.BlueprintJythonService
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts.PythonExecutorProperty
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.test.context.ContextConfiguration
-import org.springframework.test.context.TestPropertySource
-import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
-@RunWith(SpringRunner::class)
-@ContextConfiguration(
- classes = [CapabilityResourceResolutionProcessor::class, ComponentFunctionScriptingService::class,
- BluePrintScriptsServiceImpl::class,
- BlueprintJythonService::class, PythonExecutorProperty::class, MockCapabilityService::class]
-)
-@TestPropertySource(
- properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]
-)
class CapabilityResourceResolutionProcessorTest {
- @Autowired
- lateinit var capabilityResourceResolutionProcessor: CapabilityResourceResolutionProcessor
-
@Test
fun `test kotlin capability`() {
runBlocking {
@@ -111,8 +90,17 @@ class CapabilityResourceResolutionProcessorTest {
"./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_python"
)
+ val componentFunctionScriptingService = mockk<ComponentFunctionScriptingService>()
+ coEvery {
+ componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(any(), BluePrintConstants.SCRIPT_JYTHON, any())
+ } returns MockCapabilityScriptRA()
+
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
+ val capabilityResourceResolutionProcessor =
+ CapabilityResourceResolutionProcessor(componentFunctionScriptingService)
+
capabilityResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
val resourceDefinition = JacksonUtils
@@ -154,6 +142,11 @@ open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
executionRequest.property!!.value = "assigned-data".asJsonPrimitive()
}
+ override fun process(executionRequest: ResourceAssignment) {
+ log.info("executing RA mock capability : ${executionRequest.name}")
+ executionRequest.property!!.value = "assigned-data".asJsonPrimitive()
+ }
+
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}