aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/commons
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/commons')
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt55
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt1
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt10
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt11
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt9
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt52
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt57
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt93
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt40
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt57
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt108
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt78
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt14
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt8
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt125
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt98
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt44
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/BluePrintNatsLibData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt15
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt36
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt9
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt28
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt126
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt66
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt18
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt91
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt98
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt21
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt19
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt9
66 files changed, 872 insertions, 688 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
index 637031972..d4b3f807b 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
@@ -62,6 +62,7 @@ fun BluePrintDependencyService.primaryDBLibGenericService(): BluePrintDBLibGener
class DBLibConstants {
companion object {
+
const val PREFIX_DB: String = "blueprintsprocessor.db"
// list of database
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
index f78334fcd..7023106eb 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
open class DBDataSourceProperties {
+
var type: String = DBLibConstants.MARIA_DB
lateinit var url: String
lateinit var username: String
@@ -25,6 +26,7 @@ open class DBDataSourceProperties {
}
open class PrimaryDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
@@ -32,6 +34,7 @@ open class PrimaryDataSourceProperties : DBDataSourceProperties() {
}
open class MariaDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
@@ -40,6 +43,7 @@ open class MariaDataSourceProperties : DBDataSourceProperties() {
}
open class MySqlDataSourceProperties : DBDataSourceProperties() {
+
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
index e686e8396..79f5c09bc 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
@@ -33,44 +33,47 @@ import org.springframework.stereotype.Service
class BluePrintDBLibPropertyService(private var bluePrintPropertiesService: BluePrintPropertiesService) {
fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService =
- blueprintDBDataSourceService(dBDataSourceProperties(jsonNode))
+ blueprintDBDataSourceService(dBDataSourceProperties(jsonNode))
fun JdbcTemplate(selector: String): BluePrintDBLibGenericService =
- blueprintDBDataSourceService(dBDataSourceProperties("blueprintsprocessor.db.$selector"))
+ blueprintDBDataSourceService(dBDataSourceProperties("blueprintsprocessor.db.$selector"))
private fun dBDataSourceProperties(jsonNode: JsonNode): DBDataSourceProperties =
- when (val type = jsonNode.get("type").textValue()) {
- MYSQL_DB -> JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)
- MARIA_DB -> JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)
- else -> {
- throw BluePrintProcessorException(
- "DB type ($type) is not supported. Valid types: $MARIA_DB, $MYSQL_DB")
- }
- }!!
+ when (val type = jsonNode.get("type").textValue()) {
+ MYSQL_DB -> JacksonUtils.readValue(jsonNode, MySqlDataSourceProperties::class.java)
+ MARIA_DB -> JacksonUtils.readValue(jsonNode, MariaDataSourceProperties::class.java)
+ else -> {
+ throw BluePrintProcessorException(
+ "DB type ($type) is not supported. Valid types: $MARIA_DB, $MYSQL_DB"
+ )
+ }
+ }!!
private fun dBDataSourceProperties(prefix: String): DBDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java).let {
- return when (it) {
- MARIA_DB, PROCESSOR_DB -> mariaDBConnectionProperties(prefix)
- MYSQL_DB -> mySqlDBConnectionProperties(prefix)
- else -> {
- throw BluePrintProcessorException(
- "DB type ($it) is not supported. Valid types: $MARIA_DB, $MYSQL_DB, $PROCESSOR_DB")
- }
+ bluePrintPropertiesService.propertyBeanType("$prefix.type", String::class.java).let {
+ return when (it) {
+ MARIA_DB, PROCESSOR_DB -> mariaDBConnectionProperties(prefix)
+ MYSQL_DB -> mySqlDBConnectionProperties(prefix)
+ else -> {
+ throw BluePrintProcessorException(
+ "DB type ($it) is not supported. Valid types: $MARIA_DB, $MYSQL_DB, $PROCESSOR_DB"
+ )
}
}
+ }
private fun blueprintDBDataSourceService(dBConnetionProperties: DBDataSourceProperties): BluePrintDBLibGenericService =
- when (dBConnetionProperties) {
- is MariaDataSourceProperties -> MariaDatabaseConfiguration(dBConnetionProperties)
- is MySqlDataSourceProperties -> MySqlDatabaseConfiguration(dBConnetionProperties)
- else -> throw BluePrintProcessorException(
- "Failed to create db configuration for ${dBConnetionProperties.url}")
- }
+ when (dBConnetionProperties) {
+ is MariaDataSourceProperties -> MariaDatabaseConfiguration(dBConnetionProperties)
+ is MySqlDataSourceProperties -> MySqlDatabaseConfiguration(dBConnetionProperties)
+ else -> throw BluePrintProcessorException(
+ "Failed to create db configuration for ${dBConnetionProperties.url}"
+ )
+ }
private fun mySqlDBConnectionProperties(prefix: String): MySqlDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(prefix, MySqlDataSourceProperties::class.java)
private fun mariaDBConnectionProperties(prefix: String): MariaDataSourceProperties =
- bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(prefix, MariaDataSourceProperties::class.java)
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
index 49b7ec9eb..0761b72d2 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
@@ -24,6 +24,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource
import javax.sql.DataSource
class MySqlDatabaseConfiguration(private val mySqlDataSourceProperties: MySqlDataSourceProperties) : BluePrintDBLibGenericService {
+
override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
return mySqlNamedParameterJdbcTemplate(mySqlDataSource())
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
index 43bcb6741..9f4d32e7a 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
@@ -124,6 +124,7 @@ class BlueprintModel : Serializable {
var blueprintModelContent: BlueprintModelContent? = null
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
index a18ae8b1d..08977f6aa 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
@@ -78,9 +78,9 @@ class BlueprintModelContent : Serializable {
override fun toString(): String {
return "[" + "id = " + id +
- ", name = " + name +
- ", contentType = " + contentType +
- "]"
+ ", name = " + name +
+ ", contentType = " + contentType +
+ "]"
}
override fun equals(o: Any?): Boolean {
@@ -92,8 +92,10 @@ class BlueprintModelContent : Serializable {
return false
}
val blueprintModelContent = o as BlueprintModelContent?
- return (id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
- contentType == blueprintModelContent.contentType)
+ return (
+ id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
+ contentType == blueprintModelContent.contentType
+ )
}
override fun hashCode(): Int {
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
index b1c006793..e6373d9b8 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
@@ -83,6 +83,7 @@ class BlueprintModelSearch : Serializable {
var tags: String? = null
companion object {
+
const val serialversionuid = 1L
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
index 59ace723a..4bfc07845 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
@@ -48,7 +48,7 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @return B?
*/
fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
- BlueprintModelContent?
+ BlueprintModelContent?
/**
* This is a findByBlueprintModelAndContentType method
@@ -58,7 +58,7 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @return List<B>
*/
fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
- List<BlueprintModelContent>
+ List<BlueprintModelContent>
/**
* This is a findByBlueprintModel method
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
index 5986603ca..7ba9dd710 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
@@ -37,13 +37,13 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
*
* @param id id
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
fun findById(id: String): BlueprintModelSearch?
/**
* This is a findAll method
* @return List<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
override fun findAll(): List<BlueprintModelSearch>
/**
@@ -52,7 +52,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @param artifactName artifactName
* @param artifactVersion artifactVersion
* @return Optional<AsdcArtifacts>
- </AsdcArtifacts> */
+ </AsdcArtifacts> */
fun findByArtifactNameAndArtifactVersion(artifactName: String, artifactVersion: String): BlueprintModelSearch?
/**
@@ -60,7 +60,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
*
* @param tags
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch> */
+ </BlueprintModelSearch> */
fun findByTagsContainingIgnoreCase(tags: String): List<BlueprintModelSearch>
/**
@@ -74,7 +74,7 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @param artifactVersion
* @param artifactType
* @return Optional<BlueprintModelSearch>
- </BlueprintModelSearch>
+ </BlueprintModelSearch>
*/
fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
updatedBy: String,
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
index d10ec17b0..1b58bc082 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
@@ -103,7 +103,7 @@ class BlueprintProcessorCatalogServiceImpl(
deleteNBDir(deployFile.absolutePath)
throw BluePrintProcessorException(
"failed to get get cba file name($name), version($version) from db" +
- " : ${e.message}"
+ " : ${e.message}"
)
} finally {
deleteNBDir(cbaFile.parentFile.absolutePath)
@@ -149,7 +149,8 @@ class BlueprintProcessorCatalogServiceImpl(
blueprintModel.artifactVersion = artifactVersion
blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!!
blueprintModel.tags = metadata[BluePrintConstants.METADATA_TEMPLATE_TAGS]!!
- val description = if (null != metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION]) metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION] else ""
+ val description =
+ if (null != metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION]) metadata[BluePrintConstants.METADATA_TEMPLATE_DESCRIPTION] else ""
blueprintModel.artifactDescription = description
val blueprintModelContent = BlueprintModelContent()
@@ -166,8 +167,10 @@ class BlueprintProcessorCatalogServiceImpl(
blueprintModelRepository.saveAndFlush(blueprintModel)
} catch (ex: DataIntegrityViolationException) {
throw BluePrintException(
- ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
- "is already exist in database: ${ex.message}", ex
+ ErrorCode.CONFLICT_ADDING_RESOURCE.value,
+ "The blueprint entry " +
+ "is already exist in database: ${ex.message}",
+ ex
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index 5d546c2ef..b7b1f78cf 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -45,8 +45,10 @@ import kotlin.test.assertTrue
@EnableAutoConfiguration
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor"])
@ContextConfiguration(
- classes = [BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
- MockBlueprintProcessorCatalogServiceImpl::class]
+ classes = [
+ BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
+ MockBlueprintProcessorCatalogServiceImpl::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BlueprintProcessorCatalogServiceImplTest {
@@ -123,7 +125,8 @@ class BlueprintProcessorCatalogServiceImplTest {
File(
blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath +
"/baseconfiguration"
- ).deleteRecursively(), "Couldn't get blueprint archive " +
+ ).deleteRecursively(),
+ "Couldn't get blueprint archive " +
"${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " +
"from data base."
)
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
index 8ccd8cd56..dfe95733f 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
@@ -28,8 +28,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
* Representation of DMAAP client service for AAF auth type.
*/
class AafAuthDmaapClientService(
- private val clientProps:
- AafAuthDmaapClientProperties
+ private val clientProps: AafAuthDmaapClientProperties
) :
BluePrintDmaapClientService {
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
index cbde4d003..82c3f3a80 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
@@ -96,7 +96,8 @@ interface BluePrintDmaapClientService {
} catch (e: IOException) {
log.warn(
"Unable to cleanly close the connection from the " +
- "client $client", e
+ "client $client",
+ e
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
index 44ed5316b..20d9afdef 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
@@ -39,8 +39,9 @@ open class BluePrintDmaapLibConfiguration
class DmaapLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY = "blueprint" +
- "-dmaap-lib-property-service"
+ "-dmaap-lib-property-service"
const val TYPE_HTTP_NO_AUTH = "HTTPNOAUTH"
const val TYPE_HTTP_AAF_AUTH = "HTTPAAF"
}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
index a3eed159f..e5c9d432f 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
@@ -70,21 +70,21 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
* node.
*/
fun blueprintDmaapClientService(jsonNode: JsonNode):
- BluePrintDmaapClientService {
- val dmaapProps = dmaapClientProperties(jsonNode)
- return blueprintDmaapClientService(dmaapProps)
- }
+ BluePrintDmaapClientService {
+ val dmaapProps = dmaapClientProperties(jsonNode)
+ return blueprintDmaapClientService(dmaapProps)
+ }
/**
* Returns the DMAAP client by providing the input properties as a
* selector string.
*/
fun blueprintDmaapClientService(selector: String):
- BluePrintDmaapClientService {
- val prefix = "blueprintsprocessor.dmaapclient.$selector"
- val dmaapProps = dmaapClientProperties(prefix)
- return blueprintDmaapClientService(dmaapProps)
- }
+ BluePrintDmaapClientService {
+ val prefix = "blueprintsprocessor.dmaapclient.$selector"
+ val dmaapProps = dmaapClientProperties(prefix)
+ return blueprintDmaapClientService(dmaapProps)
+ }
/**
* Returns the DMAAP client properties from the type of connection it
@@ -114,7 +114,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
else -> {
throw BluePrintProcessorException(
"DMAAP adaptor($type) is " +
- "not supported"
+ "not supported"
)
}
}
@@ -149,7 +149,7 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
else -> {
throw BluePrintProcessorException(
"DMAAP adaptor($type) is " +
- "not supported"
+ "not supported"
)
}
}
@@ -160,24 +160,24 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
* Returns DMAAP client service according to the type of client properties.
*/
private fun blueprintDmaapClientService(clientProps: DmaapClientProperties):
- BluePrintDmaapClientService {
- when (clientProps) {
- is HttpNoAuthDmaapClientProperties -> {
- return HttpNoAuthDmaapClientService(clientProps)
- }
-
- is AafAuthDmaapClientProperties -> {
- return AafAuthDmaapClientService(clientProps)
- }
-
- else -> {
- throw BluePrintProcessorException(
- "Unable to get the DMAAP " +
+ BluePrintDmaapClientService {
+ when (clientProps) {
+ is HttpNoAuthDmaapClientProperties -> {
+ return HttpNoAuthDmaapClientService(clientProps)
+ }
+
+ is AafAuthDmaapClientProperties -> {
+ return AafAuthDmaapClientService(clientProps)
+ }
+
+ else -> {
+ throw BluePrintProcessorException(
+ "Unable to get the DMAAP " +
"client"
- )
+ )
+ }
}
}
- }
/**
* Parses the event.properties file which contains the default values for
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
index a3e347adc..d4adfcaac 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
@@ -29,7 +29,7 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
*/
class HttpNoAuthDmaapClientService(
private val clientProps:
- HttpNoAuthDmaapClientProperties
+ HttpNoAuthDmaapClientProperties
) :
BluePrintDmaapClientService {
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
index 3fb7f6802..e6043caae 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
@@ -50,17 +50,21 @@ import kotlin.test.assertNotNull
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(
- classes = [BluePrintDmaapLibConfiguration::class, TestController::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintDmaapLibConfiguration::class, TestController::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
- properties = ["server.port=9111",
+ properties = [
+ "server.port=9111",
"blueprintsprocessor.dmaapclient.aai.topic=cds_aai",
"blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH",
"blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111",
"blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2",
"blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"]
+ "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"
+ ]
)
class TestDmaapEventPublisher {
@@ -77,8 +81,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -95,8 +99,8 @@ class TestDmaapEventPublisher {
fun testEventPropertiesWithSingleMsg() {
val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
val str: String = "{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
dmaapClient.sendMessage(str)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 1)
@@ -114,8 +118,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -132,10 +136,10 @@ class TestDmaapEventPublisher {
@Test
fun testMultiTopicPropertiesWithJsonInput() {
val jsonString = "{\n" +
- " \"topic\" : \"cds_json1,cds_json2\",\n" +
- " \"type\" : \"HTTPNOAUTH\",\n" +
- " \"host\" : \"127.0.0.1:9111\"\n" +
- "}"
+ " \"topic\" : \"cds_json1,cds_json2\",\n" +
+ " \"type\" : \"HTTPNOAUTH\",\n" +
+ " \"host\" : \"127.0.0.1:9111\"\n" +
+ "}"
val mapper = ObjectMapper()
val node = mapper.readTree(jsonString)
val strList = mutableListOf<String>()
@@ -143,8 +147,8 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -165,13 +169,13 @@ class TestDmaapEventPublisher {
strList.add(
"{\n" +
- " \"a\" : \"hello\"\n" +
- "}"
+ " \"a\" : \"hello\"\n" +
+ "}"
)
strList.add(
"{\n" +
- " \"a\" : \"second\"\n" +
- "}"
+ " \"a\" : \"second\"\n" +
+ "}"
)
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
@@ -190,8 +194,9 @@ class TestDmaapEventPublisher {
)
assertNotNull(properties, "failed to create property bean")
assertNotNull(
- properties.host, "failed to get url property" +
- " in property bean"
+ properties.host,
+ "failed to get url property" +
+ " in property bean"
)
}
@@ -221,11 +226,11 @@ open class TestController {
*/
@PostMapping(path = ["/{topic}"])
fun postTopic(@PathVariable(value = "topic") topic: String):
- ResponseEntity<Any> {
- var a = "{\n" +
+ ResponseEntity<Any> {
+ var a = "{\n" +
" \"message\" : \"The message is published into $topic " +
"topic\"\n" +
"}"
- return ResponseEntity(a, HttpStatus.OK)
- }
+ return ResponseEntity(a, HttpStatus.OK)
+ }
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
index a3823c6ac..e94400d9b 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
@@ -44,6 +44,7 @@ fun BluePrintDependencyService.grpcClientService(jsonNode: JsonNode): BluePrintG
class GRPCLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_GRPC_LIB_PROPERTY = "blueprint-grpc-lib-property-service"
const val PROPERTY_GRPC_CLIENT_PREFIX = "blueprintsprocessor.grpcclient."
const val PROPERTY_GRPC_SERVER_PREFIX = "blueprintsprocessor.grpcserver."
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
index f94d918a2..ebb9a5b32 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
@@ -25,12 +25,15 @@ open class GrpcServerProperties {
}
open class TokenAuthGrpcServerProperties : GrpcServerProperties() {
+
lateinit var token: String
}
open class TLSAuthGrpcServerProperties : GrpcServerProperties() {
+
lateinit var certChain: String
lateinit var privateKey: String
+
/** Below Used only for Mutual TLS */
var trustCertCollection: String? = null
}
@@ -44,17 +47,21 @@ open class GrpcClientProperties {
}
open class TokenAuthGrpcClientProperties : GrpcClientProperties() {
+
lateinit var token: String
}
open class TLSAuthGrpcClientProperties : GrpcClientProperties() {
+
var trustCertCollection: String? = null
+
/** Below Used only for Mutual TLS */
var clientCertChain: String? = null
var clientPrivateKey: String? = null
}
open class BasicAuthGrpcClientProperties : GrpcClientProperties() {
+
lateinit var username: String
lateinit var password: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
index 43e56606f..56384ceff 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
@@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.GrpcLoggerService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
class GrpcClientLoggingInterceptor : ClientInterceptor {
+
val log = logger(GrpcClientLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
index a49b96743..aaa4d5f26 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
@@ -32,6 +32,7 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn
import org.slf4j.MDC
class GrpcServerLoggingInterceptor : ServerInterceptor {
+
val log = logger(GrpcServerLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
@@ -42,59 +43,59 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
):
ServerCall.Listener<ReqT> {
- val forwardingServerCall = object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
- override fun sendHeaders(responseHeaders: Metadata) {
- loggingService.grpResponding(requestHeaders, responseHeaders)
- super.sendHeaders(responseHeaders)
+ val forwardingServerCall = object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
+ override fun sendHeaders(responseHeaders: Metadata) {
+ loggingService.grpResponding(requestHeaders, responseHeaders)
+ super.sendHeaders(responseHeaders)
+ }
}
- }
- return object :
- ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
- next.startCall(forwardingServerCall, requestHeaders)
- ) {
+ return object :
+ ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
+ next.startCall(forwardingServerCall, requestHeaders)
+ ) {
- override fun onMessage(message: ReqT) {
- /** Get the requestId, SubRequestId and Originator Id and set in MDS context
- * If you are using other GRPC services, Implement own Logging Interceptors to get tracing.
- * */
- when (message) {
- is ExecutionServiceInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintUploadInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintDownloadInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- is BluePrintRemoveInput -> {
- val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
- loggingService.grpcRequesting(call, commonHeader, next)
- }
- else -> {
- loggingService.grpcRequesting(call, requestHeaders, next)
+ override fun onMessage(message: ReqT) {
+ /** Get the requestId, SubRequestId and Originator Id and set in MDS context
+ * If you are using other GRPC services, Implement own Logging Interceptors to get tracing.
+ * */
+ when (message) {
+ is ExecutionServiceInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintUploadInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintDownloadInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ is BluePrintRemoveInput -> {
+ val commonHeader = message.commonHeader
+ ?: throw BluePrintProcessorException("missing common header in request")
+ loggingService.grpcRequesting(call, commonHeader, next)
+ }
+ else -> {
+ loggingService.grpcRequesting(call, requestHeaders, next)
+ }
}
+ super.onMessage(message)
}
- super.onMessage(message)
- }
- override fun onComplete() {
- MDC.clear()
- super.onComplete()
- }
+ override fun onComplete() {
+ MDC.clear()
+ super.onComplete()
+ }
- override fun onCancel() {
- MDC.clear()
- super.onCancel()
+ override fun onCancel() {
+ MDC.clear()
+ super.onCancel()
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
index 79da447a1..a102ee6da 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
@@ -88,15 +88,15 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
private fun blueprintGrpcServerService(grpcServerProperties: GrpcServerProperties):
BluePrintGrpcServerService {
- when (grpcServerProperties) {
- is TLSAuthGrpcServerProperties -> {
- return TLSAuthGrpcServerService(grpcServerProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get grpc client service for properties $grpcServerProperties")
+ when (grpcServerProperties) {
+ is TLSAuthGrpcServerProperties -> {
+ return TLSAuthGrpcServerService(grpcServerProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get grpc client service for properties $grpcServerProperties")
+ }
}
}
- }
/** GRPC Client Lib Property Service */
@@ -152,21 +152,21 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
fun blueprintGrpcClientService(grpcClientProperties: GrpcClientProperties):
BluePrintGrpcClientService {
- return when (grpcClientProperties) {
- is TokenAuthGrpcClientProperties -> {
- TokenAuthGrpcClientService(grpcClientProperties)
- }
- is TLSAuthGrpcClientProperties -> {
- TLSAuthGrpcClientService(grpcClientProperties)
- }
- is BasicAuthGrpcClientProperties -> {
- BasicAuthGrpcClientService(grpcClientProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get grpc service for type(${grpcClientProperties.type})")
+ return when (grpcClientProperties) {
+ is TokenAuthGrpcClientProperties -> {
+ TokenAuthGrpcClientService(grpcClientProperties)
+ }
+ is TLSAuthGrpcClientProperties -> {
+ TLSAuthGrpcClientService(grpcClientProperties)
+ }
+ is BasicAuthGrpcClientProperties -> {
+ BasicAuthGrpcClientService(grpcClientProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get grpc service for type(${grpcClientProperties.type})")
+ }
}
}
- }
private fun tokenAuthGrpcClientProperties(prefix: String): TokenAuthGrpcClientProperties {
return bluePrintPropertiesService.propertyBeanType(prefix, TokenAuthGrpcClientProperties::class.java)
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
index e71525f0a..d2db14a53 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
@@ -21,9 +21,11 @@ import io.grpc.ManagedChannel
import io.grpc.netty.NettyServerBuilder
interface BluePrintGrpcServerService {
+
fun serverBuilder(): NettyServerBuilder
}
interface BluePrintGrpcClientService {
+
suspend fun channel(): ManagedChannel
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
index d9a8082d4..30722c8e3 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
@@ -40,36 +40,39 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintGrpcLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintGrpcLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.grpcclient.sample.type=basic-auth",
- "blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.sample.port=50505",
- "blueprintsprocessor.grpcclient.sample.username=sampleuser",
- "blueprintsprocessor.grpcclient.sample.password=sampleuser",
-
- "blueprintsprocessor.grpcclient.token.type=token-auth",
- "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.token.port=50505",
- "blueprintsprocessor.grpcclient.token.username=sampleuser",
- "blueprintsprocessor.grpcclient.token.password=sampleuser",
-
- "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcserver.tls-sample.port=50505",
- "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
- "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
- "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
-
- "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.tls-sample.port=50505",
- "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
- ]
+ [
+ "blueprintsprocessor.grpcclient.sample.type=basic-auth",
+ "blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.sample.port=50505",
+ "blueprintsprocessor.grpcclient.sample.username=sampleuser",
+ "blueprintsprocessor.grpcclient.sample.password=sampleuser",
+
+ "blueprintsprocessor.grpcclient.token.type=token-auth",
+ "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.token.port=50505",
+ "blueprintsprocessor.grpcclient.token.username=sampleuser",
+ "blueprintsprocessor.grpcclient.token.password=sampleuser",
+
+ "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcserver.tls-sample.port=50505",
+ "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
+ "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
+ "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
+
+ "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.tls-sample.port=50505",
+ "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
+ ]
)
class BluePrintGrpcLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
index fb7282f75..78fa27d3a 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
@@ -51,6 +51,7 @@ fun main() {
}
class MockTLSBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
+
override fun process(responseObserver: StreamObserver<ExecutionServiceOutput>): StreamObserver<ExecutionServiceInput> {
return object : StreamObserver<ExecutionServiceInput> {
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
index c6587c799..659295a6b 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
@@ -57,6 +57,7 @@ fun BluePrintDependencyService.messageConsumerService(jsonNode: JsonNode): Bluep
class MessageLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY = "blueprint-message-lib-property-service"
const val PROPERTY_MESSAGE_CONSUMER_PREFIX = "blueprintsprocessor.messageconsumer."
const val PROPERTY_MESSAGE_PRODUCER_PREFIX = "blueprintsprocessor.messageproducer."
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
index d76621c26..67dba1f19 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
@@ -32,6 +32,7 @@ import org.apache.kafka.streams.StreamsConfig
/** Common Properties **/
abstract class CommonProperties {
+
lateinit var type: String
lateinit var topic: String
lateinit var bootstrapServers: String
@@ -73,6 +74,7 @@ open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties()
/** SSL Auth */
open class KafkaSslAuthMessageProducerProperties : KafkaBasicAuthMessageProducerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -100,6 +102,7 @@ open class KafkaSslAuthMessageProducerProperties : KafkaBasicAuthMessageProducer
/** (SASL) SCRAM SSL Auth */
class KafkaScramSslAuthMessageProducerProperties : KafkaSslAuthMessageProducerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -109,8 +112,8 @@ class KafkaScramSslAuthMessageProducerProperties : KafkaSslAuthMessageProducerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
@@ -122,6 +125,7 @@ abstract class MessageConsumerProperties : CommonProperties()
/** Basic Auth */
open class KafkaStreamsBasicAuthConsumerProperties : MessageConsumerProperties() {
+
lateinit var applicationId: String
var autoOffsetReset: String = "latest"
var processingGuarantee: String = StreamsConfig.EXACTLY_ONCE
@@ -137,6 +141,7 @@ open class KafkaStreamsBasicAuthConsumerProperties : MessageConsumerProperties()
/** SSL Auth */
open class KafkaStreamsSslAuthConsumerProperties : KafkaStreamsBasicAuthConsumerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -163,6 +168,7 @@ open class KafkaStreamsSslAuthConsumerProperties : KafkaStreamsBasicAuthConsumer
/** (SASL) SCRAM SSL Auth */
class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -172,8 +178,8 @@ class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
@@ -182,6 +188,7 @@ class KafkaStreamsScramSslAuthConsumerProperties : KafkaStreamsSslAuthConsumerPr
/** Message Consumer Properties **/
/** Basic Auth */
open class KafkaBasicAuthMessageConsumerProperties : MessageConsumerProperties() {
+
lateinit var groupId: String
lateinit var clientId: String
var autoCommit: Boolean = true
@@ -213,6 +220,7 @@ open class KafkaBasicAuthMessageConsumerProperties : MessageConsumerProperties()
/** SSL Auth */
open class KafkaSslAuthMessageConsumerProperties : KafkaBasicAuthMessageConsumerProperties() {
+
lateinit var truststore: String
lateinit var truststorePassword: String
var truststoreType: String = SslConfigs.DEFAULT_SSL_TRUSTSTORE_TYPE
@@ -239,6 +247,7 @@ open class KafkaSslAuthMessageConsumerProperties : KafkaBasicAuthMessageConsumer
/** (SASL) SCRAM SSL Auth */
class KafkaScramSslAuthMessageConsumerProperties : KafkaSslAuthMessageConsumerProperties() {
+
var saslMechanism: String = "SCRAM-SHA-512"
lateinit var scramUsername: String
lateinit var scramPassword: String
@@ -248,8 +257,8 @@ class KafkaScramSslAuthMessageConsumerProperties : KafkaSslAuthMessageConsumerPr
configProps[CommonClientConfigs.SECURITY_PROTOCOL_CONFIG] = SecurityProtocol.SASL_SSL.toString()
configProps[SaslConfigs.SASL_MECHANISM] = saslMechanism
configProps[SaslConfigs.SASL_JAAS_CONFIG] = "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"${scramUsername}\" " +
- "password=\"${scramPassword}\";"
+ "username=\"${scramUsername}\" " +
+ "password=\"${scramPassword}\";"
return configProps
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
index e9bc5d8ad..8b31de9b9 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSL.kt
@@ -102,15 +102,15 @@ class MessageProducerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaSslAuth(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaSslAuthMessageProducerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaSslAuthMessageProducerProperties(block)
)
}
fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block)
)
}
}
@@ -125,14 +125,14 @@ fun BluePrintTypes.kafkaBasicAuthMessageProducerProperties(block: KafkaBasicAuth
fun BluePrintTypes.kafkaSslAuthMessageProducerProperties(block: KafkaSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaSslAuthMessageProducerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaScramSslAuthMessageProducerProperties(block: KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaScramSslAuthMessageProducerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -174,58 +174,60 @@ open class KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder : MessagePro
}
open class KafkaSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaBasicAuthMessageProducerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
+ property(KafkaSslAuthMessageProducerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
+ property(KafkaSslAuthMessageProducerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
+ property(KafkaSslAuthMessageProducerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaSslAuthMessageProducerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaScramSslAuthMessageProducerPropertiesAssignmentBuilder : KafkaSslAuthMessageProducerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
+ property(KafkaScramSslAuthMessageProducerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
+ property(KafkaScramSslAuthMessageProducerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
+ property(KafkaScramSslAuthMessageProducerProperties::scramPassword, scramPassword)
}
/** Relationships Templates DSL for Message Consumer */
@@ -255,15 +257,15 @@ class MessageConsumerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaSslAuth(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block)
)
}
fun kafkaScramSslAuth(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block)
)
}
@@ -276,15 +278,15 @@ class MessageConsumerRelationshipTemplateBuilder(name: String, description: Stri
fun kafkaStreamsSslAuth(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block)
)
}
fun kafkaStreamsScramSslAuth(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit) {
property(
- BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
- BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
+ BluePrintConstants.PROPERTY_CONNECTION_CONFIG,
+ BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block)
)
}
}
@@ -299,14 +301,14 @@ fun BluePrintTypes.kafkaBasicAuthMessageConsumerProperties(block: KafkaBasicAuth
fun BluePrintTypes.kafkaSslAuthMessageConsumerProperties(block: KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaSslAuthMessageConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaScramSslAuthMessageConsumerProperties(block: KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaScramSslAuthMessageConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -320,14 +322,14 @@ fun BluePrintTypes.kafkaStreamsBasicAuthConsumerProperties(block: KafkaStreamsBa
fun BluePrintTypes.kafkaStreamsSslAuthConsumerProperties(block: KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaStreamsSslAuthConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
fun BluePrintTypes.kafkaStreamsScramSslAuthConsumerProperties(block: KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder.() -> Unit): JsonNode {
val assignments = KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder().apply(block).build()
assignments[KafkaStreamsScramSslAuthConsumerProperties::type.name] =
- MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH.asJsonPrimitive()
return assignments.asJsonType()
}
@@ -378,58 +380,60 @@ open class KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder : MessageCon
}
open class KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaBasicAuthMessageConsumerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
+ property(KafkaSslAuthMessageConsumerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
+ property(KafkaSslAuthMessageConsumerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
+ property(KafkaSslAuthMessageConsumerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaSslAuthMessageConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaScramSslAuthMessageConsumerPropertiesAssignmentBuilder : KafkaSslAuthMessageConsumerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
+ property(KafkaScramSslAuthMessageConsumerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
+ property(KafkaScramSslAuthMessageConsumerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
+ property(KafkaScramSslAuthMessageConsumerProperties::scramPassword, scramPassword)
}
/** KafkaStreamsConsumerProperties assignment builder */
@@ -462,56 +466,58 @@ open class KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder : MessageCon
}
open class KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsBasicAuthConsumerPropertiesAssignmentBuilder() {
+
fun truststore(truststore: String) = truststore(truststore.asJsonPrimitive())
fun truststore(truststore: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
+ property(KafkaStreamsSslAuthConsumerProperties::truststore, truststore)
fun truststorePassword(truststorePassword: String) = truststorePassword(truststorePassword.asJsonPrimitive())
fun truststorePassword(truststorePassword: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
+ property(KafkaStreamsSslAuthConsumerProperties::truststorePassword, truststorePassword)
fun truststoreType(truststoreType: String) = truststoreType(truststoreType.asJsonPrimitive())
fun truststoreType(truststoreType: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
+ property(KafkaStreamsSslAuthConsumerProperties::truststoreType, truststoreType)
fun keystore(keystore: String) = keystore(keystore.asJsonPrimitive())
fun keystore(keystore: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
+ property(KafkaSslAuthMessageProducerProperties::keystore, keystore)
fun keystorePassword(keystorePassword: String) = keystorePassword(keystorePassword.asJsonPrimitive())
fun keystorePassword(keystorePassword: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
+ property(KafkaSslAuthMessageProducerProperties::keystorePassword, keystorePassword)
fun keystoreType(keystoreType: String) = keystoreType(keystoreType.asJsonPrimitive())
fun keystoreType(keystoreType: JsonNode) =
- property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
+ property(KafkaSslAuthMessageProducerProperties::keystoreType, keystoreType)
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: String) =
- sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
+ sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm.asJsonPrimitive())
fun sslEndpointIdentificationAlgorithm(sslEndpointIdentificationAlgorithm: JsonNode) =
- property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
+ property(KafkaStreamsSslAuthConsumerProperties::sslEndpointIdentificationAlgorithm, sslEndpointIdentificationAlgorithm)
}
class KafkaStreamsScramSslAuthConsumerPropertiesAssignmentBuilder : KafkaStreamsSslAuthConsumerPropertiesAssignmentBuilder() {
+
fun saslMechanism(saslMechanism: String) = saslMechanism(saslMechanism.asJsonPrimitive())
fun saslMechanism(saslMechanism: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
+ property(KafkaStreamsScramSslAuthConsumerProperties::saslMechanism, saslMechanism)
fun scramUsername(scramUsername: String) = scramUsername(scramUsername.asJsonPrimitive())
fun scramUsername(scramUsername: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
+ property(KafkaStreamsScramSslAuthConsumerProperties::scramUsername, scramUsername)
fun scramPassword(scramPassword: String) = scramPassword(scramPassword.asJsonPrimitive())
fun scramPassword(scramPassword: JsonNode) =
- property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
+ property(KafkaStreamsScramSslAuthConsumerProperties::scramPassword, scramPassword)
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
index 67fbef580..456bfbdd9 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
@@ -59,12 +59,12 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaSslAuthMessageProducerProperties::class.java
+ prefix, KafkaSslAuthMessageProducerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaScramSslAuthMessageProducerProperties::class.java
+ prefix, KafkaScramSslAuthMessageProducerProperties::class.java
)
}
else -> {
@@ -113,33 +113,33 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
/** Message Consumer */
MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaBasicAuthMessageConsumerProperties::class.java
+ prefix, KafkaBasicAuthMessageConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaSslAuthMessageConsumerProperties::class.java
+ prefix, KafkaSslAuthMessageConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaScramSslAuthMessageConsumerProperties::class.java
+ prefix, KafkaScramSslAuthMessageConsumerProperties::class.java
)
}
/** Stream Consumer */
MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsBasicAuthConsumerProperties::class.java
+ prefix, KafkaStreamsBasicAuthConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsSslAuthConsumerProperties::class.java
+ prefix, KafkaStreamsSslAuthConsumerProperties::class.java
)
}
MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsScramSslAuthConsumerProperties::class.java
+ prefix, KafkaStreamsScramSslAuthConsumerProperties::class.java
)
}
else -> {
@@ -178,44 +178,44 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
private fun blueprintMessageConsumerService(messageConsumerProperties: MessageConsumerProperties):
- BlueprintMessageConsumerService {
+ BlueprintMessageConsumerService {
- when (messageConsumerProperties.type) {
- /** Message Consumer */
- MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
- return KafkaMessageConsumerService(
+ when (messageConsumerProperties.type) {
+ /** Message Consumer */
+ MessageLibConstants.TYPE_KAFKA_BASIC_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaBasicAuthMessageConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
- return KafkaMessageConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_SSL_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaSslAuthMessageConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
- return KafkaMessageConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_SCRAM_SSL_AUTH -> {
+ return KafkaMessageConsumerService(
messageConsumerProperties as KafkaScramSslAuthMessageConsumerProperties
- )
- }
- /** Stream Consumer */
- MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ /** Stream Consumer */
+ MessageLibConstants.TYPE_KAFKA_STREAMS_BASIC_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsBasicAuthConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SSL_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsSslAuthConsumerProperties
- )
- }
- MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
- return KafkaStreamsConsumerService(
+ )
+ }
+ MessageLibConstants.TYPE_KAFKA_STREAMS_SCRAM_SSL_AUTH -> {
+ return KafkaStreamsConsumerService(
messageConsumerProperties as KafkaStreamsScramSslAuthConsumerProperties
- )
- }
- else -> {
- throw BluePrintProcessorException("couldn't get message client service for ${messageConsumerProperties.type}")
+ )
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get message client service for ${messageConsumerProperties.type}")
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
index 311d35c38..b39d89bfd 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
@@ -74,6 +74,7 @@ interface KafkaConsumerRecordsFunction : ConsumerFunction {
}
interface KafkaStreamConsumerFunction : ConsumerFunction {
+
suspend fun createTopology(
messageConsumerProperties: MessageConsumerProperties,
additionalConfig: Map<String, Any>?
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
index 66d3a5b73..36392cff3 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
@@ -25,11 +25,17 @@ interface BlueprintMessageProducerService {
sendMessageNB(key, message, headers)
}
- fun sendMessage(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean = runBlocking {
- sendMessageNB(key, topic, message, headers)
- }
+ fun sendMessage(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean =
+ runBlocking {
+ sendMessageNB(key, topic, message, headers)
+ }
suspend fun sendMessageNB(key: String = UUID.randomUUID().toString(), message: Any, headers: MutableMap<String, String>? = null): Boolean
- suspend fun sendMessageNB(key: String = UUID.randomUUID().toString(), topic: String, message: Any, headers: MutableMap<String, String>? = null): Boolean
+ suspend fun sendMessageNB(
+ key: String = UUID.randomUUID().toString(),
+ topic: String,
+ message: Any,
+ headers: MutableMap<String, String>? = null
+ ): Boolean
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
index 59e9192bb..eccf75301 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
@@ -44,6 +44,7 @@ class KafkaMessageProducerService(
private val messageLoggerService = MessageLoggerService()
companion object {
+
const val MAX_ERR_MSG_LEN = 128
}
@@ -113,8 +114,8 @@ class KafkaMessageProducerService(
/** Truncation of error messages */
var truncErrMsg = executionServiceOutput.status.errorMessage
if (truncErrMsg != null && truncErrMsg.length > MAX_ERR_MSG_LEN) {
- truncErrMsg = "${truncErrMsg.substring(0,MAX_ERR_MSG_LEN)}" +
- " [...]. Check Blueprint Processor logs for more information."
+ truncErrMsg = "${truncErrMsg.substring(0, MAX_ERR_MSG_LEN)}" +
+ " [...]. Check Blueprint Processor logs for more information."
}
/** Truncation for Command Executor responses */
var truncPayload = executionServiceOutput.payload.deepCopy()
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
index 04b754b13..90b850017 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
@@ -61,7 +61,8 @@ class MessageLoggerService {
val headers = consumerRecord.headers().toMap()
val localhost = InetAddress.getLocalHost()
MDC.put(
- "InvokeTimestamp", ZonedDateTime
+ "InvokeTimestamp",
+ ZonedDateTime
.ofInstant(Instant.ofEpochMilli(consumerRecord.timestamp()), ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_INSTANT)
)
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
index b1af230b9..b68678baf 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/MessagePropertiesDSLTest.kt
@@ -67,12 +67,12 @@ class MessagePropertiesDSLTest {
assertNotNull(relationshipTypes, "failed to get relationship types")
assertEquals(2, relationshipTypes.size, "relationshipTypes doesn't match")
assertNotNull(
- relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO],
- "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO}"
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO}"
)
assertNotNull(
- relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER],
- "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER}"
+ relationshipTypes[BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER],
+ "failed to get ${BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO_MESSAGE_PRODUCER}"
)
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
index 77bdbe408..a69f9f51a 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
@@ -59,36 +59,39 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.messageconsumer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
- "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
- "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
- "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
- "blueprintsprocessor.messageconsumer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageconsumer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageconsumer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageconsumer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageconsumer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageconsumer.sample.scramPassword=secretpassword",
+ [
+ "blueprintsprocessor.messageconsumer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
+ "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
+ "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
+ "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
+ "blueprintsprocessor.messageconsumer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageconsumer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageconsumer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageconsumer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageconsumer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageconsumer.sample.scramPassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
- ]
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
+ ]
)
open class BlueprintMessageConsumerServiceTest {
@@ -206,46 +209,52 @@ open class BlueprintMessageConsumerServiceTest {
fun testKafkaScramSslAuthConfig() {
val expectedConfig = mapOf<String, Any>(
- ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
- ConsumerConfig.GROUP_ID_CONFIG to "sample-group",
- ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to true,
- ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "latest",
- ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java,
- ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to ByteArrayDeserializer::class.java,
- ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
- CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
- SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
- SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
- SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
- SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
- SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"sample-user\" " +
- "password=\"secretpassword\";"
- )
+ ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
+ ConsumerConfig.GROUP_ID_CONFIG to "sample-group",
+ ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG to true,
+ ConsumerConfig.AUTO_OFFSET_RESET_CONFIG to "latest",
+ ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG to StringDeserializer::class.java,
+ ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG to ByteArrayDeserializer::class.java,
+ ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
+ CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
+ SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
+ SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
+ SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
+ SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
+ SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
+ "username=\"sample-user\" " +
+ "password=\"secretpassword\";"
+ )
val messageConsumerProperties = bluePrintMessageLibPropertyService
- .messageConsumerProperties("${MessageLibConstants.PROPERTY_MESSAGE_CONSUMER_PREFIX}sample")
+ .messageConsumerProperties("${MessageLibConstants.PROPERTY_MESSAGE_CONSUMER_PREFIX}sample")
val configProps = messageConsumerProperties.getConfig()
- assertEquals(messageConsumerProperties.topic,
- "default-topic",
- "Topic doesn't match the expected value"
+ assertEquals(
+ messageConsumerProperties.topic,
+ "default-topic",
+ "Topic doesn't match the expected value"
+ )
+ assertEquals(
+ messageConsumerProperties.type,
+ "kafka-scram-ssl-auth",
+ "Authentication type doesn't match the expected value"
)
- assertEquals(messageConsumerProperties.type,
- "kafka-scram-ssl-auth",
- "Authentication type doesn't match the expected value")
expectedConfig.forEach {
- assertTrue(configProps.containsKey(it.key),
- "Missing expected kafka config key : ${it.key}")
- assertEquals(configProps[it.key],
- it.value,
- "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
+ assertTrue(
+ configProps.containsKey(it.key),
+ "Missing expected kafka config key : ${it.key}"
+ )
+ assertEquals(
+ configProps[it.key],
+ it.value,
+ "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
index 881f0b422..f88caa173 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
@@ -49,22 +49,25 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
- ]
+ [
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.sample.keystorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword"
+ ]
)
open class BlueprintMessageProducerServiceTest {
@@ -96,48 +99,53 @@ open class BlueprintMessageProducerServiceTest {
@Test
fun testKafkaScramSslAuthConfig() {
val expectedConfig = mapOf<String, Any>(
- ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
- ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to StringSerializer::class.java,
- ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to ByteArraySerializer::class.java,
- ProducerConfig.ACKS_CONFIG to "all",
- ProducerConfig.MAX_BLOCK_MS_CONFIG to 250,
- ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG to 60 * 60 * 1000,
- ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG to true,
- ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
- CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
- SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
- SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
- SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
- SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
- SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
- SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
- SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
- "username=\"sample-user\" " +
- "password=\"secretpassword\";"
+ ProducerConfig.BOOTSTRAP_SERVERS_CONFIG to "127.0.0.1:9092",
+ ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to StringSerializer::class.java,
+ ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to ByteArraySerializer::class.java,
+ ProducerConfig.ACKS_CONFIG to "all",
+ ProducerConfig.MAX_BLOCK_MS_CONFIG to 250,
+ ProducerConfig.RECONNECT_BACKOFF_MS_CONFIG to 60 * 60 * 1000,
+ ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG to true,
+ ConsumerConfig.CLIENT_ID_CONFIG to "default-client-id",
+ CommonClientConfigs.SECURITY_PROTOCOL_CONFIG to SecurityProtocol.SASL_SSL.toString(),
+ SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG to "/path/to/truststore.jks",
+ SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG to "/path/to/keystore.jks",
+ SslConfigs.SSL_KEYSTORE_TYPE_CONFIG to "JKS",
+ SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG to "secretpassword",
+ SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG to SslConfigs.DEFAULT_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM,
+ SaslConfigs.SASL_MECHANISM to "SCRAM-SHA-512",
+ SaslConfigs.SASL_JAAS_CONFIG to "${ScramLoginModule::class.java.canonicalName} required " +
+ "username=\"sample-user\" " +
+ "password=\"secretpassword\";"
)
val messageProducerProperties = bluePrintMessageLibPropertyService
- .messageProducerProperties("${MessageLibConstants.PROPERTY_MESSAGE_PRODUCER_PREFIX}sample")
+ .messageProducerProperties("${MessageLibConstants.PROPERTY_MESSAGE_PRODUCER_PREFIX}sample")
val configProps = messageProducerProperties.getConfig()
- assertEquals(messageProducerProperties.topic,
- "default-topic",
- "Topic doesn't match the expected value"
+ assertEquals(
+ messageProducerProperties.topic,
+ "default-topic",
+ "Topic doesn't match the expected value"
+ )
+ assertEquals(
+ messageProducerProperties.type,
+ "kafka-scram-ssl-auth",
+ "Authentication type doesn't match the expected value"
)
- assertEquals(messageProducerProperties.type,
- "kafka-scram-ssl-auth",
- "Authentication type doesn't match the expected value")
expectedConfig.forEach {
- assertTrue(configProps.containsKey(it.key),
- "Missing expected kafka config key : ${it.key}"
+ assertTrue(
+ configProps.containsKey(it.key),
+ "Missing expected kafka config key : ${it.key}"
)
- assertEquals(configProps[it.key],
- it.value,
- "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
+ assertEquals(
+ configProps[it.key],
+ it.value,
+ "Unexpected value for ${it.key} got ${configProps[it.key]} instead of ${it.value}"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
index 44990ae7f..f488a4c74 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsConsumerServiceTest.kt
@@ -41,31 +41,33 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- [
- "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword",
+ [
+ "blueprintsprocessor.messageproducer.sample.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageproducer.sample.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.sample.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.sample.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.sample.scramPassword=secretpassword",
- "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
- "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic",
- "blueprintsprocessor.messageproducer.stream-consumer.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.stream-consumer.truststorePassword=secretpassword",
- "blueprintsprocessor.messageproducer.stream-consumer.scramUsername=sample-user",
- "blueprintsprocessor.messageproducer.stream-consumer.scramPassword=secretpassword"
+ "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
+ "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic",
+ "blueprintsprocessor.messageproducer.stream-consumer.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.stream-consumer.truststorePassword=secretpassword",
+ "blueprintsprocessor.messageproducer.stream-consumer.scramUsername=sample-user",
+ "blueprintsprocessor.messageproducer.stream-consumer.scramPassword=secretpassword"
- ]
+ ]
)
class KafkaStreamsConsumerServiceTest {
@@ -92,7 +94,7 @@ class KafkaStreamsConsumerServiceTest {
): Topology {
val topology = Topology()
val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
- as KafkaStreamsBasicAuthConsumerProperties
+ as KafkaStreamsBasicAuthConsumerProperties
val topics = kafkaStreamsBasicAuthConsumerProperties.topic.split(",")
topology.addSource("Source", *topics.toTypedArray())
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
index 5d77c3746..aa38b6e5c 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
@@ -31,6 +31,7 @@ import java.nio.charset.Charset
import java.util.UUID
class PriorityMessage : Serializable {
+
lateinit var id: String
lateinit var requestMessage: String
}
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 8d5d846d7..a47dd8918 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
@@ -38,6 +38,7 @@ fun BluePrintDependencyService.controllerNatsService(): BluePrintNatsService {
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."
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 74897f322..a989dcf1e 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
@@ -20,20 +20,25 @@ import org.onap.ccsdk.cds.blueprintsprocessor.nats.utils.NatsClusterUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ClusterUtils
open class NatsConnectionProperties {
+
lateinit var type: String
var clusterId: String = NatsClusterUtils.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() {
+
lateinit var token: String
}
open class TLSAuthNatsConnectionProperties : NatsConnectionProperties() {
+
var trustCertCollection: String? = null
+
/** Below Used only for Mutual TLS */
var clientCertChain: String? = null
var clientPrivateKey: String? = null
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
index 8ef476446..4c5471796 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/NatsPropertiesDSL.kt
@@ -111,6 +111,7 @@ open class NatsConnectionPropertiesAssignmentBuilder : PropertiesAssignmentBuild
}
class NatsTokenAuthPropertiesAssignmentBuilder : NatsConnectionPropertiesAssignmentBuilder() {
+
fun token(selector: String) = token(selector.asJsonPrimitive())
fun token(selector: JsonNode) = property(TokenAuthNatsConnectionProperties::token, selector)
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
index 18d0639f1..1ac44bc94 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyService.kt
@@ -80,16 +80,16 @@ open class BluePrintNatsLibPropertyService(private var bluePrintPropertiesServic
fun bluePrintNatsService(natsConnectionProperties: NatsConnectionProperties):
BluePrintNatsService {
- return when (natsConnectionProperties) {
- is TokenAuthNatsConnectionProperties -> {
- TokenAuthNatsService(natsConnectionProperties)
- }
- is TLSAuthNatsConnectionProperties -> {
- TLSAuthNatsService(natsConnectionProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get NATS service for properties $natsConnectionProperties")
+ return when (natsConnectionProperties) {
+ is TokenAuthNatsConnectionProperties -> {
+ TokenAuthNatsService(natsConnectionProperties)
+ }
+ is TLSAuthNatsConnectionProperties -> {
+ TLSAuthNatsService(natsConnectionProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get NATS service for properties $natsConnectionProperties")
+ }
}
}
- }
}
diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
index ba993d96a..9a332d589 100644
--- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/BluePrintNatsLibPropertyServiceTest.kt
@@ -30,15 +30,18 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintNatsLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintNatsLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.nats.cds-controller.type=token-auth",
- "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
- "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
- ]
+ [
+ "blueprintsprocessor.nats.cds-controller.type=token-auth",
+ "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
+ "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
+ ]
)
class BluePrintNatsLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
index a86dcc40f..2a4d05dcb 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Service
open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: BluePrintPropertiesService) {
companion object {
+
const val PREFIX_BLUEPRINT_PROCESSOR = "blueprintsprocessor"
}
@@ -60,6 +61,7 @@ open class BluePrintPropertyConfiguration {
@Service
open class BluePrintPropertiesService(private var bluePrintPropertyConfig: BluePrintPropertyConfiguration) {
+
private val log = logger(BluePrintPropertiesService::class)
fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
index 58d0f13c2..61997061b 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
@@ -34,40 +34,51 @@ import java.util.UUID
*/
open class ExecutionServiceInput {
+
@get:ApiModelProperty(required = false, hidden = true)
var correlationUUID: String = UUID.randomUUID().toString()
+
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
+
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
+
@get:ApiModelProperty(
required = true,
value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
)
lateinit var payload: ObjectNode
+
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
var stepData: StepData? = null
}
open class ExecutionServiceOutput {
+
@get:ApiModelProperty(required = false, hidden = true)
var correlationUUID: String? = null
+
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
+
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
+
@get:ApiModelProperty(required = true, value = "Status of the request.")
lateinit var status: Status
+
@get:ApiModelProperty(
required = true,
value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
)
lateinit var payload: ObjectNode
+
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
var stepData: StepData? = null
@@ -77,12 +88,16 @@ const val ACTION_MODE_ASYNC = "async"
const val ACTION_MODE_SYNC = "sync"
open class ActionIdentifiers {
+
@get:ApiModelProperty(required = false, value = "Name of the CBA.")
lateinit var blueprintName: String
+
@get:ApiModelProperty(required = false, value = "Version of the CBA.")
lateinit var blueprintVersion: String
+
@get:ApiModelProperty(required = true, value = "Name of the workflow to execute.")
lateinit var actionName: String
+
@get:ApiModelProperty(
required = true,
value = "Async processing is only supported for gRPC client.",
@@ -92,31 +107,41 @@ open class ActionIdentifiers {
}
open class CommonHeader {
+
@get:ApiModelProperty(required = true, value = "Date of the execution", example = "2012-04-23T18:25:43.511Z")
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = Date()
+
@get:ApiModelProperty(required = true, value = "Identify the system/person triggering the request.")
lateinit var originatorId: String
+
@get:ApiModelProperty(required = true, value = "Uniquely identify a request.")
lateinit var requestId: String
+
@get:ApiModelProperty(required = true, value = "Allow for fine-grain request identifier")
lateinit var subRequestId: String
+
@get:ApiModelProperty(required = false, hidden = true)
var flags: Flags? = null
}
open class Flags {
+
@get:ApiModelProperty(value = "Whether or not to force the action.")
var isForce: Boolean = false
+
@get:ApiModelProperty(value = "3600")
var ttl: Int = 3600
}
open class Status {
+
@get:ApiModelProperty(required = true, value = "HTTP status code equivalent.")
var code: Int = 200
+
@get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.")
var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name
+
@get:ApiModelProperty(
required = true,
value = "Time when the execution ended.",
@@ -124,13 +149,16 @@ open class Status {
)
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = Date()
+
@get:ApiModelProperty(required = false, value = "Error message when system failed")
var errorMessage: String? = null
+
@get:ApiModelProperty(required = true, value = "Message providing request status")
var message: String = BluePrintConstants.STATUS_SUCCESS
}
open class StepData {
+
lateinit var name: String
var properties: MutableMap<String, JsonNode> = mutableMapOf()
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
index d3c88d732..5493bac1a 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterService.kt
@@ -80,6 +80,7 @@ open class HazelcastClusterService : BluePrintClusterService {
)
val configFile = configuration.configFile
+
/** Check file exists */
val clusterConfigFile = normalizedFile(configuration.configFile)
check(clusterConfigFile.absolutePath.endsWith("yaml", true)) {
@@ -211,6 +212,7 @@ open class HazelcastClusterService : BluePrintClusterService {
open class BlueprintsClusterMembershipListener() :
MembershipListener {
+
private val log = logger(BlueprintsClusterMembershipListener::class)
override fun memberRemoved(membershipEvent: MembershipEvent) {
@@ -223,6 +225,7 @@ open class BlueprintsClusterMembershipListener() :
}
open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val name: String) : ClusterLock {
+
private val log = logger(ClusterLockImpl::class)
private val distributedLock: FencedLock = hazelcast.cpSubsystem.getLock(name)
@@ -238,8 +241,10 @@ open class ClusterLockImpl(private val hazelcast: HazelcastInstance, private val
override suspend fun tryLock(timeout: Long): Boolean {
return distributedLock.tryLock(timeout, TimeUnit.MILLISECONDS)
- .also { if (it) log.trace("Cluster lock acquired: $name")
- else log.trace("Failed to acquire Cluster lock $name within timeout $timeout") }
+ .also {
+ if (it) log.trace("Cluster lock acquired: $name")
+ else log.trace("Failed to acquire Cluster lock $name within timeout $timeout")
+ }
}
override suspend fun unLock() {
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
index 2d957c289..8cb9f4f92 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/service/BluePrintClusterService.kt
@@ -71,6 +71,7 @@ data class ClusterMember(
)
interface ClusterLock {
+
fun name(): String
suspend fun lock()
suspend fun fenceLock(): String
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
index 7ef4eb49b..95394e7a9 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/BluePrintClusterExtensionsTest.kt
@@ -24,7 +24,6 @@ import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.core.service.ClusterLock
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import java.lang.RuntimeException
import kotlin.test.assertEquals
class BluePrintClusterExtensionsTest {
@@ -58,7 +57,8 @@ class BluePrintClusterExtensionsTest {
try {
clusterLockMock.executeWithLock(1_000) { throw RuntimeException("It crashed") }
- } catch (e: Exception) { }
+ } catch (e: Exception) {
+ }
verify { runBlocking { clusterLockMock.unLock() } }
}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
index e214b6593..da5564235 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/cluster/HazelcastClusterServiceTest.kt
@@ -45,6 +45,7 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
class HazelcastClusterServiceTest {
+
private val log = logger(HazelcastClusterServiceTest::class)
private val clusterSize = 3
@@ -229,6 +230,7 @@ class HazelcastClusterServiceTest {
}
open class SampleSchedulerTask : Runnable, Serializable {
+
private val log = logger(SampleSchedulerTask::class)
override fun run() {
log.info("I am scheduler action")
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
index 23125430a..6e9e4b554 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
@@ -47,6 +47,7 @@ fun BluePrintDependencyService.restClientService(jsonNode: JsonNode): BlueprintW
class RestLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service"
const val PROPERTY_REST_CLIENT_PREFIX = "blueprintsprocessor.restclient."
const val PROPERTY_TYPE = "type"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
index 4c18f81ab..a227cf24e 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
@@ -19,12 +19,14 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest
open class RestClientProperties {
+
lateinit var type: String
lateinit var url: String
var additionalHeaders: Map<String, String>? = null
}
open class SSLRestClientProperties : RestClientProperties() {
+
lateinit var keyStoreInstance: String // JKS, PKCS12
lateinit var sslTrust: String
lateinit var sslTrustPassword: String
@@ -46,15 +48,18 @@ open class SSLTokenAuthRestClientProperties : SSLRestClientProperties() {
}
open class BasicAuthRestClientProperties : RestClientProperties() {
+
lateinit var password: String
lateinit var username: String
}
open class TokenAuthRestClientProperties : RestClientProperties() {
+
var token: String? = null
}
open class PolicyManagerRestClientProperties : RestClientProperties() {
+
lateinit var env: String
lateinit var clientAuth: String
lateinit var authorisation: String
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
index 5d68e5d43..ca1046dde 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
@@ -112,6 +112,7 @@ open class RestClientPropertiesAssignmentBuilder : PropertiesAssignmentBuilder()
}
open class BasicAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun password(password: String) {
password(password.asJsonPrimitive())
}
@@ -130,6 +131,7 @@ open class BasicAuthRestClientPropertiesAssignmentBuilder : RestClientProperties
}
open class TokenAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun token(token: String) {
token(token.asJsonPrimitive())
}
@@ -140,6 +142,7 @@ open class TokenAuthRestClientPropertiesAssignmentBuilder : RestClientProperties
}
open class SslAuthRestClientPropertiesAssignmentBuilder : RestClientPropertiesAssignmentBuilder() {
+
open fun keyStoreInstance(keyStoreInstance: String) {
keyStoreInstance(keyStoreInstance.asJsonPrimitive())
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
index 5b6691eff..4b5c2c4e8 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
@@ -25,6 +25,7 @@ import reactor.core.publisher.Mono
import reactor.util.context.Context
open class RestServerLoggingWebFilter : WebFilter {
+
override fun filter(serverWebExchange: ServerWebExchange, webFilterChain: WebFilterChain): Mono<Void> {
val loggingService = RestLoggerService()
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
index bfc0a5cd4..be9b849f6 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
@@ -26,7 +26,7 @@ import java.util.Base64
class BasicAuthRestClientService(
private val restClientProperties:
- BasicAuthRestClientProperties
+ BasicAuthRestClientProperties
) :
BlueprintWebClientService {
@@ -49,21 +49,21 @@ class BasicAuthRestClientService(
}
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- // inject additionalHeaders
- customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
+ Array<BasicHeader> {
+ val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+ // inject additionalHeaders
+ customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- val encodedCredentials = setBasicAuth(
- restClientProperties.username,
- restClientProperties.password
- )
- customHeaders[HttpHeaders.AUTHORIZATION] =
- "Basic $encodedCredentials"
+ if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
+ val encodedCredentials = setBasicAuth(
+ restClientProperties.username,
+ restClientProperties.password
+ )
+ customHeaders[HttpHeaders.AUTHORIZATION] =
+ "Basic $encodedCredentials"
+ }
+ return super.convertToBasicHeaders(customHeaders)
}
- return super.convertToBasicHeaders(customHeaders)
- }
private fun setBasicAuth(username: String, password: String): String {
val credentialsString = "$username:$password"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
index 8f528a2ef..a2c68ec68 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
@@ -90,7 +90,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
else -> {
throw BluePrintProcessorException(
"Rest adaptor($type) is" +
- " not supported"
+ " not supported"
)
}
}
@@ -128,91 +128,93 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
}
private fun blueprintWebClientService(restClientProperties: RestClientProperties):
- BlueprintWebClientService {
-
- when (restClientProperties) {
- is SSLRestClientProperties -> {
- return SSLRestClientService(restClientProperties)
- }
- is TokenAuthRestClientProperties -> {
- return TokenAuthRestClientService(restClientProperties)
- }
- is BasicAuthRestClientProperties -> {
- return BasicAuthRestClientService(restClientProperties)
- }
- else -> {
- throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type} uri: ${restClientProperties.url}")
+ BlueprintWebClientService {
+
+ when (restClientProperties) {
+ is SSLRestClientProperties -> {
+ return SSLRestClientService(restClientProperties)
+ }
+ is TokenAuthRestClientProperties -> {
+ return TokenAuthRestClientService(restClientProperties)
+ }
+ is BasicAuthRestClientProperties -> {
+ return BasicAuthRestClientService(restClientProperties)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't get rest service for type:${restClientProperties.type} uri: ${restClientProperties.url}")
+ }
}
}
- }
private fun tokenRestClientProperties(prefix: String):
- TokenAuthRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, TokenAuthRestClientProperties::class.java
- )
- }
+ TokenAuthRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, TokenAuthRestClientProperties::class.java
+ )
+ }
private fun basicAuthRestClientProperties(prefix: String):
- BasicAuthRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java
- )
- }
+ BasicAuthRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, BasicAuthRestClientProperties::class.java
+ )
+ }
private fun sslBasicAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
+ SSLRestClientProperties {
- val sslProps: SSLBasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, SSLBasicAuthRestClientProperties::class.java
- )
- val basicProps: BasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java
- )
- sslProps.basicAuth = basicProps
- return sslProps
- }
+ val sslProps: SSLBasicAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, SSLBasicAuthRestClientProperties::class.java
+ )
+ val basicProps: BasicAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, BasicAuthRestClientProperties::class.java
+ )
+ sslProps.basicAuth = basicProps
+ return sslProps
+ }
private fun sslTokenAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
+ SSLRestClientProperties {
- val sslProps: SSLTokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix,
- SSLTokenAuthRestClientProperties::class.java
- )
- val basicProps: TokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix,
- TokenAuthRestClientProperties::class.java
- )
- sslProps.tokenAuth = basicProps
- return sslProps
- }
+ val sslProps: SSLTokenAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ SSLTokenAuthRestClientProperties::class.java
+ )
+ val basicProps: TokenAuthRestClientProperties =
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ TokenAuthRestClientProperties::class.java
+ )
+ sslProps.tokenAuth = basicProps
+ return sslProps
+ }
private fun sslNoAuthRestClientProperties(prefix: String):
- SSLRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, SSLRestClientProperties::class.java
- )
- }
+ SSLRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, SSLRestClientProperties::class.java
+ )
+ }
private fun policyManagerRestClientProperties(prefix: String):
- PolicyManagerRestClientProperties {
- return bluePrintPropertiesService.propertyBeanType(
- prefix, PolicyManagerRestClientProperties::class.java
- )
- }
+ PolicyManagerRestClientProperties {
+ return bluePrintPropertiesService.propertyBeanType(
+ prefix, PolicyManagerRestClientProperties::class.java
+ )
+ }
interface PreInterceptor {
+
fun getInstance(jsonNode: JsonNode): BlueprintWebClientService?
fun getInstance(selector: String): BlueprintWebClientService?
}
interface PostInterceptor {
+
fun getInstance(jsonNode: JsonNode, service: BlueprintWebClientService): BlueprintWebClientService
fun getInstance(selector: String, service: BlueprintWebClientService): BlueprintWebClientService
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
index 11f6dc7e3..9beacfcea 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
@@ -165,14 +165,14 @@ interface BlueprintWebClientService {
httpUriRequest: HttpUriRequest,
responseType: Class<T>
):
- WebClientResponse<T> {
- val httpResponse = httpClient().execute(httpUriRequest)
- val statusCode = httpResponse.statusLine.statusCode
- httpResponse.entity.content.use {
- val body = getResponse(it, responseType)
- return WebClientResponse(statusCode, body)
+ WebClientResponse<T> {
+ val httpResponse = httpClient().execute(httpUriRequest)
+ val statusCode = httpResponse.statusLine.statusCode
+ httpResponse.entity.content.use {
+ val body = getResponse(it, responseType)
+ return WebClientResponse(statusCode, body)
+ }
}
- }
suspend fun getNB(path: String): WebClientResponse<String> {
return getNB(path, null, String::class.java)
@@ -183,9 +183,9 @@ interface BlueprintWebClientService {
}
suspend fun <T> getNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- get(path, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ get(path, additionalHeaders!!, responseType)
+ }
suspend fun postNB(path: String, request: Any): WebClientResponse<String> {
return postNB(path, request, null, String::class.java)
@@ -230,19 +230,19 @@ interface BlueprintWebClientService {
}
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?):
- WebClientResponse<String> {
- return deleteNB(path, additionalHeaders, String::class.java)
- }
+ WebClientResponse<String> {
+ return deleteNB(path, additionalHeaders, String::class.java)
+ }
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- delete(path, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ delete(path, additionalHeaders!!, responseType)
+ }
suspend fun <T> patchNB(path: String, request: Any, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
- patch(path, request, additionalHeaders!!, responseType)
- }
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
+ patch(path, request, additionalHeaders!!, responseType)
+ }
suspend fun exchangeNB(methodType: String, path: String, request: Any): WebClientResponse<String> {
return exchangeNB(
@@ -252,9 +252,9 @@ interface BlueprintWebClientService {
}
suspend fun exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?):
- WebClientResponse<String> {
- return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
- }
+ WebClientResponse<String> {
+ return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
+ }
suspend fun <T> exchangeNB(
methodType: String,
@@ -294,16 +294,16 @@ interface BlueprintWebClientService {
}
private fun basicHeaders(headers: Map<String, String>?):
- Array<BasicHeader> {
- val basicHeaders = mutableListOf<BasicHeader>()
- defaultHeaders().forEach { (name, value) ->
- basicHeaders.add(BasicHeader(name, value))
- }
- headers?.forEach { name, value ->
- basicHeaders.add(BasicHeader(name, value))
+ Array<BasicHeader> {
+ val basicHeaders = mutableListOf<BasicHeader>()
+ defaultHeaders().forEach { (name, value) ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ headers?.forEach { name, value ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ return basicHeaders.toTypedArray()
}
- return basicHeaders.toTypedArray()
- }
// Non Blocking Rest Implementation
suspend fun httpClientNB(): CloseableHttpClient {
@@ -323,8 +323,8 @@ interface BlueprintWebClientService {
restClientProperties.additionalHeaders?.let {
if (it.keys.map { k -> k.toLowerCase().trim() }.contains(HttpHeaders.AUTHORIZATION.toLowerCase())) {
val errMsg = "Error in definition of endpoint ${restClientProperties.url}." +
- " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
- " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
+ " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
+ " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
WebClientUtils.log.error(errMsg)
throw BluePrintProcessorException(errMsg)
} else {
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
index dc45e3545..611c0855d 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
@@ -54,9 +54,11 @@ import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
class RestLoggerService {
+
private val log = logger(RestLoggerService::class)
companion object {
+
/** Used before invoking any REST outbound request, Inbound Invocation ID is used as request Id
* for outbound Request, If invocation Id is missing then default Request Id will be generated.
*/
@@ -110,6 +112,7 @@ suspend fun <T> mdcWebCoroutineScope(
block: suspend CoroutineScope.() -> T
) = coroutineScope {
val reactorContext = this.coroutineContext[ReactorContext]
+
/** Populate MDC context only if present in Reactor Context */
val newContext = if (reactorContext != null &&
!reactorContext.context.isEmpty &&
@@ -138,8 +141,11 @@ fun <T> monoMdc(
block: suspend CoroutineScope.() -> T?
): Mono<T> = Mono.create { sink ->
- val reactorContext = (context[ReactorContext]?.context?.putAll(sink.currentContext())
- ?: sink.currentContext()).asCoroutineContext()
+ val reactorContext = (
+ context[ReactorContext]?.context?.putAll(sink.currentContext())
+ ?: sink.currentContext()
+ ).asCoroutineContext()
+
/** Populate MDC context only if present in Reactor Context */
val newContext = if (!reactorContext.context.isEmpty &&
reactorContext.context.hasKey(MDCContext)
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
index 57702f8ac..600eedf15 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
@@ -23,7 +23,7 @@ import org.springframework.http.MediaType
class TokenAuthRestClientService(
private val restClientProperties:
- TokenAuthRestClientProperties
+ TokenAuthRestClientProperties
) :
BlueprintWebClientService {
@@ -36,15 +36,15 @@ class TokenAuthRestClientService(
}
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
- val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- // inject additionalHeaders
- customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
- if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
- customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
+ Array<BasicHeader> {
+ val customHeaders: MutableMap<String, String> = headers.toMutableMap()
+ // inject additionalHeaders
+ customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
+ if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
+ customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
+ }
+ return super.convertToBasicHeaders(customHeaders)
}
- return super.convertToBasicHeaders(customHeaders)
- }
override fun host(uri: String): String {
return restClientProperties.url + uri
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
index 53047d4a8..f45d1cd69 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
@@ -42,35 +42,38 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
- BluePrintPropertiesService::class]
+ classes = [
+ BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
+ BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
- "blueprintsprocessor.restclient.sample.userId=sampleuser",
- "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
- "blueprintsprocessor.restclient.sslbasic.username=admin",
- "blueprintsprocessor.restclient.sslbasic.password=cds",
- "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
- "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
- "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
- "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
- ]
+ [
+ "blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
+ "blueprintsprocessor.restclient.sample.userId=sampleuser",
+ "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.sslbasic.username=admin",
+ "blueprintsprocessor.restclient.sslbasic.password=cds",
+ "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
+ "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
+ "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
+ "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
+ ]
)
class BluePrintRestLibPropertyServiceTest {
@@ -84,8 +87,9 @@ class BluePrintRestLibPropertyServiceTest {
)
assertNotNull(properties, "failed to create property bean")
assertNotNull(
- properties.url, "failed to get url property in" +
- " property bean"
+ properties.url,
+ "failed to get url property in" +
+ " property bean"
)
}
@@ -424,6 +428,7 @@ class BluePrintRestLibPropertyServiceTest {
}
companion object BluePrintRestLibPropertyServiceTest {
+
val defaultMapper = ObjectMapper()
val expectedTokenAuthDefaultHeaders = mapOf<String, String>(
"Content-Type" to "application/json",
@@ -435,7 +440,8 @@ class BluePrintRestLibPropertyServiceTest {
""",
"additionalHeaders" : {
"authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
)
private fun sslTokenAuthEndpointWithHeadersField(headers: String = ""): String =
@@ -462,7 +468,8 @@ class BluePrintRestLibPropertyServiceTest {
"username" : "admin",
"password" : "cds"
}$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
private fun sslNoAuthEndpointWithHeadersField(headers: String = ""): String = """{
"type" : "ssl-no-auth",
@@ -472,7 +479,8 @@ class BluePrintRestLibPropertyServiceTest {
"sslTrustPassword" : "changeit",
"sslKey" : "src/test/resources/keystore.p12",
"sslKeyPassword" : "changeit"$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
// Don't forget to supply "," as the first char to make valid JSON
private fun basicAuthEndpointWithHeadersField(headers: String = ""): String =
@@ -481,37 +489,44 @@ class BluePrintRestLibPropertyServiceTest {
"url": "http://127.0.0.1:8000",
"username": "user",
"password": "pass"$headers
- }""".trimIndent()
+ }
+ """.trimIndent()
private val emptyAdditionalHeaders = """,
"additionalHeaders" : {
- }""".trimIndent()
+ }
+ """.trimIndent()
private val oneAdditionalParameter = """,
"additionalHeaders" : {
"key1": "value1"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val threeAdditionalHeaders = """,
"additionalHeaders" : {
"key1": "value1",
"key2": "value2",
"key3": "value3"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val contentTypeAdditionalHeader = """,
"additionalHeaders" : {
"${HttpHeaders.CONTENT_TYPE}": "${MediaType.APPLICATION_XML}"
- }""".trimIndent()
+ }
+ """.trimIndent()
private val additionalHeadersWithAuth = """,
"additionalHeaders" : {
"Authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
private val additionalHeadersWithAuthLowercased = """,
"additionalHeaders" : {
"authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent()
+ }
+ """.trimIndent()
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
index ea202481e..74e3807f7 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
@@ -65,31 +65,33 @@ import kotlin.test.assertNotNull
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(
- classes = [BluePrintRestLibConfiguration::class, SampleController::class,
+ classes = [
+ BluePrintRestLibConfiguration::class, SampleController::class,
SecurityConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- [
- "server.port=8443",
- "server.ssl.enabled=true",
- "server.ssl.key-store=classpath:keystore.p12",
- "server.ssl.key-store-password=changeit",
- "server.ssl.keyStoreType=PKCS12",
- "server.ssl.keyAlias=tomcat",
- "blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:9081",
- "blueprintsprocessor.restclient.sample.username=admin",
- "blueprintsprocessor.restclient.sample.password=jans",
- "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.test.url=https://localhost:8443",
- "blueprintsprocessor.restclient.test.username=admin",
- "blueprintsprocessor.restclient.test.password=jans",
- "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
- ]
+ [
+ "server.port=8443",
+ "server.ssl.enabled=true",
+ "server.ssl.key-store=classpath:keystore.p12",
+ "server.ssl.key-store-password=changeit",
+ "server.ssl.keyStoreType=PKCS12",
+ "server.ssl.keyAlias=tomcat",
+ "blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:9081",
+ "blueprintsprocessor.restclient.sample.username=admin",
+ "blueprintsprocessor.restclient.sample.password=jans",
+ "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.test.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.test.username=admin",
+ "blueprintsprocessor.restclient.test.password=jans",
+ "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
+ ]
)
class RestClientServiceTest {
@@ -119,26 +121,26 @@ class RestClientServiceTest {
@Test
fun testGetQueryParam() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val response = restClientService.exchangeResource(
- HttpMethod.GET.name, "/sample/query?id=3", ""
+ HttpMethod.GET.name, "/sample/query?id=3", ""
)
assertEquals(
- "query with id:3", response.body,
- "failed to get query param response"
+ "query with id:3", response.body,
+ "failed to get query param response"
)
}
@Test
fun testGetPathParamWithWhitespace() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val response = restClientService.exchangeResource(
- HttpMethod.GET.name, "/sample/path/id 3/get", ""
+ HttpMethod.GET.name, "/sample/path/id 3/get", ""
)
assertEquals(
- "path param id:id 3", response.body,
- "failed to get query param response"
+ "path param id:id 3", response.body,
+ "failed to get query param response"
)
}
@@ -171,11 +173,11 @@ class RestClientServiceTest {
@Test
fun testSimpleBasicAuth() {
val json: String = "{\n" +
- " \"type\" : \"basic-auth\",\n" +
- " \"url\" : \"http://localhost:9081\",\n" +
- " \"username\" : \"admin\",\n" +
- " \"password\" : \"jans\"\n" +
- "}"
+ " \"type\" : \"basic-auth\",\n" +
+ " \"url\" : \"http://localhost:9081\",\n" +
+ " \"username\" : \"admin\",\n" +
+ " \"password\" : \"jans\"\n" +
+ "}"
val mapper = ObjectMapper()
val actualObj: JsonNode = mapper.readTree(json)
val restClientService = bluePrintRestLibPropertyService
@@ -203,13 +205,13 @@ class RestClientServiceTest {
headers["X-TransactionId"] = "9999"
headers["X-FromAppId"] = "AAI"
val post1 = "{\n" +
- " \"customer\": {\n" +
- " \"global-customer-id\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"subscriber-name\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"subscriber-type\": \"CUST\",\n" +
- " \"resource-version\": \"1552985011163\"\n" +
- " }\n" +
- "}"
+ " \"customer\": {\n" +
+ " \"global-customer-id\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"subscriber-name\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"subscriber-type\": \"CUST\",\n" +
+ " \"resource-version\": \"1552985011163\"\n" +
+ " }\n" +
+ "}"
lateinit var res1: Customer
lateinit var res2: Customer
lateinit var res3: String
@@ -307,11 +309,11 @@ open class SampleController {
@GetMapping("/query")
fun getQuery(@RequestParam("id") id: String): String =
- "query with id:$id"
+ "query with id:$id"
@GetMapping("/path/{id}/get")
fun getPathParam(@PathVariable("id") id: String): String =
- "path param id:$id"
+ "path param id:$id"
@PatchMapping("/name")
fun patchName(): String = "Patch request successful"
@@ -330,11 +332,11 @@ open class SampleController {
return ""
}
return "{\n" +
- " \"id\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"name\": \"ONSDEMOBJHKCustomer\",\n" +
- " \"type\": \"CUST\",\n" +
- " \"resource\": \"1552985011163\"\n" +
- "}"
+ " \"id\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"name\": \"ONSDEMOBJHKCustomer\",\n" +
+ " \"type\": \"CUST\",\n" +
+ " \"resource\": \"1552985011163\"\n" +
+ "}"
}
@PostMapping("/aai/v14/business/customers")
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
index 382c9b7d7..dc10722cc 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
@@ -43,6 +43,7 @@ fun BluePrintDependencyService.sshClientService(jsonNode: JsonNode): BlueprintSs
class SshLibConstants {
companion object {
+
const val SERVICE_BLUEPRINT_SSH_LIB_PROPERTY = "blueprint-ssh-lib-property-service"
const val PROPERTY_SSH_CLIENT_PREFIX = "blueprintsprocessor.sshclient."
const val TYPE_BASIC_AUTH = "basic-auth"
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
index cc323adb3..295021f21 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
@@ -19,6 +19,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.ssh
open class SshClientProperties {
+
lateinit var type: String
lateinit var host: String
var port: Int = 22
@@ -27,6 +28,7 @@ open class SshClientProperties {
}
open class BasicAuthSshClientProperties : SshClientProperties() {
+
lateinit var password: String
lateinit var username: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
index a3c730039..6ee73c238 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
@@ -31,13 +31,13 @@ import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.PipedInputStream
import java.io.PipedOutputStream
+import java.util.ArrayList
import java.util.Collections
import java.util.EnumSet
import java.util.Scanner
-import java.util.ArrayList
open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties) :
- BlueprintSshClientService {
+ BlueprintSshClientService {
private val log = LoggerFactory.getLogger(BasicAuthSshClientService::class.java)!!
private val newLine = "\n".toByteArray()
@@ -54,8 +54,9 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
log.debug("SSH Client Service started successfully")
clientSession = sshClient.connect(
- basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
- basicAuthSshClientProperties.port).verify(basicAuthSshClientProperties.connectionTimeOut).session
+ basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
+ basicAuthSshClientProperties.port
+ ).verify(basicAuthSshClientProperties.connectionTimeOut).session
clientSession.addPasswordIdentity(basicAuthSshClientProperties.password)
clientSession.auth().verify(basicAuthSshClientProperties.connectionTimeOut)
@@ -79,7 +80,7 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
}
}
- override suspend fun executeCommandsNB(commands: List <String>, timeOut: Long): List<CommandResult> {
+ override suspend fun executeCommandsNB(commands: List<String>, timeOut: Long): List<CommandResult> {
val response = ArrayList<CommandResult>()
try {
var stopLoop = false
@@ -126,7 +127,8 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
private fun waitForPrompt(timeOut: Long): String {
val waitMask = channel!!.waitFor(
- Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED)), timeOut)
+ Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED)), timeOut
+ )
if (channel!!.out.toString().indexOfAny(arrayListOf("$", ">", "#")) <= 0 && waitMask.contains(ClientChannelEvent.TIMEOUT)) {
throw BluePrintProcessorException("Timeout: Failed to retrieve commands result in $timeOut ms")
}
@@ -157,8 +159,11 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
Scanner(output).use { scanner ->
while (scanner.hasNextLine()) {
val temp = scanner.nextLine()
- if (temp.isNotBlank() && (temp.trim { it <= ' ' }.startsWith("%") ||
- temp.trim { it <= ' ' }.startsWith("syntax error"))) {
+ if (temp.isNotBlank() && (
+ temp.trim { it <= ' ' }.startsWith("%") ||
+ temp.trim { it <= ' ' }.startsWith("syntax error")
+ )
+ ) {
return true
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
index f4c39c936..43a997ae9 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
@@ -31,17 +31,20 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
- "blueprintsprocessor.sshclient.sample.port=22",
- "blueprintsprocessor.sshclient.sample.password=1234",
- "blueprintsprocessor.sshclient.sample.username=dummy"
- ]
+ [
+ "blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
+ "blueprintsprocessor.sshclient.sample.port=22",
+ "blueprintsprocessor.sshclient.sample.password=1234",
+ "blueprintsprocessor.sshclient.sample.username=dummy"
+ ]
)
class BluePrintSshLibPropertyServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
index 3785a21b2..1cf0de52b 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
@@ -27,6 +27,7 @@ import org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
import org.apache.sshd.server.session.ServerSession
import org.apache.sshd.server.shell.ProcessShellCommandFactory
+import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
@@ -36,27 +37,29 @@ import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import java.nio.file.Paths
-import org.junit.runner.RunWith
-import kotlin.test.BeforeTest
import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
import kotlin.test.Test
-import kotlin.test.assertTrue
-import kotlin.test.assertNotNull
import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+ classes = [
+ BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=localhost",
- "blueprintsprocessor.sshclient.sample.port=52815",
- "blueprintsprocessor.sshclient.sample.username=root",
- "blueprintsprocessor.sshclient.sample.password=dummyps"
- ]
+ [
+ "blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=localhost",
+ "blueprintsprocessor.sshclient.sample.port=52815",
+ "blueprintsprocessor.sshclient.sample.username=root",
+ "blueprintsprocessor.sshclient.sample.password=dummyps"
+ ]
)
class BlueprintSshClientServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
index 9d308202f..6e9d1968f 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/echoShell/EchoShellFactory.kt
@@ -18,14 +18,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.echoShell
import org.apache.sshd.common.Factory
import org.apache.sshd.server.Environment
-import org.apache.sshd.server.command.Command
import org.apache.sshd.server.ExitCallback
-import java.io.InputStream
-import java.io.OutputStream
-import java.io.IOException
+import org.apache.sshd.server.command.Command
import java.io.BufferedReader
+import java.io.IOException
+import java.io.InputStream
import java.io.InputStreamReader
import java.io.InterruptedIOException
+import java.io.OutputStream
class EchoShellFactory : Factory<Command> {
@@ -34,6 +34,7 @@ class EchoShellFactory : Factory<Command> {
}
companion object {
+
val INSTANCE = EchoShellFactory()
}
}