X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Fmodules%2Fservices%2Fworkflow-service%2Fsrc%2Ftest%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fapps%2Fblueprintsprocessor%2Fservices%2Fworkflow%2FBlueprintServiceLogicTest.kt;h=7312d2def52740844faa1645424416ce0298826d;hb=4836b1ed3ebfa56b45f6f08951204b0a5d5187b5;hp=2c1c40c9c66f2026c66e5b11c9138ea4059aaec6;hpb=04425ebaae2abc1862160acc7674205377078b4f;p=ccsdk%2Fapps.git 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 2c1c40c9..7312d2de 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]) @@ -33,6 +37,9 @@ class BlueprintServiceLogicTest { private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java) + @Autowired + lateinit var applicationContext: ApplicationContext + @Autowired lateinit var blueprintDGExecutionService: BlueprintDGExecutionService @@ -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