import org.hamcrest.CoreMatchers
import org.hamcrest.MatcherAssert.assertThat
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 kotlin.test.Test
import kotlin.test.assertNotNull
+fun String.prefixIfNot(prefix: String) =
+ if (this.startsWith(prefix)) this else "$prefix$this"
+
@ActiveProfiles("uat")
@Suppress("MemberVisibilityCanBePrivate")
class UatServicesTest : BaseUatTest() {
val askLimitOnLaunch = jtLaunchReqs.at("/ask_limit_on_launch").asBoolean()
if (askLimitOnLaunch && !limitProp.isNullOrMissing()) {
- payload.set(INPUT_LIMIT_TO_HOST, limitProp)
+ payload.set<JsonNode>(INPUT_LIMIT_TO_HOST, limitProp)
}
val askTagsOnLaunch = jtLaunchReqs.at("/ask_tags_on_launch").asBoolean()
if (askTagsOnLaunch && !tagsProp.isNullOrMissing()) {
- payload.set(INPUT_TAGS, tagsProp)
+ payload.set<JsonNode>(INPUT_TAGS, tagsProp)
}
if (askTagsOnLaunch && !skipTagsProp.isNullOrMissing()) {
- payload.set("skip_tags", skipTagsProp)
+ payload.set<JsonNode>("skip_tags", skipTagsProp)
}
}
} else {
inventoryProp
}
- payload.set(INPUT_INVENTORY, inventoryKeyId)
+ payload.set<JsonNode>(INPUT_INVENTORY, inventoryKeyId)
}
- payload.set("extra_vars", extraArgs)
+ payload.set<JsonNode>("extra_vars", extraArgs)
return payload.asJsonString(false)
}
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
+import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.JsonNodeFactory
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
// provide indexed result in output if we have multiple resolution
if (occurrence != 1) {
- jsonResponse.set(Integer.toString(j), response.asJsonNode())
+ jsonResponse.set<JsonNode>(Integer.toString(j), response.asJsonNode())
} else {
jsonResponse.setAll(response.asObjectNode())
}
val valueToPrint = getValueToLog(metadata, value)
containsLogProtected = hasLogProtect(metadata)
logger.trace("Generating Resource name ($rName), type ($type), value ($valueToPrint)")
- root.set(rName, value)
+ root.set<JsonNode>(rName, value)
}
}
result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root)
val arrayNodeForList1 = JacksonUtils.objectMapper.createArrayNode()
listOfIps.forEach {
val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
- arrayChildNode.set("value", it.asJsonPrimitive())
+ arrayChildNode.set<JsonNode>("value", it.asJsonPrimitive())
arrayNodeForList1.add(arrayChildNode)
}
inputMapToTestCollectionOfPrimitiveType = arrayNodeForList1
val arrayNodeForList2 = JacksonUtils.objectMapper.createArrayNode()
listOfIpAddresses.forEach {
val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
- arrayChildNode.set("value", it.asJsonType())
+ arrayChildNode.set<JsonNode>("value", it.asJsonType())
arrayNodeForList2.add(arrayChildNode)
}
inputMapToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayNodeForList2
val arrayNodeForList3 = JacksonUtils.objectMapper.createArrayNode()
var childNode = JacksonUtils.objectMapper.createObjectNode()
- childNode.set("port", "1111".asJsonPrimitive())
- childNode.set("ip", "1.2.3.1".asJsonPrimitive())
+ childNode.set<JsonNode>("port", "1111".asJsonPrimitive())
+ childNode.set<JsonNode>("ip", "1.2.3.1".asJsonPrimitive())
arrayNodeForList3.add(childNode)
childNode = JacksonUtils.objectMapper.createObjectNode()
- childNode.set("port", "2222".asJsonPrimitive())
- childNode.set("ip", "1.2.3.2".asJsonPrimitive())
+ childNode.set<JsonNode>("port", "2222".asJsonPrimitive())
+ childNode.set<JsonNode>("ip", "1.2.3.2".asJsonPrimitive())
arrayNodeForList3.add(childNode)
childNode = JacksonUtils.objectMapper.createObjectNode()
- childNode.set("port", "3333".asJsonPrimitive())
- childNode.set("ip", "1.2.3.3".asJsonPrimitive())
+ childNode.set<JsonNode>("port", "3333".asJsonPrimitive())
+ childNode.set<JsonNode>("ip", "1.2.3.3".asJsonPrimitive())
arrayNodeForList3.add(childNode)
inputMapToTestCollectionOfComplexTypeWithAllOutputKeyMapping = arrayNodeForList3
objectNode.set("host", Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType())
val childNode1 = JacksonUtils.objectMapper.createObjectNode()
- childNode1.set("name", "my-ipAddress".asJsonPrimitive())
- childNode1.set("ipAddress", IpAddress("1111", "1.2.3.1").asJsonType())
- childNode1.set("port", "8888".asJsonType())
- childNode1.set("something", IpAddress("2222", "1.2.3.1").asJsonType())
+ childNode1.set<JsonNode>("name", "my-ipAddress".asJsonPrimitive())
+ childNode1.set<JsonNode>("ipAddress", IpAddress("1111", "1.2.3.1").asJsonType())
+ childNode1.set<JsonNode>("port", "8888".asJsonType())
+ childNode1.set<JsonNode>("something", IpAddress("2222", "1.2.3.1").asJsonType())
inputMapToTestComplexTypeWithAllOutputKeyMapping = childNode1
val childNode2 = JacksonUtils.objectMapper.createObjectNode()
- childNode2.set("name", "my-ipAddress".asJsonPrimitive())
- childNode2.set("ipAddress", IpAddress("1111", "1.2.3.1").asJsonType())
+ childNode2.set<JsonNode>("name", "my-ipAddress".asJsonPrimitive())
+ childNode2.set<JsonNode>("ipAddress", IpAddress("1111", "1.2.3.1").asJsonType())
expectedValueToTestComplexTypeWithAllOutputKeyMapping = childNode2
}
val key = it.replace(path, "")
if (keys.contains(key)) {
val value = store[it] as JsonNode
- jsonNode.set(key, value)
+ jsonNode.set<JsonNode>(key, value)
}
}
return jsonNode
fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType)
?: throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)")
- objectNode.set(key, defaultValue)
+ objectNode.set<JsonNode>(key, defaultValue)
}
fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
fun populateJsonNodeValues(key: String, nodeValue: JsonNode?, type: String, objectNode: ObjectNode) {
if (nodeValue == null || nodeValue is NullNode) {
- objectNode.set(key, nodeValue)
+ objectNode.set<JsonNode>(key, nodeValue)
} else if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
populatePrimitiveValues(key, nodeValue, type, objectNode)
} else {
- objectNode.set(key, nodeValue)
+ objectNode.set<JsonNode>(key, nodeValue)
}
}
fun prepareRequestPayload(workflowName: String, jsonNode: JsonNode): JsonNode {
val objectNode = JacksonUtils.objectMapper.createObjectNode()
- objectNode["$workflowName-request"] = jsonNode
+ objectNode.set<JsonNode>("$workflowName-request", jsonNode)
return objectNode
}
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.http.MediaType
@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(
- classes = [BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class]
+ classes = [BluePrintCoreConfiguration::class, BluePrintCatalogService::class]
)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
@WebFluxTest
@ContextConfiguration(
classes = [BluePrintRuntimeService::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class, ComponentScriptExecutor::class]
+ BluePrintCatalogService::class, ComponentScriptExecutor::class]
)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
@WebFluxTest
@ContextConfiguration(
classes = [TestDatabaseConfiguration::class,
- ResourceController::class, ResourceResolutionDBService::class, SecurityProperties::class]
+ ResourceController::class, ResourceResolutionDBService::class]
)
@ComponentScan(
basePackages = ["org.onap.ccsdk.cds.controllerblueprints.core.service",
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.http.MediaType
@WebFluxTest
@ContextConfiguration(
classes = [TestDatabaseConfiguration::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class]
+ BluePrintCatalogService::class]
)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
@WebFluxTest
@ContextConfiguration(
classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class]
+ BluePrintCatalogService::class]
)
@ComponentScan(
basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
try {
// Set the Response Payload
executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode()
- executionServiceOutput.payload.set("$actionName-response", responseActionPayload)
+ executionServiceOutput.payload.set<JsonNode>("$actionName-response", responseActionPayload)
// Set the Default Step Status
status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name
} catch (e: Exception) {
package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
+import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
// Set the Response Payload
executionServiceOutput.payload = JacksonUtils.objectMapper.createObjectNode()
- executionServiceOutput.payload.set("$workflowName-response", workflowOutputs.asObjectNode())
+ executionServiceOutput.payload.set<JsonNode>("$workflowName-response", workflowOutputs.asObjectNode())
return executionServiceOutput
}
}
<!-- Should be using released artifact as soon as available: -->
<!-- https://github.com/springfox/springfox/milestone/44 -->
<springfox.swagger2.version>2.9.2</springfox.swagger2.version>
- <spring.kafka.version>2.2.6.RELEASE</spring.kafka.version>
- <kafka.version>2.2.0</kafka.version>
<eelf.version>1.0.0</eelf.version>
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
- <version>${spring.kafka.version}</version>
+ <version>${spring-kafka.version}</version>
</dependency>
<!--Swagger Dependencies -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
- <version>${spring.kafka.version}</version>
+ <version>${spring-kafka.version}</version>
<scope>test</scope>
</dependency>
<!-- Spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
import com.google.protobuf.ByteString;
import io.grpc.ManagedChannel;
import org.apache.commons.io.FileUtils;
-import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.apache.commons.io.IOUtils;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
<description>SDC Listener Parent</description>
<properties>
- <spring.boot.version>2.1.3.RELEASE</spring.boot.version>
- <spring.version>5.1.5.RELEASE</spring.version>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
<version>${reactorcore.version}</version>
</dependency>
- <!-- Blueprint Processor Application Module Dependencies -->
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>processor-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>db-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>rest-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>dmaap-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>grpc-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>execution-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>workflow-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>resource-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>selfservice-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>application</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Controller Blueprints Application Dependency -->
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>resource-dict</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>blueprint-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>blueprint-scripts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>db-resources</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <artifactId>blueprint-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<!-- Test Dependency -->
<dependency>
<groupId>io.grpc</groupId>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.1</version>
+ <version>1.5.2-SNAPSHOT</version>
<relativePath/>
</parent>