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 | 48b1bea8c1a636169cb5fecd3d0091064e02145b (patch) | |
tree | fd9d267b6cfbd9ca0f3042aaa787f67560c0327e /ms/controllerblueprints/modules/service | |
parent | 01eff6bc81499a9e41395f6b384a5e893b366505 (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 d4e4a24c..63171de6 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 ab5ca74c..43eb019e 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() |