diff options
author | Brinda Santh <bs2796@att.com> | 2020-01-16 11:21:50 -0500 |
---|---|---|
committer | Brinda Santh <bs2796@att.com> | 2020-01-16 13:58:05 -0500 |
commit | 8029f8e5332f107267ec11293c3099e54e87c67b (patch) | |
tree | 5341184c90a8a0013ea207dae2ed59d1ba3fa80b /ms/blueprintsprocessor/modules/blueprints | |
parent | f52cf7ce4451fd5fa1bbc6cf30e5b2a0acab7276 (diff) |
Prioritization Optional NATS consumer support
Add prioritization NATS consumer service and configuration data beans.
Optimizing message prioritization service interface.
Added Integration testing for NATS simulation.
Updated sample docker compose for NATS support
Issue-ID: CCSDK-1917
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: Icd21e5e2ab7b64d6e6e4b0610599ca947555ee15
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints')
2 files changed, 13 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt index df3bde1b4..e8457283e 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.springframework.context.ApplicationContext +import org.springframework.context.ConfigurableApplicationContext import kotlin.reflect.KClass /** @@ -36,6 +37,14 @@ object BluePrintDependencyService { BluePrintDependencyService.applicationContext = applicationContext } + /** Used to inject [instance] into spring application context for the [key], + * Use this method only for testing + * */ + fun registerSingleton(key: String, instance: Any) { + val configurableApplicationContext = applicationContext as ConfigurableApplicationContext + configurableApplicationContext.beanFactory.registerSingleton(key, instance) + } + inline fun <reified T> instance(name: String): T { return applicationContext.getBean(name) as? T ?: throw BluePrintProcessorException("failed to get instance($name)") diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt index b52cd711b..7fe955b03 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt @@ -27,6 +27,10 @@ object ClusterUtils { return ip.hostName } + fun applicationName(): String { + return BluePrintConstants.APP_NAME + } + fun clusterId(): String { return System.getenv(BluePrintConstants.PROPERTY_CLUSTER_ID) ?: "cds-cluster" } |