diff options
Diffstat (limited to 'ms/blueprintsprocessor/application')
18 files changed, 52 insertions, 26 deletions
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml index a566c8447..a4c8ad05d 100755 --- a/ms/blueprintsprocessor/application/pom.xml +++ b/ms/blueprintsprocessor/application/pom.xml @@ -45,7 +45,6 @@ </properties> <dependencies> - <dependency> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>blueprint-core</artifactId> @@ -87,12 +86,10 @@ <dependency> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>health-api</artifactId> - <version>0.7.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>health-api-common</artifactId> - <version>0.7.0-SNAPSHOT</version> </dependency> <!-- Libs --> @@ -162,12 +159,10 @@ <dependency> <groupId>com.nhaarman.mockitokotlin2</groupId> <artifactId>mockito-kotlin</artifactId> - <version>2.2.0</version> </dependency> <dependency> <groupId>com.schibsted.spt.data</groupId> <artifactId>jslt</artifactId> - <version>0.1.8</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> 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 0ff5dc55d..7f38608c9 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 @@ -23,6 +23,8 @@ import org.junit.runner.RunWith import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.COLOR_TEST_CLIENT import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.resetContextColor import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.setContextColor +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.TestSecuritySettings +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.WorkingFoldersInitializer import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ContextConfiguration import org.springframework.test.context.TestPropertySource 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 ad97ce82a..ff7cd78c0 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 @@ -24,6 +24,8 @@ import org.junit.ClassRule import org.junit.Rule import org.junit.runner.RunWith import org.junit.runners.Parameterized +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.ExtendedTemporaryFolder +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.UatExecutor import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.UAT_SPECIFICATION_FILE import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils.Companion.compressToBytes import org.springframework.beans.factory.annotation.Autowired 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 2df5f2940..688ba663c 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 @@ -44,6 +44,10 @@ import org.hamcrest.Matchers.equalToIgnoringCase import org.jetbrains.kotlin.konan.util.prefixIfNot import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.COLOR_WIREMOCK import org.onap.ccsdk.cds.blueprintsprocessor.uat.logging.LogColor.markerOf +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.MarkedSlf4jNotifier +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.ServiceDefinition +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.TestSecuritySettings +import org.onap.ccsdk.cds.blueprintsprocessor.uat.utils.UatDefinition import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.UAT_SPECIFICATION_FILE import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils.Companion.compressToBytes import org.skyscreamer.jsonassert.JSONAssert diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt index 9ae3ff805..9ae3ff805 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt index f0cba2670..f0cba2670 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt index f8e6bd486..f8e6bd486 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/MockInvocationLogger.kt diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt index cad235450..cad235450 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt 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/utils/ExtendedTemporaryFolder.kt index c483d90b3..9090361fb 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/utils/ExtendedTemporaryFolder.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import java.io.File import java.io.IOException diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/JsonNormalizer.kt index c5821bed1..39caa0178 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/JsonNormalizer.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper @@ -35,7 +35,8 @@ internal class JsonNormalizer { } return { s: String -> val input = mapper.readTree(s) - val expandedJstlSpec = expandJstlSpec(jsltSpec) + val expandedJstlSpec = + expandJstlSpec(jsltSpec) val jslt = Parser.compileString(expandedJstlSpec) val output = jslt.apply(input) output.toString() @@ -50,7 +51,8 @@ internal class JsonNormalizer { * @return the string representation of the extended JSTL spec. */ private fun expandJstlSpec(jstlSpec: JsonNode): String { - val extendedJstlSpec = updateObjectNodes(jstlSpec, "*", ".") + val extendedJstlSpec = + updateObjectNodes(jstlSpec, "*", ".") return extendedJstlSpec.toString() // Handle the "?" as a prefix to literal/non-quoted values .replace("\"\\?([^\"]+)\"".toRegex(), "$1") @@ -69,7 +71,11 @@ internal class JsonNormalizer { if (jsonNode is ContainerNode<*>) { (jsonNode as? ObjectNode)?.put(fieldName, fieldValue) jsonNode.forEach { child -> - updateObjectNodes(child, fieldName, fieldValue) + updateObjectNodes( + child, + fieldName, + fieldValue + ) } } return jsonNode diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MarkedSlf4jNotifier.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt index 13ebd9e4b..e6198b1ba 100644 --- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MarkedSlf4jNotifier.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/MarkedSlf4jNotifier.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.github.tomakehurst.wiremock.common.Notifier import org.slf4j.LoggerFactory diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt index 710a65c6f..6c5759155 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/PathDeserializer.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.DeserializationContext diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt index 163544fc9..0f98d7213 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/RequiredMapEntriesMatcher.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.google.common.collect.Maps import org.mockito.ArgumentMatcher 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/utils/TestSecuritySettings.kt index b0917cb7d..888ab8dcd 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/utils/TestSecuritySettings.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import org.springframework.context.ApplicationContextInitializer import org.springframework.context.ConfigurableApplicationContext diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt index cc7ac69f0..c45ac45c6 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatDefinition.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.fasterxml.jackson.annotation.JsonAlias import com.fasterxml.jackson.annotation.JsonInclude diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt index 89ba1500b..a904fa9b6 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatExecutor.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper @@ -133,7 +133,12 @@ class UatExecutor( client, process.request, process.expectedResponse, responseNormalizer ) - ProcessDefinition(process.name, process.request, actualResponse, process.responseNormalizerSpec) + ProcessDefinition( + process.name, + process.request, + actualResponse, + process.responseNormalizerSpec + ) } } @@ -251,7 +256,8 @@ class UatExecutor( val username = environment.getRequiredProperty("security.user.name") val password = environment.getRequiredProperty("security.user.password") val plainPassword = when { - password.startsWith(NOOP_PASSWORD_PREFIX) -> password.substring(NOOP_PASSWORD_PREFIX.length) + password.startsWith(NOOP_PASSWORD_PREFIX) -> password.substring( + NOOP_PASSWORD_PREFIX.length) else -> username } return "Basic " + Base64Utils.encodeToString("$username:$plainPassword".toByteArray()) @@ -300,7 +306,9 @@ class UatExecutor( private val expectations: MutableList<ExpectationDefinition> = mutableListOf() override fun exchangeResource(methodType: String, path: String, request: String): WebClientResponse<String> = - exchangeResource(methodType, path, request, DEFAULT_HEADERS) + exchangeResource(methodType, path, request, + DEFAULT_HEADERS + ) override fun exchangeResource( methodType: String, @@ -308,15 +316,22 @@ class UatExecutor( request: String, headers: Map<String, String> ): WebClientResponse<String> { - val requestDefinition = RequestDefinition(methodType, path, headers, toJson(request)) + val requestDefinition = + RequestDefinition(methodType, path, headers, toJson(request)) val realAnswer = realService.exchangeResource(methodType, path, request, headers) val responseBody = when { // TODO: confirm if we need to normalize the response here realAnswer.status == HttpStatus.SC_OK -> toJson(realAnswer.body) else -> null } - val responseDefinition = ResponseDefinition(realAnswer.status, responseBody) - expectations.add(ExpectationDefinition(requestDefinition, responseDefinition)) + val responseDefinition = + ResponseDefinition(realAnswer.status, responseBody) + expectations.add( + ExpectationDefinition( + requestDefinition, + responseDefinition + ) + ) return realAnswer } diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt index 5b62f1296..f40b903de 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt +++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/utils/UatServices.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import com.fasterxml.jackson.databind.ObjectMapper import kotlinx.coroutines.runBlocking @@ -87,7 +87,9 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper: val uat = UatDefinition.load(mapper, uatSpec) val cbaBytes = tempFile.readBytes() val updatedUat = uatExecutor.execute(uat, cbaBytes) - return@runBlocking updatedUat.dump(mapper, FIELDS_TO_EXCLUDE) + return@runBlocking updatedUat.dump(mapper, + FIELDS_TO_EXCLUDE + ) } catch (t: Throwable) { throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, t.message, t) } finally { 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/utils/WorkingFoldersInitializer.kt index 3c1757432..001dcbec4 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/utils/WorkingFoldersInitializer.kt @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.cds.blueprintsprocessor.uat +package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils import org.springframework.beans.factory.support.BeanDefinitionBuilder import org.springframework.beans.factory.support.BeanDefinitionRegistry @@ -32,7 +32,7 @@ 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)}" } + .map { "blueprintsprocessor.blueprint${it}Path=${tempFolder.newFolder(it).absolutePath.replace("\\", "/")}" } .toTypedArray() TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, *properties) // Expose tempFolder as a bean so it can be accessed via DI |