From d425c6319a995402163c8868e9fe40f3d88f02ea Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Sat, 9 Nov 2019 20:35:47 -0500 Subject: Convert component functions IT to UT. Issue-ID: CCSDK-1735 Convert Netconf and Restconf Executor IT to UT. Remove duplicate BluePrintProperties. Signed-off-by: Brinda Santh Change-Id: I2eafdbabb17a4df72541ab93c46e7fc9eb0fe8d7 --- .../blueprintsprocessor/db/BluePrintDBLibConfiguration.kt | 6 +++--- .../db/primary/BluePrintDBLibPropertyService.kt | 12 ++++++------ .../db/primary/PrimaryDatabaseConfiguration.kt | 4 ---- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin') diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt index 907e93bed..a7ad921de 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db -import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService @@ -26,11 +26,11 @@ import org.springframework.context.annotation.Configuration @Configuration @EnableConfigurationProperties -open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrintProperties) { +open class BluePrintDBLibConfiguration(private var bluePrintPropertiesService: BluePrintPropertiesService) { @Bean("primary-database-properties") open fun getPrimaryProperties(): PrimaryDataSourceProperties { - return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB, + return bluePrintPropertiesService.propertyBeanType(DBLibConstants.PREFIX_DB, PrimaryDataSourceProperties::class.java) } } diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt index 2ae50424f..ff53de89f 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt @@ -17,14 +17,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService import org.onap.ccsdk.cds.blueprintsprocessor.db.* import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.stereotype.Service @Service -class BluePrintDBLibPropertySevice(private var bluePrintProperties: BluePrintProperties) { +class BluePrintDBLibPropertySevice(private var bluePrintPropertiesService: BluePrintPropertiesService) { fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService { val dBConnetionProperties = dBDataSourceProperties(jsonNode) @@ -53,7 +53,7 @@ class BluePrintDBLibPropertySevice(private var bluePrintProperties: BluePrintPro } private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties { - val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java) + val type = bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java) return when (type) { DBLibConstants.MARIA_DB -> { mariaDBConnectionProperties(prefix) @@ -91,15 +91,15 @@ class BluePrintDBLibPropertySevice(private var bluePrintProperties: BluePrintPro } private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties { - return bluePrintProperties.propertyBeanType(prefix, MySqlDataSourceProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java) } private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties { - return bluePrintProperties.propertyBeanType(prefix, MariaDataSourceProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java) } private fun primaryDBConnectionProperties(prefix: String): PrimaryDataSourceProperties { - return bluePrintProperties.propertyBeanType(prefix, PrimaryDataSourceProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, PrimaryDataSourceProperties::class.java) } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt index b17dcf0fc..82b77da47 100644 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt @@ -22,7 +22,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.context.annotation.Bean import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Primary import org.springframework.data.jpa.repository.config.EnableJpaAuditing import org.springframework.data.jpa.repository.config.EnableJpaRepositories import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate @@ -48,7 +47,6 @@ import javax.sql.DataSource open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) { private val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!! - @Primary @Bean("primaryEntityManager") open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean { val em = LocalContainerEntityManagerFactoryBean() @@ -63,7 +61,6 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: return em } - @Primary @Bean("primaryDataSource") open fun primaryDataSource(): DataSource { val dataSource = DriverManagerDataSource() @@ -74,7 +71,6 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: return dataSource } - @Primary @Bean("primaryTransactionManager") open fun primaryTransactionManager(): PlatformTransactionManager { val transactionManager = JpaTransactionManager() -- cgit 1.2.3-korg