import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService
import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.MockComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
-import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.mock.mockito.MockBean
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [WorkflowServiceConfiguration::class])
-class BluePrintWorkflowExecutionServiceImplTest {
+class BlueprintWorkflowExecutionServiceImplTest {
@Autowired
- lateinit var bluePrintWorkflowExecutionService: BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>
+ lateinit var bluePrintWorkflowExecutionService: BlueprintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>
@MockBean
- lateinit var bluePrintClusterService: BluePrintClusterService
+ lateinit var bluePrintClusterService: BlueprintClusterService
@Before
fun init() {
- mockkObject(BluePrintDependencyService)
- every { BluePrintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction()
+ mockkObject(BlueprintDependencyService)
+ every { BlueprintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction()
}
@After
}
@Test
- fun testBluePrintWorkflowExecutionService() {
+ fun testBlueprintWorkflowExecutionService() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(
"1234",
"./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
)!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
assertEquals(
- BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
"failed to get successful response"
)
}
}
@Test
- fun testImperativeBluePrintWorkflowExecutionService() {
+ fun testImperativeBlueprintWorkflowExecutionService() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(
"1234",
"./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
)!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
assertEquals(
- BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
"failed to get successful response"
)
}
@Test
fun `Blueprint fails on missing workflowName-parameters with a useful message`() {
- assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
+ assertFailsWith(exceptionClass = BlueprintProcessorException::class) {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(
"1234",
"./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
)!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
}
}
}
@Test
fun `Should handle errors from resolve workflow output`() {
val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk()
- val bluePrintWorkflowExecutionServiceImpl = BluePrintWorkflowExecutionServiceImpl(
+ val bluePrintWorkflowExecutionServiceImpl = BlueprintWorkflowExecutionServiceImpl(
mockk(), mockk(), imperativeWorkflowExecutionService
)
- val bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>> = mockk()
- val bluePrintContext: BluePrintContext = mockk()
+ 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()
val workflow = Workflow().apply {
this.steps = mutableMapOf("one" to Step(), "two" to Step())
}
- val blueprintError = BluePrintError()
+ val blueprintError = BlueprintError()
every { bluePrintRuntimeService.bluePrintContext() } returns bluePrintContext
every { bluePrintRuntimeService.assignWorkflowInputs(any(), any()) } returns Unit
} throws RuntimeException("failed to resolve property...")
every {
runBlocking {
- imperativeWorkflowExecutionService.executeBluePrintWorkflow(any(), any(), any())
+ imperativeWorkflowExecutionService.executeBlueprintWorkflow(any(), any(), any())
}
} returns ExecutionServiceOutput()
- every { bluePrintRuntimeService.getBluePrintError() } returns blueprintError
+ every { bluePrintRuntimeService.getBlueprintError() } returns blueprintError
runBlocking {
- val output = bluePrintWorkflowExecutionServiceImpl.executeBluePrintWorkflow(
+ val output = bluePrintWorkflowExecutionServiceImpl.executeBlueprintWorkflow(
bluePrintRuntimeService, executionServiceInput, mutableMapOf()
)
assertEquals("failed to resolve property...", blueprintError.errors[0])