aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/workflow-service/src/test
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-13 16:47:33 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-13 16:47:33 -0500
commitcbbe0eac48b8df6e616f56a8ef51fbc7c955d171 (patch)
treee9a5b4a4bfc2da3e97bfb32094ae8af1bd973c24 /ms/blueprintsprocessor/modules/services/workflow-service/src/test
parentb0c989325aff489c06c32fad3aa1c996d5a4b7d6 (diff)
Blueprints Processor Microservice
Implement basic blueprint service logic workflow execution engine. Change-Id: Ifbbad70f2bdc4ba879b07d972083a411c7cc02f1 Issue-ID: CCSDK-672 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/BlueprintServiceLogicTest.kt62
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt46
-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
4 files changed, 184 insertions, 0 deletions
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
new file mode 100644
index 000000000..5c90852ee
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+
+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.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.junit4.SpringRunner
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
+class BlueprintServiceLogicTest {
+
+ private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ @Autowired
+ lateinit var blueprintSvcLogicService: BlueprintSvcLogicService
+
+ @Test
+ fun testExecuteGraphWithSingleComponent() {
+
+ val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml")
+ val svcLogicContext = BlueprintSvcLogicContext()
+ svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
+ svcLogicContext.setRequest(ExecutionServiceInput())
+ blueprintSvcLogicService.execute(graph, svcLogicContext)
+
+ }
+
+ @Test
+ fun testExecuteGraphWithMultipleComponents() {
+ val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml")
+ val svcLogicContext = BlueprintSvcLogicContext()
+ svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
+ svcLogicContext.setRequest(ExecutionServiceInput())
+ blueprintSvcLogicService.execute(graph, svcLogicContext)
+
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..5787721ca
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+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.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
+import org.slf4j.LoggerFactory
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+open class MockComponentConfiguration {
+
+ @Bean(name = ["component-resource-assignment", "component-netconf-executor"])
+ open fun createComponentFunction(): AbstractComponentFunction {
+ return MockComponentFunction()
+ }
+}
+
+class MockComponentFunction : AbstractComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ super.process(executionRequest)
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ super.recover(runtimeException, executionRequest)
+ }
+} \ 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
new file mode 100644
index 000000000..5ff26ad2c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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
new file mode 100644
index 000000000..7de61db57
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml
@@ -0,0 +1,42 @@
+<!--
+ ~ 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