aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/workflow-service/src/test
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-04 10:25:44 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-12-04 10:31:15 -0500
commit809ef53debb3fd10de78e640e4a1626626eb8373 (patch)
treec6867fc2138fff65ea38a6a12855e77a85a4718b /ms/blueprintsprocessor/modules/services/workflow-service/src/test
parent43aeebfba2e83b5a10b1988074f15e677db23f9d (diff)
Add Blueprint Runtime Input/Output logic
Change-Id: I0355e78862096b7b4074faa882d66ce27d6e1844 Issue-ID: CCSDK-670 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/test')
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt26
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt12
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json20
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml34
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml42
8 files changed, 68 insertions, 114 deletions
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
index 46bb6f087..2d0dff53b 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
@@ -43,7 +43,7 @@ class BlueprintDGExecutionServiceTest {
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
"./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
index 341b6f840..2c1c40c9c 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -20,7 +20,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils.SvcGraphUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
@@ -34,26 +33,31 @@ class BlueprintServiceLogicTest {
private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
-
@Autowired
- lateinit var blueprintSvcLogicService: BlueprintSvcLogicService
+ lateinit var blueprintDGExecutionService: BlueprintDGExecutionService
@Test
fun testExecuteGraphWithSingleComponent() {
- val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml")
- blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput)
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
+
+
+ blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
}
@Test
fun testExecuteGraphWithMultipleComponents() {
- val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml")
- blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput)
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!!
+
+ blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
index 747be76c0..9f7a9c974 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -17,9 +17,8 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -27,7 +26,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
open class MockComponentConfiguration {
- @Bean(name = ["component-resource-assignment", "component-netconf-executor"])
+ @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"])
open fun createComponentFunction(): AbstractComponentFunction {
return MockComponentFunction()
}
@@ -35,12 +34,13 @@ open class MockComponentConfiguration {
class MockComponentFunction : AbstractComponentFunction() {
- private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+ private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component..")
+ log.info("Processing component : ${operationInputs}")
- this.executionServiceOutput = ExecutionServiceOutput()
+ bluePrintRuntimeService!!.setNodeTemplateAttributeValue(nodeTemplateName,
+ "assignment-params", "params".asJsonPrimitive())
}
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
new file mode 100644
index 000000000..d63b1d318
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
@@ -0,0 +1,23 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "assign-activate",
+ "mode": "sync"
+ },
+ "payload": {
+ "assign-activate-request": {
+ "assign-activate-properties": {
+ "request-id": "1234",
+ "action-name": "assign-activate",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json
deleted file mode 100644
index 20401fd1c..000000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "commonHeader" : {
- "originatorId" : "System",
- "requestId" : "1234",
- "subRequestId" : "1234-12234"
- },
- "actionIdentifiers" : {
- "blueprintName" : "baseconfiguration",
- "blueprintVersion" : "1.0.0",
- "actionName" : "activate",
- "mode" : "sync"
- },
- "payload" : { },
- "metadata" : {
- "current-node-template" : "resource-assignment-py",
- "current-step" : "resource-assignment-py",
- "current-operation" : "process",
- "current-interface" : "ResourceAssignmentComponent"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
new file mode 100644
index 000000000..ce7bc8e5a
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
@@ -0,0 +1,23 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "resource-assignment",
+ "mode": "sync"
+ },
+ "payload": {
+ "resource-assignment-request": {
+ "resource-assignment-properties": {
+ "request-id": "1234",
+ "action-name": "resource-assignment",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml
deleted file mode 100644
index 5ff26ad2c..000000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<service-logic
- xmlns='http://www.onap.org/sdnc/svclogic'
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
- <method rpc='ActivateNetconf' mode='sync'>
- <block atomic="true">
- <execute plugin="resource-assignment" method="process">
- <outcome value='failure'>
- <return status="failure">
- </return>
- </outcome>
- <outcome value='success'>
- <return status='success'>
- </return>
- </outcome>
- </execute>
- </block>
- </method>
-</service-logic> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml
deleted file mode 100644
index 7de61db57..000000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<service-logic
- xmlns='http://www.onap.org/sdnc/svclogic'
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
- <method rpc='ResourceAssignAndActivate' mode='sync'>
- <block atomic="true">
- <execute plugin="resource-assignment" method="process">
- <outcome value='failure'>
- <return status="failure">
- </return>
- </outcome>
- <outcome value='success'>
- <execute plugin="resource-assignment-py" method="process">
- <outcome value='failure'>
- <return status="failure">
- </return>
- </outcome>
- <outcome value='success'>
- <return status='success'>
- </return>
- </outcome>
- </execute>
- </outcome>
- </execute>
- </block>
- </method>
-</service-logic> \ No newline at end of file