+
+ @Test
+ fun `Should handle errors from resolve workflow output`() {
+ val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk()
+ val bluePrintWorkflowExecutionServiceImpl = BluePrintWorkflowExecutionServiceImpl(
+ mockk(), mockk(), imperativeWorkflowExecutionService)
+ val bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>> = mockk()
+ val bluePrintContext: BluePrintContext = mockk()
+ val executionServiceInput = ExecutionServiceInput().apply {
+ this.actionIdentifiers = ActionIdentifiers().apply { this.actionName = "config-assign" }
+ this.commonHeader = CommonHeader()
+ this.payload = """{"config-assign-request": {}}""".asJsonType() as ObjectNode
+ }
+ val workflow = Workflow().apply {
+ this.steps = mutableMapOf("one" to Step(), "two" to Step())
+ }
+ val blueprintError = BluePrintError()
+
+ every { bluePrintRuntimeService.bluePrintContext() } returns bluePrintContext
+ every { bluePrintRuntimeService.assignWorkflowInputs(any(), any()) } returns Unit
+ every { bluePrintContext.workflowByName(any()) } returns workflow
+ every {
+ bluePrintRuntimeService.resolveWorkflowOutputs(any())
+ } throws RuntimeException("failed to resolve property...")
+ every {
+ runBlocking {
+ imperativeWorkflowExecutionService.executeBluePrintWorkflow(any(), any(), any())
+ }
+ } returns ExecutionServiceOutput()
+ every { bluePrintRuntimeService.getBluePrintError() } returns blueprintError
+
+ runBlocking {
+ val output = bluePrintWorkflowExecutionServiceImpl.executeBluePrintWorkflow(
+ bluePrintRuntimeService, executionServiceInput, mutableMapOf())
+ assertEquals("failed to resolve property...", blueprintError.errors[0])
+ assertEquals("""{"config-assign-response":{}}""".asJsonType(), output.payload)
+ }
+ }