2 * Copyright (C) 2019 Bell Canada.
3 * Modifications Copyright © 2019 IBM.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.mock
20 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
21 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
22 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
23 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
24 import org.slf4j.LoggerFactory
25 import org.springframework.context.annotation.Bean
26 import org.springframework.context.annotation.Configuration
29 open class MockComponentConfiguration {
31 @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"])
32 open fun createComponentFunction(): AbstractComponentFunction {
33 return MockComponentFunction()
37 class MockComponentFunction : AbstractComponentFunction() {
39 private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
41 override suspend fun processNB(executionRequest: ExecutionServiceInput) {
42 log.info("Processing component : $operationInputs")
44 bluePrintRuntimeService.setNodeTemplateAttributeValue(
46 "assignment-params", "params".asJsonPrimitive()
50 override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
51 log.info("Recovering component..")
55 open class MockResourceSource {
58 "rr-processor-source-input",
59 "rr-processor-source-default",
60 "rr-processor-source-db",
61 "rr-processor-source-rest"]
63 open fun sourceInstance(): ResourceAssignmentProcessor {
64 return mockk<ResourceAssignmentProcessor>()