Fix default behavior for DatabaseResourceAssignmentProcessor
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / resource-resolution / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / resource / resolution / processor / DatabaseResourceAssignmentProcessor.kt
index a0fa97b..2640b5b 100644 (file)
@@ -107,7 +107,7 @@ open class DatabaseResourceAssignmentProcessor(
             "DatabaseResource ($dSource) dictionary information: " +
                     "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
         )
-        val jdbcTemplate = blueprintDBLibService(sourceProperties)
+        val jdbcTemplate = blueprintDBLibService(sourceProperties, dSource)
 
         val rows = jdbcTemplate.query(sql, populateNamedParameter(inputKeyMapping))
         if (rows.isNullOrEmpty()) {
@@ -117,12 +117,12 @@ open class DatabaseResourceAssignmentProcessor(
         }
     }
 
-    private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource): BluePrintDBLibGenericService {
+    private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource, selector: String): BluePrintDBLibGenericService {
         return if (isNotEmpty(sourceProperties.endpointSelector)) {
             val dbPropertiesJson = raRuntimeService.resolveDSLExpression(sourceProperties.endpointSelector!!)
             bluePrintDBLibPropertyService.JdbcTemplate(dbPropertiesJson)
         } else {
-            primaryDBLibGenericService
+            bluePrintDBLibPropertyService.JdbcTemplate(selector)
         }
     }