Fix: Complementary JUnit tests in BlueprintProcessor 34/84034/1
authorSteve Siani <alphonse.steve.siani.djissitchi@ibm.com>
Wed, 3 Apr 2019 03:01:50 +0000 (23:01 -0400)
committerSteve Siani <alphonse.steve.siani.djissitchi@ibm.com>
Wed, 3 Apr 2019 03:04:03 +0000 (23:04 -0400)
Change-Id: I4fdad443f46e674d7cf61604105c7797e2889e11
Issue-ID: CCSDK-1187
Signed-off-by: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com>
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt

index 4a82dbd..f7f4a98 100644 (file)
@@ -97,47 +97,48 @@ class ResourceResolutionServiceTest {
     @Test
     @Throws(Exception::class)
     fun testResolveResources() {
+        runBlocking {
+            Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
 
-        Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
-
-        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 executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
-                ExecutionServiceInput::class.java)!!
+            val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
+                    ExecutionServiceInput::class.java)!!
 
-        val artefactNames = listOf("baseconfig", "another")
+            val artefactNames = listOf("baseconfig", "another")
 
-        // Prepare Inputs
-        PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
+            // Prepare Inputs
+            PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
 
-        resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", artefactNames, mapOf())
+            resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", artefactNames, mapOf())
+        }
 
     }
 
     @Test
     @Throws(Exception::class)
     fun testResolveResourcesWithMappingAndTemplate() {
+        runBlocking {
+            Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
 
-        Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
-
-        val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
-                "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
-
-        val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
-                ExecutionServiceInput::class.java)!!
+            val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+                    "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
 
-        val artifactPrefix = "another"
+            val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
+                    ExecutionServiceInput::class.java)!!
 
-        // Velocity Artifact Definition Name
-        val artifactTemplate = "$artifactPrefix-template"
-        // Resource Assignment Artifact Definition Name
-        val artifactMapping = "$artifactPrefix-mapping"
+            val artifactPrefix = "another"
 
-        // Prepare Inputs
-        PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
+            // Velocity Artifact Definition Name
+            val artifactTemplate = "$artifactPrefix-template"
+            // Resource Assignment Artifact Definition Name
+            val artifactMapping = "$artifactPrefix-mapping"
 
-        resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", artifactMapping, artifactTemplate)
+            // Prepare Inputs
+            PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService, executionServiceInput.payload, "resource-assignment")
 
+            resourceResolutionService.resolveResources(bluePrintRuntimeService, "resource-assignment", artifactMapping, artifactTemplate)
+        }
     }
 }
index ceb824d..5c9ae99 100644 (file)
@@ -18,9 +18,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
 
 import io.mockk.every
 import io.mockk.mockk
+import org.junit.Ignore
 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.services.execution.AbstractComponentFunction
 import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
@@ -51,7 +51,6 @@ class BlueprintJythonServiceTest {
 
     @Test
     fun testGetAbstractPythonPlugin() {
-
         val content = JacksonUtils.getClassPathFileContent("scripts/SamplePythonComponentNode.py")
         val dependencies: MutableMap<String, Any> = hashMapOf()
 
@@ -60,18 +59,15 @@ class BlueprintJythonServiceTest {
                         content, dependencies)
 
         assertNotNull(abstractPythonPlugin, "failed to get python component")
-
-        abstractPythonPlugin.process(ExecutionServiceInput())
-
     }
-
+    
     @Test
     fun testGetAbstractJythonComponent() {
-
         val scriptInstance = "test-classes/scripts/SamplePythonComponentNode.py"
 
         val abstractJythonComponent = blueprintJythonService.jythonComponentInstance(blueprintContext, scriptInstance)
 
         assertNotNull(abstractJythonComponent, "failed to get Jython component")
+
     }
 }
\ No newline at end of file