aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt29
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt33
3 files changed, 63 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java
index 8aeb41531..0f3b4a821 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/resource/api/ResourceResolutionController.java
@@ -19,7 +19,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.resource.api;
import io.swagger.annotations.ApiOperation;
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput;
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput;
-import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.ResourceResolutionService;
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
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 2c1c40c9c..7312d2def 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,12 +20,16 @@ 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.mock.PrototypeComponentFunction
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock.SingletonComponentFunction
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
+import kotlin.test.assertEquals
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
@@ -34,6 +38,9 @@ class BlueprintServiceLogicTest {
private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
@Autowired
+ lateinit var applicationContext: ApplicationContext
+
+ @Autowired
lateinit var blueprintDGExecutionService: BlueprintDGExecutionService
@Test
@@ -61,4 +68,26 @@ class BlueprintServiceLogicTest {
}
+ @Test
+ fun testSingleton() {
+ val singleton1 = applicationContext.getBean(SingletonComponentFunction::class.java)
+ singleton1.stepName = "step1"
+ val singleton2 = applicationContext.getBean(SingletonComponentFunction::class.java)
+ assertEquals(singleton1.stepName, singleton2.stepName, " failed to get singleton data")
+ }
+
+ @Test
+ fun testProtoTypeFunction() {
+ val stepName1 = "step1"
+ val stepName2 = "step2"
+ val proto1 = applicationContext.getBean(PrototypeComponentFunction::class.java)
+ proto1.stepName = stepName1
+
+ val proto2 = applicationContext.getBean(PrototypeComponentFunction::class.java)
+ proto2.stepName = stepName2
+
+ assertEquals(stepName1, proto1.stepName, " Failed to match the step1 name")
+ assertEquals(stepName2, proto2.stepName, " Failed to match the step2 name")
+ }
+
} \ 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
index 9f7a9c974..1d738eef9 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
@@ -20,8 +20,11 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInp
import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Component
@Configuration
open class MockComponentConfiguration {
@@ -46,4 +49,34 @@ class MockComponentFunction : AbstractComponentFunction() {
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Recovering component..")
}
+}
+
+@Component("singleton-function")
+@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
+class SingletonComponentFunction : AbstractComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ log.info("Processing component : ${operationInputs}")
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Recovering component..")
+ }
+}
+
+@Component("prototype-function")
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+class PrototypeComponentFunction : AbstractComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ log.info("Processing component : ${operationInputs}")
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Recovering component..")
+ }
} \ No newline at end of file