aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 12:16:46 -0400
committerSingal, Kapil (ks220y) <ks220y@att.com>2020-09-22 13:49:05 -0400
commit1072867dfac0df993cbd3e44bcc11a5cac7465fd (patch)
tree4a821659cf3b50cf946cbb535d528be8508e9fff /ms/blueprintsprocessor/functions/resource-resolution/src
parentd97021cd756d63402545fdc2e14ac7611c3da118 (diff)
Enabling Code Formatter
Code Formatter was turned off due to java 11 migation Issue-ID: CCSDK-2852 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com> Change-Id: I3d02ed3cc7a93d7551fe25356512cfe8db1517d8
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt23
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt41
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt8
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt121
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt71
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt90
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt45
34 files changed, 357 insertions, 272 deletions
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 7c6ba603b..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
@@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
/** Resource Definition DSL **/
fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit):
- MutableMap<String, ResourceDefinition> {
- return ResourceDefinitionsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceDefinition> {
+ return ResourceDefinitionsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceDefinition(
name: String,
@@ -39,9 +39,9 @@ fun BluePrintTypes.resourceDefinition(
/** Resource Mapping DSL **/
fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit):
- MutableMap<String, ResourceAssignment> {
- return ResourceAssignmentsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceAssignment> {
+ return ResourceAssignmentsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceAssignment(
name: String,
@@ -53,6 +53,7 @@ fun BluePrintTypes.resourceAssignment(
}
class ResourceDefinitionsBuilder() {
+
private val resourceDefinitions: MutableMap<String, ResourceDefinition> = hashMapOf()
fun resourceDefinition(
@@ -74,6 +75,7 @@ class ResourceDefinitionsBuilder() {
}
class ResourceDefinitionBuilder(private val name: String, private val description: String) {
+
private val resourceDefinition = ResourceDefinition()
fun updatedBy(updatedBy: String) {
@@ -115,6 +117,7 @@ class ResourceDefinitionBuilder(private val name: String, private val descriptio
}
class ResourceDefinitionSourcesBuilder {
+
var sources: MutableMap<String, NodeTemplate> = hashMapOf()
fun source(source: NodeTemplate) {
@@ -147,6 +150,7 @@ class ResourceDefinitionSourcesBuilder {
}
class ResourceAssignmentsBuilder() {
+
private val resourceAssignments: MutableMap<String, ResourceAssignment> = hashMapOf()
fun resourceAssignment(
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 3ebd2f893..dac237fc5 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
@@ -37,6 +37,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
AbstractComponentFunction() {
companion object {
+
const val INPUT_REQUEST_ID = "request-id"
const val INPUT_RESOURCE_ID = "resource-id"
const val INPUT_ACTION_NAME = "action-name"
@@ -68,7 +69,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val resourceType =
getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
val resolutionSummary =
- getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult
@@ -99,7 +100,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
} else if (resourceType.isEmpty() && resourceId.isEmpty() && resolutionKey.isEmpty()) {
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."
+ "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 8c854b840..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
@@ -83,7 +83,7 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
property(
ResourceResolutionComponent.INPUT_RESOLUTION_SUMMARY, BluePrintConstants.DATA_TYPE_BOOLEAN,
- false, "Enables ResolutionSummary output"
+ false, "Enables ResolutionSummary output"
)
property(
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 0f04ea38e..6451b8fc8 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
@@ -48,9 +48,9 @@ suspend fun AbstractComponentFunction.contentFromResolvedArtifactNB(artifactPref
*/
fun AbstractComponentFunction.storedContentFromResolvedArtifact(resolutionKey: String, artifactName: String):
- String = runBlocking {
- storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
-}
+ String = runBlocking {
+ storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
+ }
fun AbstractComponentFunction.contentFromResolvedArtifact(artifactPrefix: String): String = runBlocking {
contentFromResolvedArtifactNB(artifactPrefix)
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 836db4c70..07eb15dda 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
@@ -197,8 +197,8 @@ open class ResourceResolutionServiceImpl(
false
) as Boolean
val assignmentMap = resourceAssignments
- .associateBy({ it.name }, { it.property?.value })
- .asJsonNode()
+ .associateBy({ it.name }, { it.property?.value })
+ .asJsonNode()
val resolvedParamJsonContent =
ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
val artifactTemplateDefinition =
@@ -213,7 +213,7 @@ open class ResourceResolutionServiceImpl(
ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE]
.asJsonPrimitive()
- )
+ )
)
}
resolutionSummary -> {
@@ -443,10 +443,12 @@ open class ResourceResolutionServiceImpl(
// Comparision between what we have in the database vs what we have to assign.
private fun compareOne(resourceResolution: ResourceResolution, resourceAssignment: ResourceAssignment): Boolean {
- return (resourceResolution.name == resourceAssignment.name &&
- resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
- resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
- resourceResolution.dictionaryVersion == resourceAssignment.version)
+ return (
+ resourceResolution.name == resourceAssignment.name &&
+ resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
+ resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
+ resourceResolution.dictionaryVersion == resourceAssignment.version
+ )
}
private fun exposeOccurrencePropertyInResourceAssignments(
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 d541fe60c..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
@@ -247,6 +247,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -286,6 +287,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
}
class KeyMappingBuilder() {
+
val map: MutableMap<String, String> = hashMapOf()
fun map(key: String, value: String) {
map[key] = value
@@ -312,6 +314,7 @@ class SourceRestNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -390,6 +393,7 @@ class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
index 7a7edc92b..e2fef746b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
@@ -23,61 +23,84 @@ import com.fasterxml.jackson.annotation.JsonProperty
open class ResourceSourceProperties
open class InputResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DefaultResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DatabaseResourceSource : ResourceSourceProperties() {
+
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
lateinit var query: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class RestResourceSource : ResourceSourceProperties() {
+
lateinit var verb: String
+
@get:JsonProperty("payload")
var payload: String? = null
+
@get:JsonProperty("resolved-payload")
var resolvedPayload: String? = null
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
+
@get:JsonProperty("url-path")
lateinit var urlPath: String
lateinit var path: String
+
@get:JsonProperty("expression-type")
lateinit var expressionType: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("headers")
var headers: Map<String, String> = emptyMap()
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class CapabilityResourceSource : ResourceSourceProperties() {
+
@get:JsonProperty("script-type")
lateinit var scriptType: String
+
@get:JsonProperty("script-class-reference")
lateinit var scriptClassReference: String
+
@get:JsonProperty("instance-dependencies")
var instanceDependencies: List<String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
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 b38c32056..03a90d134 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
@@ -122,21 +122,21 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() {
/** Generates aggregated request payload for Ip Assign mS. Parses the resourceassignments of
* sourceCapability "ipassign-ms". It generates below sample payload
* {
- "requests": [{
- "name": "fixed_ipv4_Address_01",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }, {
- "name": "fixed_ipv4_Address_02",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }
- ]
- } */
+ "requests": [{
+ "name": "fixed_ipv4_Address_01",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }, {
+ "name": "fixed_ipv4_Address_02",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
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 dbac70a39..7a5986aa6 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
@@ -125,25 +125,25 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
* sourceCapability "naming-ms". "naming-type" should be provides as property metadata for
* each resourceassigment of sourceCapability "naming-ms". It generates below sample payload
* {
- "elements": [{
- "vf-module-name": "${vf-module-name}",
- "naming-type": "VF-MODULE",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }, {
- "vnfc-name": "${vnfc-name}",
- "naming-type": "VNFC",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }
- ]
- } */
+ "elements": [{
+ "vf-module-name": "${vf-module-name}",
+ "naming-type": "VF-MODULE",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }, {
+ "vnfc-name": "${vnfc-name}",
+ "naming-type": "VNFC",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
@@ -158,7 +158,8 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
val moduleValue = "\${".plus(moduleName.plus("}"))
val request: MutableMap<String, String> = input.mapValues {
- it.value.toString().removeSurrounding("\"") } as MutableMap<String, String>
+ it.value.toString().removeSurrounding("\"")
+ } as MutableMap<String, String>
if (namingType != null) {
request["naming-type"] = namingType
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
index db023acfb..55a4d1120 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
@@ -112,6 +112,7 @@ class ResourceResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
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 1a5d062a3..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
@@ -215,10 +215,10 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
resolutionKey: String
) {
resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName,
- blueprintVersion,
- artifactName,
- resolutionKey
+ blueprintName,
+ blueprintVersion,
+ artifactName,
+ resolutionKey
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index 8b235925b..971caa338 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -89,6 +89,7 @@ class TemplateResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
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 895bc993f..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
@@ -147,7 +147,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
+ "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
)
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resolutionKey,
@@ -163,7 +163,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
+ "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
)
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resourceId,
@@ -178,13 +178,14 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
try {
log.info(
"Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
)
templateResolutionRepository.saveAndFlush(resourceResolutionResult)
} catch (ex: DataIntegrityViolationException) {
log.error(
"Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}",
+ ex.message
)
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 42e086137..b1dc14091 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
@@ -97,14 +97,14 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>):
ResourceAssignmentProcessor {
- log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
+ log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
- val scriptComponent = componentFunctionScriptingService
- .scriptInstance<ResourceAssignmentProcessor>(
- raRuntimeService.bluePrintContext(), scriptType,
- scriptClassReference
- )
+ val scriptComponent = componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(
+ raRuntimeService.bluePrintContext(), scriptType,
+ scriptClassReference
+ )
- return scriptComponent
- }
+ return scriptComponent
+ }
}
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 2640b5b85..0417024d3 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
@@ -18,15 +18,15 @@
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.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
+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.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -68,8 +68,10 @@ open class DatabaseResourceAssignmentProcessor(
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process Database resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or DB resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or DB resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
@@ -99,13 +101,13 @@ open class DatabaseResourceAssignmentProcessor(
}
sourceProperties.inputKeyMapping
- ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
logger.info(
"DatabaseResource ($dSource) dictionary information: " +
- "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val jdbcTemplate = blueprintDBLibService(sourceProperties, dSource)
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 2921cb6fb..892d8fbc9 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
@@ -53,8 +53,10 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process default resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong default value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong default value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
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 d078a2d70..131e2ae9a 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
@@ -52,8 +52,10 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process input resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong input value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong input value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
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/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index 0c0735ff0..cffc5e3bf 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
@@ -106,12 +106,12 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, JsonNode>):
String {
- if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
- return valueToResolve
+ if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
+ return valueToResolve
+ }
+ // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
+ return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
}
- // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
- return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
- }
final override suspend fun applyNB(resourceAssignment: ResourceAssignment): Boolean {
try {
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 c60bc7648..c2cf30247 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
@@ -23,10 +23,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.util
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.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
+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
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -80,8 +80,8 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
val resolvedInputKeyMapping = resolveInputKeyMappingVariables(inputKeyMapping).toMutableMap()
inputKeyMapping?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
// Resolving content Variables
val payload = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.payload), resolvedInputKeyMapping)
@@ -92,7 +92,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
logger.info(
"RestResource ($dSource) dictionary information: " +
- "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val requestHeaders = sourceProperties.headers
logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
@@ -120,8 +120,10 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process REST resource resolution in template key ($resourceAssignment) assignments."
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, errorMsg)
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
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/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 1be9649b9..54231da61 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
@@ -93,7 +93,7 @@ class ResourceAssignmentUtils {
resourceAssignment.dictionaryName = resourceAssignment.name
logger.warn(
"Missing dictionary key, setting with template key (${resourceAssignment.name}) " +
- "as dictionary key (${resourceAssignment.dictionaryName})"
+ "as dictionary key (${resourceAssignment.dictionaryName})"
)
}
@@ -103,8 +103,8 @@ class ResourceAssignmentUtils {
val valueToPrint = getValueToLog(metadata, value)
logger.info(
"Setting Resource Value ($valueToPrint) for Resource Name " +
- "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
- "of type (${resourceProp.type})"
+ "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
+ "of type (${resourceProp.type})"
)
setResourceValue(resourceAssignment, raRuntimeService, value)
resourceAssignment.updatedDate = Date()
@@ -114,8 +114,9 @@ class ResourceAssignmentUtils {
} catch (e: Exception) {
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})", e
+ "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " +
+ "type (${resourceProp.type}) with error message (${e.message})",
+ e
)
}
}
@@ -132,29 +133,32 @@ class ResourceAssignmentUtils {
val metadata = resourceAssignment.property?.metadata
metadata?.get(ResourceResolutionConstants.METADATA_TRANSFORM_TEMPLATE)
- ?.let { if (it.contains("$")) it else null }
- ?.let { template ->
- val resolutionStore = raRuntimeService.getResolutionStore()
- .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
- val newValue: JsonNode
- try {
- newValue = BluePrintVelocityTemplateService
- .generateContent(template, null, true, resolutionStore)
- .also { if (hasLogProtect(metadata))
- logger.info("Transformed value: $resourceAssignment.name")
- else
- logger.info("Transformed value: $value -> $it") }
- .let { v -> v.asJsonType() }
- } catch (e: Exception) {
- throw BluePrintProcessorException(
- "transform-template failed: $template", e)
- }
- with(resourceAssignment) {
- raRuntimeService.putResolutionStore(this.name, newValue)
- raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
- this.property!!.value = newValue
- }
+ ?.let { if (it.contains("$")) it else null }
+ ?.let { template ->
+ val resolutionStore = raRuntimeService.getResolutionStore()
+ .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
+ val newValue: JsonNode
+ try {
+ newValue = BluePrintVelocityTemplateService
+ .generateContent(template, null, true, resolutionStore)
+ .also {
+ if (hasLogProtect(metadata))
+ logger.info("Transformed value: $resourceAssignment.name")
+ else
+ logger.info("Transformed value: $value -> $it")
+ }
+ .let { v -> v.asJsonType() }
+ } catch (e: Exception) {
+ throw BluePrintProcessorException(
+ "transform-template failed: $template", e
+ )
}
+ with(resourceAssignment) {
+ raRuntimeService.putResolutionStore(this.name, newValue)
+ raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
+ this.property!!.value = newValue
+ }
+ }
}
fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) {
@@ -199,7 +203,7 @@ class ResourceAssignmentUtils {
}
}
result = mapper.writerWithDefaultPrettyPrinter()
- .writeValueAsString(mapper.treeToValue(root, Object::class.java))
+ .writeValueAsString(mapper.treeToValue(root, Object::class.java))
if (!containsLogProtected) {
logger.info("Generated Resource Param Data ($result)")
@@ -238,35 +242,35 @@ class ResourceAssignmentUtils {
val definition = resourceDefinitions[it.name]
val description = definition?.property?.description ?: ""
val value = it.property?.value
- ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
- ?: emptyTextNode
+ ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
+ ?: emptyTextNode
var payload: JsonNode = definition?.sources?.get(it.dictionarySource)
- ?.properties?.get("resolved-payload")
- ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
- ?: emptyTextNode
+ ?.properties?.get("resolved-payload")
+ ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
+ ?: emptyTextNode
val metadata = definition?.property?.metadata
- ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
- ?.toMutableList() ?: mutableListOf()
+ ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
+ ?.toMutableList() ?: mutableListOf()
val keyIdentifiers: MutableList<KeyIdentifier> = it.keyIdentifiers.map { k ->
if (k.value.isNullOrMissing()) KeyIdentifier(k.name, emptyTextNode) else k
}.toMutableList()
ResolutionSummary(
- it.name,
- value,
- it.property?.required ?: false,
- it.property?.type ?: "",
- keyIdentifiers,
- description,
- metadata,
- it.dictionaryName ?: "",
- it.dictionarySource ?: "",
- payload,
- it.status ?: "",
- it.message ?: ""
+ it.name,
+ value,
+ it.property?.required ?: false,
+ it.property?.type ?: "",
+ keyIdentifiers,
+ description,
+ metadata,
+ it.dictionaryName ?: "",
+ it.dictionarySource ?: "",
+ payload,
+ it.status ?: "",
+ it.message ?: ""
)
}
// Wrapper needed for integration with SDNC
@@ -409,7 +413,7 @@ class ResourceAssignmentUtils {
if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) {
throw BluePrintProcessorException(
"Couldn't get data type for dictionary type " +
- "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
+ "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
)
}
val entrySchemaType = resourceAssignment.property!!.entrySchema!!.type
@@ -487,7 +491,7 @@ class ResourceAssignmentUtils {
val outputKeyMap = outputKeyMapping.entries.first()
if (resourceAssignment.keyIdentifiers.none { it.name == outputKeyMap.key }) {
resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
+ KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
)
}
return parseSingleElementNodeWithOneOutputKeyMapping(
@@ -576,13 +580,14 @@ class ResourceAssignmentUtils {
logKeyValueResolvedResource(metadata, outputKeyMappingKey, responseKeyValue, type)
JacksonUtils.populateJsonNodeValues(outputKeyMappingKey, responseKeyValue, type, arrayChildNode)
resourceAssignment.keyIdentifiers.find { it.name == outputKeyMappingKey && it.value.isArray }
- .let {
- if (it != null)
- (it.value as ArrayNode).add(responseKeyValue)
- else
- resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMappingKey, responseKeyValue))
- }
+ .let {
+ if (it != null)
+ (it.value as ArrayNode).add(responseKeyValue)
+ else
+ resourceAssignment.keyIdentifiers.add(
+ KeyIdentifier(outputKeyMappingKey, responseKeyValue)
+ )
+ }
return arrayChildNode
}
@@ -694,7 +699,7 @@ class ResourceAssignmentUtils {
logger.info(
"For List Type Resource: key ($key), value ($valueToPrint), " +
- "type ({$type})"
+ "type ({$type})"
)
}
@@ -703,6 +708,6 @@ class ResourceAssignmentUtils {
}
fun getValueToLog(metadata: MutableMap<String, String>?, value: Any): Any =
- if (hasLogProtect(metadata)) LOG_REDACTED else value
+ if (hasLogProtect(metadata)) LOG_REDACTED else value
}
}
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 d3641a850..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
@@ -45,47 +45,48 @@ object ResourceDefinitionUtils {
resolveDefinition: String,
sources: List<String>
):
- 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)")
+ 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)")
- val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- /** Get the dependency property fields for the the resource definition to resolve */
- val definitionDependencies = definitionDependencies(resourceDefinition, sources)
- definitionDependencies.forEach { definitionDependencyName ->
- val definitionDependency = resourceDefinitions[definitionDependencyName]
- ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
+ val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- val resourceAssignment = ResourceAssignment().apply {
- name = definitionDependency.name
- dictionaryName = definitionDependency.name
- /** The assumption is al resource are already resolved and shall get as input source */
- dictionarySource = "input"
- property = definitionDependency.property
- }
- resourceAssignments.add(resourceAssignment)
- }
+ /** Get the dependency property fields for the the resource definition to resolve */
+ val definitionDependencies = definitionDependencies(resourceDefinition, sources)
+ definitionDependencies.forEach { definitionDependencyName ->
+ val definitionDependency = resourceDefinitions[definitionDependencyName]
+ ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
- resourceDefinition.sources.forEach { (sourceName, source) ->
- if (sources.contains(sourceName)) {
val resourceAssignment = ResourceAssignment().apply {
- name = "$sourceName:${resourceDefinition.name}"
- dictionaryName = resourceDefinition.name
- dictionarySource = sourceName
- dictionarySourceDefinition = source
- // Clone the PropertyDefinition, otherwise property value will be overridden
- property = JacksonUtils
- .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
- val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
- if (keyDependenciesExists) {
- dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
- }
+ name = definitionDependency.name
+ dictionaryName = definitionDependency.name
+ /** The assumption is al resource are already resolved and shall get as input source */
+ dictionarySource = "input"
+ property = definitionDependency.property
}
resourceAssignments.add(resourceAssignment)
}
+
+ resourceDefinition.sources.forEach { (sourceName, source) ->
+ if (sources.contains(sourceName)) {
+ val resourceAssignment = ResourceAssignment().apply {
+ name = "$sourceName:${resourceDefinition.name}"
+ dictionaryName = resourceDefinition.name
+ dictionarySource = sourceName
+ dictionarySourceDefinition = source
+ // Clone the PropertyDefinition, otherwise property value will be overridden
+ property = JacksonUtils
+ .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
+ val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
+ if (keyDependenciesExists) {
+ dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
+ }
+ }
+ resourceAssignments.add(resourceAssignment)
+ }
+ }
+ // Populate Resource Definition's dependencies as Input Resource Assignment
+ return resourceAssignments
}
- // Populate Resource Definition's dependencies as Input Resource Assignment
- return resourceAssignments
- }
}
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 d1347113a..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
@@ -48,7 +48,8 @@ class ResourceResolutionComponentDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
}
outputs {
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 d6fc52230..a22a73f2f 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
@@ -95,7 +95,8 @@ class ResourceResolutionServiceTest {
"source-input", "source-default", "source-db",
"source-rest", "source-capability"
)
- ), "failed to get registered sources : $sources"
+ ),
+ "failed to get registered sources : $sources"
)
}
@@ -140,9 +141,9 @@ class ResourceResolutionServiceTest {
assertEquals("This is Sample Velocity Template", templateMap)
val expectedAssignmentMap = hashMapOf(
- "service-instance-id" to "siid_1234",
- "vnf-id" to "vnf_1234",
- "vnf_name" to "temp_vnf"
+ "service-instance-id" to "siid_1234",
+ "vnf-id" to "vnf_1234",
+ "vnf_name" to "temp_vnf"
).asJsonType()
assertEquals(expectedAssignmentMap, assignmentMap)
}
@@ -226,7 +227,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
@@ -239,36 +241,36 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
val artifactPrefix = "notemplate"
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
val summaries = JacksonUtils.jsonNode(it.first)["resolution-summary"]
@@ -285,43 +287,46 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
- assertEquals("""
+ assertEquals(
+ """
{
"service-instance-id" : "siid_1234",
"vnf-id" : "vnf_1234",
"vnf_name" : "temp_vnf"
}
- """.trimIndent(), it.first)
+ """.trimIndent(),
+ it.first
+ )
assertEquals("siid_1234", it.second["service-instance-id"].asText())
}
}
@@ -364,7 +369,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
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 121fff7cb..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
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
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 e252b4153..8a954c130 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
@@ -51,6 +51,7 @@ import kotlin.test.assertTrue
*/
class IpAssignResolutionCapabilityTest {
+
val log = logger(IpAssignResolutionCapabilityTest::class)
@Before
@@ -61,7 +62,8 @@ class IpAssignResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse(
- 200, """{
+ 200,
+ """{
"fixed_ipv4_Address_01" : "10.10.10.11",
"fixed_ipv4_Address_02" : "10.10.10.12",
"fixed_ipv4_Address_03" : "10.10.10.13"
@@ -133,8 +135,10 @@ class IpAssignResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
@@ -148,7 +152,7 @@ class IpAssignResolutionCapabilityTest {
}
}
- /** Test dictionaries */
+ /** Test dictionaries */
/** Test dictionaries */
private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> {
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 ee53f8a04..449845f7f 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
@@ -64,7 +64,8 @@ class NamingResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse<String>(
- 200, """{
+ 200,
+ """{
"vf-module-name" : "dlsst001dbcx-adsf-Base-01",
"vnfc-name" : "dlsst001dbcx"
}
@@ -136,8 +137,10 @@ class NamingResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
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 672d4b75d..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
@@ -239,8 +239,8 @@ open class ResourceResolutionDBServiceTest {
} returns ResourceResolution()
runBlocking {
resourceResolutionDBService.write(
- props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
- )
+ props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
+ )
val res = slot.captured
@@ -255,7 +255,8 @@ open class ResourceResolutionDBServiceTest {
} returns Unit
runBlocking {
val res = resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName, blueprintVersion, artifactPrefix, resolutionKey)
+ blueprintName, blueprintVersion, artifactPrefix, resolutionKey
+ )
assertEquals(Unit, res)
}
}
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 61e9f51c9..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
@@ -24,13 +24,13 @@ class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintProperti
fun mockBlueprintWebClientService(selector: String):
MockBlueprintWebClientService {
- val prefix = "blueprintsprocessor.restclient.$selector"
- val restClientProperties = restClientProperties(prefix)
- return mockBlueprintWebClientService(restClientProperties)
- }
+ val prefix = "blueprintsprocessor.restclient.$selector"
+ val restClientProperties = restClientProperties(prefix)
+ return mockBlueprintWebClientService(restClientProperties)
+ }
private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties):
MockBlueprintWebClientService {
- return MockBlueprintWebClientService(restClientProperties)
- }
+ return MockBlueprintWebClientService(restClientProperties)
+ }
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
index e27f3ef1b..53db7563f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
@@ -29,6 +29,7 @@ import java.util.Base64
class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) :
BlueprintWebClientService {
+
private var mockServer: ClientAndServer
private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080"
else restClientProperties.url.split(":")[2]
@@ -41,7 +42,8 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
// Create expected requests and responses
setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456")
setRequest(
- "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
+ "GET",
+ "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
"vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
)
setRequestWithPayload(
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 3600156ce..0312126b7 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
@@ -33,7 +33,7 @@ import java.util.HashMap
class MockRestResourceResolutionProcessor(
private val blueprintRestLibPropertyService:
- MockBluePrintRestLibPropertyService
+ MockBluePrintRestLibPropertyService
) : ResourceAssignmentProcessor() {
private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
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 5fbe32e07..f618b41db 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
@@ -139,6 +139,7 @@ class CapabilityResourceResolutionProcessorTest {
open class MockCapabilityService
open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
+
val log = logger(MockCapabilityScriptRA::class)
override fun getName(): String {
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 57d2c1b60..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
@@ -36,10 +36,12 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [TestDatabaseConfiguration::class,
+ classes = [
+ TestDatabaseConfiguration::class,
PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class,
DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class,
- MockBlueprintProcessorCatalogServiceImpl::class]
+ MockBlueprintProcessorCatalogServiceImpl::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class DatabaseResourceResolutionProcessorTest {
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 af78a604a..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
@@ -37,8 +37,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class]
+ classes = [
+ MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class RestResourceResolutionProcessorTest {
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 59be79568..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
@@ -48,6 +48,7 @@ data class ExpectedResponseIp(val ip: String)
data class ExpectedResponseIpAddress(val ipAddress: IpAddress)
class ResourceAssignmentUtilsTest {
+
private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService
private lateinit var resourceAssignment: ResourceAssignment
@@ -180,9 +181,11 @@ class ResourceAssignmentUtilsTest {
}
val result = ResourceAssignmentUtils.generateResolutionSummaryData(
- listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition))
+ listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition)
+ )
- assertEquals("""
+ assertEquals(
+ """
{
"resolution-summary":[
{
@@ -203,7 +206,9 @@ class ResourceAssignmentUtilsTest {
}
]
}
- """.replace("\n|\\s".toRegex(), ""), result)
+ """.replace("\n|\\s".toRegex(), ""),
+ result
+ )
}
private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment {
@@ -243,8 +248,8 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for primitive type of key-value String"
)
assertEquals(
- expectedValueToTestPrimitiveType,
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestPrimitiveType,
+ resourceAssignment.keyIdentifiers[0].value
)
}
@@ -262,8 +267,8 @@ class ResourceAssignmentUtilsTest {
val expectedKeyIdentifierValue = JacksonUtils.getJsonNode(outcome.map { it["ip"] })
assertEquals(
- expectedKeyIdentifierValue,
- resourceAssignment.keyIdentifiers[0].value
+ expectedKeyIdentifierValue,
+ resourceAssignment.keyIdentifiers[0].value
)
// FIXME("Map is not collection type, It is known complex type")
@@ -313,8 +318,9 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for complex type"
)
assertEquals(
- expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
- resourceAssignment.keyIdentifiers[0].value)
+ expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
+ resourceAssignment.keyIdentifiers[0].value
+ )
}
@Test
@@ -330,13 +336,13 @@ class ResourceAssignmentUtilsTest {
)
assertEquals(2, resourceAssignment.keyIdentifiers.size)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
+ resourceAssignment.keyIdentifiers[0].value
)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
- resourceAssignment.keyIdentifiers[1].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
+ resourceAssignment.keyIdentifiers[1].value
)
}
@@ -351,13 +357,15 @@ class ResourceAssignmentUtilsTest {
// Enable transform template
resourceAssignment.property!!.metadata =
- mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
+ mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
ResourceAssignmentUtils
- .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
+ .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
- assertEquals("abc-vnf_private2",
- resourceAssignment.property!!.value!!.asText())
+ assertEquals(
+ "abc-vnf_private2",
+ resourceAssignment.property!!.value!!.asText()
+ )
}
private fun initInputMapAndExpectedValuesForPrimitiveType() {
@@ -412,7 +420,8 @@ class ResourceAssignmentUtilsTest {
expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(
ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
- ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
+ ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")),
+ ExpectedResponseIpAddress(
IpAddress("3333", "1.2.3.3")
)
).asJsonType()