Merge "Data Dictionary has erroneous resolution source for vnf-name."
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / services / execution-service / src / test / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / services / execution / scripts / AbstractComponentFunctionTest.kt
index 224319c..2fc9a99 100644 (file)
@@ -34,15 +34,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.componentScriptExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
 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.normalizedPathName
+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.service.DefaultBluePrintRuntimeService
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.junit4.SpringRunner
@@ -70,9 +70,6 @@ class AbstractComponentFunctionTest {
         every { blueprintContext.rootPath } returns normalizedPathName("target")
     }
 
-    /**
-     * Tests the abstract component functionality.
-     */
     @Test
     fun testAbstractComponent() {
         runBlocking {
@@ -95,9 +92,18 @@ class AbstractComponentFunctionTest {
         }
     }
 
-    /**
-     * Tests the abstract script component functionality.
-     */
+    @Test
+    fun testComponentFunctionPayload() {
+        val sampleComponent = SampleComponent()
+        sampleComponent.workflowName = "sample-action"
+        sampleComponent.executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+            "payload/requests/sample-execution-request.json", ExecutionServiceInput::class.java)!!
+        val payload = sampleComponent.requestPayload()
+        assertNotNull(payload, "failed to get payload")
+        val data = sampleComponent.requestPayloadActionProperty("data")?.first()
+        assertNotNull(data, "failed to get payload request action data")
+    }
+
     @Test
     fun testAbstractScriptComponent() {
         runBlocking {
@@ -187,8 +193,9 @@ class AbstractComponentFunctionTest {
 
     @Test
     fun testComponentScriptExecutorNodeType() {
-        val componentScriptExecutor = BluePrintTypes.componentScriptExecutor()
+        val componentScriptExecutor = BluePrintTypes.nodeTypeComponentScriptExecutor()
         assertNotNull(componentScriptExecutor.interfaces, "failed to get interface operations")
     }
+
 }