Optimize spring data JPA UT. 12/98912/2
authorBrinda Santh <bs2796@att.com>
Thu, 28 Nov 2019 00:42:17 +0000 (19:42 -0500)
committerKAPIL SINGAL <ks220y@att.com>
Fri, 29 Nov 2019 05:18:04 +0000 (05:18 +0000)
Test case based database configuration, so that we can define what repositories and entities can be used for testing.

Issue-ID: CCSDK-1735
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: I4f8a7eb4ed47fec9ab17eb9552648ebd0de01236

47 files changed:
ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt
ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/PrimaryDBLibGenericService.kt [moved from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt with 82% similarity]
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryReactRepositoryTest.kt
ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt

diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..58464cb
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class BlueprintDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.controllerblueprints",
+            "org.onap.ccsdk.cds.blueprintsprocessor"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index cb7467b..e180643 100644 (file)
@@ -16,6 +16,7 @@
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db
 
 import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
 import javax.transaction.Transactional
 
 /**
@@ -24,6 +25,7 @@ import javax.transaction.Transactional
  * @author Serge Simard
  * @version 1.0
  */
+@Repository
 interface ResourceConfigSnapshotRepository : JpaRepository<ResourceConfigSnapshot, String> {
 
     fun findByResourceIdAndResourceTypeAndStatus(
index fcbc157..9260b79 100644 (file)
@@ -32,7 +32,7 @@ import java.util.UUID
  * @version 1.0
  */
 @Service
-class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapshotRepository) {
+open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepository: ResourceConfigSnapshotRepository) {
 
     private val log = LoggerFactory.getLogger(ResourceConfigSnapshotService::class.toString())
 
@@ -42,7 +42,7 @@ class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapsh
         status: ResourceConfigSnapshot.Status = RUNNING
     ): String =
         withContext(Dispatchers.IO) {
-            repository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
+            resourceConfigSnapshotRepository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
                 ?.config_snapshot ?: Strings.EMPTY
         }
 
@@ -63,18 +63,18 @@ class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapsh
 
             // Overwrite configuration snapshot entry of resId/resType
             if (resId.isNotEmpty() && resType.isNotEmpty()) {
-                repository.findByResourceIdAndResourceTypeAndStatus(resId, resType, status)
+                resourceConfigSnapshotRepository.findByResourceIdAndResourceTypeAndStatus(resId, resType, status)
                     ?.let {
                         log.info(
                             "Overwriting configuration snapshot entry for resourceId=($resId), " +
                                     "resourceType=($resType), status=($status)"
                         )
-                        repository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
+                        resourceConfigSnapshotRepository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
                     }
             }
             var storedSnapshot: ResourceConfigSnapshot
             try {
-                storedSnapshot = repository.saveAndFlush(resourceConfigSnapshotEntry)
+                storedSnapshot = resourceConfigSnapshotRepository.saveAndFlush(resourceConfigSnapshotEntry)
                 log.info(
                     "Stored configuration snapshot for resourceId=($resId), " +
                             "resourceType=($resType), status=($status), " +
index c472337..450da1c 100644 (file)
@@ -23,10 +23,7 @@ import org.junit.Assert.assertTrue
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF
@@ -36,11 +33,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.Reso
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshotService
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
 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
@@ -48,13 +43,12 @@ import org.springframework.test.context.junit4.SpringRunner
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [ResourceConfigSnapshotService::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
-        BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class]
+    classes = [ResourceConfigSnapshotService::class, TestDatabaseConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
-@EnableAutoConfiguration
+@ComponentScan(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"]
+)
 @Suppress("SameParameterValue")
 class ComponentConfigSnapshotsExecutorTest {
 
@@ -346,9 +340,9 @@ class ComponentConfigSnapshotsExecutorTest {
             // then; we should get JSON-patches differences in our response property
             val diffJson =
                 "[{\"op\":\"add\",\"path\":\"/system-uptime-information/last-configured-time/new-child-object\",\"value\":{\"property\":\"value\"}}," +
-                        "{\"op\":\"replace\",\"path\":\"/system-uptime-information/system-booted-time/time-length\",\"value\":\"14:52:54\"}," +
-                        "{\"op\":\"replace\",\"path\":\"/system-uptime-information/time-source\",\"value\":\" DNS CLOCK \"}," +
-                        "{\"op\":\"add\",\"path\":\"/system-uptime-information/uptime-information/load-average-10\",\"value\":\"0.05\"}]"
+                    "{\"op\":\"replace\",\"path\":\"/system-uptime-information/system-booted-time/time-length\",\"value\":\"14:52:54\"}," +
+                    "{\"op\":\"replace\",\"path\":\"/system-uptime-information/time-source\",\"value\":\" DNS CLOCK \"}," +
+                    "{\"op\":\"add\",\"path\":\"/system-uptime-information/uptime-information/load-average-10\",\"value\":\"0.05\"}]"
             assertEquals(
                 diffJson.asJsonPrimitive(),
                 bluePrintRuntimeService.getNodeTemplateAttributeValue(
@@ -394,13 +388,13 @@ class ComponentConfigSnapshotsExecutorTest {
 
             // then; we should get XML-patches differences in our response property
             val diffXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-                    "<diff>" +
-                    "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/@seconds\">2343</replace>" +
-                    "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/text()[1]\">34</replace>" +
-                    "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/input-packets[1]/text()[1]\">09098789</replace>" +
-                    "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/output-packets[1]/text()[1]\">2828828</replace>" +
-                    "<add sel=\"/output[1]/interface-information[1]/physical-interface[1]\"><interface-name>TEGig400-int01</interface-name></add>" +
-                    "</diff>"
+                "<diff>" +
+                "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/@seconds\">2343</replace>" +
+                "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/text()[1]\">34</replace>" +
+                "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/input-packets[1]/text()[1]\">09098789</replace>" +
+                "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/output-packets[1]/text()[1]\">2828828</replace>" +
+                "<add sel=\"/output[1]/interface-information[1]/physical-interface[1]\"><interface-name>TEGig400-int01</interface-name></add>" +
+                "</diff>"
             assertEquals(
                 diffXml.asJsonPrimitive(),
                 bluePrintRuntimeService.getNodeTemplateAttributeValue(
@@ -411,30 +405,47 @@ class ComponentConfigSnapshotsExecutorTest {
         }
     }
 
-    private fun preparePayload(filename: String, resId: String, resType: String, status: ResourceConfigSnapshot.Status) {
+    private fun preparePayload(
+        filename: String,
+        resId: String,
+        resType: String,
+        status: ResourceConfigSnapshot.Status
+    ) {
         runBlocking {
-            cfgSnapshotService.write(JacksonUtils.getClassPathFileContent("payload/requests/$filename"), resId, resType, status)
+            cfgSnapshotService.write(
+                JacksonUtils.getClassPathFileContent("payload/requests/$filename"),
+                resId,
+                resType,
+                status
+            )
         }
     }
 
     private fun prepareRequestProperties(oper: String, resId: String, resType: String, optional: String = "") {
         cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_OPERATION] = oper.asJsonPrimitive()
-        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_ID] = resId.asJsonPrimitive()
-        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_TYPE] = resType.asJsonPrimitive()
+        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_ID] =
+            resId.asJsonPrimitive()
+        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_TYPE] =
+            resType.asJsonPrimitive()
 
         // Optional inputs
-        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] = "".asJsonPrimitive()
-        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] = "".asJsonPrimitive()
+        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] =
+            "".asJsonPrimitive()
+        cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] =
+            "".asJsonPrimitive()
         cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] =
             ResourceConfigSnapshot.Status.RUNNING.name.asJsonPrimitive()
 
         when (oper) {
             OPERATION_DIFF ->
-                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] = optional.asJsonPrimitive()
+                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] =
+                    optional.asJsonPrimitive()
             OPERATION_STORE ->
-                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] = optional.asJsonPrimitive()
+                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] =
+                    optional.asJsonPrimitive()
             OPERATION_FETCH ->
-                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] = optional.asJsonPrimitive()
+                cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] =
+                    optional.asJsonPrimitive()
         }
     }
 }
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..96045ee
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.functions.config.snapshots
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index be65c1d..37d853c 100644 (file)
@@ -16,7 +16,7 @@
 
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization
 
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageAggregateProcessor
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageOutputProcessor
@@ -36,7 +36,9 @@ open class TestDatabaseConfiguration {
 
     @Bean("primaryDBLibGenericService")
     open fun primaryDBLibGenericService(dataSource: DataSource): PrimaryDBLibGenericService {
-        return PrimaryDBLibGenericService(NamedParameterJdbcTemplate(dataSource))
+        return PrimaryDBLibGenericService(
+            NamedParameterJdbcTemplate(dataSource)
+        )
     }
 }
 
index 610a3cf..642a41b 100644 (file)
 package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
 
 import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
 import javax.transaction.Transactional
 
+@Repository
 interface TemplateResolutionRepository : JpaRepository<TemplateResolution, String> {
 
     fun findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
index 8ca0ab6..53698ca 100644 (file)
@@ -19,7 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro
 
 import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
index e1f7083..83dd0ce 100644 (file)
@@ -121,7 +121,7 @@ class ResourceResolutionComponentTest {
             } catch (e: BluePrintProcessorException) {
                 assertEquals(
                     "Can't proceed with the resolution: can't persist resolution without a correlation key. " +
-                            "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.",
+                        "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.",
                     e.message
                 )
                 return@runBlocking
index e46d457..264b457 100644 (file)
@@ -25,23 +25,14 @@ import org.junit.Assert
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.CapabilityResourceResolutionProcessor
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.DatabaseResourceAssignmentProcessor
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.DefaultResourceResolutionProcessor
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.InputResourceResolutionProcessor
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.MockCapabilityScriptRA
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.RestResourceResolutionProcessor
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
 import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -63,12 +54,7 @@ import kotlin.test.assertTrue
  */
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [ResourceResolutionServiceImpl::class,
-        InputResourceResolutionProcessor::class, DefaultResourceResolutionProcessor::class,
-        DatabaseResourceAssignmentProcessor::class, RestResourceResolutionProcessor::class,
-        CapabilityResourceResolutionProcessor::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
-        BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class]
+    classes = [TestDatabaseConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..121fff7
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.functions.resource.resolution
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+        "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index 18a9f32..71d8955 100644 (file)
@@ -139,7 +139,12 @@ class TemplateResolutionServiceTest {
             val res = templateResolutionService.write(props, result, bluePrintRuntimeService, artifactPrefix)
             verify {
                 templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
-                    eq(resourceId), eq(resourceType), eq(blueprintName), eq(blueprintVersion), eq(artifactPrefix), eq(occurrence)
+                    eq(resourceId),
+                    eq(resourceType),
+                    eq(blueprintName),
+                    eq(blueprintVersion),
+                    eq(artifactPrefix),
+                    eq(occurrence)
                 )
             }
             assertEquals(tr, res)
index d6331fe..61e9f51 100644 (file)
@@ -23,14 +23,14 @@ class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintProperti
     BluePrintRestLibPropertyService(bluePrintProperties) {
 
     fun mockBlueprintWebClientService(selector: String):
-            MockBlueprintWebClientService {
+        MockBlueprintWebClientService {
         val prefix = "blueprintsprocessor.restclient.$selector"
         val restClientProperties = restClientProperties(prefix)
         return mockBlueprintWebClientService(restClientProperties)
     }
 
     private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties):
-            MockBlueprintWebClientService {
+        MockBlueprintWebClientService {
         return MockBlueprintWebClientService(restClientProperties)
     }
 }
index ef5c79e..e27f3ef 100644 (file)
@@ -27,7 +27,8 @@ import org.springframework.http.MediaType
 import java.nio.charset.Charset
 import java.util.Base64
 
-class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) : BlueprintWebClientService {
+class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) :
+    BlueprintWebClientService {
     private var mockServer: ClientAndServer
     private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080"
     else restClientProperties.url.split(":")[2]
@@ -41,7 +42,7 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
         setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456")
         setRequest(
             "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
-                    "vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
+                "vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
         )
         setRequestWithPayload(
             "PUT", "/query",
@@ -66,7 +67,11 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
         mockServer.close()
     }
 
-    override fun exchangeResource(method: String, path: String, payload: String): BlueprintWebClientService.WebClientResponse<String> {
+    override fun exchangeResource(
+        method: String,
+        path: String,
+        payload: String
+    ): BlueprintWebClientService.WebClientResponse<String> {
         val header = arrayOf(BasicHeader(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
         return when (method) {
             "POST" -> {
index 0a4de92..774c402 100644 (file)
@@ -24,9 +24,9 @@ import org.springframework.context.annotation.Bean
 import org.springframework.context.annotation.Configuration
 
 @Configuration
-open class MockDatabaseConfiguration {
+open class MockDBLibGenericService {
 
-    @Bean(name = ["MariaDatabaseConfiguration", "MySqlDatabaseConfiguration", "PrimaryDatabaseConfiguration"])
+    @Bean(name = ["MariaDatabaseConfiguration", "MySqlDatabaseConfiguration"])
     open fun createDatabaseConfiguration(): BluePrintDBLibGenericService {
         return mockk<BluePrintDBLibGenericService>()
     }
index a7379e2..3600156 100644 (file)
@@ -81,7 +81,7 @@ class MockRestResourceResolutionProcessor(
 
                 logger.info(
                     "MockRestResource ($dSource) dictionary information: " +
-                            "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+                        "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
                 )
 
                 // Get the Rest Client Service
@@ -102,7 +102,10 @@ class MockRestResourceResolutionProcessor(
             }
         } catch (e: Exception) {
             ResourceAssignmentUtils.setFailedResourceDataValue(executionRequest, e.message)
-            throw BluePrintProcessorException("Failed in template resolutionKey ($executionRequest) assignments with: ${e.message}", e)
+            throw BluePrintProcessorException(
+                "Failed in template resolutionKey ($executionRequest) assignments with: ${e.message}",
+                e
+            )
         }
     }
 
index da22820..57d2c1b 100644 (file)
@@ -18,15 +18,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro
 import kotlinx.coroutines.runBlocking
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
-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.TestDatabaseConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBlueprintProcessorCatalogServiceImpl
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDatabaseConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDBLibGenericService
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
 import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
@@ -39,10 +36,10 @@ import kotlin.test.assertNotNull
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DatabaseResourceAssignmentProcessor::class, BluePrintPropertyConfiguration::class,
-        BluePrintPropertiesService::class, BluePrintDBLibPropertyService::class, BluePrintDBLibConfiguration::class,
-        BluePrintCoreConfiguration::class, MockDatabaseConfiguration::class, MockBlueprintProcessorCatalogServiceImpl::class,
-        BluePrintPropertiesService::class, PrimaryDatabaseConfiguration::class]
+    classes = [TestDatabaseConfiguration::class,
+        PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class,
+        DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class,
+        MockBlueprintProcessorCatalogServiceImpl::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 class DatabaseResourceResolutionProcessorTest {
index 17bb5e6..cf8dc0c 100644 (file)
@@ -56,7 +56,8 @@ class InputResourceResolutionProcessorTest {
             every { resourceAssignmentRuntimeService.getInputValue("rr-name") } returns textNode
 
             inputResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
-            inputResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils.resourceDefinitions(bluePrintContext.rootPath)
+            inputResourceResolutionProcessor.resourceDictionaries =
+                ResourceAssignmentUtils.resourceDefinitions(bluePrintContext.rootPath)
 
             val resourceAssignment = ResourceAssignment().apply {
                 name = "rr-name"
index 7631339..c564d33 100644 (file)
@@ -112,7 +112,9 @@ class ResourceAssignmentUtilsTest {
             properties = mapOfPropertiesHost
         }
 
-        every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address") } returns myDataTypeIpaddress
+        every {
+            resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address")
+        } returns myDataTypeIpaddress
 
         every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("host") } returns myDataTypeHost
 
@@ -171,13 +173,21 @@ class ResourceAssignmentUtilsTest {
             "sample-value", "string", "",
             inputMapToTestPrimitiveTypeWithValue
         )
-        assertEquals(expectedValueToTestPrimitiveType, outcome, "Unexpected outcome returned for primitive type of simple String")
+        assertEquals(
+            expectedValueToTestPrimitiveType,
+            outcome,
+            "Unexpected outcome returned for primitive type of simple String"
+        )
 
         outcome = prepareResponseNodeForTest(
             "sample-key-value", "string", "",
             inputMapToTestPrimitiveTypeWithKeyValue
         )
-        assertEquals(expectedValueToTestPrimitiveType, outcome, "Unexpected outcome returned for primitive type of key-value String")
+        assertEquals(
+            expectedValueToTestPrimitiveType,
+            outcome,
+            "Unexpected outcome returned for primitive type of key-value String"
+        )
     }
 
     @Test
@@ -186,13 +196,21 @@ class ResourceAssignmentUtilsTest {
             "listOfString", "list",
             "string", inputMapToTestCollectionOfPrimitiveType
         )
-        assertEquals(expectedValueToTesCollectionOfPrimitiveType, outcome, "unexpected outcome returned for list of String")
+        assertEquals(
+            expectedValueToTesCollectionOfPrimitiveType,
+            outcome,
+            "unexpected outcome returned for list of String"
+        )
 
         outcome = prepareResponseNodeForTest(
             "mapOfString", "map", "string",
             inputMapToTestCollectionOfPrimitiveType
         )
-        assertEquals(expectedValueToTesCollectionOfPrimitiveType, outcome, "unexpected outcome returned for map of String")
+        assertEquals(
+            expectedValueToTesCollectionOfPrimitiveType,
+            outcome,
+            "unexpected outcome returned for map of String"
+        )
     }
 
     @Test
@@ -201,13 +219,21 @@ class ResourceAssignmentUtilsTest {
             "listOfMyDataTypeWithOneOutputKeyMapping", "list",
             "ip-address", inputMapToTestCollectionOfComplexTypeWithOneOutputKeyMapping
         )
-        assertEquals(expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping, outcome, "unexpected outcome returned for list of String")
+        assertEquals(
+            expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping,
+            outcome,
+            "unexpected outcome returned for list of String"
+        )
 
         outcome = prepareResponseNodeForTest(
             "listOfMyDataTypeWithAllOutputKeyMapping", "list",
             "ip-address", inputMapToTestCollectionOfComplexTypeWithAllOutputKeyMapping
         )
-        assertEquals(expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping, outcome, "unexpected outcome returned for list of String")
+        assertEquals(
+            expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping,
+            outcome,
+            "unexpected outcome returned for list of String"
+        )
     }
 
     @Test
@@ -216,7 +242,11 @@ class ResourceAssignmentUtilsTest {
             "complexTypeOneKeys", "host",
             "", inputMapToTestComplexTypeWithOneOutputKeyMapping
         )
-        assertEquals(expectedValueToTestComplexTypeWithOneOutputKeyMapping, outcome, "Unexpected outcome returned for complex type")
+        assertEquals(
+            expectedValueToTestComplexTypeWithOneOutputKeyMapping,
+            outcome,
+            "Unexpected outcome returned for complex type"
+        )
     }
 
     @Test
@@ -225,7 +255,11 @@ class ResourceAssignmentUtilsTest {
             "complexTypeAllKeys", "host",
             "", inputMapToTestComplexTypeWithAllOutputKeyMapping
         )
-        assertEquals(expectedValueToTestComplexTypeWithAllOutputKeyMapping, outcome, "Unexpected outcome returned for complex type")
+        assertEquals(
+            expectedValueToTestComplexTypeWithAllOutputKeyMapping,
+            outcome,
+            "Unexpected outcome returned for complex type"
+        )
     }
 
     private fun initInputMapAndExpectedValuesForPrimitiveType() {
@@ -340,7 +374,12 @@ class ResourceAssignmentUtilsTest {
 
         val outputKeyMapping = prepareOutputKeyMapping(dictionary_source)
 
-        return ResourceAssignmentUtils.parseResponseNode(responseNode, resourceAssignment, resourceAssignmentRuntimeService, outputKeyMapping)
+        return ResourceAssignmentUtils.parseResponseNode(
+            responseNode,
+            resourceAssignment,
+            resourceAssignmentRuntimeService,
+            outputKeyMapping
+        )
     }
 
     private fun prepareRADataDictionaryOfPrimaryType(dictionary_source: String): ResourceAssignment {
@@ -354,7 +393,11 @@ class ResourceAssignmentUtilsTest {
         }
     }
 
-    private fun prepareRADataDictionaryCollection(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+    private fun prepareRADataDictionaryCollection(
+        dictionary_source: String,
+        sourceType: String,
+        schema: String
+    ): ResourceAssignment {
         return ResourceAssignment().apply {
             name = "ipAddress-list"
             dictionaryName = "sample-licenses"
@@ -368,7 +411,11 @@ class ResourceAssignmentUtilsTest {
         }
     }
 
-    private fun prepareRADataDictionaryComplexType(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+    private fun prepareRADataDictionaryComplexType(
+        dictionary_source: String,
+        sourceType: String,
+        schema: String
+    ): ResourceAssignment {
         return ResourceAssignment().apply {
             name = "ipAddress-complexType"
             dictionaryName = "sample-licenses"
index f915b1a..7087c23 100644 (file)
@@ -24,6 +24,7 @@
     </appender>
 
     <logger name="org.springframework" level="warn"/>
+    <logger name="org.springframework.data.repository" level="debug"/>
     <logger name="org.hibernate" level="info"/>
     <logger name="org.mockserver.mock" level="warn"/>
     <logger name="org.onap.ccsdk.cds.controllerblueprints" level="warn"/>
index d990f39..0d737f4 100644 (file)
 
 package org.onap.ccsdk.cds.blueprintsprocessor.db
 
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
 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.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
+import javax.sql.DataSource
 
 @Configuration
+@Import(
+    BluePrintPropertyConfiguration::class,
+    BluePrintPropertiesService::class,
+    BluePrintCoreConfiguration::class
+)
 @EnableConfigurationProperties
 open class BluePrintDBLibConfiguration(private var bluePrintPropertiesService: BluePrintPropertiesService) {
 
@@ -35,6 +44,11 @@ open class BluePrintDBLibConfiguration(private var bluePrintPropertiesService: B
             PrimaryDataSourceProperties::class.java
         )
     }
+
+    @Bean("primaryNamedParameterJdbcTemplate")
+    open fun primaryNamedParameterJdbcTemplate(primaryDataSource: DataSource): NamedParameterJdbcTemplate {
+        return NamedParameterJdbcTemplate(primaryDataSource)
+    }
 }
 
 /**
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Copyright © 2018-2019 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.
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
+package org.onap.ccsdk.cds.blueprintsprocessor.db
 
-import org.onap.ccsdk.cds.blueprintsprocessor.db.AbstractDBLibGenericService
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
 import org.springframework.stereotype.Service
 
index 4faaa2e..8289525 100644 (file)
@@ -25,6 +25,8 @@ import javax.sql.DataSource
 
 class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDataSourceProperties) : BluePrintDBLibGenericService {
 
+    val log = LoggerFactory.getLogger(MariaDatabaseConfiguration::class.java)!!
+
     override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
         return mariaNamedParameterJdbcTemplate(mariaDataSource())
     }
@@ -37,8 +39,6 @@ class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDat
         return mariaNamedParameterJdbcTemplate(mariaDataSource()).update(sql, params)
     }
 
-    val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
-
     fun mariaDataSource(): DataSource {
         val dataSource = DriverManagerDataSource()
         dataSource.setDriverClassName(mariaDataSourceProperties.driverClassName)
index 4223ed3..0913a0a 100644 (file)
@@ -18,13 +18,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
 
 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.data.jpa.repository.config.EnableJpaAuditing
-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
@@ -33,31 +26,15 @@ import org.springframework.transaction.PlatformTransactionManager
 import java.util.HashMap
 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.*"],
-    entityManagerFactoryRef = "primaryEntityManager",
-    transactionManagerRef = "primaryTransactionManager"
-)
-@EnableJpaAuditing
 open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) {
 
     private val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
 
-    @Bean("primaryEntityManager")
-    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+    /** Child class will override with spring bean annotation 'primaryEntityManager' and passing entity [packagesToScan]*/
+    open fun primaryEntityManager(vararg packagesToScan: String): LocalContainerEntityManagerFactoryBean {
         val em = LocalContainerEntityManagerFactoryBean()
         em.dataSource = primaryDataSource()
-        em.setPackagesToScan(
-            "org.onap.ccsdk.cds.blueprintsprocessor.*",
-            "org.onap.ccsdk.cds.controllerblueprints.*"
-        )
+        em.setPackagesToScan(*packagesToScan)
         em.jpaVendorAdapter = HibernateJpaVendorAdapter()
         val properties = HashMap<String, Any>()
         properties["hibernate.hbm2ddl.auto"] = primaryDataSourceProperties.hibernateHbm2ddlAuto
@@ -66,7 +43,7 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
         return em
     }
 
-    @Bean("primaryDataSource")
+    /** Child class will override with spring bean annotation 'primaryDataSource' */
     open fun primaryDataSource(): DataSource {
         val dataSource = DriverManagerDataSource()
         dataSource.setDriverClassName(primaryDataSourceProperties.driverClassName)
@@ -76,16 +53,11 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
         return dataSource
     }
 
-    @Bean("primaryTransactionManager")
+    /** Child class will override with spring bean annotation '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)
-    }
 }
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..d8192ac
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.db
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager("org.onap.ccsdk.cds.blueprintsprocessor.db.primary.*")
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index 185b2e3..d551fee 100644 (file)
@@ -18,13 +18,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
 
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.TestDatabaseConfiguration
 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
@@ -33,12 +28,9 @@ import kotlin.test.assertNotNull
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
-        BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class]
+    classes = [TestDatabaseConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
-@EnableAutoConfiguration
 class PrimaryDatabaseConfigurationTest {
 
     @Autowired
index 124e844..4345d6e 100644 (file)
@@ -14,7 +14,6 @@
 # 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
index 2cf5f5f..9d9dec2 100644 (file)
@@ -34,7 +34,6 @@
         <dependency>
             <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
             <artifactId>config-snapshots</artifactId>
-            <version>${project.parent.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework.security</groupId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..661e28d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.configs.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+        "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots",
+        "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots",
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index 0938431..582fd9a 100644 (file)
@@ -42,9 +42,7 @@ import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
 import org.onap.ccsdk.cds.controllerblueprints.management.api.RemoveAction
 import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction
 import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.TestPropertySource
 import org.springframework.test.context.junit4.SpringRunner
 import kotlin.test.AfterTest
@@ -54,11 +52,8 @@ import kotlin.test.assertNotNull
 import kotlin.test.assertTrue
 
 @RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@DirtiesContext
-@ComponentScan(
-    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
-        "org.onap.ccsdk.cds.controllerblueprints"]
+@ContextConfiguration(
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 class BluePrintManagementGRPCHandlerTest {
index 50eafd1..0e33884 100644 (file)
@@ -26,9 +26,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
 import org.onap.ccsdk.cds.controllerblueprints.core.compress
 import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
@@ -66,8 +63,7 @@ import kotlin.test.assertTrue
 @RunWith(SpringRunner::class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index 4953d9c..33a2bd7 100644 (file)
@@ -23,7 +23,8 @@ import org.springframework.context.annotation.Configuration
 @Configuration
 @ComponentScan(
     basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
-        "org.onap.ccsdk.cds.blueprintsprocessor"]
+        "org.onap.ccsdk.cds.blueprintsprocessor.designer.api",
+        "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"]
 )
 @EnableAutoConfiguration
 open class DesignerApiTestConfiguration
index fd51df4..6b409db 100644 (file)
@@ -21,9 +21,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -36,8 +33,7 @@ import org.springframework.test.context.junit4.SpringRunner
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index cfb16c7..c4390db 100644 (file)
@@ -20,9 +20,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.boot.test.context.SpringBootTest
 import org.springframework.test.context.ContextConfiguration
@@ -33,8 +30,7 @@ import kotlin.test.assertNotNull
 @RunWith(SpringRunner::class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..be012bb
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.designer.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+    "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+            "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index c8c2f0b..2762725 100644 (file)
@@ -21,9 +21,6 @@ import kotlinx.coroutines.runBlocking
 import org.junit.Assert
 import org.junit.Test
 import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ModelTypeLoadService
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ResourceDictionaryLoadService
@@ -38,8 +35,7 @@ import org.springframework.test.context.junit4.SpringRunner
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 class BluePrintEnhancerServiceImplTest {
index fe5cd4d..c4a77e5 100644 (file)
@@ -22,9 +22,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
@@ -38,8 +35,7 @@ import org.springframework.test.context.junit4.SpringRunner
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index 4b771c0..4c05f60 100644 (file)
@@ -21,9 +21,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
@@ -45,8 +42,7 @@ import java.util.Arrays
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index 0534afa..988fa4d 100644 (file)
@@ -21,9 +21,6 @@ import org.junit.FixMethodOrder
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
 import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
 import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -37,8 +34,7 @@ import org.springframework.transaction.annotation.Transactional
 
 @RunWith(SpringRunner::class)
 @ContextConfiguration(
-    classes = [DesignerApiTestConfiguration::class,
-        BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class]
+    classes = [DesignerApiTestConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
index 60b2413..39ff32d 100644 (file)
@@ -39,8 +39,15 @@ import org.springframework.test.web.reactive.server.WebTestClient
 
 @RunWith(SpringRunner::class)
 @WebFluxTest
-@ContextConfiguration(classes = [ResourceController::class, ResourceResolutionDBService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+    classes = [TestDatabaseConfiguration::class,
+        ResourceController::class, ResourceResolutionDBService::class, SecurityProperties::class]
+)
+@ComponentScan(
+    basePackages = ["org.onap.ccsdk.cds.controllerblueprints.core.service",
+        "org.onap.ccsdk.cds.blueprintsprocessor.resource.api",
+        "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"]
+)
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 class ResourceControllerTest {
 
index baf0aa7..d91792d 100644 (file)
@@ -38,7 +38,7 @@ import kotlin.test.AfterTest
 @RunWith(SpringRunner::class)
 @WebFluxTest
 @ContextConfiguration(
-    classes = [BluePrintCoreConfiguration::class,
+    classes = [TestDatabaseConfiguration::class, BluePrintCoreConfiguration::class,
         BluePrintCatalogService::class, SecurityProperties::class]
 )
 @ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@@ -57,7 +57,7 @@ class TemplateControllerTest {
     val payloadDummyTemplateData = "PAYLOAD DATA"
 
     var requestArguments = "bpName=$blueprintName&bpVersion=$blueprintVersion" +
-            "&artifactName=$templatePrefix&resolutionKey=$resolutionKey"
+        "&artifactName=$templatePrefix&resolutionKey=$resolutionKey"
 
     @AfterTest
     fun cleanDir() {
@@ -115,9 +115,9 @@ class TemplateControllerTest {
     fun `get returns 400 error if missing arg`() {
         runBlocking {
             val arguments = "bpBADName=$blueprintName" +
-                    "&bpBADVersion=$blueprintVersion" +
-                    "&artifactName=$templatePrefix" +
-                    "&resolutionKey=$resolutionKey"
+                "&bpBADVersion=$blueprintVersion" +
+                "&artifactName=$templatePrefix" +
+                "&resolutionKey=$resolutionKey"
 
             webTestClient.get().uri("/api/v1/template?$arguments")
                 .exchange()
@@ -133,7 +133,7 @@ class TemplateControllerTest {
                 .get()
                 .uri(
                     "/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
-                            "&artifactName=$templatePrefix&resolutionKey=notFound"
+                        "&artifactName=$templatePrefix&resolutionKey=notFound"
                 )
                 .exchange()
                 .expectStatus().isNotFound
@@ -155,7 +155,7 @@ class TemplateControllerTest {
 
     private fun get(expectedType: String, resKey: String) {
         var requestArguments = "bpName=$blueprintName&bpVersion=$blueprintVersion" +
-                "&artifactName=$templatePrefix&resolutionKey=$resKey"
+            "&artifactName=$templatePrefix&resolutionKey=$resKey"
 
         if (expectedType.isNotEmpty()) {
             requestArguments = "$requestArguments&format=$expectedType"
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..0ab3b5b
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.resource.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+        "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index e990c90..af23e79 100644 (file)
@@ -33,19 +33,16 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn
 import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
 import org.slf4j.LoggerFactory
 import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
 import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
 import org.springframework.test.context.TestPropertySource
 import org.springframework.test.context.junit4.SpringRunner
 import kotlin.test.BeforeTest
 
 @RunWith(SpringRunner::class)
 @DirtiesContext
-@EnableAutoConfiguration
-@ComponentScan(
-    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
-        "org.onap.ccsdk.cds.controllerblueprints"]
+@ContextConfiguration(
+    classes = [SelfServiceApiTestConfiguration::class, TestDatabaseConfiguration::class]
 )
 @TestPropertySource(locations = ["classpath:application-test.properties"])
 class BluePrintProcessingGRPCHandlerTest {
@@ -69,7 +66,7 @@ class BluePrintProcessingGRPCHandlerTest {
         requestObs = blockingStub.process(object : StreamObserver<ExecutionServiceOutput> {
             override fun onNext(executionServiceOuput: ExecutionServiceOutput) {
                 log.debug("onNext {}", executionServiceOuput)
-                if ("1234".equals(executionServiceOuput.commonHeader.requestId)) {
+                if ("1234" == executionServiceOuput.commonHeader.requestId) {
                     Assert.assertEquals(
                         "Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.",
                         executionServiceOuput.status.errorMessage
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
new file mode 100644 (file)
index 0000000..98b8829
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.selfservice.api
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan(
+    basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+        "org.onap.ccsdk.cds.blueprintsprocessor"]
+)
+@EnableAutoConfiguration
+open class SelfServiceApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
new file mode 100644 (file)
index 0000000..94da0f5
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 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.blueprintsprocessor.selfservice.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+    basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+        "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+    entityManagerFactoryRef = "primaryEntityManager",
+    transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+    PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+    @Bean("primaryEntityManager")
+    open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+        return primaryEntityManager(
+            "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+            "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"
+        )
+    }
+
+    @Bean("primaryDataSource")
+    override fun primaryDataSource(): DataSource {
+        return super.primaryDataSource()
+    }
+
+    @Bean("primaryTransactionManager")
+    override fun primaryTransactionManager(): PlatformTransactionManager {
+        return super.primaryTransactionManager()
+    }
+}
index 820c4be..75d9f48 100644 (file)
@@ -37,7 +37,8 @@ class BluePrintRuntimeValidatorServiceTest {
 
     @Test
     fun testBlueprintRuntimeValidation() {
-        val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+        val blueprintBasePath =
+            "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
         assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService")
 
         bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath)