From adcd4f2bc695840e9ecbc05003bc52c675f22fec Mon Sep 17 00:00:00 2001 From: KAPIL SINGAL Date: Fri, 22 Jan 2021 11:49:51 -0500 Subject: Renaming Files having BluePrint to have Blueprint Replacing BluePrint with Blueprint throughout Issue-ID: CCSDK-3098 Signed-off-by: KAPIL SINGAL Change-Id: Ibee8bad07ae7d9287073db2d4f2f2cd730fa8b96 --- .../BluePrintProcessorCluster.kt | 87 ---------------------- .../BlueprintDatabaseConfiguration.kt | 4 +- .../cds/blueprintsprocessor/BlueprintGRPCServer.kt | 8 +- .../BlueprintProcessorCluster.kt | 87 ++++++++++++++++++++++ .../actuator/indicator/BluePrintCustomIndicator.kt | 56 -------------- .../actuator/indicator/BlueprintCustomIndicator.kt | 56 ++++++++++++++ .../blueprintsprocessor/uat/utils/UatExecutor.kt | 8 +- .../blueprintsprocessor/uat/utils/UatServices.kt | 2 +- 8 files changed, 154 insertions(+), 154 deletions(-) delete mode 100644 ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BluePrintProcessorCluster.kt create mode 100644 ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorCluster.kt delete mode 100644 ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt create mode 100644 ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BlueprintCustomIndicator.kt (limited to 'ms/blueprintsprocessor/application/src/main/kotlin') diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BluePrintProcessorCluster.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BluePrintProcessorCluster.kt deleted file mode 100644 index 513bd5135..000000000 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BluePrintProcessorCluster.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright © 2018-2019 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor - -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BluePrintClusterService -import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterInfo -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.logger -import org.onap.ccsdk.cds.controllerblueprints.core.utils.ClusterUtils -import org.springframework.boot.context.event.ApplicationReadyEvent -import org.springframework.context.event.EventListener -import org.springframework.stereotype.Component -import java.util.Properties - -/** - * To Start the cluster, minimum 2 Instances/ Replicas od CDS needed. - * All instance such as Blueprintprocessor, ResourceResolution, MessagePrioritization should be in - * same cluster and should have same cluster name. - * - * Data can be shared only between the clusters, outside the cluster data can't be shared. - * If cds-controller-x instance wants to share data with resource-resolution-x instance, then it should be in the - * same cluster.(cds-cluster) and same network (cds-network) - * - * Assumptions: - * 1. Container, Pod and Host names are same. - * 2. Container names should end with sequence number. - * Blueprintprocessor example be : cds-controller-1, cds-controller-2, cds-controller-3 - * ResourceResolution example be : resource-resolution-1, resource-resolution-2, resource-resolution-3 - * 3. Each contained, should have environment properties CLUSTER_ID, CLUSTER_NODE_ID, CLUSTER_JOIN_AS_CLIENT, - * CLUSTER_CONFIG_FILE - * Example values : - * CLUSTER_ID: cds-cluster - * CLUSTER_NODE_ID: cds-controller-2 - * CLUSTER_JOIN_AS_CLIENT: "true" or "false" - * CLUSTER_CONFIG_FILE: - * 4. Cluster will be enabled only all the above properties present in the environments. - * if CLUSTER_ENABLED is present, then it will try to create cluster. - */ -@Component -open class BluePrintProcessorCluster(private val bluePrintClusterService: BluePrintClusterService) { - - private val log = logger(BluePrintProcessorCluster::class) - - @EventListener(ApplicationReadyEvent::class) - fun startAndJoinCluster() = GlobalScope.launch { - - if (BluePrintConstants.CLUSTER_ENABLED) { - - val clusterId = ClusterUtils.clusterId() - val nodeId = ClusterUtils.clusterNodeId() - - val joinAsClient = - (System.getenv(BluePrintConstants.PROPERTY_CLUSTER_JOIN_AS_CLIENT) ?: "false").toBoolean() - - val clusterConfigFile = System.getenv(BluePrintConstants.PROPERTY_CLUSTER_CONFIG_FILE) - - val properties = Properties() - properties["hazelcast.logging.type"] = "slf4j" - - val clusterInfo = ClusterInfo( - id = clusterId, nodeId = nodeId, - joinAsClient = joinAsClient, - configFile = clusterConfigFile, - properties = properties - ) - bluePrintClusterService.startCluster(clusterInfo) - } else { - log.info("Cluster is disabled, to enable cluster set the environment CLUSTER_* properties.") - } - } -} diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt index f5ccdee18..ec84e2ac3 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt @@ -16,7 +16,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor -import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.db.BlueprintDBLibConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration import org.springframework.context.annotation.Bean @@ -29,7 +29,7 @@ import org.springframework.transaction.PlatformTransactionManager import javax.sql.DataSource @Configuration -@Import(BluePrintDBLibConfiguration::class) +@Import(BlueprintDBLibConfiguration::class) @EnableJpaRepositories( basePackages = [ "org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor", diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt index bfde39aa0..bba947647 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt @@ -17,10 +17,10 @@ package org.onap.ccsdk.cds.blueprintsprocessor import io.grpc.ServerBuilder -import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BluePrintManagementGRPCHandler +import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintManagementGRPCHandler import org.onap.ccsdk.cds.blueprintsprocessor.grpc.interceptor.GrpcServerLoggingInterceptor import org.onap.ccsdk.cds.blueprintsprocessor.security.BasicAuthServerInterceptor -import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.BluePrintProcessingGRPCHandler +import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.BlueprintProcessingGRPCHandler import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.springframework.beans.factory.annotation.Value import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty @@ -31,8 +31,8 @@ import org.springframework.stereotype.Component @ConditionalOnProperty(name = ["blueprintsprocessor.grpcEnable"], havingValue = "true") @Component open class BlueprintGRPCServer( - private val bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler, - private val bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler, + private val bluePrintProcessingGRPCHandler: BlueprintProcessingGRPCHandler, + private val bluePrintManagementGRPCHandler: BlueprintManagementGRPCHandler, private val authInterceptor: BasicAuthServerInterceptor ) : ApplicationListener { diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorCluster.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorCluster.kt new file mode 100644 index 000000000..b7903a2f7 --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorCluster.kt @@ -0,0 +1,87 @@ +/* + * Copyright © 2018-2019 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor + +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import org.onap.ccsdk.cds.blueprintsprocessor.core.service.BlueprintClusterService +import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterInfo +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.logger +import org.onap.ccsdk.cds.controllerblueprints.core.utils.ClusterUtils +import org.springframework.boot.context.event.ApplicationReadyEvent +import org.springframework.context.event.EventListener +import org.springframework.stereotype.Component +import java.util.Properties + +/** + * To Start the cluster, minimum 2 Instances/ Replicas od CDS needed. + * All instance such as Blueprintprocessor, ResourceResolution, MessagePrioritization should be in + * same cluster and should have same cluster name. + * + * Data can be shared only between the clusters, outside the cluster data can't be shared. + * If cds-controller-x instance wants to share data with resource-resolution-x instance, then it should be in the + * same cluster.(cds-cluster) and same network (cds-network) + * + * Assumptions: + * 1. Container, Pod and Host names are same. + * 2. Container names should end with sequence number. + * Blueprintprocessor example be : cds-controller-1, cds-controller-2, cds-controller-3 + * ResourceResolution example be : resource-resolution-1, resource-resolution-2, resource-resolution-3 + * 3. Each contained, should have environment properties CLUSTER_ID, CLUSTER_NODE_ID, CLUSTER_JOIN_AS_CLIENT, + * CLUSTER_CONFIG_FILE + * Example values : + * CLUSTER_ID: cds-cluster + * CLUSTER_NODE_ID: cds-controller-2 + * CLUSTER_JOIN_AS_CLIENT: "true" or "false" + * CLUSTER_CONFIG_FILE: + * 4. Cluster will be enabled only all the above properties present in the environments. + * if CLUSTER_ENABLED is present, then it will try to create cluster. + */ +@Component +open class BlueprintProcessorCluster(private val bluePrintClusterService: BlueprintClusterService) { + + private val log = logger(BlueprintProcessorCluster::class) + + @EventListener(ApplicationReadyEvent::class) + fun startAndJoinCluster() = GlobalScope.launch { + + if (BlueprintConstants.CLUSTER_ENABLED) { + + val clusterId = ClusterUtils.clusterId() + val nodeId = ClusterUtils.clusterNodeId() + + val joinAsClient = + (System.getenv(BlueprintConstants.PROPERTY_CLUSTER_JOIN_AS_CLIENT) ?: "false").toBoolean() + + val clusterConfigFile = System.getenv(BlueprintConstants.PROPERTY_CLUSTER_CONFIG_FILE) + + val properties = Properties() + properties["hazelcast.logging.type"] = "slf4j" + + val clusterInfo = ClusterInfo( + id = clusterId, nodeId = nodeId, + joinAsClient = joinAsClient, + configFile = clusterConfigFile, + properties = properties + ) + bluePrintClusterService.startCluster(clusterInfo) + } else { + log.info("Cluster is disabled, to enable cluster set the environment CLUSTER_* properties.") + } + } +} diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt deleted file mode 100644 index c795ee5fb..000000000 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2019-2020 Orange. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator - -import kotlinx.coroutines.runBlocking -import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse -import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus -import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrintProcessorHealthCheck -import org.slf4j.LoggerFactory -import org.springframework.boot.actuate.health.AbstractHealthIndicator -import org.springframework.boot.actuate.health.Health -import org.springframework.stereotype.Component - -/** - * Health Indicator for BluePrintProcessor. - * @author Shaaban Ebrahim - * @version 1.0 - */ -@Component -open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) : - AbstractHealthIndicator() { - - private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java) - - @Throws(Exception::class) - override fun doHealthCheck(builder: Health.Builder) { - runBlocking { - var result: HealthApiResponse? = null - try { - result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus() - if (result?.status == HealthCheckStatus.UP) { - builder.up() - } else { - builder.down() - } - builder.withDetail("Services", result?.checks) - } catch (exception: IllegalArgumentException) { - logger.error(exception.message) - } - } - } -} diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BlueprintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BlueprintCustomIndicator.kt new file mode 100644 index 000000000..50935196e --- /dev/null +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BlueprintCustomIndicator.kt @@ -0,0 +1,56 @@ +/* + * Copyright © 2019-2020 Orange. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator + +import kotlinx.coroutines.runBlocking +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus +import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BlueprintProcessorHealthCheck +import org.slf4j.LoggerFactory +import org.springframework.boot.actuate.health.AbstractHealthIndicator +import org.springframework.boot.actuate.health.Health +import org.springframework.stereotype.Component + +/** + * Health Indicator for BlueprintProcessor. + * @author Shaaban Ebrahim + * @version 1.0 + */ +@Component +open class BlueprintCustomIndicator(private val bluePrintProcessorHealthCheck: BlueprintProcessorHealthCheck) : + AbstractHealthIndicator() { + + private var logger = LoggerFactory.getLogger(BlueprintCustomIndicator::class.java) + + @Throws(Exception::class) + override fun doHealthCheck(builder: Health.Builder) { + runBlocking { + var result: HealthApiResponse? = null + try { + result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus() + if (result?.status == HealthCheckStatus.UP) { + builder.up() + } else { + builder.down() + } + builder.withDetail("Services", result?.checks) + } catch (exception: IllegalArgumentException) { + logger.error(exception.message) + } + } + } +} diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt index 7d0c8751d..00e53c1a1 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt @@ -46,7 +46,7 @@ import org.hamcrest.CoreMatchers.notNullValue import org.hamcrest.MatcherAssert.assertThat import org.mockito.Answers import org.mockito.verification.VerificationMode -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService.WebClientResponse import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.COLOR_MOCKITO @@ -73,7 +73,7 @@ import java.util.concurrent.ConcurrentHashMap @Component class UatExecutor( private val environment: ConfigurableEnvironment, - private val restClientFactory: BluePrintRestLibPropertyService, + private val restClientFactory: BlueprintRestLibPropertyService, private val mapper: ObjectMapper ) { @@ -297,7 +297,7 @@ class UatExecutor( return "Basic " + Base64Utils.encodeToString("$username:$plainPassword".toByteArray()) } - private class MockPreInterceptor : BluePrintRestLibPropertyService.PreInterceptor { + private class MockPreInterceptor : BlueprintRestLibPropertyService.PreInterceptor { private val mocks = ConcurrentHashMap() @@ -313,7 +313,7 @@ class UatExecutor( } } - private class SpyPostInterceptor(private val mapper: ObjectMapper) : BluePrintRestLibPropertyService.PostInterceptor { + private class SpyPostInterceptor(private val mapper: ObjectMapper) : BlueprintRestLibPropertyService.PostInterceptor { private val spies = ConcurrentHashMap() diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt index f6dd88dd5..31c7ad4b1 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt @@ -24,7 +24,7 @@ import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.COLOR_SERVICES import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.resetContextColor import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.setContextColor -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.UAT_SPECIFICATION_FILE +import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants.UAT_SPECIFICATION_FILE import org.springframework.context.annotation.Profile import org.springframework.http.HttpStatus import org.springframework.http.MediaType -- cgit 1.2.3-korg