From 72d22a4339db09824d46746dacbba1e141763dc0 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Tue, 26 Mar 2019 09:49:13 -0400 Subject: Migrate ccdsk/apps to ccsdk/cds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I020a2ccec4e691717f888e8bd2afec91a7c4e987 Issue-ID: CCSDK-1178 Signed-off-by: Alexis de Talhouët --- .../modules/commons/db-lib/pom.xml | 71 ------------- .../db/BluePrintDBLibConfiguration.kt | 56 ---------- .../blueprintsprocessor/db/BluePrintDBLibData.kt | 52 ---------- .../db/BluePrintDBLibGenericService.kt | 44 -------- .../db/BlueprintProcessorCatalogServiceImpl.kt | 114 --------------------- .../db/primary/BluePrintDBLibPropertyService.kt | 105 ------------------- .../db/primary/MariaDatabaseConfiguration.kt | 59 ----------- .../db/primary/MySqlDatabaseConfiguration.kt | 55 ---------- .../db/primary/PrimaryDBLibGenericService.kt | 27 ----- .../db/primary/PrimaryDatabaseConfiguration.kt | 82 --------------- .../db/primary/domain/BlueprintProcessorModel.kt | 84 --------------- .../domain/BlueprintProcessorModelContent.kt | 101 ------------------ .../BlueprintProcessorModelContentRepository.kt | 22 ---- .../BlueprintProcessorModelRepository.kt | 21 ---- .../db/BlueprintProcessorCatalogServiceImplTest.kt | 52 ---------- .../db/primary/PrimaryDatabaseConfigurationTest.kt | 49 --------- .../src/test/resources/application-test.properties | 27 ----- .../db-lib/src/test/resources/logback-test.xml | 35 ------- .../commons/db-lib/src/test/resources/test-cba.zip | Bin 9302 -> 0 bytes 19 files changed, 1056 deletions(-) delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/pom.xml delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt delete mode 100755 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt delete mode 100755 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml delete mode 100644 ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip (limited to 'ms/blueprintsprocessor/modules/commons/db-lib') diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml deleted file mode 100644 index 045c871f..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.onap.ccsdk.apps.blueprintsprocessor - commons - 0.4.2-SNAPSHOT - - - db-lib - jar - Blueprints Processor DB Lib - Blueprints Processor DB Lib - - - - org.onap.ccsdk.apps.controllerblueprints - blueprint-core - - - org.onap.ccsdk.apps.controllerblueprints - db-resources - - - org.onap.ccsdk.apps.controllerblueprints - blueprint-validation - - - org.onap.ccsdk.apps.blueprintsprocessor - processor-core - - - org.springframework.boot - spring-boot-starter-data-jpa - - - javax.validation - validation-api - - - com.h2database - h2 - - - org.mariadb.jdbc - mariadb-java-client - - - org.hibernate - hibernate-testing - test - - - - diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt deleted file mode 100644 index 3e9ec0ce..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt +++ /dev/null @@ -1,56 +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.apps.blueprintsprocessor.db - -import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties -import org.springframework.boot.context.properties.EnableConfigurationProperties -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan -@EnableConfigurationProperties -open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrintProperties) { - - @Bean("primary-database-properties") - open fun getPrimaryProperties(): PrimaryDataSourceProperties { - return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB_PRIMARY, - PrimaryDataSourceProperties::class.java) - } -} - -class DBLibConstants { - companion object { - const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary" - - //list of database - const val MARIA_DB: String = "maria-db" - const val PRIMARY_DB: String = "primary-db" - const val MYSQL_DB: String = "mysql-db" - const val ORACLE_DB: String = "oracle-db" - const val POSTGRES_DB: String = "postgres-db" - - //List of database drivers - const val DRIVER_MARIA_DB = "org.mariadb.jdbc.Driver" - const val DRIVER_MYSQL_DB = "com.mysql.jdbc.Driver" - const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver" - const val DRIVER_POSTGRES_DB = "org.postgresql.Driver" - - - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt deleted file mode 100644 index ab2c19a4..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibData.kt +++ /dev/null @@ -1,52 +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.apps.blueprintsprocessor.db - - -open class DBDataSourceProperties { - lateinit var url: String - lateinit var username: String - lateinit var password: String - open lateinit var driverClassName: String - -} - -open class PrimaryDataSourceProperties: DBDataSourceProperties() { - lateinit var hibernateHbm2ddlAuto: String - lateinit var hibernateDDLAuto: String - lateinit var hibernateNamingStrategy: String - lateinit var hibernateDialect: String -} - -open class MariaDataSourceProperties: DBDataSourceProperties() { - lateinit var hibernateHbm2ddlAuto: String - lateinit var hibernateDDLAuto: String - lateinit var hibernateNamingStrategy: String - lateinit var type: String - lateinit var hibernateDialect: String - override var driverClassName = DBLibConstants.DRIVER_MARIA_DB -} - -open class MySqlDataSourceProperties: DBDataSourceProperties() { - lateinit var hibernateHbm2ddlAuto: String - lateinit var hibernateDDLAuto: String - lateinit var hibernateNamingStrategy: String - lateinit var type: String - lateinit var hibernateDialect: String - override var driverClassName = DBLibConstants.DRIVER_MYSQL_DB -} - diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt deleted file mode 100644 index aee74d3f..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BluePrintDBLibGenericService.kt +++ /dev/null @@ -1,44 +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.apps.blueprintsprocessor.db - -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate - -interface BluePrintDBLibGenericService { - - fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate - - fun query(sql: String, params: Map): List> - - fun update(sql: String, params: Map): Int -} - -abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplate: NamedParameterJdbcTemplate) - : BluePrintDBLibGenericService { - - override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate { - return namedParameterJdbcTemplate - } - - override fun query(sql: String, params: Map): List> { - return namedParameterJdbcTemplate.queryForList(sql, params) - } - - override fun update(sql: String, params: Map): Int { - return namedParameterJdbcTemplate.update(sql, params) - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt deleted file mode 100755 index e94bcff5..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 Bell Canada. - * 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. - * 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.apps.blueprintsprocessor.db - -import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants -import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService -import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils -import org.onap.ccsdk.apps.controllerblueprints.db.resources.BlueprintCatalogServiceImpl -import org.slf4j.LoggerFactory -import org.springframework.dao.DataIntegrityViolationException -import org.springframework.stereotype.Service -import java.io.File -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths - -/** - * Similar/Duplicate implementation in [org.onap.ccsdk.apps.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl] - */ -@Service -class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService, - private val blueprintConfig: BluePrintCoreConfiguration, - private val blueprintModelRepository: BlueprintProcessorModelRepository) - : BlueprintCatalogServiceImpl(bluePrintRuntimeValidatorService) { - - private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString()) - - init { - - log.info("BlueprintProcessorCatalogServiceImpl initialized") - } - - override fun delete(name: String, version: String) = blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(name, version) - - - override fun get(name: String, version: String, extract: Boolean): Path? { - var path = "${blueprintConfig.archivePath}/$name/$version.zip" - - blueprintModelRepository.findByArtifactNameAndArtifactVersion(name, version)?.also { - it.blueprintModelContent.run { - val file = File(path) - file.parentFile.mkdirs() - file.createNewFile() - file.writeBytes(this!!.content!!).let { - if (extract) { - path = "${blueprintConfig.archivePath}/$name/$version" - BluePrintArchiveUtils.deCompress(file, path) - } - return Paths.get(path) - } - } - } - return null - } - - override fun save(metadata: MutableMap, archiveFile: File) { - val artifactName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME] - val artifactVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION] - - blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let { - log.info("Overwriting blueprint model :$artifactName::$artifactVersion") - blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion) - } - - val blueprintModel = BlueprintProcessorModel() - blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] - blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL - blueprintModel.artifactName = artifactName - blueprintModel.artifactVersion = artifactVersion - blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR] - blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS] - blueprintModel.artifactDescription = "Controller Blueprint for $artifactName:$artifactVersion" - - val blueprintModelContent = BlueprintProcessorModelContent() - blueprintModelContent.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID] - blueprintModelContent.contentType = "CBA_ZIP" - blueprintModelContent.name = "$artifactName:$artifactVersion" - blueprintModelContent.description = "$artifactName:$artifactVersion CBA Zip Content" - blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath()) - blueprintModelContent.blueprintModel = blueprintModel - - blueprintModel.blueprintModelContent = blueprintModelContent - - try { - blueprintModelRepository.saveAndFlush(blueprintModel) - } catch (ex: DataIntegrityViolationException) { - throw BluePrintException(ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " + - "is already exist in database: ${ex.message}", ex) - } - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt deleted file mode 100644 index f93c241d..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright © 2019 Bell Canada 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.apps.blueprintsprocessor.db.primary - -import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.apps.blueprintsprocessor.db.* -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils -import org.springframework.stereotype.Service - -@Service -class BluePrintDBLibPropertySevice(private var bluePrintProperties: BluePrintProperties) { - - fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService { - val dBConnetionProperties = dBDataSourceProperties(jsonNode) - return blueprintDBDataSourceService(dBConnetionProperties) - } - - fun JdbcTemplate(selector: String): BluePrintDBLibGenericService { - val prefix = "blueprintsprocessor.database.$selector" - val dBConnetionProperties = dBDataSourceProperties(prefix) - return blueprintDBDataSourceService(dBConnetionProperties) - } - - private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties { - val type = jsonNode.get("type").textValue() - return when (type) { - DBLibConstants.MYSQL_DB -> { - JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)!! - } - DBLibConstants.MARIA_DB -> { - JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)!! - } - else -> { - throw BluePrintProcessorException("Rest adaptor($type) is not supported") - } - } - } - - private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties { - val type = bluePrintProperties.propertyBeanType("$prefix.type", String::class.java) - return when (type) { - DBLibConstants.MARIA_DB -> { - mariaDBConnectionProperties(prefix) - } - DBLibConstants.MYSQL_DB -> { - mySqlDBConnectionProperties(prefix) - } - DBLibConstants.ORACLE_DB -> { - TODO("not implemented") - } - DBLibConstants.POSTGRES_DB -> { - TODO("not implemented") - } - DBLibConstants.PRIMARY_DB -> { - primaryDBConnectionProperties(prefix) - } - else -> { - throw BluePrintProcessorException("Rest adaptor($type) is not supported") - } - } - } - - private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService { - when (dBConnetionProperties) { - is MariaDataSourceProperties -> { - return MariaDatabaseConfiguration(dBConnetionProperties) - } - is MySqlDataSourceProperties -> { - return MySqlDatabaseConfiguration(dBConnetionProperties) - } - else -> { - throw BluePrintProcessorException("couldn't get rest service for") - } - } - } - - private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties { - return bluePrintProperties.propertyBeanType(prefix, MySqlDataSourceProperties::class.java) - } - - private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties { - return bluePrintProperties.propertyBeanType(prefix, MariaDataSourceProperties::class.java) - } - - private fun primaryDBConnectionProperties(prefix: String): PrimaryDataSourceProperties { - return bluePrintProperties.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/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt deleted file mode 100644 index c67fb339..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2019 Bell Canada 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.apps.blueprintsprocessor.db.primary - -import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService -import org.onap.ccsdk.apps.blueprintsprocessor.db.MariaDataSourceProperties -import org.slf4j.LoggerFactory -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate -import org.springframework.jdbc.datasource.DriverManagerDataSource -import org.springframework.orm.jpa.JpaTransactionManager -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter -import org.springframework.transaction.PlatformTransactionManager -import java.util.* -import javax.sql.DataSource - -class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDataSourceProperties) : BluePrintDBLibGenericService { - - override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate { - return mariaNamedParameterJdbcTemplate(mariaDataSource()) - } - - override fun query(sql: String, params: Map): List> { - return mariaNamedParameterJdbcTemplate(mariaDataSource()).queryForList(sql, params) - } - - override fun update(sql: String, params: Map): Int { - return mariaNamedParameterJdbcTemplate(mariaDataSource()).update(sql, params) - } - - val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!! - - fun mariaDataSource(): DataSource { - val dataSource = DriverManagerDataSource() - dataSource.setDriverClassName(mariaDataSourceProperties.driverClassName) - dataSource.url = mariaDataSourceProperties.url - dataSource.username = mariaDataSourceProperties.username - dataSource.password = mariaDataSourceProperties.password - return dataSource - } - - fun mariaNamedParameterJdbcTemplate(mariaDataSource: DataSource): NamedParameterJdbcTemplate { - return NamedParameterJdbcTemplate(mariaDataSource) - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt deleted file mode 100644 index 2a0dec73..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2019 Bell Canada 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.apps.blueprintsprocessor.db.primary - -import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibGenericService -import org.onap.ccsdk.apps.blueprintsprocessor.db.MySqlDataSourceProperties -import org.slf4j.LoggerFactory -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate -import org.springframework.jdbc.datasource.DriverManagerDataSource -import javax.sql.DataSource - -class MySqlDatabaseConfiguration(private val mySqlDataSourceProperties: MySqlDataSourceProperties) : BluePrintDBLibGenericService { - override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate { - return mySqlNamedParameterJdbcTemplate(mySqlDataSource()) - } - - override fun query(sql: String, params: Map): List> { - return mySqlNamedParameterJdbcTemplate(mySqlDataSource()).queryForList(sql, params) - } - - override fun update(sql: String, params: Map): Int { - return mySqlNamedParameterJdbcTemplate(mySqlDataSource()).update(sql, params) - } - - val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!! - - fun mySqlDataSource(): DataSource { - val dataSource = DriverManagerDataSource() - dataSource.setDriverClassName(mySqlDataSourceProperties.driverClassName) - dataSource.url = mySqlDataSourceProperties.url - dataSource.username = mySqlDataSourceProperties.username - dataSource.password = mySqlDataSourceProperties.password - return dataSource - } - - fun mySqlNamedParameterJdbcTemplate(mySqlDataSource: DataSource): NamedParameterJdbcTemplate { - return NamedParameterJdbcTemplate(mySqlDataSource) - } - - -} diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt deleted file mode 100644 index 5a926534..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt +++ /dev/null @@ -1,27 +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.apps.blueprintsprocessor.db.primary - -import org.onap.ccsdk.apps.blueprintsprocessor.db.AbstractDBLibGenericService -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate -import org.springframework.stereotype.Service - -@Service -open class PrimaryDBLibGenericService(primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate) - : AbstractDBLibGenericService(primaryNamedParameterJdbcTemplate) { - -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt deleted file mode 100644 index 4039b053..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt +++ /dev/null @@ -1,82 +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.apps.blueprintsprocessor.db.primary - -import org.onap.ccsdk.apps.blueprintsprocessor.db.PrimaryDataSourceProperties -import org.slf4j.LoggerFactory -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Primary -import org.springframework.data.jpa.repository.config.EnableJpaRepositories -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate -import org.springframework.jdbc.datasource.DriverManagerDataSource -import org.springframework.orm.jpa.JpaTransactionManager -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter -import org.springframework.transaction.PlatformTransactionManager -import java.util.* -import javax.sql.DataSource - -@Configuration -@EnableJpaRepositories( - basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor.*"], - entityManagerFactoryRef = "primaryEntityManager", - transactionManagerRef = "primaryTransactionManager" -) -open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) { - val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!! - - @Primary - @Bean("primaryEntityManager") - open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean { - val em = LocalContainerEntityManagerFactoryBean() - em.dataSource = primaryDataSource() - em.setPackagesToScan("org.onap.ccsdk.apps.blueprintsprocessor.*") - em.jpaVendorAdapter = HibernateJpaVendorAdapter() - val properties = HashMap() - properties["hibernate.hbm2ddl.auto"] = primaryDataSourceProperties.hibernateHbm2ddlAuto - properties["hibernate.dialect"] = primaryDataSourceProperties.hibernateDialect - em.jpaPropertyMap = properties - return em - } - - @Primary - @Bean("primaryDataSource") - open fun primaryDataSource(): DataSource { - val dataSource = DriverManagerDataSource() - dataSource.setDriverClassName(primaryDataSourceProperties.driverClassName) - dataSource.url = primaryDataSourceProperties.url - dataSource.username = primaryDataSourceProperties.username - dataSource.password = primaryDataSourceProperties.password - return dataSource - } - - @Primary - @Bean("primaryTransactionManager") - open fun primaryTransactionManager(): PlatformTransactionManager { - val transactionManager = JpaTransactionManager() - transactionManager.entityManagerFactory = primaryEntityManager().getObject() - log.info("Initialised Primary Transaction Manager for url ${primaryDataSourceProperties.url}") - return transactionManager - } - - @Bean("primaryNamedParameterJdbcTemplate") - open fun primaryNamedParameterJdbcTemplate(primaryDataSource: DataSource): NamedParameterJdbcTemplate { - return NamedParameterJdbcTemplate(primaryDataSource) - } - -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt deleted file mode 100755 index 0935d038..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModel.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * 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.apps.blueprintsprocessor.db.primary.domain - -import com.fasterxml.jackson.annotation.JsonFormat -import io.swagger.annotations.ApiModelProperty -import javax.persistence.Entity -import javax.persistence.EntityListeners -import javax.persistence.Table -import org.hibernate.annotations.Proxy -import org.springframework.data.annotation.LastModifiedDate -import org.springframework.data.jpa.domain.support.AuditingEntityListener -import java.io.Serializable -import java.util.* -import javax.persistence.CascadeType -import javax.persistence.Column -import javax.persistence.FetchType -import javax.persistence.Id -import javax.persistence.Lob -import javax.persistence.OneToOne -import javax.persistence.Temporal -import javax.persistence.TemporalType - -@EntityListeners(AuditingEntityListener::class) -@Entity -@Table(name = "BLUEPRINT_RUNTIME") -@Proxy(lazy = false) -class BlueprintProcessorModel : Serializable { - - @Id - @Column(name = "blueprint_runtime_id") - var id: String? = null - - @Column(name = "artifact_type") - var artifactType: String? = null - - @Column(name = "artifact_version", nullable = false) - @ApiModelProperty(required = true) - var artifactVersion: String? = null - - @Lob - @Column(name = "artifact_description") - var artifactDescription: String? = null - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "creation_date") - var createdDate = Date() - - @Column(name = "artifact_name", nullable = false) - @ApiModelProperty(required = true) - var artifactName: String? = null - - @Column(name = "updated_by", nullable = false) - @ApiModelProperty(required = true) - var updatedBy: String? = null - - @Lob - @Column(name = "tags", nullable = false) - @ApiModelProperty(required = true) - var tags: String? = null - - @OneToOne(mappedBy = "blueprintModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = [CascadeType.ALL]) - var blueprintModelContent: BlueprintProcessorModelContent? = null - - companion object { - private const val serialVersionUID = 1L - } -} diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt deleted file mode 100644 index 58bf8a33..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/domain/BlueprintProcessorModelContent.kt +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * 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.apps.blueprintsprocessor.db.primary.domain - -import com.fasterxml.jackson.annotation.JsonFormat -import io.swagger.annotations.ApiModelProperty -import java.io.Serializable -import java.util.Date -import java.util.Objects -import javax.persistence.Column -import javax.persistence.Entity -import javax.persistence.EntityListeners -import javax.persistence.Id -import javax.persistence.JoinColumn -import javax.persistence.Lob -import javax.persistence.OneToOne -import javax.persistence.Table -import javax.persistence.Temporal -import javax.persistence.TemporalType -import org.springframework.data.annotation.LastModifiedDate -import org.springframework.data.jpa.domain.support.AuditingEntityListener - -@EntityListeners(AuditingEntityListener::class) -@Entity -@Table(name = "BLUEPRINT_CONTENT_RUNTIME") -class BlueprintProcessorModelContent : Serializable { - - @Id - @Column(name = "blueprint_content_runtime_id") - var id: String? = null - - @Column(name = "name", nullable = false) - @ApiModelProperty(required = true) - var name: String? = null - - @Column(name = "content_type", nullable = false) - @ApiModelProperty(required = true) - var contentType: String? = null - - @OneToOne - @JoinColumn(name = "blueprint_runtime_id") - var blueprintModel: BlueprintProcessorModel? = null - - @Lob - @Column(name = "description") - var description: String? = null - - @Lob - @Column(name = "content", nullable = false) - @ApiModelProperty(required = true) - var content: ByteArray? = null - - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - @LastModifiedDate - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "updated_date") - var creationDate = Date() - - override fun toString(): String { - return "[" + "id = " + id + - ", name = " + name + - ", contentType = " + contentType + - "]" - } - - override fun equals(o: Any?): Boolean { - - if (o === this) { - return true - } - if (o !is BlueprintProcessorModelContent) { - return false - } - val blueprintModelContent = o as BlueprintProcessorModelContent? - return (id == blueprintModelContent!!.id && name == blueprintModelContent.name - && contentType == blueprintModelContent.contentType) - } - - override fun hashCode(): Int { - return Objects.hash(id, name, contentType) - } - - companion object { - private const val serialVersionUID = 1L - } - -} diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt deleted file mode 100644 index e614544e..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelContentRepository.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * 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.apps.blueprintsprocessor.db.primary.repository - -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent -import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelContentRepository - -interface BlueprintProcessorModelContentRepository : ModelContentRepository \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt deleted file mode 100644 index 25f3dac9..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/repository/BlueprintProcessorModelRepository.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * 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.apps.blueprintsprocessor.db.primary.repository - -import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel -import org.onap.ccsdk.apps.controllerblueprints.db.resources.repository.ModelRepository - -interface BlueprintProcessorModelRepository : ModelRepository diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt deleted file mode 100644 index 4c953163..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2019 Bell Canada. - * - * 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.apps.blueprintsprocessor.db - -import org.junit.Test -import org.junit.runner.RunWith -import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.context.annotation.ComponentScan -import org.springframework.test.context.TestPropertySource -import org.springframework.test.context.junit4.SpringRunner -import java.io.File -import java.nio.file.Paths -import kotlin.test.assertTrue - -@RunWith(SpringRunner::class) -@EnableAutoConfiguration -@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"]) -@TestPropertySource(locations = ["classpath:application-test.properties"]) -class BlueprintProcessorCatalogServiceImplTest { - - @Autowired - lateinit var blueprintCatalog: BluePrintCatalogService - - @Test - fun `test catalog service`() { - val file = Paths.get("./src/test/resources/test-cba.zip").toFile() - assertTrue(file.exists(), "couldnt get file ${file.absolutePath}") - - blueprintCatalog.saveToDatabase(file) - - blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0") - - blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0") - - File("./src/test/resources/baseconfiguration").deleteRecursively() - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt deleted file mode 100644 index 3f737e31..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt +++ /dev/null @@ -1,49 +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.apps.blueprintsprocessor.db.primary - -import org.junit.Test -import org.junit.runner.RunWith -import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.apps.blueprintsprocessor.core.BlueprintPropertyConfiguration -import org.onap.ccsdk.apps.blueprintsprocessor.db.BluePrintDBLibConfiguration -import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.autoconfigure.EnableAutoConfiguration -import org.springframework.context.annotation.ComponentScan -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.TestPropertySource -import org.springframework.test.context.junit4.SpringRunner -import javax.sql.DataSource -import kotlin.test.assertNotNull - -@RunWith(SpringRunner::class) -@ContextConfiguration(classes = [BlueprintPropertyConfiguration::class, BluePrintProperties::class, - BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class]) -@TestPropertySource(locations = ["classpath:application-test.properties"]) -@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"]) -@EnableAutoConfiguration -class PrimaryDatabaseConfigurationTest { - - @Autowired - lateinit var primaryDataSource: DataSource - - @Test - fun testPrimaryDatabaseConfiguration() { - assertNotNull(primaryDataSource, " failed to create primary data source") - } -} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties deleted file mode 100644 index 3ac7ec38..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties +++ /dev/null @@ -1,27 +0,0 @@ -# suppress inspection "UnusedProperty" for whole file -# -# 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. -# -blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1 -blueprintsprocessor.db.primary.username=sa -blueprintsprocessor.db.primary.password= -blueprintsprocessor.db.primary.driverClassName=org.h2.Driver -blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop -blueprintsprocessor.db.primary.hibernateDDLAuto=update -blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy -blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect -# Controller Blueprints Core Configuration -blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy -blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml deleted file mode 100644 index f9ec9fe5..00000000 --- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/logback-test.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n - - - - - - - - - - - - - diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip deleted file mode 100644 index 90748240..00000000 Binary files a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/test-cba.zip and /dev/null differ -- cgit 1.2.3-korg