import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBlueprintProcessorCatalogServiceImpl
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDatabaseConfiguration
@ContextConfiguration(classes = [DatabaseResourceAssignmentProcessor::class, BlueprintPropertyConfiguration::class,
BluePrintProperties::class, BluePrintDBLibPropertySevice::class, BluePrintDBLibConfiguration::class,
BluePrintCoreConfiguration::class, MockDatabaseConfiguration::class, MockBlueprintProcessorCatalogServiceImpl::class,
- BlueprintPropertiesService::class])
+ BlueprintPropertiesService::class, PrimaryDatabaseConfiguration::class])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class DatabaseResourceResolutionProcessorTest {
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
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) {
lateinit var username: String
lateinit var password: String
open lateinit var driverClassName: String
-
}
open class PrimaryDataSourceProperties: DBDataSourceProperties() {
import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
import org.slf4j.LoggerFactory
+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 javax.sql.DataSource
@Configuration
+@ConditionalOnProperty(name = ["blueprintsprocessor.db.primary.defaultConfig"], havingValue = "true",
+ matchIfMissing = true)
+@ComponentScan
@EnableJpaRepositories(
basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.*",
"org.onap.ccsdk.cds.controllerblueprints.*"],
)
@EnableJpaAuditing
open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) {
- val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
+ private val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
@Primary
@Bean("primaryEntityManager")
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.db.service
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.db.service
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.db.service
+package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.mock.MockBlueprintProcessorCatalogServiceImpl
-import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintCatalogServiceImpl
-import org.onap.ccsdk.cds.blueprintsprocessor.db.service.BlueprintProcessorCatalogServiceImpl
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service.BlueprintCatalogServiceImpl
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service.BlueprintProcessorCatalogServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
# See the License for the specific language governing permissions and
# limitations under the License.
#
+blueprintsprocessor.db.primary.defaultConfig=true
+
blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
blueprintsprocessor.db.username=sa
blueprintsprocessor.db.password=