From 1b779b6a43e304f87ff59b836c39c2ae376bcc2e Mon Sep 17 00:00:00 2001
From: "Singal, Kapil (ks220y)" <ks220y@att.com>
Date: Wed, 23 Jan 2019 00:52:14 -0500
Subject: Blueprint Processor: Jython Component

Component Jython Executor Test Junit Test Case enhancement

Change-Id: I5cb845d4c56d2b9e15a7eedf5095bb754c5b63ac
Issue-ID: CCSDK-993
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
---
 .../python/executor/ComponentJythonExecutorTest.kt |  8 +++++-
 .../payload/requests/sample-activate-request.json  | 31 ++++++++++++++++++++++
 .../requests/sample-activate-request.json          | 31 ----------------------
 3 files changed, 38 insertions(+), 32 deletions(-)
 create mode 100644 ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
 delete mode 100644 ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json

(limited to 'ms/blueprintsprocessor/functions/python-executor')

diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 7684b2b0..83cf59c2 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -27,6 +27,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
 import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
 import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.TestPropertySource
@@ -44,6 +45,7 @@ class ComponentJythonExecutorTest {
 
     @Test
     fun testPythonComponentInjection() {
+        /*
         val executionServiceInput = ExecutionServiceInput()
         executionServiceInput.payload = JsonNodeFactory.instance.objectNode()
 
@@ -57,8 +59,12 @@ class ComponentJythonExecutorTest {
         actionIdentifiers.actionName = "activate"
         executionServiceInput.actionIdentifiers = actionIdentifiers
 
+        */
 
-        val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(commonHeader.requestId,
+        val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
+                ExecutionServiceInput::class.java)!!
+
+        val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
                 "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
 
         val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
new file mode 100644
index 00000000..7142f045
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
@@ -0,0 +1,31 @@
+{
+  "actionIdentifiers": {
+    "actionName": "activate",
+    "blueprintName": "baseconfiguration",
+    "blueprintVersion": "1.0.0",
+    "mode": "sync"
+  },
+  "commonHeader": {
+    "flags": {
+      "force": true,
+      "ttl": 3600
+    },
+    "originatorId": "sdnc",
+    "requestId": "123456-1000",
+    "subRequestId": "sub-123456-1000",
+    "timestamp": "2012-04-23T18:25:43.511Z"
+  },
+  "payload": {
+    "resource-assignment-request": {
+      "resource-assignment-properties": {
+        "request-id": "1234",
+        "service-instance-id": "siid_1234",
+        "vnf-id": "vnf_1234",
+        "action-name": "assign-activate",
+        "scope-type": "vnf-type",
+        "hostname": "localhost",
+        "vnf_name": "temp_vnf"
+      }
+    }
+  }
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json
deleted file mode 100644
index 7142f045..00000000
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-  "actionIdentifiers": {
-    "actionName": "activate",
-    "blueprintName": "baseconfiguration",
-    "blueprintVersion": "1.0.0",
-    "mode": "sync"
-  },
-  "commonHeader": {
-    "flags": {
-      "force": true,
-      "ttl": 3600
-    },
-    "originatorId": "sdnc",
-    "requestId": "123456-1000",
-    "subRequestId": "sub-123456-1000",
-    "timestamp": "2012-04-23T18:25:43.511Z"
-  },
-  "payload": {
-    "resource-assignment-request": {
-      "resource-assignment-properties": {
-        "request-id": "1234",
-        "service-instance-id": "siid_1234",
-        "vnf-id": "vnf_1234",
-        "action-name": "assign-activate",
-        "scope-type": "vnf-type",
-        "hostname": "localhost",
-        "vnf_name": "temp_vnf"
-      }
-    }
-  }
-}
-- 
cgit