diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2020-04-16 08:33:36 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-04-20 12:33:20 +0000 |
commit | 508c39cfc1473f081bfad0dbe438d50a5eda1e86 (patch) | |
tree | 3a9a1c5cf5e119f940805f2a5b62e4457058e1ee /ms/blueprintsprocessor/functions/resource-resolution | |
parent | 1b8d78599d5919825fca2cb314ec28a7573b3a67 (diff) |
Fix default behavior for DatabaseResourceAssignmentProcessor
If a data-dictionary did not declare an endpoint-selector, it would
default to primary cds-db instead of using data-dictionary source to
look up database configuration. Processor-db configurations were not
used because of this.
Also improved error messages and some refactoring.
Issue-ID: CCSDK-2315
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Change-Id: I7122e1334951db4eec5b9ae8b01c1f66596636f6
(cherry picked from commit 87bf1928aa4772c3b953a0a5800bec99f23b6e9c)
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution')
-rw-r--r-- | ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt index a0fa97b6d..2640b5b85 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt @@ -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) } } |