From d425c6319a995402163c8868e9fe40f3d88f02ea Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Sat, 9 Nov 2019 20:35:47 -0500 Subject: Convert component functions IT to UT. Issue-ID: CCSDK-1735 Convert Netconf and Restconf Executor IT to UT. Remove duplicate BluePrintProperties. Signed-off-by: Brinda Santh Change-Id: I2eafdbabb17a4df72541ab93c46e7fc9eb0fe8d7 --- .../grpc/service/BluePrintGrpcLibPropertyService.kt | 18 +++++++++--------- .../service/BluePrintGrpcLibPropertyServiceTest.kt | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ms/blueprintsprocessor/modules/commons/grpc-lib') 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 f4933a3ad..fbc9ddd86 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 @@ -18,7 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service import com.fasterxml.jackson.databind.JsonNode -import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService import org.onap.ccsdk.cds.blueprintsprocessor.grpc.* import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing @@ -26,7 +26,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.stereotype.Service @Service(GRPCLibConstants.SERVICE_BLUEPRINT_GRPC_LIB_PROPERTY) -open class BluePrintGrpcLibPropertyService(private var bluePrintProperties: BluePrintProperties) { +open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesService: BluePrintPropertiesService) { /** GRPC Server Lib Property Service */ fun grpcServerProperties(jsonNode: JsonNode): GrpcServerProperties { @@ -44,7 +44,7 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintProperties: Blue } fun grpcServerProperties(prefix: String): GrpcServerProperties { - val type = bluePrintProperties.propertyBeanType( + val type = bluePrintPropertiesService.propertyBeanType( "$prefix.type", String::class.java) return when (type) { GRPCLibConstants.TYPE_TOKEN_AUTH -> { @@ -60,11 +60,11 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintProperties: Blue } private fun tokenAuthGrpcServerProperties(prefix: String): TokenAuthGrpcServerProperties { - return bluePrintProperties.propertyBeanType(prefix, TokenAuthGrpcServerProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, TokenAuthGrpcServerProperties::class.java) } private fun tlsAuthGrpcServerProperties(prefix: String): TLSAuthGrpcServerProperties { - return bluePrintProperties.propertyBeanType(prefix, TLSAuthGrpcServerProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, TLSAuthGrpcServerProperties::class.java) } /** GRPC Client Lib Property Service */ @@ -101,7 +101,7 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintProperties: Blue } fun grpcClientProperties(prefix: String): GrpcClientProperties { - val type = bluePrintProperties.propertyBeanType( + val type = bluePrintPropertiesService.propertyBeanType( "$prefix.type", String::class.java) return when (type) { GRPCLibConstants.TYPE_TOKEN_AUTH -> { @@ -139,14 +139,14 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintProperties: Blue } private fun tokenAuthGrpcClientProperties(prefix: String): TokenAuthGrpcClientProperties { - return bluePrintProperties.propertyBeanType(prefix, TokenAuthGrpcClientProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, TokenAuthGrpcClientProperties::class.java) } private fun tlsAuthGrpcClientProperties(prefix: String): TLSAuthGrpcClientProperties { - return bluePrintProperties.propertyBeanType(prefix, TLSAuthGrpcClientProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, TLSAuthGrpcClientProperties::class.java) } private fun basicAuthGrpcClientProperties(prefix: String): BasicAuthGrpcClientProperties { - return bluePrintProperties.propertyBeanType(prefix, BasicAuthGrpcClientProperties::class.java) + return bluePrintPropertiesService.propertyBeanType(prefix, BasicAuthGrpcClientProperties::class.java) } } \ No newline at end of file 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 b7ddc1569..e4bfd5d7c 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 @@ -21,8 +21,8 @@ import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import org.junit.Test import org.junit.runner.RunWith -import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties -import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService +import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration import org.onap.ccsdk.cds.blueprintsprocessor.grpc.* import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType import org.springframework.beans.factory.annotation.Autowired @@ -35,7 +35,7 @@ import kotlin.test.assertTrue @RunWith(SpringRunner::class) @ContextConfiguration(classes = [BluePrintGrpcLibConfiguration::class, - BlueprintPropertyConfiguration::class, BluePrintProperties::class]) + BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]) @TestPropertySource(properties = ["blueprintsprocessor.grpcclient.sample.type=basic-auth", "blueprintsprocessor.grpcclient.sample.host=127.0.0.1", -- cgit 1.2.3-korg