aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt6
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt29
4 files changed, 20 insertions, 21 deletions
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
index c7f35f7c8..1b84964e8 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
@@ -41,12 +41,6 @@ abstract class CliComponentFunction : AbstractScriptComponentFunction() {
return file.readNBLines()
}
- suspend fun generateMessage(artifactName: String, json: String): String {
- val templateService = BluePrintTemplateService()
- return templateService.generateContent(bluePrintRuntimeService, nodeTemplateName, artifactName, json, true)
- }
-
-
fun generateMessage(artifactName: String): String {
return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
}
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
index 18d4a4797..0955ace79 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
@@ -20,6 +20,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.CliComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.ComponentCliExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
import org.slf4j.LoggerFactory
open class TestCliScriptFunction : CliComponentFunction() {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index ebff47899..fe5906220 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -59,7 +59,8 @@ interface ResourceResolutionService {
@Service(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
open class ResourceResolutionServiceImpl(private var applicationContext: ApplicationContext,
- private var resolutionResultService: ResourceResolutionResultService) :
+ private var resolutionResultService: ResourceResolutionResultService,
+ private var blueprintTemplateService: BluePrintTemplateService) :
ResourceResolutionService {
private val log = LoggerFactory.getLogger(ResourceResolutionService::class.java)
@@ -137,7 +138,6 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
// Check Template is there
if (artifactTemplate != null) {
- val blueprintTemplateService = BluePrintTemplateService()
resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName,
artifactTemplate, resolvedParamJsonContent)
@@ -189,6 +189,7 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
// Set errors from RA
blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError())
} catch (e: RuntimeException) {
+ log.error("Fail in processing ${resourceAssignment.name}", e)
throw BluePrintProcessorException(e)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
index 2e91eb93f..242739067 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
@@ -15,8 +15,11 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.TextNode
+import io.mockk.every
+import io.mockk.spyk
import kotlinx.coroutines.runBlocking
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
@@ -28,7 +31,7 @@ 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.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [InputResourceResolutionProcessor::class])
@@ -38,20 +41,21 @@ class InputResourceResolutionProcessorTest {
@Autowired
lateinit var inputResourceResolutionProcessor: InputResourceResolutionProcessor
- @Ignore
@Test
- fun `test input resource resolution`() {
+ fun `InputResourceResolutionProcessor should be able to resolve a value for an input parameter`() {
runBlocking {
+
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
"./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
- val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
+ val resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext))
- inputResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
- inputResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintContext.rootPath)
+ // mocking input for resource resolution
+ val textNode: JsonNode = TextNode("any value")
+ every {resourceAssignmentRuntimeService.getInputValue("rr-name") } returns textNode
- //TODO ("Mock the input Values")
+ inputResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
+ inputResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils.resourceDefinitions(bluePrintContext.rootPath)
val resourceAssignment = ResourceAssignment().apply {
name = "rr-name"
@@ -62,9 +66,8 @@ class InputResourceResolutionProcessorTest {
}
}
- val processorName = inputResourceResolutionProcessor.applyNB(resourceAssignment)
- assertNotNull(processorName, "couldn't get Input resource assignment processor name")
- println(processorName)
+ val operationOutcome = inputResourceResolutionProcessor.applyNB(resourceAssignment)
+ assertTrue(operationOutcome, "An error occurred while trying to test the InputResourceResolutionProcessor")
}
}
-} \ No newline at end of file
+}