CCSDK-1637: Fix DGWorkflowExecutionServiceTest fail if run 1st 04/94104/1
authorebo <eliezio.oliveira@est.tech>
Thu, 22 Aug 2019 11:38:01 +0000 (11:38 +0000)
committerebo <eliezio.oliveira@est.tech>
Thu, 22 Aug 2019 11:38:01 +0000 (11:38 +0000)
The failure depends on the ordering of the test classes, which in turn
depends on the file system ordering (Surefire plugin's default. See
https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#runOrder)

This class is sharing the same SB context configuration of the
BlueprintServiceLogicTest, but the later manually changes the global
BluePrintDependencyService.
It was fixed by repeating the same change on the
DGWorkflowExecutionServiceTest.

Change-Id: I6f76948a766f8d56446a987cb61a781dc0d3f501
Issue-ID: CCSDK-1637
Signed-off-by: ebo <eliezio.oliveira@est.tech>
ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt

index ac2d7d6..6e7e3cb 100644 (file)
 package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
 
 import kotlinx.coroutines.runBlocking
+import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonReactorUtils
 import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.test.annotation.DirtiesContext
 import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.junit4.SpringRunner
 import kotlin.test.assertEquals
@@ -35,10 +39,18 @@ import kotlin.test.assertNotNull
 @ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
 class DGWorkflowExecutionServiceTest {
 
+    @Autowired
+    lateinit var applicationContext: ApplicationContext
+
     @Autowired
     lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService
 
 
+    @Before
+    fun init() {
+        BluePrintDependencyService.inject(applicationContext)
+    }
+
     @Test
     fun testExecuteDirectedGraph() {
         runBlocking {