diff options
author | Alexis de Talhouët <adetalhouet89@gmail.com> | 2019-02-18 08:08:24 -0500 |
---|---|---|
committer | Alexis de Talhouët <adetalhouet89@gmail.com> | 2019-02-18 17:31:41 -0500 |
commit | 7f4a72d7ab4a0e5509a7249c4616b90fb66f38d1 (patch) | |
tree | 40d1b8e0717d11b9fc9b05d6e9fdfc48ed7de115 /ms/controllerblueprints/modules/service | |
parent | 2ba3b4353edf536ecd15b9fb8af5a326d0b34e01 (diff) |
Simplify NetconfRpcService
Change-Id: I6daac25c272ab6b437c07602167a76a2d61816db
Issue-ID: CCSDK-790
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service')
2 files changed, 7 insertions, 6 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt index d4e4a24cb..63171de6f 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImpl.kt @@ -67,14 +67,14 @@ open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService }
} catch (e: Exception) {
- log.error("failed in blueprint enhancement", e)
+ throw e
}
return blueprintRuntimeService.bluePrintContext()
}
private fun enhanceResourceDefinition(blueprintRuntimeService: BluePrintRuntimeService<*>) {
-
+ log.info("##### Enhancing blueprint Resource Definitions")
resourceDefinitionEnhancerService.enhance(blueprintRuntimeService)
}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt index ab5ca74cb..43eb019e2 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +76,7 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe artifactDefinitionMap.value.file } - }?.single { it.isNotEmpty() }?.distinct() + }?.flatten()?.distinct() } // Convert file content to ResourceAssignments asynchronously @@ -103,12 +104,12 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe // Read the Resource Definitions from the Database and write to type file. private fun generateResourceDictionaryFile(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>) { - val resourcekeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct() - log.info("distinct resource keys ($resourcekeys)") + val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted() + log.info("distinct resource keys ($resourceKeys)") //TODO("Optimise DB single Query to multiple Query") // Collect the Resource Definition from database and convert to map to save in file - val resourceDefinitionMap = resourcekeys.map { resourceKey -> + val resourceDefinitionMap = resourceKeys.map { resourceKey -> getResourceDefinition(resourceKey) }.map { it.name to it }.toMap() |