diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
38 files changed, 382 insertions, 382 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt index 69db6cf8e..8087f7e3f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt @@ -1,12 +1,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService -class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BlueprintContext) : - DefaultBlueprintRuntimeService(id, bluePrintContext) { +class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext) : + DefaultBluePrintRuntimeService(id, bluePrintContext) { private lateinit var resolutionId: String private var resourceStore: MutableMap<String, JsonNode> = hashMapOf() @@ -29,7 +29,7 @@ class ResourceAssignmentRuntimeService(private var id: String, private var blueP fun getResolutionStore(key: String): JsonNode { return resourceStore[key] - ?: throw BlueprintProcessorException("failed to get execution property ($key)") + ?: throw BluePrintProcessorException("failed to get execution property ($key)") } fun checkResolutionStore(key: String): Boolean { @@ -62,7 +62,7 @@ class ResourceAssignmentRuntimeService(private var id: String, private var blueP fun getDictionaryStore(key: String): JsonNode { return resourceStore["dictionary-$key"] - ?: throw BlueprintProcessorException("failed to get execution property (dictionary-$key)") + ?: throw BluePrintProcessorException("failed to get execution property (dictionary-$key)") } fun checkDictionaryStore(key: String): Boolean { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt index 66077c4ed..c755e89bf 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertyDefinitionBuilder @@ -24,12 +24,12 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition /** Resource Definition DSL **/ -fun BlueprintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit): +fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit): MutableMap<String, ResourceDefinition> { return ResourceDefinitionsBuilder().apply(block).build() } -fun BlueprintTypes.resourceDefinition( +fun BluePrintTypes.resourceDefinition( name: String, description: String, block: ResourceDefinitionBuilder.() -> Unit @@ -38,12 +38,12 @@ fun BlueprintTypes.resourceDefinition( } /** Resource Mapping DSL **/ -fun BlueprintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit): +fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit): MutableMap<String, ResourceAssignment> { return ResourceAssignmentsBuilder().apply(block).build() } -fun BlueprintTypes.resourceAssignment( +fun BluePrintTypes.resourceAssignment( name: String, dictionaryName: String, dictionarySource: String, diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt index ada1a720e..0435d1d2c 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt @@ -22,7 +22,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory import com.fasterxml.jackson.databind.node.ObjectNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing @@ -94,11 +94,11 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re // validate inputs if we need to store the resource and template resolution. if (storeResult) { if (resolutionKey.isNotEmpty() && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) { - throw BlueprintProcessorException("Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.") + throw BluePrintProcessorException("Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.") } else if ((resourceType.isNotEmpty() && resourceId.isEmpty()) || (resourceType.isEmpty() && resourceId.isNotEmpty())) { - throw BlueprintProcessorException("Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.") + throw BluePrintProcessorException("Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.") } else if (resourceType.isEmpty() && resourceId.isEmpty() && resolutionKey.isEmpty()) { - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Can't proceed with the resolution: can't persist resolution without a correlation key. " + "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false." ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt index c8b9e2c87..774873a43 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt @@ -17,8 +17,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import com.fasterxml.jackson.databind.JsonNode -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.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType @@ -33,94 +33,94 @@ import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType /** Component Extensions **/ fun ServiceTemplateBuilder.nodeTypeComponentResourceResolution() { - val nodeType = BlueprintTypes.nodeTypeComponentResourceResolution() + val nodeType = BluePrintTypes.nodeTypeComponentResourceResolution() if (this.nodeTypes == null) this.nodeTypes = hashMapOf() this.nodeTypes!![nodeType.id!!] = nodeType } -fun BlueprintTypes.nodeTypeComponentResourceResolution(): NodeType { +fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType { return nodeType( - id = "component-resource-resolution", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_COMPONENT, + id = "component-resource-resolution", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, description = "Resource Assignment Component" ) { attribute( - ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BluePrintConstants.DATA_TYPE_STRING, true ) attribute( - ResourceResolutionComponent.ATTRIBUTE_STATUS, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING, true ) operation("ResourceResolutionComponent", "ResourceResolutionComponent Operation") { inputs { property( - ResourceResolutionComponent.INPUT_REQUEST_ID, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.INPUT_REQUEST_ID, BluePrintConstants.DATA_TYPE_STRING, true, "Request Id, Unique Id for the request." ) property( - ResourceResolutionComponent.INPUT_RESOURCE_ID, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.INPUT_RESOURCE_ID, BluePrintConstants.DATA_TYPE_STRING, false, "Resource Id." ) property( - ResourceResolutionComponent.INPUT_ACTION_NAME, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.INPUT_ACTION_NAME, BluePrintConstants.DATA_TYPE_STRING, false, "Action Name of the process" ) property( - ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, BlueprintConstants.DATA_TYPE_JSON, + ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON, false, "Dynamic Json Content or DSL Json reference." ) property( - ResourceResolutionComponent.INPUT_RESOLUTION_KEY, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.INPUT_RESOLUTION_KEY, BluePrintConstants.DATA_TYPE_STRING, false, "Key for service instance related correlation." ) property( - ResourceResolutionComponent.INPUT_RESOLUTION_SUMMARY, BlueprintConstants.DATA_TYPE_BOOLEAN, + ResourceResolutionComponent.INPUT_RESOLUTION_SUMMARY, BluePrintConstants.DATA_TYPE_BOOLEAN, false, "Enables ResolutionSummary output" ) property( - ResourceResolutionComponent.INPUT_OCCURRENCE, BlueprintConstants.DATA_TYPE_INTEGER, + ResourceResolutionComponent.INPUT_OCCURRENCE, BluePrintConstants.DATA_TYPE_INTEGER, false, "Number of time to perform the resolution." ) { defaultValue(1) } property( - ResourceResolutionComponent.INPUT_STORE_RESULT, BlueprintConstants.DATA_TYPE_BOOLEAN, + ResourceResolutionComponent.INPUT_STORE_RESULT, BluePrintConstants.DATA_TYPE_BOOLEAN, false, "Whether or not to store the output." ) property( - ResourceResolutionComponent.INPUT_RESOURCE_TYPE, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.INPUT_RESOURCE_TYPE, BluePrintConstants.DATA_TYPE_STRING, false, "Request type." ) property( - ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, BlueprintConstants.DATA_TYPE_LIST, + ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, BluePrintConstants.DATA_TYPE_LIST, true, "Template , Resource Assignment Artifact Prefix names" ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } } outputs { property( - ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, BluePrintConstants.DATA_TYPE_STRING, true, "Output Response" ) property( - ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_MAP, BlueprintConstants.DATA_TYPE_MAP, + ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_MAP, BluePrintConstants.DATA_TYPE_MAP, true, "Output Resolved Values" ) property( - ResourceResolutionComponent.OUTPUT_STATUS, BlueprintConstants.DATA_TYPE_STRING, + ResourceResolutionComponent.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING, true, "Status of the Component Execution ( success or failure )" ) } @@ -134,7 +134,7 @@ fun TopologyTemplateBuilder.nodeTemplateComponentResourceResolution( description: String, block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit ) { - val nodeTemplate = BlueprintTypes.nodeTemplateComponentResourceResolution( + val nodeTemplate = BluePrintTypes.nodeTemplateComponentResourceResolution( id, description, block ) @@ -142,7 +142,7 @@ fun TopologyTemplateBuilder.nodeTemplateComponentResourceResolution( nodeTemplates!![nodeTemplate.id!!] = nodeTemplate } -fun BlueprintTypes.nodeTemplateComponentResourceResolution( +fun BluePrintTypes.nodeTemplateComponentResourceResolution( id: String, description: String, block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt index a3cc1ef18..4774ad57a 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt @@ -20,22 +20,22 @@ import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionDBService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService /** * Register the Resolution module exposed dependency */ -fun BlueprintDependencyService.resourceResolutionService(): ResourceResolutionService = +fun BluePrintDependencyService.resourceResolutionService(): ResourceResolutionService = instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION) -fun BlueprintDependencyService.resourceResolutionDBService(): ResourceResolutionDBService = +fun BluePrintDependencyService.resourceResolutionDBService(): ResourceResolutionDBService = instance(ResourceResolutionDBService::class.java) suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB( resolutionKey: String, artifactName: String ): String { - return BlueprintDependencyService.resourceResolutionService() + return BluePrintDependencyService.resourceResolutionService() .resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey) } @@ -44,7 +44,7 @@ suspend fun AbstractComponentFunction.storedResourceResolutionsNB( artifactName: String, occurrence: Int = 1 ): List<ResourceResolution> { - return BlueprintDependencyService.resourceResolutionDBService() + return BluePrintDependencyService.resourceResolutionDBService() .findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence( bluePrintRuntimeService, resolutionKey, @@ -57,7 +57,7 @@ suspend fun AbstractComponentFunction.storedResourceResolutionsNB( * Return resolved and mashed artifact content for artifact prefix [artifactPrefix] */ suspend fun AbstractComponentFunction.contentFromResolvedArtifactNB(artifactPrefix: String): String { - return BlueprintDependencyService.resourceResolutionService() + return BluePrintDependencyService.resourceResolutionService() .resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefix, mapOf()) .first } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt index ea420dca4..6b4260ad0 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt @@ -27,15 +27,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.T import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceDefinitionUtils.createResourceAssignments -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants.LOG_REDACTED -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintTemplateService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.PropertyDefinitionUtils.Companion.hasLogProtect import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -56,13 +56,13 @@ interface ResourceResolutionService { fun registeredResourceSources(): List<String> suspend fun resolveFromDatabase( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String, resolutionKey: String ): String suspend fun resolveResources( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, artifactNames: List<String>, properties: Map<String, Any>, @@ -70,7 +70,7 @@ interface ResourceResolutionService { ): ResourceResolutionResult suspend fun resolveResources( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, artifactPrefix: String, properties: Map<String, Any> @@ -80,7 +80,7 @@ interface ResourceResolutionService { * with other [resourceDefinitions] dependencies for the sources [sources] * Used to get the same resource values from multiple sources. **/ suspend fun resolveResourceDefinition( - blueprintRuntimeService: BlueprintRuntimeService<*>, + blueprintRuntimeService: BluePrintRuntimeService<*>, resourceDefinitions: MutableMap<String, ResourceDefinition>, resolveDefinition: String, sources: List<String> @@ -88,7 +88,7 @@ interface ResourceResolutionService { MutableMap<String, JsonNode> suspend fun resolveResourceAssignments( - blueprintRuntimeService: BlueprintRuntimeService<*>, + blueprintRuntimeService: BluePrintRuntimeService<*>, resourceDefinitions: MutableMap<String, ResourceDefinition>, resourceAssignments: MutableList<ResourceAssignment>, artifactPrefix: String, @@ -100,7 +100,7 @@ interface ResourceResolutionService { open class ResourceResolutionServiceImpl( private var applicationContext: ApplicationContext, private var templateResolutionDBService: TemplateResolutionService, - private var blueprintTemplateService: BlueprintTemplateService, + private var blueprintTemplateService: BluePrintTemplateService, private var resourceResolutionDBService: ResourceResolutionDBService ) : ResourceResolutionService { @@ -114,7 +114,7 @@ open class ResourceResolutionServiceImpl( } override suspend fun resolveFromDatabase( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String, resolutionKey: String ): String { @@ -126,7 +126,7 @@ open class ResourceResolutionServiceImpl( } override suspend fun resolveResources( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, artifactNames: List<String>, properties: Map<String, Any>, @@ -153,16 +153,16 @@ open class ResourceResolutionServiceImpl( val failedResolution = resourceAssignmentList.filter { it.status != "success" && it.property?.required == true }.map { it.name } if (failedResolution.isNotEmpty()) { val errorMessages = mutableListOf("Failed to resolve required values: $failedResolution").apply { - this.addAll(resourceAssignmentRuntimeService.getBlueprintError().allErrors()) + this.addAll(resourceAssignmentRuntimeService.getBluePrintError().allErrors()) } - bluePrintRuntimeService.getBlueprintError().addErrors(stepName, errorMessages) + bluePrintRuntimeService.getBluePrintError().addErrors(stepName, errorMessages) } } return ResourceResolutionResult(templateMap, assignmentMap) } override suspend fun resolveResources( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String, artifactPrefix: String, properties: Map<String, Any> @@ -181,7 +181,7 @@ open class ResourceResolutionServiceImpl( val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment::class.java) as? MutableList<ResourceAssignment> - ?: throw BlueprintProcessorException("couldn't get Dictionary Definitions") + ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions") if (isToStore(properties)) { val existingResourceResolution = isNewResolution(bluePrintRuntimeService, properties, artifactPrefix) @@ -245,7 +245,7 @@ open class ResourceResolutionServiceImpl( } override suspend fun resolveResourceDefinition( - blueprintRuntimeService: BlueprintRuntimeService<*>, + blueprintRuntimeService: BluePrintRuntimeService<*>, resourceDefinitions: MutableMap<String, ResourceDefinition>, resolveDefinition: String, sources: List<String> @@ -269,7 +269,7 @@ open class ResourceResolutionServiceImpl( * request. */ override suspend fun resolveResourceAssignments( - blueprintRuntimeService: BlueprintRuntimeService<*>, + blueprintRuntimeService: BluePrintRuntimeService<*>, resourceDefinitions: MutableMap<String, ResourceDefinition>, resourceAssignments: MutableList<ResourceAssignment>, artifactPrefix: String, @@ -292,7 +292,7 @@ open class ResourceResolutionServiceImpl( // Execute Non Dependent Assignments in parallel ( ie asynchronously ) val deferred = batchResourceAssignments .filter { it.name != "*" && it.name != "start" } - .filter { it.status != BlueprintConstants.STATUS_SUCCESS } + .filter { it.status != BluePrintConstants.STATUS_SUCCESS } .map { resourceAssignment -> async { val dictionaryName = resourceAssignment.dictionaryName @@ -302,12 +302,12 @@ open class ResourceResolutionServiceImpl( val resourceAssignmentProcessor = applicationContext.getBean(processorName) as? ResourceAssignmentProcessor - ?: throw BlueprintProcessorException( + ?: throw BluePrintProcessorException( "failed to get resource processor ($processorName) " + "for resource assignment(${resourceAssignment.name})" ) try { - // Set Blueprint Runtime Service + // Set BluePrint Runtime Service resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService // Set Resource Dictionaries resourceAssignmentProcessor.resourceDictionaries = resourceDefinitions @@ -328,10 +328,10 @@ open class ResourceResolutionServiceImpl( } // Set errors from RA - blueprintRuntimeService.setBlueprintError(resourceAssignmentRuntimeService.getBlueprintError()) + blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError()) } catch (e: RuntimeException) { log.error("Fail in processing ${resourceAssignment.name}", e) - throw BlueprintProcessorException(e) + throw BluePrintProcessorException(e) } } } @@ -359,10 +359,10 @@ open class ResourceResolutionServiceImpl( } else -> { val resourceDefinition = resourceDefinitions[dictionaryName] - ?: throw BlueprintProcessorException("couldn't get resource dictionary definition for $dictionaryName") + ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dictionaryName") val resourceSource = resourceDefinition.sources[dictionarySource] - ?: throw BlueprintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)") ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR.plus(resourceSource.type) } @@ -382,7 +382,7 @@ open class ResourceResolutionServiceImpl( // Check whether resolution already exist in the database for the specified resolution-key or resourceId/resourceType private suspend fun isNewResolution( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: Map<String, Any>, artifactPrefix: String ): List<ResourceResolution> { @@ -434,7 +434,7 @@ open class ResourceResolutionServiceImpl( resourceAssignmentList: MutableList<ResourceAssignment> ) { resourceResolutionList.forEach { resourceResolution -> - if (resourceResolution.status == BlueprintConstants.STATUS_SUCCESS) { + if (resourceResolution.status == BluePrintConstants.STATUS_SUCCESS) { resourceAssignmentList.forEach { if (compareOne(resourceResolution, it)) { log.info( diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt index a681b4f68..62ec2bdf4 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt @@ -18,8 +18,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -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.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType @@ -30,30 +30,30 @@ import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuil import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType import kotlin.reflect.KClass -fun BlueprintTypes.nodeTypeSourceInput(): NodeType { +fun BluePrintTypes.nodeTypeSourceInput(): NodeType { return nodeType( - id = "source-input", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + id = "source-input", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, description = "This is Input Resource Source Node Type" ) {} } -fun BlueprintTypes.nodeTypeSourceDefault(): NodeType { +fun BluePrintTypes.nodeTypeSourceDefault(): NodeType { return nodeType( - id = "source-default", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + id = "source-default", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, description = "This is Default Resource Source Node Type" ) {} } -fun BlueprintTypes.nodeTypeSourceDb(): NodeType { +fun BluePrintTypes.nodeTypeSourceDb(): NodeType { return nodeType( - id = "source-db", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + id = "source-db", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, description = "This is Database Resource Source Node Type" ) { property( - "type", BlueprintConstants.DATA_TYPE_STRING, + "type", BluePrintConstants.DATA_TYPE_STRING, true, "" ) { defaultValue("SQL".asJsonPrimitive()) @@ -62,42 +62,42 @@ fun BlueprintTypes.nodeTypeSourceDb(): NodeType { } } property( - "endpoint-selector", BlueprintConstants.DATA_TYPE_STRING, + "endpoint-selector", BluePrintConstants.DATA_TYPE_STRING, false, "" ) property( - "query", BlueprintConstants.DATA_TYPE_STRING, + "query", BluePrintConstants.DATA_TYPE_STRING, true, "" ) property( - "input-key-mapping", BlueprintConstants.DATA_TYPE_MAP, + "input-key-mapping", BluePrintConstants.DATA_TYPE_MAP, true, "" ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } property( - "output-key-mapping", BlueprintConstants.DATA_TYPE_MAP, + "output-key-mapping", BluePrintConstants.DATA_TYPE_MAP, false, "" ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } property( - "key-dependencies", BlueprintConstants.DATA_TYPE_LIST, + "key-dependencies", BluePrintConstants.DATA_TYPE_LIST, true, "Resource Resolution dependency dictionary names." ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } } } -fun BlueprintTypes.nodeTypeSourceRest(): NodeType { +fun BluePrintTypes.nodeTypeSourceRest(): NodeType { return nodeType( - id = "source-rest", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + id = "source-rest", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, description = "This is Rest Resource Source Node Type" ) { property( - "type", BlueprintConstants.DATA_TYPE_STRING, + "type", BluePrintConstants.DATA_TYPE_STRING, true, "" ) { defaultValue("JSON".asJsonPrimitive()) @@ -106,7 +106,7 @@ fun BlueprintTypes.nodeTypeSourceRest(): NodeType { } } property( - "verb", BlueprintConstants.DATA_TYPE_STRING, + "verb", BluePrintConstants.DATA_TYPE_STRING, true, "" ) { defaultValue("GET".asJsonPrimitive()) @@ -120,25 +120,25 @@ fun BlueprintTypes.nodeTypeSourceRest(): NodeType { } } property( - "payload", BlueprintConstants.DATA_TYPE_STRING, + "payload", BluePrintConstants.DATA_TYPE_STRING, false, "" ) { defaultValue("".asJsonPrimitive()) } property( - "endpoint-selector", BlueprintConstants.DATA_TYPE_STRING, + "endpoint-selector", BluePrintConstants.DATA_TYPE_STRING, false, "" ) property( - "url-path", BlueprintConstants.DATA_TYPE_STRING, + "url-path", BluePrintConstants.DATA_TYPE_STRING, true, "" ) property( - "path", BlueprintConstants.DATA_TYPE_STRING, + "path", BluePrintConstants.DATA_TYPE_STRING, true, "" ) property( - "expression-type", BlueprintConstants.DATA_TYPE_STRING, + "expression-type", BluePrintConstants.DATA_TYPE_STRING, false, "" ) { defaultValue("JSON_PATH".asJsonPrimitive()) @@ -147,62 +147,62 @@ fun BlueprintTypes.nodeTypeSourceRest(): NodeType { } } property( - "input-key-mapping", BlueprintConstants.DATA_TYPE_MAP, + "input-key-mapping", BluePrintConstants.DATA_TYPE_MAP, true, "" ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } property( - "output-key-mapping", BlueprintConstants.DATA_TYPE_MAP, + "output-key-mapping", BluePrintConstants.DATA_TYPE_MAP, false, "" ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } property( - "key-dependencies", BlueprintConstants.DATA_TYPE_LIST, + "key-dependencies", BluePrintConstants.DATA_TYPE_LIST, true, "Resource Resolution dependency dictionary names." ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } } } -fun BlueprintTypes.nodeTypeSourceCapability(): NodeType { +fun BluePrintTypes.nodeTypeSourceCapability(): NodeType { return nodeType( - id = "source-capability", version = BlueprintConstants.DEFAULT_VERSION_NUMBER, - derivedFrom = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, + id = "source-capability", version = BluePrintConstants.DEFAULT_VERSION_NUMBER, + derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE, description = "This is Component Resource Source Node Type" ) { property( - ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BlueprintConstants.DATA_TYPE_STRING, + ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING, true, "Request Id, Unique Id for the request." ) { - defaultValue(BlueprintConstants.SCRIPT_KOTLIN) + defaultValue(BluePrintConstants.SCRIPT_KOTLIN) constrain { validValues( arrayListOf( - BlueprintConstants.SCRIPT_KOTLIN.asJsonPrimitive(), - BlueprintConstants.SCRIPT_INTERNAL.asJsonPrimitive(), - BlueprintConstants.SCRIPT_JYTHON.asJsonPrimitive() + BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive(), + BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(), + BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive() ) ) } } property( - ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BlueprintConstants.DATA_TYPE_STRING, + ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING, true, "Kotlin Script class name or jython script name." ) property( - "key-dependencies", BlueprintConstants.DATA_TYPE_LIST, + "key-dependencies", BluePrintConstants.DATA_TYPE_LIST, true, "Resource Resolution dependency dictionary names." ) { - entrySchema(BlueprintConstants.DATA_TYPE_STRING) + entrySchema(BluePrintConstants.DATA_TYPE_STRING) } } } /** Node Template Source Input **/ -fun BlueprintTypes.nodeTemplateSourceInput( +fun BluePrintTypes.nodeTemplateSourceInput( id: String, description: String, block: SourceInputNodeTemplateBuilder.() -> Unit @@ -217,7 +217,7 @@ class SourceInputNodeTemplateBuilder(id: String, description: String) : ) /** Node Template Source Default **/ -fun BlueprintTypes.nodeTemplateSourceDefault( +fun BluePrintTypes.nodeTemplateSourceDefault( id: String, description: String, block: SourceDefaultNodeTemplateBuilder.() -> Unit @@ -232,7 +232,7 @@ class SourceDefaultNodeTemplateBuilder(id: String, description: String) : ) /** Node Template Source DB **/ -fun BlueprintTypes.nodeTemplateSourceDb( +fun BluePrintTypes.nodeTemplateSourceDb( id: String, description: String, block: SourceDbNodeTemplateBuilder.() -> Unit @@ -299,7 +299,7 @@ class KeyMappingBuilder() { } /** Node Template Source Rest **/ -fun BlueprintTypes.nodeTemplateSourceRest( +fun BluePrintTypes.nodeTemplateSourceRest( id: String, description: String, block: SourceRestNodeTemplateBuilder.() -> Unit @@ -378,7 +378,7 @@ class SourceRestNodeTemplateBuilder(id: String, description: String) : } /** Node Template Source Rest **/ -fun BlueprintTypes.nodeTemplateSourceCapability( +fun BluePrintTypes.nodeTemplateSourceCapability( id: String, description: String, block: SourceCapabilityNodeTemplateBuilder.() -> Unit diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt index a1f3249ab..71cf6ceea 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt @@ -20,10 +20,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.rest.restClientService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.KeyIdentifier import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -51,7 +51,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() { /** Check Resource Assignment has the source definitions, If not get from Resource Definitions **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " } @@ -81,7 +81,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() { resourceSourceProperties["resolved-payload"] = JacksonUtils.jsonNode(generatedPayload) // Get the Rest Client service, selector will be included in application.properties - val restClientService = BlueprintDependencyService.restClientService( + val restClientService = BluePrintDependencyService.restClientService( "ipassign-ms" ) @@ -100,7 +100,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() { "Failed to dictionary name ($dName), dictionary source($($dName) " + "response_code: ($responseStatusCode)" log.warn(errMsg) - throw BlueprintProcessorException(errMsg) + throw BluePrintProcessorException(errMsg) } // Parse the error Body and assign the property value } @@ -108,7 +108,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() { ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Failed in template key ($resourceAssignment) assignments with: ${e.message}", e ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt index 4f656a8f0..139d8232f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt @@ -20,10 +20,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.rest.restClientService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.KeyIdentifier import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -51,7 +51,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() { /** Check Resource Assignment has the source definitions, If not get from Resource Definitions **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " } @@ -82,7 +82,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() { resourceSourceProperties["resolved-payload"] = JacksonUtils.jsonNode(generatedPayload) // Get the Rest Client service, selector will be included in application.properties - val restClientService = BlueprintDependencyService.restClientService( + val restClientService = BluePrintDependencyService.restClientService( "naming-ms" ) @@ -102,7 +102,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() { "Failed to dictionary name ($dName), dictionary source($($dName) " + "response_code: ($responseStatusCode)" log.warn(errMsg) - throw BlueprintProcessorException(errMsg) + throw BluePrintProcessorException(errMsg) } // Parse the error Body and assign the property value } @@ -110,7 +110,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() { ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Failed in template key ($resourceAssignment) assignments with: ${e.message}", e ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt index 592408b67..5958c7899 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt @@ -18,9 +18,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.slf4j.LoggerFactory @@ -34,7 +34,7 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso private val log = LoggerFactory.getLogger(ResourceResolutionDBService::class.toString()) suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, key: String, occurrence: Int, artifactPrefix: String @@ -42,8 +42,8 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso return try { val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! - val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!! - val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!! + val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!! + val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!! resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence( blueprintName, @@ -58,7 +58,7 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso } suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, resourceId: String, resourceType: String, occurrence: Int, @@ -68,8 +68,8 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! - val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!! - val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!! + val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!! + val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!! resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence( blueprintName, @@ -134,15 +134,15 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso suspend fun write( properties: Map<String, Any>, - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String, resourceAssignment: ResourceAssignment ): ResourceResolution = withContext(Dispatchers.IO) { val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! - val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!! - val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!! + val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!! + val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!! val resolutionKey = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] as String val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String @@ -182,7 +182,7 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso resourceResolution.resourceType = resourceType resourceResolution.resourceId = resourceId resourceResolution.value = resourceAssignment.property?.value?.let { - if (BlueprintConstants.STATUS_SUCCESS == resourceAssignment.status) + if (BluePrintConstants.STATUS_SUCCESS == resourceAssignment.status) JacksonUtils.getValue(it).toString() else "" } ?: "" @@ -190,12 +190,12 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso resourceResolution.dictionaryName = resourceAssignment.dictionaryName resourceResolution.dictionaryVersion = resourceAssignment.version resourceResolution.dictionarySource = resourceAssignment.dictionarySource - resourceResolution.status = resourceAssignment.status ?: BlueprintConstants.STATUS_FAILURE + resourceResolution.status = resourceAssignment.status ?: BluePrintConstants.STATUS_FAILURE try { resourceResolutionRepository.saveAndFlush(resourceResolution) } catch (ex: Exception) { - throw BlueprintException("Failed to store resource resolution result.", ex) + throw BluePrintException("Failed to store resource resolution result.", ex) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt index cbd8b8310..4bdd5d985 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt @@ -18,9 +18,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.slf4j.LoggerFactory import org.springframework.dao.DataIntegrityViolationException import org.springframework.dao.EmptyResultDataAccessException @@ -33,7 +33,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa private val log = LoggerFactory.getLogger(TemplateResolutionService::class.toString()) suspend fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName( - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String, resolutionKey: String ): String = @@ -41,8 +41,8 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! - val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!! - val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!! + val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!! + val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!! findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName( blueprintName, @@ -93,14 +93,14 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa suspend fun write( properties: Map<String, Any>, result: String, - bluePrintRuntimeService: BlueprintRuntimeService<*>, + bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactPrefix: String ): TemplateResolution = withContext(Dispatchers.IO) { val metadata = bluePrintRuntimeService.bluePrintContext().metadata!! - val blueprintVersion = metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION]!! - val blueprintName = metadata[BlueprintConstants.METADATA_TEMPLATE_NAME]!! + val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!! + val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!! val resolutionKey = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] as String val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String val resourceType = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] as String @@ -187,7 +187,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message ) - throw BlueprintException("Failed to store resource api result.", ex) + throw BluePrintException("Failed to store resource api result.", ex) } } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt index 5e834d73d..9f318a314 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt @@ -22,7 +22,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Capa import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.slf4j.LoggerFactory @@ -53,7 +53,7 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc /** Check Resource Assignment has the source definitions, If not get from Resource Definition **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") val resourceSourceProps = checkNotNull(resourceSource.properties) { "failed to get $resourceSource properties" } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt index 114b5b889..98df3f1cf 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt @@ -17,14 +17,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor -import org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintDBLibGenericService +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BlueprintDBLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty @@ -47,7 +47,7 @@ import java.util.HashMap @Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-db") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) open class DatabaseResourceAssignmentProcessor( - private val bluePrintDBLibPropertyService: BlueprintDBLibPropertyService, + private val bluePrintDBLibPropertyService: BluePrintDBLibPropertyService, private val primaryDBLibGenericService: PrimaryDBLibGenericService ) : ResourceAssignmentProcessor() { @@ -66,7 +66,7 @@ open class DatabaseResourceAssignmentProcessor( } // Check the value has populated for mandatory case ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to process Database resource resolution in template key ($resourceAssignment) assignments." throw e.updateErrorMessage( ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg, @@ -74,7 +74,7 @@ open class DatabaseResourceAssignmentProcessor( ) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) } } @@ -86,7 +86,7 @@ open class DatabaseResourceAssignmentProcessor( /** Check Resource Assignment has the source definitions, If not get from Resource Definition **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " } @@ -119,7 +119,7 @@ open class DatabaseResourceAssignmentProcessor( populateResource(resourceAssignment, sourceProperties, rows) } - private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource, selector: String): BlueprintDBLibGenericService { + private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource, selector: String): BluePrintDBLibGenericService { return if (isNotEmpty(sourceProperties.endpointSelector)) { val dbPropertiesJson = raRuntimeService.resolveDSLExpression(sourceProperties.endpointSelector!!) bluePrintDBLibPropertyService.JdbcTemplate(dbPropertiesJson) @@ -128,7 +128,7 @@ open class DatabaseResourceAssignmentProcessor( } } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) private fun validate(resourceAssignment: ResourceAssignment) { checkNotEmpty(resourceAssignment.name) { "resource assignment template key is not defined" } checkNotEmpty(resourceAssignment.dictionaryName) { @@ -156,7 +156,7 @@ open class DatabaseResourceAssignmentProcessor( return namedParameters } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) private fun populateResource( resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt index e904ebcb4..9e5bd08cd 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt @@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.slf4j.LoggerFactory @@ -51,7 +51,7 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() { } // Check the value has populated for mandatory case ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to process default resource resolution in template key ($resourceAssignment) assignments." throw e.updateErrorMessage( ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg, @@ -59,7 +59,7 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() { ) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt index c3add86fd..caf6b6acb 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt @@ -20,7 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -52,13 +52,13 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { } // Check the value has populated for mandatory case ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to process input resource resolution in template key ($resourceAssignment) assignments." ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) logger.error(errorMsg) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e) + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e) } } @@ -71,7 +71,7 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { /** Check Resource Assignment has the source definitions, If not get from Resource Definition **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") try { val resourceSourceProperties = checkNotNull(resourceSource.properties) { @@ -86,7 +86,7 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() { // keyDependency = service-instance.service-instance-id setFromInputKeyDependencies(keyDependency, resourceAssignment); // New API which picks attribute from Input } catch (e: IllegalStateException) { - throw BlueprintProcessorException(e) + throw BluePrintProcessorException(e) } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt index ce00ac17b..c075e1b4d 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt @@ -22,13 +22,13 @@ import com.fasterxml.jackson.databind.JsonNode import org.apache.commons.collections.MapUtils import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.cds.controllerblueprints.core.isNullOrMissing -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintVelocityTemplateService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition import org.slf4j.LoggerFactory @@ -50,7 +50,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig */ open fun <T> scriptPropertyInstanceType(name: String): T { return scriptPropertyInstances as? T - ?: throw BlueprintProcessorException("couldn't get script property instance ($name)") + ?: throw BluePrintProcessorException("couldn't get script property instance ($name)") } open fun setFromInput(resourceAssignment: ResourceAssignment): Boolean { @@ -64,7 +64,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value) return true } - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { // NoOp - couldn't find value from input } return false @@ -83,7 +83,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig return true } } - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { // NoOp - couldn't find value from input } return false @@ -110,7 +110,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig return valueToResolve } // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString() - return BlueprintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString()) + return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString()) } final override suspend fun applyNB(resourceAssignment: ResourceAssignment): Boolean { @@ -126,7 +126,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig suspend fun executeScript(resourceAssignment: ResourceAssignment) { return when (scriptType) { - BlueprintConstants.SCRIPT_JYTHON -> { + BluePrintConstants.SCRIPT_JYTHON -> { executeScriptBlocking(resourceAssignment) } else -> { @@ -163,39 +163,39 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig */ final override fun apply(resourceAssignment: ResourceAssignment): Boolean { - throw BlueprintException("Not Implemented, use applyNB method") + throw BluePrintException("Not Implemented, use applyNB method") } final override fun prepareRequest(resourceAssignment: ResourceAssignment): ResourceAssignment { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } final override fun prepareResponse(): Boolean { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } final override suspend fun prepareRequestNB(resourceAssignment: ResourceAssignment): ResourceAssignment { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } final override suspend fun prepareResponseNB(): Boolean { - throw BlueprintException("Not Implemented required") + throw BluePrintException("Not Implemented required") } override fun process(resourceAssignment: ResourceAssignment) { - throw BlueprintException("Not Implemented, child class will implement this") + throw BluePrintException("Not Implemented, child class will implement this") } override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) { - throw BlueprintException("Not Implemented, child class will implement this") + throw BluePrintException("Not Implemented, child class will implement this") } fun addError(type: String, name: String, error: String) { - raRuntimeService.getBlueprintError().addError(type, name, error, getName()) + raRuntimeService.getBluePrintError().addError(type, name, error, getName()) } fun addError(error: String) { - raRuntimeService.getBlueprintError().addError(error, getName()) + raRuntimeService.getBluePrintError().addError(error, getName()) } fun isTemplateKeyValueNull(resourceAssignment: ResourceAssignment): Boolean { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt index c17e14000..b81455c83 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt @@ -20,11 +20,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.RestResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty @@ -44,7 +44,7 @@ import org.springframework.stereotype.Service */ @Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-rest") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) -open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyService: BlueprintRestLibPropertyService) : +open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService) : ResourceAssignmentProcessor() { private val logger = LoggerFactory.getLogger(RestResourceResolutionProcessor::class.java) @@ -66,7 +66,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS /** Check Resource Assignment has the source definitions, If not get from Resource Definitions **/ val resourceSource = resourceAssignment.dictionarySourceDefinition ?: resourceDefinition?.sources?.get(dSource) - ?: throw BlueprintProcessorException("couldn't get resource definition $dName source($dSource)") + ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)") val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " } @@ -104,7 +104,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS val responseBody = response.body val outputKeyMapping = sourceProperties.outputKeyMapping if (responseStatusCode in 200..299 && outputKeyMapping.isNullOrEmpty()) { - resourceAssignment.status = BlueprintConstants.STATUS_SUCCESS + resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS logger.info("AS>> outputKeyMapping==null, will not populateResource") } else if (responseStatusCode in 200..299 && !responseBody.isBlank()) { populateResource(resourceAssignment, sourceProperties, responseBody, path) @@ -112,12 +112,12 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS val errMsg = "Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath) response_code: ($responseStatusCode)" logger.warn(errMsg) - throw BlueprintProcessorException(errMsg) + throw BluePrintProcessorException(errMsg) } } // Check the value has populated for mandatory case ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { val errorMsg = "Failed to process REST resource resolution in template key ($resourceAssignment) assignments." ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, errorMsg) throw e.updateErrorMessage( @@ -126,7 +126,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS ) } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message) - throw BlueprintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) + throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e) } } @@ -142,7 +142,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS } } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) private fun populateResource( resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource, @@ -175,7 +175,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, parsedResponseNode) } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) private fun validate(resourceAssignment: ResourceAssignment) { checkNotEmpty(resourceAssignment.name) { "resource assignment template key is not defined" } checkNotEmpty(resourceAssignment.dictionaryName) { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt index 5a03450ed..7ab3126bb 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt @@ -26,9 +26,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.node.TextNode import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty @@ -39,8 +39,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.isNullOrMissing import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintVelocityTemplateService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonReactorUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.PropertyDefinitionUtils.Companion.hasLogProtect @@ -59,14 +59,14 @@ class ResourceAssignmentUtils { suspend fun resourceDefinitions(blueprintBasePath: String): MutableMap<String, ResourceDefinition> { val dictionaryFile = normalizedFile( - blueprintBasePath, BlueprintConstants.TOSCA_DEFINITIONS_DIR, + blueprintBasePath, BluePrintConstants.TOSCA_DEFINITIONS_DIR, ResourceResolutionConstants.FILE_NAME_RESOURCE_DEFINITION_TYPES ) checkFileExists(dictionaryFile) { "resource definition file(${dictionaryFile.absolutePath}) is missing" } return JacksonReactorUtils.getMapFromFile(dictionaryFile, ResourceDefinition::class.java) } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun setResourceDataValue( resourceAssignment: ResourceAssignment, raRuntimeService: ResourceAssignmentRuntimeService, @@ -76,7 +76,7 @@ class ResourceAssignmentUtils { return setResourceDataValue(resourceAssignment, raRuntimeService, value.asJsonType()) } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun setResourceDataValue( resourceAssignment: ResourceAssignment, raRuntimeService: ResourceAssignmentRuntimeService, @@ -108,11 +108,11 @@ class ResourceAssignmentUtils { ) setResourceValue(resourceAssignment, raRuntimeService, value) resourceAssignment.updatedDate = Date() - resourceAssignment.updatedBy = BlueprintConstants.USER_SYSTEM - resourceAssignment.status = BlueprintConstants.STATUS_SUCCESS + resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM + resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS } } catch (e: Exception) { - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Failed in setting value for template key " + "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " + "type (${resourceProp.type}) with error message (${e.message})", @@ -139,7 +139,7 @@ class ResourceAssignmentUtils { .mapValues { e -> e.value.asText() } as MutableMap<String, Any> val newValue: JsonNode try { - newValue = BlueprintVelocityTemplateService + newValue = BluePrintVelocityTemplateService .generateContent(template, null, true, resolutionStore) .also { if (hasLogProtect(metadata)) @@ -149,7 +149,7 @@ class ResourceAssignmentUtils { } .let { v -> v.asJsonType() } } catch (e: Exception) { - throw BlueprintProcessorException( + throw BluePrintProcessorException( "transform-template failed: $template", e ) } @@ -164,24 +164,24 @@ class ResourceAssignmentUtils { fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) { if (isNotEmpty(resourceAssignment.name)) { resourceAssignment.updatedDate = Date() - resourceAssignment.updatedBy = BlueprintConstants.USER_SYSTEM - resourceAssignment.status = BlueprintConstants.STATUS_FAILURE + resourceAssignment.updatedBy = BluePrintConstants.USER_SYSTEM + resourceAssignment.status = BluePrintConstants.STATUS_FAILURE resourceAssignment.message = message } } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun assertTemplateKeyValueNotNull(resourceAssignment: ResourceAssignment) { val resourceProp = checkNotNull(resourceAssignment.property) { "Failed to populate mandatory resource resource mapping $resourceAssignment" } if (resourceProp.required != null && resourceProp.required!! && resourceProp.value.isNullOrMissing()) { logger.error("failed to populate mandatory resource mapping ($resourceAssignment)") - throw BlueprintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)") + throw BluePrintProcessorException("failed to populate mandatory resource mapping ($resourceAssignment)") } } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun generateResourceDataForAssignments(assignments: List<ResourceAssignment>): String { val result: String try { @@ -209,13 +209,13 @@ class ResourceAssignmentUtils { logger.info("Generated Resource Param Data ($result)") } } catch (e: Exception) { - throw BlueprintProcessorException("Resource Assignment is failed with $e.message", e) + throw BluePrintProcessorException("Resource Assignment is failed with $e.message", e) } return result } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun generateResourceForAssignments(assignments: List<ResourceAssignment>): MutableMap<String, JsonNode> { val data: MutableMap<String, JsonNode> = hashMapOf() assignments.forEach { @@ -291,7 +291,7 @@ class ResourceAssignmentUtils { } fun transformToRARuntimeService( - blueprintRuntimeService: BlueprintRuntimeService<*>, + blueprintRuntimeService: BluePrintRuntimeService<*>, templateArtifactName: String ): ResourceAssignmentRuntimeService { @@ -305,7 +305,7 @@ class ResourceAssignmentUtils { return resourceAssignmentRuntimeService } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun getPropertyType( raRuntimeService: ResourceAssignmentRuntimeService, dataTypeName: String, @@ -321,12 +321,12 @@ class ResourceAssignmentUtils { logger.trace("Data type({})'s property ({}) is ({})", dataTypeName, propertyName, type) } catch (e: Exception) { logger.error("couldn't get data type($dataTypeName)'s property ($propertyName), error message $e") - throw BlueprintProcessorException("${e.message}", e) + throw BluePrintProcessorException("${e.message}", e) } return type } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) fun parseResponseNode( responseNode: JsonNode, resourceAssignment: ResourceAssignment, @@ -336,18 +336,18 @@ class ResourceAssignmentUtils { val metadata = resourceAssignment.property!!.metadata try { if ((resourceAssignment.property?.type).isNullOrEmpty()) { - throw BlueprintProcessorException("Couldn't get data dictionary type for dictionary name (${resourceAssignment.name})") + throw BluePrintProcessorException("Couldn't get data dictionary type for dictionary name (${resourceAssignment.name})") } val type = resourceAssignment.property!!.type val valueToPrint = getValueToLog(metadata, responseNode) logger.info("For template key (${resourceAssignment.name}) trying to get value from responseNode ($valueToPrint)") return when (type) { - in BlueprintTypes.validPrimitiveTypes() -> { + in BluePrintTypes.validPrimitiveTypes() -> { // Primitive Types parseResponseNodeForPrimitiveTypes(responseNode, resourceAssignment, outputKeyMapping) } - in BlueprintTypes.validCollectionTypes() -> { + in BluePrintTypes.validCollectionTypes() -> { // Array Types parseResponseNodeForCollection(responseNode, resourceAssignment, raRuntimeService, outputKeyMapping) } @@ -358,7 +358,7 @@ class ResourceAssignmentUtils { } } catch (e: Exception) { logger.error("Fail to parse response data, error message $e") - throw BlueprintProcessorException("${e.message}", e) + throw BluePrintProcessorException("${e.message}", e) } } @@ -387,7 +387,7 @@ class ResourceAssignmentUtils { } if (returnNode.isNullOrMissing() || returnNode!!.isComplexType() && !returnNode.has(outputKeyMapping[outputKey])) { - throw BlueprintProcessorException("Fail to find output key mapping ($outputKey) in the responseNode.") + throw BluePrintProcessorException("Fail to find output key mapping ($outputKey) in the responseNode.") } val returnValue = if (returnNode.isComplexType()) { @@ -411,7 +411,7 @@ class ResourceAssignmentUtils { val metadata = resourceAssignment.property!!.metadata var resultNode: JsonNode if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) { - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Couldn't get data type for dictionary type " + "(${resourceAssignment.property!!.type}) and dictionary name ($dName)" ) @@ -441,7 +441,7 @@ class ResourceAssignmentUtils { ) } else -> { - throw BlueprintProcessorException("Key-value response expected to match the responseNode.") + throw BluePrintProcessorException("Key-value response expected to match the responseNode.") } } } else { @@ -486,7 +486,7 @@ class ResourceAssignmentUtils { ): ObjectNode { val outputKeyMappingHasOnlyOneElement = checkIfOutputKeyMappingProvideOneElement(outputKeyMapping) when (entrySchemaType) { - in BlueprintTypes.validPrimitiveTypes() -> { + in BluePrintTypes.validPrimitiveTypes() -> { if (outputKeyMappingHasOnlyOneElement) { val outputKeyMap = outputKeyMapping.entries.first() if (resourceAssignment.keyIdentifiers.none { it.name == outputKeyMap.key }) { @@ -503,7 +503,7 @@ class ResourceAssignmentUtils { metadata ) } else { - throw BlueprintProcessorException("Expect one entry in output-key-mapping") + throw BluePrintProcessorException("Expect one entry in output-key-mapping") } } else -> { @@ -533,7 +533,7 @@ class ResourceAssignmentUtils { ) } else -> { - throw BlueprintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") + throw BluePrintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") } } } @@ -557,7 +557,7 @@ class ResourceAssignmentUtils { resourceAssignment.keyIdentifiers.add(KeyIdentifier(outputKeyMap.key, returnValue)) return returnValue } else { - throw BlueprintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") + throw BluePrintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") } } @@ -669,7 +669,7 @@ class ResourceAssignmentUtils { ) } else -> { - throw BlueprintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") + throw BluePrintProcessorException("Output-key-mapping do not map the Data Type $entrySchemaType") } } } else { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt index 4b4e04e16..1bf854cbd 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition @@ -48,7 +48,7 @@ object ResourceDefinitionUtils { MutableList<ResourceAssignment> { /** Check if resolve definition is defined in the resource definition Map */ val resourceDefinition = resourceDefinitions[resolveDefinition] - ?: throw BlueprintProcessorException("failed to get resolve definition($resolveDefinition)") + ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)") val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf() @@ -56,7 +56,7 @@ object ResourceDefinitionUtils { val definitionDependencies = definitionDependencies(resourceDefinition, sources) definitionDependencies.forEach { definitionDependencyName -> val definitionDependency = resourceDefinitions[definitionDependencyName] - ?: throw BlueprintProcessorException("failed to get dependency definition($definitionDependencyName)") + ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)") val resourceAssignment = ResourceAssignment().apply { name = definitionDependency.name diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt index bdb47e711..7dcaab733 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotNull @@ -25,7 +25,7 @@ class ResourceDefinitionDSLTest { @Test fun testResourceDefinitionDSL() { - val testResourceDefinition = BlueprintTypes.resourceDefinition( + val testResourceDefinition = BluePrintTypes.resourceDefinition( "service-instance-id", "VFW Service Instance Name" ) { @@ -79,7 +79,7 @@ class ResourceDefinitionDSLTest { // println(resourceDefinition.asJsonString(true)) assertNotNull(testResourceDefinition, "failed to generate testResourceDefinition") - val testResourceDefinitions = BlueprintTypes.resourceDefinitions { + val testResourceDefinitions = BluePrintTypes.resourceDefinitions { resourceDefinition(testResourceDefinition) } assertNotNull(testResourceDefinitions, "failed to generate testResourceDefinitions") @@ -88,7 +88,7 @@ class ResourceDefinitionDSLTest { @Test fun testResourceAssignment() { - val testResourceAssignment = BlueprintTypes.resourceAssignment( + val testResourceAssignment = BluePrintTypes.resourceAssignment( "instance-name", "service-instance-name", "odl-mdsal" ) { @@ -99,7 +99,7 @@ class ResourceDefinitionDSLTest { // println(resourceAssignment.asJsonString(true)) assertNotNull(testResourceAssignment, "failed to generate resourceAssignment") - val testResourceAssignments = BlueprintTypes.resourceAssignments { + val testResourceAssignments = BluePrintTypes.resourceAssignments { resourceAssignment(testResourceAssignment) resourceAssignment( "instance-name1", diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt index 09eef46d4..f7c41bdac 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute import kotlin.test.Test import kotlin.test.assertNotNull @@ -25,14 +25,14 @@ class ResourceResolutionComponentDSLTest { @Test fun testNodeTypeComponentResourceResolution() { - val nodeType = BlueprintTypes.nodeTypeComponentResourceResolution() + val nodeType = BluePrintTypes.nodeTypeComponentResourceResolution() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeComponentResourceResolution") } @Test fun testNodeTemplateComponentResourceResolution() { - val nodeTemplate = BlueprintTypes.nodeTemplateComponentResourceResolution("resource-resolve", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateComponentResourceResolution("resource-resolve", "") { definedOperation("Resolve resources") { inputs { actionName("resolve") diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt index 74a88b4e3..84d132a55 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt @@ -26,10 +26,10 @@ import kotlinx.coroutines.runBlocking import org.junit.Before import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import kotlin.test.assertEquals import kotlin.test.fail @@ -44,7 +44,7 @@ class ResourceResolutionComponentTest { private val resourceType = "ServiceInstance" private val occurrence = 1 private val props = mutableMapOf<String, JsonNode>() - private val bluePrintRuntimeService = mockk<BlueprintRuntimeService<*>>() + private val bluePrintRuntimeService = mockk<BluePrintRuntimeService<*>>() private val artifactNames = listOf("template") private val nodeTemplateName = "nodeTemplateName" @@ -79,7 +79,7 @@ class ResourceResolutionComponentTest { runBlocking { try { resourceResolutionComponent.processNB(executionRequest) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { assertEquals( "Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.", e.message @@ -98,7 +98,7 @@ class ResourceResolutionComponentTest { runBlocking { try { resourceResolutionComponent.processNB(executionRequest) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { assertEquals( "Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.", e.message @@ -118,7 +118,7 @@ class ResourceResolutionComponentTest { runBlocking { try { resourceResolutionComponent.processNB(executionRequest) - } catch (e: BlueprintProcessorException) { + } catch (e: BluePrintProcessorException) { assertEquals( "Can't proceed with the resolution: can't persist resolution without a correlation key. " + "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.", @@ -164,9 +164,9 @@ class ResourceResolutionComponentTest { @Test fun testRecover() { runBlocking { - val blueprintError = BlueprintError() + val blueprintError = BluePrintError() val exception = RuntimeException("message") - every { bluePrintRuntimeService.getBlueprintError() } returns blueprintError + every { bluePrintRuntimeService.getBluePrintError() } returns blueprintError resourceResolutionComponent.recoverNB(exception, executionRequest) assertEquals(1, blueprintError.allErrors().size) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt index a1de557d5..3d2a9755c 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt @@ -30,11 +30,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.MockCapabilityScriptRA import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary import org.slf4j.LoggerFactory @@ -106,7 +106,7 @@ class ResourceResolutionServiceTest { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -160,7 +160,7 @@ class ResourceResolutionServiceTest { runBlocking { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -200,7 +200,7 @@ class ResourceResolutionServiceTest { runBlocking { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -245,7 +245,7 @@ class ResourceResolutionServiceTest { props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY] = true Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -291,7 +291,7 @@ class ResourceResolutionServiceTest { runBlocking { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -344,7 +344,7 @@ class ResourceResolutionServiceTest { runBlocking { Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService) - val bluePrintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime( + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime( "1234", "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -384,13 +384,13 @@ class ResourceResolutionServiceTest { @Test fun testResourceResolutionForDefinition() { - val resourceDefinitions = BlueprintTypes.resourceDefinitions { + val resourceDefinitions = BluePrintTypes.resourceDefinitions { resourceDefinition(name = "port-speed", description = "Port Speed") { property(type = "string", required = true) sources { sourceCapability(id = "sdno", description = "SDNO Source") { definedProperties { - type(BlueprintConstants.SCRIPT_KOTLIN) + type(BluePrintConstants.SCRIPT_KOTLIN) scriptClassReference(MockCapabilityScriptRA::class.qualifiedName!!) keyDependencies(arrayListOf("device-id")) } @@ -417,9 +417,9 @@ class ResourceResolutionServiceTest { } runBlocking { val raRuntimeService = mockk<ResourceAssignmentRuntimeService>() - every { raRuntimeService.bluePrintContext() } returns mockk<BlueprintContext>() - every { raRuntimeService.getBlueprintError() } returns BlueprintError() - every { raRuntimeService.setBlueprintError(any()) } returns Unit + every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>() + every { raRuntimeService.getBluePrintError() } returns BluePrintError() + every { raRuntimeService.setBluePrintError(any()) } returns Unit every { raRuntimeService.getInputValue("device-id") } returns "123456".asJsonPrimitive() every { raRuntimeService.putResolutionStore(any(), any()) } returns Unit diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt index 1dff814ac..2e9dc9e2a 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import kotlin.test.Test import kotlin.test.assertNotNull @@ -24,42 +24,42 @@ class ResourceSourceDSLTest { @Test fun testNodeTypeSourceInput() { - val nodeType = BlueprintTypes.nodeTypeSourceInput() + val nodeType = BluePrintTypes.nodeTypeSourceInput() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeSourceInput") } @Test fun testNodeTypeSourceDefault() { - val nodeType = BlueprintTypes.nodeTypeSourceDefault() + val nodeType = BluePrintTypes.nodeTypeSourceDefault() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeSourceDefault") } @Test fun testNodeTypeSourceDb() { - val nodeType = BlueprintTypes.nodeTypeSourceDb() + val nodeType = BluePrintTypes.nodeTypeSourceDb() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeSourceDb") } @Test fun testNodeTypeSourceRest() { - val nodeType = BlueprintTypes.nodeTypeSourceRest() + val nodeType = BluePrintTypes.nodeTypeSourceRest() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeSourceRest") } @Test fun testNodeTypeSourceCapability() { - val nodeType = BlueprintTypes.nodeTypeSourceCapability() + val nodeType = BluePrintTypes.nodeTypeSourceCapability() // println(nodeType.asJsonString(true)) assertNotNull(nodeType, "failed to generate nodeTypeSourceCapability") } @Test fun testNodeTemplateSourceInput() { - val nodeTemplate = BlueprintTypes.nodeTemplateSourceInput("InputSystem", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateSourceInput("InputSystem", "") { } // println(nodeTemplate.asJsonString(true)) assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceInput") @@ -67,7 +67,7 @@ class ResourceSourceDSLTest { @Test fun testNodeTemplateSourceDefault() { - val nodeTemplate = BlueprintTypes.nodeTemplateSourceDefault("DefaultSystem", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateSourceDefault("DefaultSystem", "") { } // println(nodeTemplate.asJsonString(true)) assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceDefault") @@ -75,7 +75,7 @@ class ResourceSourceDSLTest { @Test fun testNodeTemplateSourceDb() { - val nodeTemplate = BlueprintTypes.nodeTemplateSourceDb("DbSystem", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateSourceDb("DbSystem", "") { definedProperties { type("SQL") query("SELECT * FROM DB WHERE name = \$name") @@ -95,7 +95,7 @@ class ResourceSourceDSLTest { @Test fun testNodeTemplateSourceRest() { - val nodeTemplate = BlueprintTypes.nodeTemplateSourceRest("restSystem", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateSourceRest("restSystem", "") { definedProperties { type("JSON") endpointSelector("rest-source-endpoint") @@ -119,7 +119,7 @@ class ResourceSourceDSLTest { @Test fun testNodeTemplateSourceCapability() { - val nodeTemplate = BlueprintTypes.nodeTemplateSourceCapability("capabiltySystem", "") { + val nodeTemplate = BluePrintTypes.nodeTemplateSourceCapability("capabiltySystem", "") { definedProperties { type("kotlin") scriptClassReference("Scripts/Sample.kt") diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt index d720bd836..096d7ff27 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution -import org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration import org.springframework.context.annotation.Bean @@ -29,7 +29,7 @@ import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -@Import(BlueprintDBLibConfiguration::class) +@Import(BluePrintDBLibConfiguration::class) @EnableJpaRepositories( basePackages = [ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution", diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt index e48ac388d..4ce5df18f 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt @@ -29,14 +29,14 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.proc import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignments import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceDefinitions import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService -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.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -57,7 +57,7 @@ class IpAssignResolutionCapabilityTest { @Before fun setup() { - mockkObject(BlueprintDependencyService) + mockkObject(BluePrintDependencyService) val blueprintWebClientService = mockk<BlueprintWebClientService>() // Create mock Response @@ -72,9 +72,9 @@ class IpAssignResolutionCapabilityTest { ) every { blueprintWebClientService.exchangeResource(any(), any(), any()) } returns mockResponse - val restLibPropertyService = mockk<BlueprintRestLibPropertyService>() + val restLibPropertyService = mockk<BluePrintRestLibPropertyService>() every { restLibPropertyService.blueprintWebClientService("ipassign-ms") } returns blueprintWebClientService - every { BlueprintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService + every { BluePrintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService } @Test @@ -152,7 +152,7 @@ class IpAssignResolutionCapabilityTest { /** Test dictionaries */ private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> { - return BlueprintTypes.resourceDefinitions { + return BluePrintTypes.resourceDefinitions { resourceDefinition("CloudRegionId", "Cloud Region Id Resource Definition") { tags("CloudRegionId") updatedBy("saurav.paira@att.com") @@ -230,7 +230,7 @@ class IpAssignResolutionCapabilityTest { } private fun resourceAssignments(): MutableMap<String, ResourceAssignment> { - return BlueprintTypes.resourceAssignments { + return BluePrintTypes.resourceAssignments { resourceAssignment( name = "CloudRegionId", dictionaryName = "CloudRegionId", dictionarySource = "input" diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt index 66f302f6f..8c0aca49e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt @@ -29,16 +29,16 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.proc import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignments import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceDefinitions import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.logger -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.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -60,7 +60,7 @@ class NamingResolutionCapabilityTest { @Before fun setup() { - mockkObject(BlueprintDependencyService) + mockkObject(BluePrintDependencyService) val blueprintWebClientService = mockk<BlueprintWebClientService>() // Create mock Response @@ -74,9 +74,9 @@ class NamingResolutionCapabilityTest { ) every { blueprintWebClientService.exchangeResource(any(), any(), any()) } returns mockResponse - val restLibPropertyService = mockk<BlueprintRestLibPropertyService>() + val restLibPropertyService = mockk<BluePrintRestLibPropertyService>() every { restLibPropertyService.blueprintWebClientService("naming-ms") } returns blueprintWebClientService - every { BlueprintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService + every { BluePrintDependencyService.applicationContext.getBean(any()) } returns restLibPropertyService } @Test @@ -89,8 +89,8 @@ class NamingResolutionCapabilityTest { } returns NamingResolutionCapability() val raRuntimeService = mockk<ResourceAssignmentRuntimeService>() - every { raRuntimeService.getBlueprintError() } returns BlueprintError() - every { raRuntimeService.bluePrintContext() } returns mockk<BlueprintContext>() + every { raRuntimeService.getBluePrintError() } returns BluePrintError() + every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>() every { raRuntimeService.getInputValue("vf-module-name") } returns NullNode.getInstance() every { raRuntimeService.getInputValue("vnfc-name") } returns NullNode.getInstance() @@ -154,7 +154,7 @@ class NamingResolutionCapabilityTest { /** Test dictionaries */ private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> { - return BlueprintTypes.resourceDefinitions { + return BluePrintTypes.resourceDefinitions { resourceDefinition("naming-code", "naming-code Resource Definition") { tags("naming-code") updatedBy("brindasanth@onap.com") @@ -274,7 +274,7 @@ class NamingResolutionCapabilityTest { } private fun resourceAssignments(): MutableMap<String, ResourceAssignment> { - return BlueprintTypes.resourceAssignments { + return BluePrintTypes.resourceAssignments { resourceAssignment( name = "naming-code", dictionaryName = "naming-code", dictionarySource = "input" diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt index 51825a5f9..fa59876a9 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt @@ -23,10 +23,10 @@ import kotlinx.coroutines.runBlocking import org.junit.Before import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.dao.EmptyResultDataAccessException import kotlin.test.assertEquals @@ -46,13 +46,13 @@ open class ResourceResolutionDBServiceTest { private val blueprintVersion = "1.0.0" private val metadata = hashMapOf<String, String>() private val props = hashMapOf<String, Any>() - private val bluePrintContext = mockk<BlueprintContext>() - private val bluePrintRuntimeService = mockk<DefaultBlueprintRuntimeService>() + private val bluePrintContext = mockk<BluePrintContext>() + private val bluePrintRuntimeService = mockk<DefaultBluePrintRuntimeService>() @Before fun setup() { - metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = blueprintVersion - metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = blueprintName + metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = blueprintVersion + metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = blueprintName props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = resolutionKey props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] = resourceId @@ -206,7 +206,7 @@ open class ResourceResolutionDBServiceTest { fun writeTest() { val resourceResolution = ResourceResolution() val resourceAssignment = ResourceAssignment() - resourceAssignment.property?.status = BlueprintConstants.STATUS_SUCCESS + resourceAssignment.property?.status = BluePrintConstants.STATUS_SUCCESS resourceAssignment.property?.value = "result".asJsonPrimitive() resourceAssignment.dictionarySource = "ddSource" resourceAssignment.dictionaryName = "ddName" @@ -229,7 +229,7 @@ open class ResourceResolutionDBServiceTest { fun writeWithNullValue() { val slot = slot<ResourceResolution>() val resourceAssignment = ResourceAssignment() - resourceAssignment.status = BlueprintConstants.STATUS_SUCCESS + resourceAssignment.status = BluePrintConstants.STATUS_SUCCESS resourceAssignment.dictionarySource = "ddSource" resourceAssignment.dictionaryName = "ddName" resourceAssignment.version = 1 diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt index 0a7722f53..71d895574 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt @@ -7,9 +7,9 @@ import kotlinx.coroutines.runBlocking import org.junit.Before import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService import org.springframework.dao.EmptyResultDataAccessException import kotlin.test.assertEquals @@ -29,13 +29,13 @@ class TemplateResolutionServiceTest { private val result = "result" private val metadata = hashMapOf<String, String>() private val props = hashMapOf<String, Any>() - private val bluePrintContext = mockk<BlueprintContext>() - private val bluePrintRuntimeService = mockk<DefaultBlueprintRuntimeService>() + private val bluePrintContext = mockk<BluePrintContext>() + private val bluePrintRuntimeService = mockk<DefaultBluePrintRuntimeService>() @Before fun setup() { - metadata[BlueprintConstants.METADATA_TEMPLATE_VERSION] = blueprintVersion - metadata[BlueprintConstants.METADATA_TEMPLATE_NAME] = blueprintName + metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] = blueprintVersion + metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] = blueprintName props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] = resolutionKey props[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] = resourceId diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintRestLibPropertyService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt index b6c20cd5a..a2ec75d02 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintRestLibPropertyService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt @@ -15,12 +15,12 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService -class MockBlueprintRestLibPropertyService(bluePrintProperties: BlueprintPropertiesService) : - BlueprintRestLibPropertyService(bluePrintProperties) { +class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintPropertiesService) : + BluePrintRestLibPropertyService(bluePrintProperties) { fun mockBlueprintWebClientService(selector: String): MockBlueprintWebClientService { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt index 653a2c1f4..2219f2348 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt @@ -17,9 +17,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.moc import io.mockk.coEvery import io.mockk.mockk -import org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintDBLibGenericService -import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintValidatorService -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintRuntimeService +import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService +import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -27,8 +27,8 @@ import org.springframework.context.annotation.Configuration open class MockDBLibGenericService { @Bean(name = ["MariaDatabaseConfiguration", "MySqlDatabaseConfiguration"]) - open fun createDatabaseConfiguration(): BlueprintDBLibGenericService { - return mockk<BlueprintDBLibGenericService>() + open fun createDatabaseConfiguration(): BluePrintDBLibGenericService { + return mockk<BluePrintDBLibGenericService>() } } @@ -36,10 +36,10 @@ open class MockDBLibGenericService { open class MockBlueprintProcessorCatalogServiceImpl { @Bean(name = ["bluePrintRuntimeValidatorService"]) - open fun bluePrintRuntimeValidatorService(): BlueprintValidatorService { - val bluePrintValidatorService = mockk<BlueprintValidatorService>() - coEvery { bluePrintValidatorService.validateBlueprints(any<String>()) } returns true - coEvery { bluePrintValidatorService.validateBlueprints(any<BlueprintRuntimeService<*>>()) } returns true + open fun bluePrintRuntimeValidatorService(): BluePrintValidatorService { + val bluePrintValidatorService = mockk<BluePrintValidatorService>() + coEvery { bluePrintValidatorService.validateBluePrints(any<String>()) } returns true + coEvery { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true return bluePrintValidatorService } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt index 77c90ba51..69099152e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt @@ -22,8 +22,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.RestResourceSource import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils @@ -33,7 +33,7 @@ import java.util.HashMap class MockRestResourceResolutionProcessor( private val blueprintRestLibPropertyService: - MockBlueprintRestLibPropertyService + MockBluePrintRestLibPropertyService ) : ResourceAssignmentProcessor() { private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java) @@ -97,12 +97,12 @@ class MockRestResourceResolutionProcessor( val errMsg = "Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath) response_code: ($responseStatusCode)" logger.warn(errMsg) - throw BlueprintProcessorException(errMsg) + throw BluePrintProcessorException(errMsg) } } } catch (e: Exception) { ResourceAssignmentUtils.setFailedResourceDataValue(executionRequest, e.message) - throw BlueprintProcessorException( + throw BluePrintProcessorException( "Failed in template resolutionKey ($executionRequest) assignments with: ${e.message}", e ) @@ -117,7 +117,7 @@ class MockRestResourceResolutionProcessor( return blueprintRestLibPropertyService.mockBlueprintWebClientService(resourceAssignment.dictionarySource!!) } - @Throws(BlueprintProcessorException::class) + @Throws(BluePrintProcessorException::class) private fun populateResource( resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource, @@ -132,15 +132,15 @@ class MockRestResourceResolutionProcessor( val responseNode = JacksonUtils.jsonNode(restResponse).at(path) when (type) { - in BlueprintTypes.validPrimitiveTypes() -> { + in BluePrintTypes.validPrimitiveTypes() -> { ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, responseNode) } - in BlueprintTypes.validCollectionTypes() -> { + in BluePrintTypes.validCollectionTypes() -> { // Array Types entrySchemaType = resourceAssignment.property!!.entrySchema!!.type val arrayNode = responseNode as ArrayNode - if (entrySchemaType !in BlueprintTypes.validPrimitiveTypes()) { + if (entrySchemaType !in BluePrintTypes.validPrimitiveTypes()) { val responseArrayNode = responseNode.toList() for (responseSingleJsonNode in responseArrayNode) { diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt index b289cfe3e..1b0058b90 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt @@ -27,13 +27,13 @@ import org.junit.Test import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceAssignment import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService -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.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -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.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition @@ -53,14 +53,14 @@ class CapabilityResourceResolutionProcessorTest { } returns MockCapabilityScriptRA() val raRuntimeService = mockk<ResourceAssignmentRuntimeService>() - every { raRuntimeService.bluePrintContext() } returns mockk<BlueprintContext>() + every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>() every { raRuntimeService.getInputValue("test-property") } returns NullNode.getInstance() val capabilityResourceResolutionProcessor = CapabilityResourceResolutionProcessor(componentFunctionScriptingService) capabilityResourceResolutionProcessor.raRuntimeService = raRuntimeService - val resourceAssignment = BlueprintTypes.resourceAssignment( + val resourceAssignment = BluePrintTypes.resourceAssignment( name = "test-property", dictionaryName = "ra-dict-name", dictionarySource = "capability" ) { @@ -86,14 +86,14 @@ class CapabilityResourceResolutionProcessorTest { fun `test jython capability`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_python" ) val componentFunctionScriptingService = mockk<ComponentFunctionScriptingService>() coEvery { componentFunctionScriptingService - .scriptInstance<ResourceAssignmentProcessor>(any(), BlueprintConstants.SCRIPT_JYTHON, any()) + .scriptInstance<ResourceAssignmentProcessor>(any(), BluePrintConstants.SCRIPT_JYTHON, any()) } returns MockCapabilityScriptRA() val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt index 6689aff81..0c8ec7d95 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt @@ -19,14 +19,14 @@ import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService -import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BlueprintDBLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.TestDatabaseConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBlueprintProcessorCatalogServiceImpl import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDBLibGenericService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -38,7 +38,7 @@ import kotlin.test.assertNotNull @ContextConfiguration( classes = [ TestDatabaseConfiguration::class, - PrimaryDBLibGenericService::class, BlueprintDBLibPropertyService::class, + PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class, DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class, MockBlueprintProcessorCatalogServiceImpl::class ] @@ -52,7 +52,7 @@ class DatabaseResourceResolutionProcessorTest { @Test fun `test database resource resolution processor db`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt index 7cec75950..a109131fe 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt @@ -20,7 +20,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -39,7 +39,7 @@ class DefaultResourceResolutionProcessorTest { @Test fun `test default resource resolution`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt index aae35f4d3..cf8dc0c59 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt @@ -25,7 +25,7 @@ import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -45,7 +45,7 @@ class InputResourceResolutionProcessorTest { fun `InputResourceResolutionProcessor should be able to resolve a value for an input parameter`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt index 9fabf5dbd..cb7214123 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt @@ -18,15 +18,15 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro import kotlinx.coroutines.runBlocking import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertiesService -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService -import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBlueprintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockRestResourceResolutionProcessor import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.springframework.beans.factory.annotation.Autowired import org.springframework.test.context.ContextConfiguration @@ -38,15 +38,15 @@ import kotlin.test.assertNotNull @RunWith(SpringRunner::class) @ContextConfiguration( classes = [ - MockRestResourceResolutionProcessor::class, MockBlueprintRestLibPropertyService::class, - BlueprintPropertyConfiguration::class, BlueprintPropertiesService::class, RestClientProperties::class + MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class, + BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class ] ) @TestPropertySource(locations = ["classpath:application-test.properties"]) class RestResourceResolutionProcessorTest { @Autowired - lateinit var bluePrintRestLibPropertyService: MockBlueprintRestLibPropertyService + lateinit var bluePrintRestLibPropertyService: MockBluePrintRestLibPropertyService private lateinit var restResourceResolutionProcessor: MockRestResourceResolutionProcessor @@ -58,7 +58,7 @@ class RestResourceResolutionProcessorTest { @Test fun `test rest resource resolution`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -92,7 +92,7 @@ class RestResourceResolutionProcessorTest { @Test fun `test rest aai get resource resolution`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) @@ -126,7 +126,7 @@ class RestResourceResolutionProcessorTest { @Test fun `test rest aai put resource resolution`() { runBlocking { - val bluePrintContext = BlueprintMetadataUtils.getBlueprintContext( + val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt index d9e93150c..2f07e3b9a 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt @@ -36,7 +36,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils +import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition @@ -70,7 +70,7 @@ class ResourceAssignmentUtilsTest { fun setup() { val bluePrintContext = runBlocking { - BlueprintMetadataUtils.getBlueprintContext( + BluePrintMetadataUtils.getBluePrintContext( "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" ) } |