From 8029f8e5332f107267ec11293c3099e54e87c67b Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Thu, 16 Jan 2020 11:21:50 -0500 Subject: 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 Change-Id: Icd21e5e2ab7b64d6e6e4b0610599ca947555ee15 --- .../core/service/BluePrintDependencyService.kt | 9 +++++++++ .../ccsdk/cds/controllerblueprints/core/utils/ClusterUtils.kt | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'ms/blueprintsprocessor/modules/blueprints/blueprint-core/src') 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 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" } -- cgit 1.2.3-korg