From 0fbfc6eab2d42c8ee2f8601db43813a4e33ffc4d Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Thu, 29 Aug 2019 22:40:48 -0400 Subject: Resolve duplicate application property values Change-Id: I0813ff96388bce77eba9fbc9eff0eccf59a6be6a Issue-ID: CCSDK-1663 Signed-off-by: Brinda Santh --- .../service/BluePrintDesignerCoreConfiguration.kt | 61 ++++++++++++++++++++++ .../ControllerBluePrintCoreConfiguration.kt | 60 --------------------- .../controller/BlueprintModelControllerTest.kt | 10 ++-- .../src/test/resources/application.properties | 24 ++++----- 4 files changed, 78 insertions(+), 77 deletions(-) create mode 100644 ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt delete mode 100644 ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt (limited to 'ms/controllerblueprints/modules/service/src') diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt new file mode 100644 index 000000000..c69a94430 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/BluePrintDesignerCoreConfiguration.kt @@ -0,0 +1,61 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.controllerblueprints.service + +import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.context.properties.bind.Bindable +import org.springframework.boot.context.properties.bind.Binder +import org.springframework.boot.context.properties.source.ConfigurationPropertySources +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.core.env.Environment +import org.springframework.stereotype.Service + +@Configuration +open class BluePrintDesignerCoreConfiguration(private val bluePrintProperties: BluePrintDesignerProperties) { + + companion object { + const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "blueprintsprocessor" + } + + @Bean + open fun bluePrintDesignerLoadConfiguration(): BluePrintLoadConfiguration { + return bluePrintProperties + .propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java) + } +} + +@Configuration +open class BlueprintDesignerPropertyConfiguration { + @Autowired + lateinit var environment: Environment + + @Bean + open fun bluePrintDesignerPropertyBinder(): Binder { + val configurationPropertySource = ConfigurationPropertySources.get(environment) + return Binder(configurationPropertySource) + } +} + +@Service +open class BluePrintDesignerProperties(private var bluePrintDesignerPropertyBinder: Binder) { + fun propertyBeanType(prefix: String, type: Class): T { + return bluePrintDesignerPropertyBinder.bind(prefix, Bindable.of(type)).get() + } +} \ No newline at end of file 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/ControllerBluePrintCoreConfiguration.kt deleted file mode 100644 index 790c61ebc..000000000 --- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/ControllerBluePrintCoreConfiguration.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.controllerblueprints.service - -import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.context.properties.bind.Bindable -import org.springframework.boot.context.properties.bind.Binder -import org.springframework.boot.context.properties.source.ConfigurationPropertySources -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.core.env.Environment -import org.springframework.stereotype.Service - -@Configuration -open class ControllerBluePrintCoreConfiguration(private val bluePrintProperties: ControllerBlueprintProperties) { - - companion object { - const val PREFIX_BLUEPRINT_LOAD_CONFIGURATION = "controllerblueprints" - } - - @Bean - open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration { - return bluePrintProperties - .propertyBeanType(PREFIX_BLUEPRINT_LOAD_CONFIGURATION, BluePrintLoadConfiguration::class.java) - } -} - -@Configuration -open class ControllerBlueprintPropertyConfiguration { - @Autowired - lateinit var environment: Environment - - @Bean - open fun controllerBluePrintPropertyBinder(): Binder { - val configurationPropertySource = ConfigurationPropertySources.get(environment) - return Binder(configurationPropertySource) - } -} - -@Service -open class ControllerBlueprintProperties(private var bluePrintPropertyBinder: Binder) { - fun propertyBeanType(prefix: String, type: Class): T { - return bluePrintPropertyBinder.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 -- cgit 1.2.3-korg