From 730c940a84b9056fed993ccef08dc5ec4053db21 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Thu, 26 Dec 2019 15:15:27 -0500 Subject: Cluster partition master API Added cluster lock close method. Added NATS connection name and default services. Junit test cases improvements. Issue-ID: CCSDK-2011 Signed-off-by: Brinda Santh Change-Id: I44c7c1aaeae2ddbf768903152fb00bc160172fc1 --- .../cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt | 6 ++++++ .../onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt | 2 ++ .../cds/blueprintsprocessor/nats/service/TLSAuthNatsService.kt | 1 + .../cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt | 1 + 4 files changed, 10 insertions(+) (limited to 'ms/blueprintsprocessor/modules/commons/nats-lib') diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt index 709ee7d6e..147d360ba 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt @@ -17,6 +17,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.nats import org.onap.ccsdk.cds.blueprintsprocessor.nats.service.BluePrintNatsLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.nats.service.BluePrintNatsService import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration @@ -31,9 +32,14 @@ open class BluePrintNatsLibConfiguration fun BluePrintDependencyService.natsLibPropertyService(): BluePrintNatsLibPropertyService = instance(NatsLibConstants.SERVICE_BLUEPRINT_NATS_LIB_PROPERTY) +fun BluePrintDependencyService.controllerNatsService(): BluePrintNatsService { + return natsLibPropertyService().bluePrintNatsService(NatsLibConstants.DEFULT_NATS_SELECTOR) +} + class NatsLibConstants { companion object { const val SERVICE_BLUEPRINT_NATS_LIB_PROPERTY = "blueprint-nats-lib-property-service" + const val DEFULT_NATS_SELECTOR = "cds-controller" const val PROPERTY_NATS_PREFIX = "blueprintsprocessor.nats." const val TYPE_TOKEN_AUTH = "token-auth" const val TYPE_TLS_AUTH = "tls-auth" diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt index 3329ec200..9767ac29d 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt @@ -23,6 +23,8 @@ open class NatsConnectionProperties { var clusterId: String = ClusterUtils.clusterId() var clientId: String = ClusterUtils.clusterNodeId() lateinit var host: String + /** Rest endpoint selector to access Monitoring API */ + var monitoringSelector: String? = null } open class TokenAuthNatsConnectionProperties : NatsConnectionProperties() { diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TLSAuthNatsService.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TLSAuthNatsService.kt index 3781fae59..00a972eff 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TLSAuthNatsService.kt +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TLSAuthNatsService.kt @@ -34,6 +34,7 @@ open class TLSAuthNatsService(private val natsConnectionProperties: TLSAuthNatsC val serverList = natsConnectionProperties.host.splitCommaAsList() val options = Options.Builder() + .connectionName(natsConnectionProperties.clientId) .servers(serverList.toTypedArray()) // .sslContext(sslContext()) .build() diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt index 0da3022ff..60b7934ba 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt @@ -33,6 +33,7 @@ open class TokenAuthNatsService(private val natsConnectionProperties: TokenAuthN val serverList = natsConnectionProperties.host.splitCommaAsList() val options = Options.Builder() + .connectionName(natsConnectionProperties.clientId) .servers(serverList.toTypedArray()) .token(natsConnectionProperties.token.toCharArray()) .build() -- cgit 1.2.3-korg