aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/application/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/application/src')
-rwxr-xr-xms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml24
-rwxr-xr-xms/blueprintsprocessor/application/src/main/docker/distribution.xml5
-rw-r--r--ms/blueprintsprocessor/application/src/main/docker/startService.sh2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt59
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt22
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt31
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt34
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt29
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt7
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt30
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt16
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt (renamed from ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt)0
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt38
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt124
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt8
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties5
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties5
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem37
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt12
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt24
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt7
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt9
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt47
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt12
31 files changed, 398 insertions, 221 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
index 27f72b59b..0ff04bf3a 100755
--- a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
+++ b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
@@ -5,20 +5,21 @@ services:
image: mariadb:latest
container_name: ccsdk-mariadb
ports:
- - "3306:3306"
+ - "3306:3306"
volumes:
- - ~/vm_mysql:/var/lib/mysql
+ - ~/vm_mysql:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: sdnctl
MYSQL_DATABASE: sdnctl
MYSQL_USER: sdnctl
MYSQL_PASSWORD: sdnctl
- blueprints-processor:
+ cds-controller-default:
depends_on:
- db
image: onap/ccsdk-blueprintsprocessor:latest
- container_name: bp-processor
+ container_name: cds-controller-default
+ hostname: cds-controller-default
ports:
- "8000:8080"
- "9111:9111"
@@ -26,7 +27,7 @@ services:
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
environment:
- APPLICATIONNAME: BlueprintsProcessor
+ APPLICATIONNAME: cds-controller
BUNDLEVERSION: 1.0.0
APP_CONFIG_HOME: /opt/app/onap/config
STICKYSELECTORKEY:
@@ -41,28 +42,25 @@ services:
restart: always
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
- py-executor:
+ py-executor-default:
depends_on:
- db
- image: onap/ccsdk-py-script-executor
- container_name: bp-py-executor
+ image: onap/ccsdk-py-executor
+ container_name: py-executor-default
+ hostname: py-executor-default
ports:
- "50052:50052"
restart: always
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
environment:
- APPLICATIONNAME: PythonExecutor
+ APPLICATIONNAME: py-executor
BUNDLEVERSION: 1.0.0
APP_CONFIG_HOME: /opt/app/onap/config
STICKYSELECTORKEY:
ENVCONTEXT: dev
APP_PORT: 50052
- #AUTH_TYPE: basic-auth
- #AUTH_TOKEN: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
AUTH_TYPE: tls-auth
- AUTH_CERT_CHAIN: /opt/app/onap/python/py-executor-chain.pem
- AUTH_PRIVATE_KEY: /opt/app/onap/python/py-executor-key.pem
LOG_FILE: /opt/app/onap/logs/application.log
volumes:
diff --git a/ms/blueprintsprocessor/application/src/main/docker/distribution.xml b/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
index aed417581..291dca09b 100755
--- a/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
+++ b/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
@@ -45,6 +45,11 @@
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
+ <directory>${project.basedir}/src/main/resources/certs</directory>
+ <outputDirectory>opt/app/onap/config/certs</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
<directory>${project.basedir}/../../../components/model-catalog</directory>
<outputDirectory>opt/app/onap/model-catalog</outputDirectory>
<includes>
diff --git a/ms/blueprintsprocessor/application/src/main/docker/startService.sh b/ms/blueprintsprocessor/application/src/main/docker/startService.sh
index 11c471f2d..7dcb5ff16 100644
--- a/ms/blueprintsprocessor/application/src/main/docker/startService.sh
+++ b/ms/blueprintsprocessor/application/src/main/docker/startService.sh
@@ -16,6 +16,6 @@ exec java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sour
-Dms_name=org.onap.ccsdk.cds.blueprintsprocessor \
-Dlogging.config=${APP_CONFIG_HOME}/logback.xml \
-Djava.security.egd=file:/dev/./urandom \
--DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
+-DAPPNAME=${APPLICATIONNAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
-Dspring.config.location=${APP_CONFIG_HOME}/ \
org.onap.ccsdk.cds.blueprintsprocessor.BlueprintProcessorApplicationKt
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
new file mode 100644
index 000000000..58464cb10
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.cds.blueprintsprocessor
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class BlueprintDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
index 2d39eaa1f..bfde39aa0 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
@@ -30,10 +30,12 @@ import org.springframework.stereotype.Component
@ConditionalOnProperty(name = ["blueprintsprocessor.grpcEnable"], havingValue = "true")
@Component
-open class BlueprintGRPCServer(private val bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler,
- private val bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler,
- private val authInterceptor: BasicAuthServerInterceptor)
- : ApplicationListener<ContextRefreshedEvent> {
+open class BlueprintGRPCServer(
+ private val bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler,
+ private val bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler,
+ private val authInterceptor: BasicAuthServerInterceptor
+) :
+ ApplicationListener<ContextRefreshedEvent> {
private val log = logger(BlueprintGRPCServer::class)
@@ -44,12 +46,12 @@ open class BlueprintGRPCServer(private val bluePrintProcessingGRPCHandler: BlueP
try {
log.info("Starting Blueprint Processor GRPC Starting..")
val server = ServerBuilder
- .forPort(grpcPort!!)
- .intercept(GrpcServerLoggingInterceptor())
- .intercept(authInterceptor)
- .addService(bluePrintProcessingGRPCHandler)
- .addService(bluePrintManagementGRPCHandler)
- .build()
+ .forPort(grpcPort!!)
+ .intercept(GrpcServerLoggingInterceptor())
+ .intercept(authInterceptor)
+ .addService(bluePrintProcessingGRPCHandler)
+ .addService(bluePrintManagementGRPCHandler)
+ .build()
server.start()
log.info("Blueprint Processor GRPC server started and ready to serve on port({})...", server.port)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
index 4251fb5cb..f152e307f 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
@@ -30,4 +30,4 @@ open class BlueprintHttpServer : WebServerFactoryCustomizer<NettyReactiveWebServ
override fun customize(serverFactory: NettyReactiveWebServerFactory) {
serverFactory.port = httpPort!!
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
index a8ee57d9d..243533b66 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
@@ -33,28 +33,29 @@ import springfox.documentation.spring.web.plugins.Docket
* @author Brinda Santh
*/
@Configuration
-//@EnableSwagger2WebFlux
+// @EnableSwagger2WebFlux
open class SwaggerConfig {
@Bean
open fun api(): Docket {
return Docket(DocumentationType.SWAGGER_2)
- .select()
- .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
- .paths(PathSelectors.any())
- .build()
- .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
+ .paths(PathSelectors.any())
+ .build()
+ .apiInfo(apiInfo())
}
private fun apiInfo(): ApiInfo {
return ApiInfo(
- "CDS Blueprints Processor APIs",
- "Provide APIs to interact with CBA, their resolved resources and templates, and stored resource configurations.",
- "0.7.0",
- null,
- Contact("CCSDK Team", "www.onap.org", "onap-discuss@lists.onap.org"),
- "Apache 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0",
- emptyList())
+ "CDS Blueprints Processor APIs",
+ "Provide APIs to interact with CBA, their resolved resources and templates, and stored resource configurations.",
+ "0.7.0",
+ null,
+ Contact("CCSDK Team", "www.onap.org", "onap-discuss@lists.onap.org"),
+ "Apache 2.0",
+ "http://www.apache.org/licenses/LICENSE-2.0",
+ emptyList()
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
index 5b12d8df7..d2d01cc64 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
@@ -34,36 +34,38 @@ import org.springframework.web.reactive.config.WebFluxConfigurer
* @author Brinda Santh
*/
@Configuration
-open class WebConfig(private val authenticationManager: AuthenticationManager,
- private val securityContextRepository: SecurityContextRepository) : WebFluxConfigurer {
+open class WebConfig(
+ private val authenticationManager: AuthenticationManager,
+ private val securityContextRepository: SecurityContextRepository
+) : WebFluxConfigurer {
override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
registry.addResourceHandler("/swagger-ui.html**")
- .addResourceLocations("classpath:/META-INF/resources/")
+ .addResourceLocations("classpath:/META-INF/resources/")
registry.addResourceHandler("/webjars/**")
- .addResourceLocations("classpath:/META-INF/resources/webjars/")
+ .addResourceLocations("classpath:/META-INF/resources/webjars/")
}
override fun addCorsMappings(corsRegistry: CorsRegistry) {
corsRegistry.addMapping("/**")
- .allowedOrigins("*")
- .allowedMethods("*")
- .allowedHeaders("*")
- .maxAge(3600)
+ .allowedOrigins("*")
+ .allowedMethods("*")
+ .allowedHeaders("*")
+ .maxAge(3600)
}
@Bean
open fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
return http.csrf().disable()
- .formLogin().disable()
- .httpBasic().disable()
- .authenticationManager(authenticationManager)
- .securityContextRepository(securityContextRepository!!)
- .authorizeExchange()
- .pathMatchers(HttpMethod.OPTIONS).permitAll()
- .anyExchange().authenticated()
- .and().build()
+ .formLogin().disable()
+ .httpBasic().disable()
+ .authenticationManager(authenticationManager)
+ .securityContextRepository(securityContextRepository!!)
+ .authorizeExchange()
+ .pathMatchers(HttpMethod.OPTIONS).permitAll()
+ .anyExchange().authenticated()
+ .and().build()
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
index 66a19b2c5..8fcffbf06 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
@@ -16,9 +16,11 @@
package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrintProcessorHealthCheck
+import org.slf4j.LoggerFactory
import org.springframework.boot.actuate.health.AbstractHealthIndicator
import org.springframework.boot.actuate.health.Health
import org.springframework.stereotype.Component
@@ -29,19 +31,26 @@ import org.springframework.stereotype.Component
* @version 1.0
*/
@Component
-open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck)
- : AbstractHealthIndicator() {
+open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) :
+ AbstractHealthIndicator() {
+
+ private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java)
@Throws(Exception::class)
override fun doHealthCheck(builder: Health.Builder) {
- var result: HealthApiResponse? = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
- if (result?.status == HealthCheckStatus.UP) {
- builder.up()
- } else {
- builder.down()
+ runBlocking {
+ var result: HealthApiResponse? = null
+ try {
+ result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
+ if (result?.status == HealthCheckStatus.UP) {
+ builder.up()
+ } else {
+ builder.down()
+ }
+ builder.withDetail("Services", result?.checks)
+ } catch (exception: IllegalArgumentException) {
+ logger.error(exception.message)
+ }
}
- builder.withDetail("Services", result?.checks)
}
-
-
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
index 933425bc3..d9674d5b8 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
@@ -23,8 +23,8 @@ import org.springframework.security.core.AuthenticationException
import reactor.core.publisher.Mono
@Configuration
-open class AuthenticationManager(private val authenticationProvider: AuthenticationProvider)
- : ReactiveAuthenticationManager {
+open class AuthenticationManager(private val authenticationProvider: AuthenticationProvider) :
+ ReactiveAuthenticationManager {
override fun authenticate(authentication: Authentication): Mono<Authentication> {
try {
@@ -32,6 +32,5 @@ open class AuthenticationManager(private val authenticationProvider: Authenticat
} catch (e: AuthenticationException) {
return Mono.error(e)
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
index a0a4ae297..ab9ee29df 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
@@ -15,7 +15,11 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.security
-import io.grpc.*
+import io.grpc.Metadata
+import io.grpc.ServerCall
+import io.grpc.ServerCallHandler
+import io.grpc.ServerInterceptor
+import io.grpc.Status
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.springframework.security.authentication.BadCredentialsException
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
@@ -23,23 +27,24 @@ import org.springframework.security.core.AuthenticationException
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Component
import java.nio.charset.StandardCharsets
-import java.util.*
+import java.util.Base64
@Component
-class BasicAuthServerInterceptor(private val authenticationManager: AuthenticationManager)
- : ServerInterceptor {
+class BasicAuthServerInterceptor(private val authenticationManager: AuthenticationManager) :
+ ServerInterceptor {
private val log = logger(BasicAuthServerInterceptor::class)
override fun <ReqT, RespT> interceptCall(
- call: ServerCall<ReqT, RespT>,
- headers: Metadata,
- next: ServerCallHandler<ReqT, RespT>): ServerCall.Listener<ReqT> {
+ call: ServerCall<ReqT, RespT>,
+ headers: Metadata,
+ next: ServerCallHandler<ReqT, RespT>
+ ): ServerCall.Listener<ReqT> {
val authHeader = headers.get(Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER))
if (authHeader.isNullOrEmpty()) {
throw Status.UNAUTHENTICATED.withDescription("Missing required authentication")
- .asRuntimeException()
+ .asRuntimeException()
}
try {
@@ -54,7 +59,6 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
log.info("Authentication success: {}", authResult)
SecurityContextHolder.getContext().authentication = authResult
-
} catch (e: AuthenticationException) {
SecurityContextHolder.clearContext()
@@ -69,8 +73,10 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
private fun decodeBasicAuth(authHeader: String): Array<String> {
val basicAuth: String
try {
- basicAuth = String(Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8)
+ basicAuth = String(
+ Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
+ StandardCharsets.UTF_8
+ )
} catch (e: IllegalArgumentException) {
throw BadCredentialsException("Failed to decode basic authentication token")
} catch (e: IndexOutOfBoundsException) {
@@ -84,4 +90,4 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
return arrayOf(basicAuth.substring(0, delim), basicAuth.substring(delim + 1))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
index 70b0df2d1..29ec27daa 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
@@ -38,8 +38,10 @@ open class SecurityConfiguration {
@Bean
open fun inMemoryUserService(): UserDetailsService {
- val user = User(username, password,
- listOf(SimpleGrantedAuthority("USER")))
+ val user = User(
+ username, password,
+ listOf(SimpleGrantedAuthority("USER"))
+ )
return InMemoryUserDetailsManager(user)
}
@@ -54,4 +56,4 @@ open class SecurityConfiguration {
provider.setUserDetailsService(inMemoryUserService())
return provider
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
index f1c362f57..d646c2ee5 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
@@ -25,11 +25,11 @@ import org.springframework.stereotype.Component
import org.springframework.web.server.ServerWebExchange
import reactor.core.publisher.Mono
import java.nio.charset.StandardCharsets
-import java.util.*
+import java.util.Base64
@Component
-class SecurityContextRepository(private val authenticationManager: AuthenticationManager)
- : ServerSecurityContextRepository {
+class SecurityContextRepository(private val authenticationManager: AuthenticationManager) :
+ ServerSecurityContextRepository {
override fun save(swe: ServerWebExchange, sc: SecurityContext): Mono<Void> {
throw UnsupportedOperationException("Not supported.")
@@ -44,7 +44,7 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
val password = tokens[1]
val auth = UsernamePasswordAuthenticationToken(username, password)
return this.authenticationManager!!.authenticate(auth)
- .map { SecurityContextImpl(it) }
+ .map { SecurityContextImpl(it) }
} else {
return Mono.empty()
}
@@ -53,8 +53,10 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
private fun decodeBasicAuth(authHeader: String): Array<String> {
val basicAuth: String
try {
- basicAuth = String(Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8)
+ basicAuth = String(
+ Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
+ StandardCharsets.UTF_8
+ )
} catch (e: IllegalArgumentException) {
throw BadCredentialsException("Failed to decode basic authentication token")
} catch (e: IndexOutOfBoundsException) {
@@ -68,4 +70,4 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
return arrayOf(basicAuth.substring(0, delim), basicAuth.substring(delim + 1))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
index 1a625c279..c5821bed1 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
@@ -52,10 +52,10 @@ internal class JsonNormalizer {
private fun expandJstlSpec(jstlSpec: JsonNode): String {
val extendedJstlSpec = updateObjectNodes(jstlSpec, "*", ".")
return extendedJstlSpec.toString()
- // Handle the "?" as a prefix to literal/non-quoted values
- .replace("\"\\?([^\"]+)\"".toRegex(), "$1")
- // Also, remove the quotes added by Jackson for key and value of the wildcard matcher
- .replace("\"([.*])\"".toRegex(), "$1")
+ // Handle the "?" as a prefix to literal/non-quoted values
+ .replace("\"\\?([^\"]+)\"".toRegex(), "$1")
+ // Also, remove the quotes added by Jackson for key and value of the wildcard matcher
+ .replace("\"([.*])\"".toRegex(), "$1")
}
/**
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
index 6b1b0c676..710a65c6f 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
@@ -49,4 +49,4 @@ internal class PathDeserializer : StdDeserializer<String>(String::class.java) {
}
return flatJoinTo(StringBuilder(), path).toString()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt
index 163544fc9..163544fc9 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
index 3046f1041..cc7ac69f0 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
@@ -30,34 +30,45 @@ import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.nodes.Tag
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class ProcessDefinition(val name: String, val request: JsonNode, val expectedResponse: JsonNode? = null,
- val responseNormalizerSpec: JsonNode? = null)
+data class ProcessDefinition(
+ val name: String,
+ val request: JsonNode,
+ val expectedResponse: JsonNode? = null,
+ val responseNormalizerSpec: JsonNode? = null
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class RequestDefinition(val method: String,
- @JsonDeserialize(using = PathDeserializer::class)
- val path: String,
- val headers: Map<String, String> = emptyMap(),
- val body: JsonNode? = null)
+data class RequestDefinition(
+ val method: String,
+ @JsonDeserialize(using = PathDeserializer::class)
+ val path: String,
+ val headers: Map<String, String> = emptyMap(),
+ val body: JsonNode? = null
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
data class ResponseDefinition(val status: Int = 200, val body: JsonNode? = null) {
+
companion object {
val DEFAULT_RESPONSE = ResponseDefinition()
}
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class ExpectationDefinition(val request: RequestDefinition,
- val response: ResponseDefinition = ResponseDefinition.DEFAULT_RESPONSE)
+data class ExpectationDefinition(
+ val request: RequestDefinition,
+ val response: ResponseDefinition = ResponseDefinition.DEFAULT_RESPONSE
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
data class ServiceDefinition(val selector: String, val expectations: List<ExpectationDefinition>)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class UatDefinition(val processes: List<ProcessDefinition>,
- @JsonAlias("external-services")
- val externalServices: List<ServiceDefinition> = emptyList()) {
+data class UatDefinition(
+ val processes: List<ProcessDefinition>,
+ @JsonAlias("external-services")
+ val externalServices: List<ServiceDefinition> = emptyList()
+) {
fun dump(mapper: ObjectMapper, excludedProperties: List<String> = emptyList()): String {
val uatAsMap: Map<String, Any> = mapper.convertValue(this)
@@ -86,7 +97,6 @@ data class UatDefinition(val processes: List<ProcessDefinition>,
companion object {
fun load(mapper: ObjectMapper, spec: String): UatDefinition =
- mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
-
+ mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
index 4e97460d3..89ba1500b 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
@@ -70,9 +70,9 @@ import java.util.concurrent.ConcurrentHashMap
*/
@Component
class UatExecutor(
- private val environment: ConfigurableEnvironment,
- private val restClientFactory: BluePrintRestLibPropertyService,
- private val mapper: ObjectMapper
+ private val environment: ConfigurableEnvironment,
+ private val restClientFactory: BluePrintRestLibPropertyService,
+ private val mapper: ObjectMapper
) {
companion object {
@@ -103,8 +103,8 @@ class UatExecutor(
fun execute(uat: UatDefinition, cbaBytes: ByteArray): UatDefinition {
val defaultHeaders = listOf(BasicHeader(HttpHeaders.AUTHORIZATION, clientAuthToken()))
val httpClient = HttpClientBuilder.create()
- .setDefaultHeaders(defaultHeaders)
- .build()
+ .setDefaultHeaders(defaultHeaders)
+ .build()
// Only if externalServices are defined
val mockInterceptor = MockPreInterceptor()
// Always defined and used, whatever the case
@@ -113,13 +113,13 @@ class UatExecutor(
try {
// Configure mocked external services and save their expected requests for further validation
val requestsPerClient = uat.externalServices.associateBy(
- { service ->
- createRestClientMock(service.expectations).also { restClient ->
- // side-effect: register restClient to override real instance
- mockInterceptor.registerMock(service.selector, restClient)
- }
- },
- { service -> service.expectations.map { it.request } }
+ { service ->
+ createRestClientMock(service.expectations).also { restClient ->
+ // side-effect: register restClient to override real instance
+ mockInterceptor.registerMock(service.selector, restClient)
+ }
+ },
+ { service -> service.expectations.map { it.request } }
)
val newProcesses = httpClient.use { client ->
@@ -129,8 +129,10 @@ class UatExecutor(
uat.processes.map { process ->
log.info("Executing process '${process.name}'")
val responseNormalizer = JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec)
- val actualResponse = processBlueprint(client, process.request,
- process.expectedResponse, responseNormalizer)
+ val actualResponse = processBlueprint(
+ client, process.request,
+ process.expectedResponse, responseNormalizer
+ )
ProcessDefinition(process.name, process.request, actualResponse, process.responseNormalizerSpec)
}
}
@@ -139,10 +141,11 @@ class UatExecutor(
for ((mockClient, requests) in requestsPerClient) {
requests.forEach { request ->
verify(mockClient, atLeastOnce()).exchangeResource(
- eq(request.method),
- eq(request.path),
- argThat { assertJsonEquals(request.body, this) },
- argThat(RequiredMapEntriesMatcher(request.headers)))
+ eq(request.method),
+ eq(request.path),
+ argThat { assertJsonEquals(request.body, this) },
+ argThat(RequiredMapEntriesMatcher(request.headers))
+ )
}
// Don't mind the invocations to the overloaded exchangeResource(String, String, String)
verify(mockClient, atLeast(0)).exchangeResource(any(), any(), any())
@@ -150,7 +153,7 @@ class UatExecutor(
}
val newExternalServices = spyInterceptor.getSpies()
- .map(SpyService::asServiceDefinition)
+ .map(SpyService::asServiceDefinition)
return UatDefinition(newProcesses, newExternalServices)
} finally {
@@ -158,29 +161,32 @@ class UatExecutor(
}
}
- private fun createRestClientMock(restExpectations: List<ExpectationDefinition>)
- : BlueprintWebClientService {
+ private fun createRestClientMock(restExpectations: List<ExpectationDefinition>):
+ BlueprintWebClientService {
val restClient = mock<BlueprintWebClientService>(
- defaultAnswer = Answers.RETURNS_SMART_NULLS,
- // our custom verboseLogging handler
- invocationListeners = arrayOf(mockLoggingListener)
+ defaultAnswer = Answers.RETURNS_SMART_NULLS,
+ // our custom verboseLogging handler
+ invocationListeners = arrayOf(mockLoggingListener)
)
// Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
whenever(restClient.exchangeResource(any(), any(), any()))
- .thenAnswer { invocation ->
- val method = invocation.arguments[0] as String
- val path = invocation.arguments[1] as String
- val request = invocation.arguments[2] as String
- restClient.exchangeResource(method, path, request, emptyMap())
- }
+ .thenAnswer { invocation ->
+ val method = invocation.arguments[0] as String
+ val path = invocation.arguments[1] as String
+ val request = invocation.arguments[2] as String
+ restClient.exchangeResource(method, path, request, emptyMap())
+ }
for (expectation in restExpectations) {
- whenever(restClient.exchangeResource(
+ whenever(
+ restClient.exchangeResource(
eq(expectation.request.method),
eq(expectation.request.path),
any(),
- any()))
- .thenReturn(WebClientResponse(expectation.response.status, expectation.response.body.toString()))
+ any()
+ )
+ )
+ .thenReturn(WebClientResponse(expectation.response.status, expectation.response.body.toString()))
}
return restClient
}
@@ -188,9 +194,9 @@ class UatExecutor(
@Throws(AssertionError::class)
private fun uploadBlueprint(client: HttpClient, cbaBytes: ByteArray) {
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .build()
val request = HttpPost("$baseUrl/api/v1/blueprint-model/publish").apply {
entity = multipartEntity
}
@@ -201,8 +207,12 @@ class UatExecutor(
}
@Throws(AssertionError::class)
- private fun processBlueprint(client: HttpClient, requestBody: JsonNode,
- expectedResponse: JsonNode?, responseNormalizer: (String) -> String): JsonNode {
+ private fun processBlueprint(
+ client: HttpClient,
+ requestBody: JsonNode,
+ expectedResponse: JsonNode?,
+ responseNormalizer: (String) -> String
+ ): JsonNode {
val stringEntity = StringEntity(mapper.writeValueAsString(requestBody), ContentType.APPLICATION_JSON)
val request = HttpPost("$baseUrl/api/v1/execution-service/process").apply {
entity = stringEntity
@@ -234,8 +244,8 @@ class UatExecutor(
}
private fun localServerPort(): Int =
- (environment.getProperty("local.server.port")
- ?: environment.getRequiredProperty("blueprint.httpPort")).toInt()
+ (environment.getProperty("local.server.port")
+ ?: environment.getRequiredProperty("blueprint.httpPort")).toInt()
private fun clientAuthToken(): String {
val username = environment.getRequiredProperty("security.user.name")
@@ -255,7 +265,7 @@ class UatExecutor(
}
override fun getInstance(selector: String): BlueprintWebClientService? =
- mocks[selector]
+ mocks[selector]
fun registerMock(selector: String, client: BlueprintWebClientService) {
mocks[selector] = client
@@ -277,21 +287,27 @@ class UatExecutor(
}
fun getSpies(): List<SpyService> =
- spies.values.toList()
+ spies.values.toList()
}
- private class SpyService(private val mapper: ObjectMapper,
- val selector: String,
- private val realService: BlueprintWebClientService) :
- BlueprintWebClientService by realService {
+ private class SpyService(
+ private val mapper: ObjectMapper,
+ val selector: String,
+ private val realService: BlueprintWebClientService
+ ) :
+ BlueprintWebClientService by realService {
private val expectations: MutableList<ExpectationDefinition> = mutableListOf()
override fun exchangeResource(methodType: String, path: String, request: String): WebClientResponse<String> =
- exchangeResource(methodType, path, request, DEFAULT_HEADERS)
-
- override fun exchangeResource(methodType: String, path: String, request: String,
- headers: Map<String, String>): WebClientResponse<String> {
+ exchangeResource(methodType, path, request, DEFAULT_HEADERS)
+
+ override fun exchangeResource(
+ methodType: String,
+ path: String,
+ request: String,
+ headers: Map<String, String>
+ ): WebClientResponse<String> {
val requestDefinition = RequestDefinition(methodType, path, headers, toJson(request))
val realAnswer = realService.exchangeResource(methodType, path, request, headers)
val responseBody = when {
@@ -309,7 +325,7 @@ class UatExecutor(
}
fun asServiceDefinition() =
- ServiceDefinition(selector, expectations)
+ ServiceDefinition(selector, expectations)
private fun toJson(str: String): JsonNode? {
return when {
@@ -320,9 +336,9 @@ class UatExecutor(
companion object {
private val DEFAULT_HEADERS = mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
+ HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+ HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
index f133fd7c7..5b62f1296 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
@@ -72,8 +72,10 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
@PostMapping("/spy", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE], produces = ["text/vnd.yaml"])
@PreAuthorize("hasRole('USER')")
@Suppress("BlockingMethodInNonBlockingContext")
- open fun spy(@RequestPart("cba") cbaFile: FilePart,
- @RequestPart("uat", required = false) uatFile: FilePart?): String = runBlocking {
+ open fun spy(
+ @RequestPart("cba") cbaFile: FilePart,
+ @RequestPart("uat", required = false) uatFile: FilePart?
+ ): String = runBlocking {
val tempFile = createTempFile()
setContextColor(COLOR_SERVICES)
try {
@@ -118,4 +120,4 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
// Fields that can be safely ignored from BPP response, and can be omitted on the UAT specification.
private val FIELDS_TO_EXCLUDE = listOf("timestamp")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
index 10139c839..9ae3ff805 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
@@ -21,4 +21,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.uat.logging
import org.slf4j.Marker
-class ColorMarker internal constructor(private val dlg: Marker) : Marker by dlg \ No newline at end of file
+class ColorMarker internal constructor(private val dlg: Marker) : Marker by dlg
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
index dce516933..f0cba2670 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
@@ -41,5 +41,5 @@ object LogColor {
}
fun markerOf(color: String): ColorMarker =
- ColorMarker(MarkerFactory.getMarker(color))
+ ColorMarker(MarkerFactory.getMarker(color))
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
index d7b38d3fa..cad235450 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
@@ -35,7 +35,7 @@ class SmartColorDiscriminator : AbstractDiscriminator<ILoggingEvent>() {
}
override fun getDiscriminatingValue(e: ILoggingEvent): String =
- (e.marker as? ColorMarker)?.name
- ?: e.mdcPropertyMap?.get(MDC_COLOR_KEY)
- ?: defaultValue
-} \ No newline at end of file
+ (e.marker as? ColorMarker)?.name
+ ?: e.mdcPropertyMap?.get(MDC_COLOR_KEY)
+ ?: defaultValue
+}
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index fc2e7f244..89b4f65b4 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -57,6 +57,11 @@ blueprintsprocessor.grpcclient.remote-python.host=localhost
blueprintsprocessor.grpcclient.remote-python.port=50051
blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+# Py executor
+blueprintsprocessor.grpcclient.py-executor.type=tls-auth
+blueprintsprocessor.grpcclient.py-executor.host=localhost:50052
+blueprintsprocessor.grpcclient.py-executor.trustCertCollection=src/main/resources/certs/py-executor/py-executor-chain.pem
+
# Blueprint Processor File Execution and Handling Properties
### use absolute paths if testing inside docker
### blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index bd713080f..1ba29e43a 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -77,6 +77,11 @@ blueprintsprocessor.grpcclient.remote-python.host=localhost
blueprintsprocessor.grpcclient.remote-python.port=50051
blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+# Py executor
+blueprintsprocessor.grpcclient.py-executor.type=tls-auth
+blueprintsprocessor.grpcclient.py-executor.host=py-executor-default:50052
+blueprintsprocessor.grpcclient.py-executor.trustCertCollection=/opt/app/onap/config/certs/py-executor/py-executor-chain.pem
+
# Config Data REST client settings
blueprintsprocessor.restconfEnabled=true
blueprintsprocessor.restclient.sdnc.type=basic-auth
diff --git a/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem b/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem
new file mode 100644
index 000000000..98c4f39ba
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIGXTCCBEWgAwIBAgIJALA8s9WVhurtMA0GCSqGSIb3DQEBCwUAMH8xCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApOZXcgSmVyc2V5MRMwEQYDVQQHDApNaWRkbGV0b3du
+MRcwFQYDVQQKDA5PTkFQIENvbW11bml0eTEOMAwGA1UEAwwFQ0NTREsxHTAbBgkq
+hkiG9w0BCQEWDmJzMjc5NkBhdHQuY29tMB4XDTE5MTEyOTIwNTUzNFoXDTI5MTEy
+NjIwNTUzNFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCk5ldyBKZXJzZXkxEzAR
+BgNVBAcMCk1pZGRsZXRvd24xFzAVBgNVBAoMDk9OQVAgQ29tbXVuaXR5MQ4wDAYD
+VQQDDAVDQ1NESzEdMBsGCSqGSIb3DQEJARYOYnMyNzk2QGF0dC5jb20wggIiMA0G
+CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDMb8yqD/lu3IHffa1H+LnCTKCijZDC
+85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3pTqu0q5s5Q5Qg2ZF
+xZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohjSY9l+cAPuAQ3izmz
+ValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUPKkqYQOOaiv31rYVG
+sw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6e8wYO211wkPEJ/go
+sulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9NzXiKOP9Zp+Qj4jM
+3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R9fzMYEUeUdLeEEtr
+NBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V8JFP1SrT2EbguaW5
+G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcNk89wn50I4GLUY0Q5
+hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVyvcqXvnmlhOhLamr2
+72bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUqnHTHHKGXv7C2mCAO
+MIEPr/WJpS50WwIDAQABo4HbMIHYMB0GA1UdDgQWBBT+kmcpEJ/kS/kW9rGc0uom
+T0VqBDAfBgNVHSMEGDAWgBT+kmcpEJ/kS/kW9rGc0uomT0VqBDAJBgNVHRMEAjAA
+MAsGA1UdDwQEAwIF4DATBgNVHSUEDDAKBggrBgEFBQcDATA7BgNVHREENDAyghBj
+ZHMtY29udHJvbGxlci0qgg1weS1leGVjdXRvci0qgglsb2NhbGhvc3SHBH8AAAEw
+LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMA0G
+CSqGSIb3DQEBCwUAA4ICAQCdquyIETbOWFtXpzL/SQ8jB0yzBmErA3vQPm847qSz
+r8QNXsEyPq7lo06xJTfhlmfpOBzCVdpP+/3pvJfKJ8/wC/D3B8E88Ozzz/yCZPuG
+SNcv+SSnki729ptc1bx6It0FQFahXGywm2ASHGMz4zfmMtnjIfBEuMBCD+V4liwr
+oCEw8E1d+fxArv72LMbNYxPQ+HfrasYhINgVnYSpftqIGpi0PGaEoCVrosQnB0Gk
+5kHWvTXqMC+G9Q1MSQk8vs3lnp9Y4gXbdeaMu3YSmM9nVAY1uZiZRBHVbMadIDFO
+NQmDBKfyN6uK3uBV1S84woC0o5iqIR5EF3u4NeCX5jRWR1Uu4zAG70TpcLmyP1do
+Kt49m9sVrxoCgzjzRd1yZ50BZ1/5550OeF55swQv/ncGriD8uxaQu49NbUo2Rw8R
+Af5TMMW9+0KN6zDOUIVfK5a6NGqnylN3drB2jIjGyTOVycm5paL+iuKEg7euxvZ8
+51Z6QWe3F3+wVYVWtDeN3/9FUm3FzonmZvoChYkz7NTifQpS7/46BpBa5DoblcUu
+MMXWMYieVv3wLIvtFFi2CoNh0tyD7TcNsAB4hLbbBxtXmAB82tgjQhOdkQErm+qi
+Gq5AwlI8k3hhkLDcWH4hUx4YTLJLdTeQGKyM6dB+NBZATyzOrY5j86j7vITLeG8t
+3w==
+-----END CERTIFICATE-----
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
index ec338f274..0ff5dc55d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
@@ -33,10 +33,12 @@ import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
// Also set blueprintsprocessor.httpPort=0
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(initializers = [
- WorkingFoldersInitializer::class,
- TestSecuritySettings.ServerContextInitializer::class
-])
+@ContextConfiguration(
+ initializers = [
+ WorkingFoldersInitializer::class,
+ TestSecuritySettings.ServerContextInitializer::class
+ ]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
abstract class BaseUatTest {
@@ -53,4 +55,4 @@ abstract class BaseUatTest {
companion object {
const val UAT_BLUEPRINTS_BASE_DIR = "../../../components/model-catalog/blueprint-model/uat-blueprints"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index fa550d1d0..ad97ce82a 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -38,8 +38,10 @@ import kotlin.test.Test
// Only one runner can be configured with jUnit 4. We had to replace the SpringRunner by equivalent jUnit rules.
// See more on https://docs.spring.io/autorepo/docs/spring-framework/current/spring-framework-reference/testing.html#testcontext-junit4-rules
@RunWith(Parameterized::class)
-class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: String, // readable test description
- private val rootFs: FileSystem) : BaseUatTest() {
+class BlueprintsAcceptanceTest(
+ @Suppress("unused") private val blueprintName: String, // readable test description
+ private val rootFs: FileSystem
+) : BaseUatTest() {
companion object {
@@ -55,14 +57,14 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
@JvmStatic
fun scanUatEmpoweredBlueprints(): List<Array<Any>> {
return (File(UAT_BLUEPRINTS_BASE_DIR)
- .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
- ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
- .map { file ->
- arrayOf(
- file.nameWithoutExtension,
- FileSystems.newFileSystem(file.canonicalFile.toPath(), null)
- )
- }
+ .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
+ ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
+ .map { file ->
+ arrayOf(
+ file.nameWithoutExtension,
+ FileSystems.newFileSystem(file.canonicalFile.toPath(), null)
+ )
+ }
}
}
@@ -91,4 +93,4 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
uatExecutor.execute(uatSpec, cbaBytes)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
index 1c0067c36..c483d90b3 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
@@ -21,8 +21,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.uat
import java.io.File
import java.io.IOException
-import java.nio.file.*
-import java.nio.file.attribute.*
+import java.nio.file.FileVisitResult
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.SimpleFileVisitor
+import java.nio.file.attribute.BasicFileAttributes
import javax.annotation.PreDestroy
class ExtendedTemporaryFolder {
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
index 216df9aef..b0917cb7d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
@@ -30,14 +30,15 @@ class TestSecuritySettings {
private const val authPassword = "Heisenberg"
fun clientAuthToken() =
- "Basic " + Base64Utils.encodeToString("$authUsername:$authPassword".toByteArray())
+ "Basic " + Base64Utils.encodeToString("$authUsername:$authPassword".toByteArray())
}
class ServerContextInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
override fun initialize(context: ConfigurableApplicationContext) {
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "security.user.name=$authUsername",
- "security.user.password={noop}$authPassword"
+ TestPropertySourceUtils.addInlinedPropertiesToEnvironment(
+ context,
+ "security.user.name=$authUsername",
+ "security.user.password={noop}$authPassword"
)
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
index 78dc7099c..2df5f2940 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
@@ -108,7 +108,7 @@ class UatServicesTest : BaseUatTest() {
}
private fun inlinedPropertySource(): MutableMap<String, Any> =
- (environment.propertySources[INLINED_PROPERTIES_PROPERTY_SOURCE_NAME] as MapPropertySource).source
+ (environment.propertySources[INLINED_PROPERTIES_PROPERTY_SOURCE_NAME] as MapPropertySource).source
@LocalServerPort
var localServerPort: Int = 0
@@ -122,11 +122,15 @@ class UatServicesTest : BaseUatTest() {
@BeforeTest
fun setupHttpClient() {
- val defaultHeaders = listOf(BasicHeader(org.apache.http.HttpHeaders.AUTHORIZATION,
- TestSecuritySettings.clientAuthToken()))
+ val defaultHeaders = listOf(
+ BasicHeader(
+ org.apache.http.HttpHeaders.AUTHORIZATION,
+ TestSecuritySettings.clientAuthToken()
+ )
+ )
httpClient = HttpClientBuilder.create()
- .setDefaultHeaders(defaultHeaders)
- .build()
+ .setDefaultHeaders(defaultHeaders)
+ .build()
}
@Test
@@ -134,9 +138,9 @@ class UatServicesTest : BaseUatTest() {
// GIVEN
val cbaBytes = compressToBytes(BLUEPRINT_BASE_DIR)
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .build()
val request = HttpPost("$baseUrl/api/v1/uat/verify").apply {
entity = multipartEntity
}
@@ -168,10 +172,10 @@ class UatServicesTest : BaseUatTest() {
val cbaBytes = compressToBytes(BLUEPRINT_BASE_DIR)
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .addBinaryBody("uat", bareUatBytes, ContentType.DEFAULT_BINARY, "uat.yaml")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .addBinaryBody("uat", bareUatBytes, ContentType.DEFAULT_BINARY, "uat.yaml")
+ .build()
val request = HttpPost("$baseUrl/api/v1/uat/spy").apply {
entity = multipartEntity
}
@@ -193,7 +197,8 @@ class UatServicesTest : BaseUatTest() {
}
private fun createMockServer(service: ServiceDefinition): WireMockServer {
- val mockServer = WireMockServer(wireMockConfig()
+ val mockServer = WireMockServer(
+ wireMockConfig()
.dynamicPort()
.notifier(MarkedSlf4jNotifier(wireMockMarker))
)
@@ -212,10 +217,10 @@ class UatServicesTest : BaseUatTest() {
}
val responseDefinitionBuilder: ResponseDefinitionBuilder = aResponse()
- .withStatus(response.status)
+ .withStatus(response.status)
if (response.body != null) {
responseDefinitionBuilder.withBody(mapper.writeValueAsBytes(response.body))
- .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
}
mappingBuilder.willReturn(responseDefinitionBuilder)
@@ -229,11 +234,11 @@ class UatServicesTest : BaseUatTest() {
val selector = service.selector
val httpPort = mockServer.port()
val properties = mapOf(
- "blueprintsprocessor.restclient.$selector.type" to "basic-auth",
- "blueprintsprocessor.restclient.$selector.url" to "http://localhost:$httpPort/",
- // TODO credentials should be validated
- "blueprintsprocessor.restclient.$selector.username" to "admin",
- "blueprintsprocessor.restclient.$selector.password" to "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+ "blueprintsprocessor.restclient.$selector.type" to "basic-auth",
+ "blueprintsprocessor.restclient.$selector.url" to "http://localhost:$httpPort/",
+ // TODO credentials should be validated
+ "blueprintsprocessor.restclient.$selector.username" to "admin",
+ "blueprintsprocessor.restclient.$selector.password" to "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
)
setProperties(properties)
}
@@ -257,4 +262,4 @@ class UatServicesTest : BaseUatTest() {
val map: Map<String, Any> = Yaml().load(yaml)
return mapper.writeValueAsString(map)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
index ab9ae31a0..3c1757432 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
@@ -32,16 +32,20 @@ class WorkingFoldersInitializer : ApplicationContextInitializer<ConfigurableAppl
override fun initialize(context: ConfigurableApplicationContext) {
val tempFolder = ExtendedTemporaryFolder()
val properties = listOf("Deploy", "Archive", "Working")
- .map { "blueprintsprocessor.blueprint${it}Path=${tempFolder.newFolder(it)}" }
- .toTypedArray()
+ .map { "blueprintsprocessor.blueprint${it}Path=${tempFolder.newFolder(it)}" }
+ .toTypedArray()
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, *properties)
// Expose tempFolder as a bean so it can be accessed via DI
registerSingleton(context, "tempFolder", ExtendedTemporaryFolder::class.java, tempFolder)
}
@Suppress("SameParameterValue")
- private fun <T> registerSingleton(context: ConfigurableApplicationContext,
- beanName: String, beanClass: Class<T>, instance: T) {
+ private fun <T> registerSingleton(
+ context: ConfigurableApplicationContext,
+ beanName: String,
+ beanClass: Class<T>,
+ instance: T
+ ) {
val builder = BeanDefinitionBuilder.genericBeanDefinition(beanClass) { instance }
(context.beanFactory as BeanDefinitionRegistry).registerBeanDefinition(beanName, builder.beanDefinition)
}