Renaming Files having BluePrint to have Blueprint
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / blueprints / blueprint-core / src / test / kotlin / org / onap / ccsdk / cds / controllerblueprints / core / service / BlueprintWorkflowServiceTest.kt
@@ -25,25 +25,25 @@ import kotlinx.coroutines.coroutineScope
 import kotlinx.coroutines.runBlocking
 import kotlinx.coroutines.withTimeout
 import org.junit.Test
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
 import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
 import org.onap.ccsdk.cds.controllerblueprints.core.logger
 import org.onap.ccsdk.cds.controllerblueprints.core.toGraph
 import kotlin.test.assertNotNull
 
-class BluePrintWorkflowServiceTest {
+class BlueprintWorkflowServiceTest {
 
     @Test
     fun testSimpleFlow() {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>E/SUCCESS, E>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -56,9 +56,9 @@ class BluePrintWorkflowServiceTest {
                     async {
                         val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                             .toGraph()
-                        val simpleWorkflow = TestBluePrintWorkFlowService()
+                        val simpleWorkflow = TestBlueprintWorkFlowService()
                         simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
-                        val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(it), it)
+                        val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(it), it)
                         assertNotNull(response, "failed to get response")
                     }
                 }
@@ -72,10 +72,10 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), arrayListOf("B"))
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -85,10 +85,10 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -98,10 +98,10 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>TO/SUCCESS, TO>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "TO", "C", "D", "E"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -111,10 +111,10 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -125,13 +125,13 @@ class BluePrintWorkflowServiceTest {
             // Failure Flow
             val failurePatGraph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val failurePathWorkflow = TestBluePrintWorkFlowService()
+            val failurePathWorkflow = TestBlueprintWorkFlowService()
             failurePathWorkflow.simulatedState = prepareSimulation(
                 arrayListOf("B", "C", "D", "E"),
                 arrayListOf("A")
             )
             val failurePathWorkflowInput = "123456"
-            val failurePathResponse = failurePathWorkflow.executeWorkflow(failurePatGraph, mockBluePrintRuntimeService(), failurePathWorkflowInput)
+            val failurePathResponse = failurePathWorkflow.executeWorkflow(failurePatGraph, mockBlueprintRuntimeService(), failurePathWorkflowInput)
             assertNotNull(failurePathResponse, "failed to get response")
         }
     }
@@ -141,10 +141,10 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, C>D/SUCCESS, D>E/SUCCESS, B>E/SUCCESS, E>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
@@ -154,20 +154,20 @@ class BluePrintWorkflowServiceTest {
         runBlocking {
             val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/SUCCESS, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
                 .toGraph()
-            val simpleWorkflow = TestBluePrintWorkFlowService()
+            val simpleWorkflow = TestBlueprintWorkFlowService()
             simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
             val input = "123456"
-            val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+            val response = simpleWorkflow.executeWorkflow(graph, mockBlueprintRuntimeService(), input)
             assertNotNull(response, "failed to get response")
         }
     }
 
-    private fun mockBluePrintRuntimeService(): BluePrintRuntimeService<*> {
-        return mockBluePrintRuntimeService("123456")
+    private fun mockBlueprintRuntimeService(): BlueprintRuntimeService<*> {
+        return mockBlueprintRuntimeService("123456")
     }
 
-    private fun mockBluePrintRuntimeService(id: String): BluePrintRuntimeService<*> {
-        val bluePrintRuntimeService = mockk<BluePrintRuntimeService<*>>()
+    private fun mockBlueprintRuntimeService(id: String): BlueprintRuntimeService<*> {
+        val bluePrintRuntimeService = mockk<BlueprintRuntimeService<*>>()
         every { bluePrintRuntimeService.id() } returns id
         return bluePrintRuntimeService
     }
@@ -184,10 +184,10 @@ class BluePrintWorkflowServiceTest {
     }
 }
 
-class TestBluePrintWorkFlowService :
-    AbstractBluePrintWorkFlowService<String, String>() {
+class TestBlueprintWorkFlowService :
+    AbstractBlueprintWorkFlowService<String, String>() {
 
-    val log = logger(TestBluePrintWorkFlowService::class)
+    val log = logger(TestBlueprintWorkFlowService::class)
 
     lateinit var simulatedState: MutableMap<String, EdgeLabel>
 
@@ -195,7 +195,7 @@ class TestBluePrintWorkFlowService :
         return EdgeLabel.SUCCESS
     }
 
-    override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: String): String {
+    override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BlueprintRuntimeService<*>, input: String): String {
         log.info("Executing Graph : $graph")
         this.graph = graph
         this.workflowId = bluePrintRuntimeService.id()
@@ -205,7 +205,7 @@ class TestBluePrintWorkFlowService :
         if (!workflowActor.isClosedForSend) {
             workflowActor().send(startMessage)
         } else {
-            throw BluePrintProcessorException("workflow actor is closed for send $workflowActor")
+            throw BlueprintProcessorException("workflow actor is closed for send $workflowActor")
         }
         return startMessage.output.await()
     }
@@ -229,7 +229,7 @@ class TestBluePrintWorkFlowService :
                 kotlinx.coroutines.delay(2)
             }
         }
-        return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
+        return simulatedState[node.id] ?: throw BlueprintException("failed to get status for the node($node)")
     }
 
     override suspend fun prepareNodeSkipMessage(node: Graph.Node): NodeSkipMessage<String, String> {
@@ -242,7 +242,7 @@ class TestBluePrintWorkFlowService :
         nodeInput: String,
         nodeOutput: String
     ): EdgeLabel {
-        return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
+        return simulatedState[node.id] ?: throw BlueprintException("failed to get status for the node($node)")
     }
 
     override suspend fun cancelNode(