diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-29 22:40:48 -0400 |
---|---|---|
committer | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-29 22:40:48 -0400 |
commit | 0fbfc6eab2d42c8ee2f8601db43813a4e33ffc4d (patch) | |
tree | 240a92c46f7bc1a46605c6aa895c0ec6c56e936e /ms/controllerblueprints/modules | |
parent | b12d13b0b78b7e87912c07a7c946cbbfcee41d47 (diff) |
Resolve duplicate application property values
Change-Id: I0813ff96388bce77eba9fbc9eff0eccf59a6be6a
Issue-ID: CCSDK-1663
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules')
7 files changed, 39 insertions, 41 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt index 8674c4d40..9b25a5ac9 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +18,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.config -open class BluePrintPathConfiguration { +open class BluePrintLoadConfiguration { lateinit var blueprintDeployPath: String lateinit var blueprintArchivePath: String lateinit var blueprintWorkingPath: String -} - -open class BluePrintLoadConfiguration : BluePrintPathConfiguration() { var loadInitialData: Boolean = false var loadBluePrint: Boolean = false var loadBluePrintPaths: String? = null diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt index a06fb99ff..78997fe52 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt @@ -25,7 +25,7 @@ import com.hubspot.jinjava.interpret.JinjavaInterpreter import com.hubspot.jinjava.loader.ResourceLocator import com.hubspot.jinjava.loader.ResourceNotFoundException import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode @@ -39,7 +39,7 @@ object BluePrintJinjaTemplateService { /** * To enable inheritance within CBA, we need Jinja runtime to know where to load the templates. */ - class BlueprintRelatedTemplateLocator(private val bluePrintPathConfiguration: BluePrintPathConfiguration, + class BlueprintRelatedTemplateLocator(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val artifactName: String, private val artifactVersion: String) : ResourceLocator { @@ -47,7 +47,7 @@ object BluePrintJinjaTemplateService { override fun getString(fullName: String, encoding: Charset, interpreter: JinjavaInterpreter): String { try { val deployFile = - normalizedPathName(bluePrintPathConfiguration.blueprintDeployPath, + normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion, fullName) @@ -62,14 +62,14 @@ object BluePrintJinjaTemplateService { fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>, - bluePrintPathConfiguration: BluePrintPathConfiguration, artifactName: String, + bluePrintLoadConfiguration: BluePrintLoadConfiguration, artifactName: String, artifactVersion: String): String { return generateContent(template, json, ignoreJsonNull, additionalContext, - BlueprintRelatedTemplateLocator(bluePrintPathConfiguration, artifactName, artifactVersion)) + BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion)) } fun generateContent(template: String, json: String, ignoreJsonNull: Boolean, diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt index af97d6691..2c928e288 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt @@ -17,13 +17,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTemplateService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.stereotype.Service @Service -class BluePrintTemplateService(private val bluePrintPathConfiguration: BluePrintPathConfiguration) : +class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) : BlueprintTemplateService { override suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>, @@ -41,7 +40,7 @@ class BluePrintTemplateService(private val bluePrintPathConfiguration: BluePrint jsonData, ignoreJsonNull, additionalContext, - bluePrintPathConfiguration, + bluePrintLoadConfiguration, bluePrintRuntimeService.bluePrintContext().name(), bluePrintRuntimeService.bluePrintContext().version()) } diff --git a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt index b3436a991..7244e00e5 100644 --- a/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt +++ b/ms/controllerblueprints/modules/db-resources/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/db/resources/BlueprintCatalogServiceImpl.kt @@ -19,7 +19,7 @@ package org.onap.ccsdk.cds.controllerblueprints.db.resources import org.onap.ccsdk.cds.controllerblueprints.core.* -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils @@ -31,7 +31,7 @@ import javax.persistence.MappedSuperclass @MappedSuperclass abstract class BlueprintCatalogServiceImpl( - private val bluePrintPathConfiguration: BluePrintPathConfiguration, + private val bluePrintLoadConfiguration: BluePrintLoadConfiguration, private val blueprintValidator: BluePrintValidatorService) : BluePrintCatalogService { private val log = LoggerFactory.getLogger(BlueprintCatalogServiceImpl::class.java)!! @@ -44,7 +44,7 @@ abstract class BlueprintCatalogServiceImpl( if (blueprintFile.isDirectory) { log.info("Save processing($processingId) Working Dir(${blueprintFile.absolutePath})") workingDir = blueprintFile.absolutePath - archiveFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath, processingId, "cba.zip") + archiveFile = normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath, processingId, "cba.zip") if (!BluePrintArchiveUtils.compress(blueprintFile, archiveFile)) { throw BluePrintException("Fail to compress blueprint") @@ -52,7 +52,7 @@ abstract class BlueprintCatalogServiceImpl( } else { // Compressed File log.info("Save processing($processingId) CBA(${blueprintFile.absolutePath})") - workingDir = normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath, processingId) + workingDir = normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, processingId) archiveFile = blueprintFile // Decompress the CBA file to working Directory blueprintFile.deCompress(workingDir) diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt index 790c61ebc..c69a94430 100644 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2019 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,34 +28,34 @@ import org.springframework.core.env.Environment import org.springframework.stereotype.Service @Configuration -open class ControllerBluePrintCoreConfiguration(private val bluePrintProperties: ControllerBlueprintProperties) { +open class BluePrintDesignerCoreConfiguration(private val bluePrintProperties: BluePrintDesignerProperties) { companion object { - const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "controllerblueprints" + const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "blueprintsprocessor" } @Bean - open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration { + open fun bluePrintDesignerLoadConfiguration(): BluePrintLoadConfiguration { return bluePrintProperties .propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java) } } @Configuration -open class ControllerBlueprintPropertyConfiguration { +open class BlueprintDesignerPropertyConfiguration { @Autowired lateinit var environment: Environment @Bean - open fun controllerBluePrintPropertyBinder(): Binder { + open fun bluePrintDesignerPropertyBinder(): Binder { val configurationPropertySource = ConfigurationPropertySources.get(environment) return Binder(configurationPropertySource) } } @Service -open class ControllerBlueprintProperties(private var bluePrintPropertyBinder: Binder) { +open class BluePrintDesignerProperties(private var bluePrintDesignerPropertyBinder: Binder) { fun <T> propertyBeanType(prefix: String, type: Class<T>): T { - return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() + return bluePrintDesignerPropertyBinder.bind(prefix, Bindable.of(type)).get() } }
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt index 64bd3ff3e..1ef717a5c 100644 --- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt +++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt @@ -28,8 +28,8 @@ import org.junit.runner.RunWith import org.junit.runners.MethodSorters import org.onap.ccsdk.cds.controllerblueprints.TestApplication import org.onap.ccsdk.cds.controllerblueprints.core.* -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration -import org.onap.ccsdk.cds.controllerblueprints.service.ControllerBluePrintCoreConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration +import org.onap.ccsdk.cds.controllerblueprints.service.BluePrintDesignerCoreConfiguration import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired @@ -62,7 +62,7 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ContextConfiguration(classes = [TestApplication::class, ControllerBluePrintCoreConfiguration::class]) +@ContextConfiguration(classes = [TestApplication::class, BluePrintDesignerCoreConfiguration::class]) @ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints"]) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @EnableAutoConfiguration @@ -77,7 +77,7 @@ class BlueprintModelControllerTest { @Autowired lateinit var webTestClient: WebTestClient - private var bluePrintLoadConfiguration: BluePrintPathConfiguration? = null + private var bluePrintLoadConfiguration: BluePrintLoadConfiguration? = null private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration" private var zipBlueprintFileName: String? = null @@ -89,7 +89,7 @@ class BlueprintModelControllerTest { fun setUp() { assertNotNull(webTestClient, " Failed to create WebTestClient") - bluePrintLoadConfiguration = BluePrintPathConfiguration().apply { + bluePrintLoadConfiguration = BluePrintLoadConfiguration().apply { blueprintArchivePath = "./target/blueprints/archive" blueprintWorkingPath = "./target/blueprints/work" blueprintDeployPath = "./target/blueprints/deploy" diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index c3afe13d8..ac83276e6 100755 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -22,20 +22,20 @@ logging.level.org.hibernate.type.descriptor.sql=debug # Load Resource Source Mappings resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability # Controller Blueprints Core Configuration -controllerblueprints.blueprintDeployPath=./target/blueprints/deploy -controllerblueprints.blueprintArchivePath=./target/blueprints/archive -controllerblueprints.blueprintWorkingPath=./target/blueprints/work +blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy +blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work # Controller Blueprint Load Configurations -controllerblueprints.loadInitialData=false -controllerblueprints.loadBluePrint=false -controllerblueprints.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint -controllerblueprints.loadModelType=false -controllerblueprints.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type -controllerblueprints.loadResourceDictionary=false -controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary +blueprintsprocessor.loadInitialData=false +blueprintsprocessor.loadBluePrint=false +blueprintsprocessor.loadBluePrintPaths=./../../../../components/model-catalog/blueprint-model/test-blueprint +blueprintsprocessor.loadModelType=false +blueprintsprocessor.loadModeTypePaths=./../../../../components/model-catalog/definition-type/starter-type +blueprintsprocessor.loadResourceDictionary=false +blueprintsprocessor.loadResourceDictionaryPaths=./../../../../components/model-catalog/resource-dictionary/starter-dictionary # CBA file extension -controllerblueprints.loadCbaExtension=zip +blueprintsprocessor.loadCbaExtension=zip # CBA examples for tests cases -controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint +blueprintsprocessor.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint |