From adcd4f2bc695840e9ecbc05003bc52c675f22fec Mon Sep 17 00:00:00 2001 From: KAPIL SINGAL Date: Fri, 22 Jan 2021 11:49:51 -0500 Subject: Renaming Files having BluePrint to have Blueprint Replacing BluePrint with Blueprint throughout Issue-ID: CCSDK-3098 Signed-off-by: KAPIL SINGAL Change-Id: Ibee8bad07ae7d9287073db2d4f2f2cd730fa8b96 --- .../BluePrintWorkflowExecutionServiceImplTest.kt | 185 --------------------- .../services/workflow/BlueprintServiceLogicTest.kt | 24 +-- .../BlueprintWorkflowExecutionServiceImplTest.kt | 185 +++++++++++++++++++++ .../workflow/DGWorkflowExecutionServiceTest.kt | 18 +- .../ImperativeWorkflowExecutionServiceTest.kt | 24 +-- .../workflow/NodeTemplateExecutionServiceTest.kt | 18 +- .../workflow/mock/MockComponentFunction.kt | 4 +- 7 files changed, 229 insertions(+), 229 deletions(-) delete mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt create mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/test') diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt deleted file mode 100644 index b661e73a5..000000000 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright © 2019 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow - -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.node.ObjectNode -import io.mockk.every -import io.mockk.mockk -import io.mockk.mockkObject -import io.mockk.unmockkAll -import kotlinx.coroutines.runBlocking -import org.junit.After -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers -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.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.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.utils.JacksonUtils -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.mock.mockito.MockBean -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.junit4.SpringRunner -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.test.assertNotNull - -@RunWith(SpringRunner::class) -@ContextConfiguration(classes = [WorkflowServiceConfiguration::class]) -class BluePrintWorkflowExecutionServiceImplTest { - - @Autowired - lateinit var bluePrintWorkflowExecutionService: BluePrintWorkflowExecutionService - - @MockBean - lateinit var bluePrintClusterService: BluePrintClusterService - - @Before - fun init() { - mockkObject(BluePrintDependencyService) - every { BluePrintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction() - } - - @After - fun afterTests() { - unmockkAll() - } - - @Test - fun testBluePrintWorkflowExecutionService() { - runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( - "1234", - "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - ) - - val executionServiceInput = JacksonUtils.readValueFromClassPathFile( - "execution-input/resource-assignment-input.json", - ExecutionServiceInput::class.java - )!! - - val executionServiceOutput = bluePrintWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) - - assertNotNull(executionServiceOutput, "failed to get response") - assertEquals( - BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, - "failed to get successful response" - ) - } - } - - @Test - fun testImperativeBluePrintWorkflowExecutionService() { - runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( - "1234", - "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - ) - - val executionServiceInput = JacksonUtils.readValueFromClassPathFile( - "execution-input/imperative-test-input.json", - ExecutionServiceInput::class.java - )!! - - val executionServiceOutput = bluePrintWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) - - assertNotNull(executionServiceOutput, "failed to get response") - assertEquals( - 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) { - runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( - "1234", - "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" - ) - // service input will have a mislabeled input params, we are expecting to get an error when that happens with a useful error message - val executionServiceInput = - JacksonUtils.readValueFromClassPathFile( - "execution-input/resource-assignment-input-missing-resource_assignment_request.json", - ExecutionServiceInput::class.java - )!! - - val executionServiceOutput = bluePrintWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) - } - } - } - - @Test - fun `Should handle errors from resolve workflow output`() { - val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk() - val bluePrintWorkflowExecutionServiceImpl = BluePrintWorkflowExecutionServiceImpl( - mockk(), mockk(), imperativeWorkflowExecutionService - ) - val bluePrintRuntimeService: BluePrintRuntimeService> = 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) - } - } -} diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt index d391050a6..e7dd9dedb 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt @@ -22,13 +22,13 @@ 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.core.service.BluePrintClusterService +import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.PrototypeComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.SingletonComponentFunction -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.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.boot.test.mock.mockito.MockBean @@ -49,17 +49,17 @@ class BlueprintServiceLogicTest { lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService @MockBean - lateinit var bluePrintClusterService: BluePrintClusterService + lateinit var bluePrintClusterService: BlueprintClusterService @Before fun init() { - BluePrintDependencyService.inject(applicationContext) + BlueprintDependencyService.inject(applicationContext) } @Test fun testExecuteGraphWithSingleComponent() { runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( "1234", "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -72,10 +72,10 @@ class BlueprintServiceLogicTest { bluePrintRuntimeService.assignWorkflowInputs("resource-assignment", input) val executionServiceOutput = dgWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf()) + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf()) assertNotNull(executionServiceOutput, "failed to get response") assertEquals( - BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, + BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, "failed to get successful response" ) } @@ -84,7 +84,7 @@ class BlueprintServiceLogicTest { @Test fun testExecuteGraphWithMultipleComponents() { runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( "1234", "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -97,10 +97,10 @@ class BlueprintServiceLogicTest { bluePrintRuntimeService.assignWorkflowInputs("assign-activate", input) val executionServiceOutput = dgWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf()) + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf()) assertNotNull(executionServiceOutput, "failed to get response") assertEquals( - BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, + BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, "failed to get successful response" ) } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt new file mode 100644 index 000000000..0bd1c33c9 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt @@ -0,0 +1,185 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.ObjectNode +import io.mockk.every +import io.mockk.mockk +import io.mockk.mockkObject +import io.mockk.unmockkAll +import kotlinx.coroutines.runBlocking +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers +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.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.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.utils.JacksonUtils +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.mock.mockito.MockBean +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNotNull + +@RunWith(SpringRunner::class) +@ContextConfiguration(classes = [WorkflowServiceConfiguration::class]) +class BlueprintWorkflowExecutionServiceImplTest { + + @Autowired + lateinit var bluePrintWorkflowExecutionService: BlueprintWorkflowExecutionService + + @MockBean + lateinit var bluePrintClusterService: BlueprintClusterService + + @Before + fun init() { + mockkObject(BlueprintDependencyService) + every { BlueprintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction() + } + + @After + fun afterTests() { + unmockkAll() + } + + @Test + fun testBlueprintWorkflowExecutionService() { + runBlocking { + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + "1234", + "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) + + val executionServiceInput = JacksonUtils.readValueFromClassPathFile( + "execution-input/resource-assignment-input.json", + ExecutionServiceInput::class.java + )!! + + val executionServiceOutput = bluePrintWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) + + assertNotNull(executionServiceOutput, "failed to get response") + assertEquals( + BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, + "failed to get successful response" + ) + } + } + + @Test + fun testImperativeBlueprintWorkflowExecutionService() { + runBlocking { + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + "1234", + "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) + + val executionServiceInput = JacksonUtils.readValueFromClassPathFile( + "execution-input/imperative-test-input.json", + ExecutionServiceInput::class.java + )!! + + val executionServiceOutput = bluePrintWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) + + assertNotNull(executionServiceOutput, "failed to get response") + assertEquals( + 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) { + runBlocking { + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + "1234", + "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" + ) + // service input will have a mislabeled input params, we are expecting to get an error when that happens with a useful error message + val executionServiceInput = + JacksonUtils.readValueFromClassPathFile( + "execution-input/resource-assignment-input-missing-resource_assignment_request.json", + ExecutionServiceInput::class.java + )!! + + val executionServiceOutput = bluePrintWorkflowExecutionService + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) + } + } + } + + @Test + fun `Should handle errors from resolve workflow output`() { + val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService = mockk() + val bluePrintWorkflowExecutionServiceImpl = BlueprintWorkflowExecutionServiceImpl( + mockk(), mockk(), imperativeWorkflowExecutionService + ) + val bluePrintRuntimeService: BlueprintRuntimeService> = 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) + } + } +} diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt index cc1bfee7f..355939cdd 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt @@ -22,11 +22,11 @@ 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.core.service.BluePrintClusterService +import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService 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.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.boot.test.mock.mockito.MockBean @@ -47,18 +47,18 @@ class DGWorkflowExecutionServiceTest { lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService @MockBean - lateinit var bluePrintClusterService: BluePrintClusterService + lateinit var bluePrintClusterService: BlueprintClusterService @Before fun init() { - BluePrintDependencyService.inject(applicationContext) + BlueprintDependencyService.inject(applicationContext) } @Test fun testExecuteDirectedGraph() { runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( "1234", "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -70,14 +70,14 @@ class DGWorkflowExecutionServiceTest { val input = executionServiceInput.payload.get("resource-assignment-request") bluePrintRuntimeService.assignWorkflowInputs("resource-assignment", input) - val executionServiceOutput = dgWorkflowExecutionService.executeBluePrintWorkflow( + val executionServiceOutput = dgWorkflowExecutionService.executeBlueprintWorkflow( bluePrintRuntimeService, executionServiceInput, mutableMapOf() ) assertNotNull(executionServiceOutput, "failed to get response") assertEquals( - BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, + BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, "failed to get successful response" ) } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt index 2367422a7..9ba607cd4 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt @@ -28,15 +28,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeCompone import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.MockComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock.mockNodeTemplateComponentScriptExecutor import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName -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.utils.BluePrintMetadataUtils +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.utils.BlueprintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import kotlin.test.Test import kotlin.test.assertEquals @@ -48,8 +48,8 @@ class ImperativeWorkflowExecutionServiceTest { @Before fun init() { - mockkObject(BluePrintDependencyService) - every { BluePrintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction() + mockkObject(BlueprintDependencyService) + every { BlueprintDependencyService.applicationContext.getBean(any()) } returns MockComponentFunction() } @After @@ -101,7 +101,7 @@ class ImperativeWorkflowExecutionServiceTest { step("activate-licence", "activate-licence", "") } } - nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor()) + nodeType(BlueprintTypes.nodeTypeComponentScriptExecutor()) } } @@ -109,10 +109,10 @@ class ImperativeWorkflowExecutionServiceTest { fun testImperativeExecutionService() { runBlocking { val serviceTemplate = mockServiceTemplate() - val bluePrintContext = BluePrintContext(serviceTemplate) + val bluePrintContext = BlueprintContext(serviceTemplate) bluePrintContext.rootPath = normalizedPathName(".") bluePrintContext.entryDefinition = "cba.imperative.test.ImperativeTestDefinitions.kt" - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("12345", bluePrintContext) + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime("12345", bluePrintContext) val executionServiceInput = JacksonUtils .readValueFromClassPathFile( @@ -122,10 +122,10 @@ class ImperativeWorkflowExecutionServiceTest { val imperativeWorkflowExecutionService = ImperativeWorkflowExecutionService(NodeTemplateExecutionService(mockk())) val output = imperativeWorkflowExecutionService - .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) + .executeBlueprintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf()) assertNotNull(output, "failed to get imperative workflow output") assertNotNull(output.status, "failed to get imperative workflow output status") - assertEquals(output.status.message, BluePrintConstants.STATUS_SUCCESS) + assertEquals(output.status.message, BlueprintConstants.STATUS_SUCCESS) assertEquals(output.status.eventType, EventType.EVENT_COMPONENT_EXECUTED.name) } } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt index f30086596..70b52d053 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt @@ -24,11 +24,11 @@ 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.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.service.BluePrintDependencyService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils +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.JacksonUtils import org.springframework.boot.test.mock.mockito.MockBean import org.springframework.test.context.ContextConfiguration @@ -42,12 +42,12 @@ import kotlin.test.assertNotNull class NodeTemplateExecutionServiceTest { @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 @@ -58,7 +58,7 @@ class NodeTemplateExecutionServiceTest { @Test fun testExecuteNodeTemplate() { runBlocking { - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( + val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( "1234", "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -79,7 +79,7 @@ class NodeTemplateExecutionServiceTest { assertNotNull(executionServiceOutput, "failed to get response") assertEquals( - BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, + BlueprintConstants.STATUS_SUCCESS, executionServiceOutput.status.message, "failed to get successful response" ) } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt index 9c3727288..e2bc0f131 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt @@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.mock import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.slf4j.LoggerFactory import org.springframework.beans.factory.config.ConfigurableBeanFactory @@ -29,7 +29,7 @@ import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Scope import org.springframework.stereotype.Component -fun mockNodeTemplateComponentScriptExecutor(id: String, script: String) = BluePrintTypes.nodeTemplateComponentScriptExecutor( +fun mockNodeTemplateComponentScriptExecutor(id: String, script: String) = BlueprintTypes.nodeTemplateComponentScriptExecutor( id, "mock($id) component function" ) { -- cgit 1.2.3-korg