summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml6
-rw-r--r--docs/datadictionary/create_netbox_ip_address.rst61
-rw-r--r--docs/datadictionary/dt-netbox-ip.rst33
-rw-r--r--docs/datadictionary/resourcedefinitioncodesnip.rst83
-rw-r--r--docs/microservices/bluePrintsProcessorMS.rst2
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt26
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt34
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt11
8 files changed, 147 insertions, 109 deletions
diff --git a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
index 789659eb2..3a5903c49 100644
--- a/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
+++ b/components/model-catalog/blueprint-model/uat-blueprints/pnf_config/Tests/uat.yaml
@@ -96,7 +96,8 @@ external-services:
- request:
method: PUT
path: &configUri [ restconf/config, &nodeIdentifier [network-topology:network-topology/topology/topology-netconf/node, *pnfId]]
- content-type: application/json
+ headers:
+ Content-Type: application/json
body:
node:
- node-id: *pnfId
@@ -124,7 +125,8 @@ external-services:
- request:
method: PATCH
path: [*configUri, *configletResourcePath]
- content-type: application/yang.patch+json
+ headers:
+ Content-Type: application/yang.patch+json
body: *assignPatch
- request:
method: DELETE
diff --git a/docs/datadictionary/create_netbox_ip_address.rst b/docs/datadictionary/create_netbox_ip_address.rst
index 5d9a9be87..f17ddb407 100644
--- a/docs/datadictionary/create_netbox_ip_address.rst
+++ b/docs/datadictionary/create_netbox_ip_address.rst
@@ -5,32 +5,35 @@
create_netbox_ip_address code
=============================
-{
- "tags" : "oam-local-ipv4-address",
- "name" : "create_netbox_ip",
- "property" : {
- "description" : "netbox ip",
- "type" : "dt-netbox-ip"
- },
- "updated-by" : "adetalhouet",
- "sources" : {
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "verb" : "POST",
- "endpoint-selector" : "ipam-1",
- "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/",
- "path" : "",
- "input-key-mapping" : {
- "prefixId" : "prefix-id"
- },
- "output-key-mapping" : {
- "address" : "address",
- "id" : "id"
- },
- "key-dependencies" : [ "prefix-id" ]
- }
- }
- }
- } \ No newline at end of file
+.. code-block:: json
+ :linenos:
+
+ {
+ "tags" : "oam-local-ipv4-address",
+ "name" : "create_netbox_ip",
+ "property" : {
+ "description" : "netbox ip",
+ "type" : "dt-netbox-ip"
+ },
+ "updated-by" : "adetalhouet",
+ "sources" : {
+ "primary-config-data" : {
+ "type" : "source-rest",
+ "properties" : {
+ "type" : "JSON",
+ "verb" : "POST",
+ "endpoint-selector" : "ipam-1",
+ "url-path" : "/api/ipam/prefixes/$prefixId/available-ips/",
+ "path" : "",
+ "input-key-mapping" : {
+ "prefixId" : "prefix-id"
+ },
+ "output-key-mapping" : {
+ "address" : "address",
+ "id" : "id"
+ },
+ "key-dependencies" : [ "prefix-id" ]
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/docs/datadictionary/dt-netbox-ip.rst b/docs/datadictionary/dt-netbox-ip.rst
index 9410580fb..6dc3c8464 100644
--- a/docs/datadictionary/dt-netbox-ip.rst
+++ b/docs/datadictionary/dt-netbox-ip.rst
@@ -5,18 +5,21 @@
dt-netbox-ip code
=================
-{
- "version": "1.0.0",
- "description": "This is Netbox IP Data Type",
- "properties": {
- "address": {
- "required": true,
- "type": "string"
- },
- "id": {
- "required": true,
- "type": "integer"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
+.. code-block:: none
+ :linenos:
+
+ {
+ "version": "1.0.0",
+ "description": "This is Netbox IP Data Type",
+ "properties": {
+ "address": {
+ "required": true,
+ "type": "string"
+ },
+ "id": {
+ "required": true,
+ "type": "integer"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ }
diff --git a/docs/datadictionary/resourcedefinitioncodesnip.rst b/docs/datadictionary/resourcedefinitioncodesnip.rst
index a91767678..6504a07c3 100644
--- a/docs/datadictionary/resourcedefinitioncodesnip.rst
+++ b/docs/datadictionary/resourcedefinitioncodesnip.rst
@@ -5,44 +5,45 @@
Source Capability Code
======================
-{
- "description": "This is Component Resource Source Node Type",
- "version": "1.0.0",
- "properties": {
- "script-type": {
- "required": true,
- "type": "string",
- "default": "kotlin",
- "constraints": [
- {
- "valid_values": [
- "kotlin",
- "jython"
- ]
- }
- ]
- },
- "script-class-reference": {
- "description": "Capability reference name for internal and kotlin, for jython script file path",
- "required": true,
- "type": "string"
- },
- "instance-dependencies": {
- "required": false,
- "description": "Instance dependency Names to Inject to Kotlin / Jython Script.",
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "key-dependencies": {
- "description": "Resource Resolution dependency dictionary names.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- }
- },
- "derived_from": "tosca.nodes.ResourceSource"
-}
+.. code-block:: json
+ :linenos:
+
+ "description": "This is Component Resource Source Node Type",
+ "version": "1.0.0",
+ "properties": {
+ "script-type": {
+ "required": true,
+ "type": "string",
+ "default": "kotlin",
+ "constraints": [
+ {
+ "valid_values": [
+ "kotlin",
+ "jython"
+ ]
+ }
+ ]
+ },
+ "script-class-reference": {
+ "description": "Capability reference name for internal and kotlin, for jython script file path",
+ "required": true,
+ "type": "string"
+ },
+ "instance-dependencies": {
+ "required": false,
+ "description": "Instance dependency Names to Inject to Kotlin / Jython Script.",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "key-dependencies": {
+ "description": "Resource Resolution dependency dictionary names.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.ResourceSource" \ No newline at end of file
diff --git a/docs/microservices/bluePrintsProcessorMS.rst b/docs/microservices/bluePrintsProcessorMS.rst
index bd0b6997d..292f99e51 100644
--- a/docs/microservices/bluePrintsProcessorMS.rst
+++ b/docs/microservices/bluePrintsProcessorMS.rst
@@ -84,4 +84,4 @@ Testing the environment:
Point your browser to http://localhost:8000/api/v1/execution-service/ping (please note that the port is 8000, not 8080)
-To authenticate, use ccsdkapps / ccsdkapps as login / password. \ No newline at end of file
+To authenticate, use login user id and password. \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
index ad4173c9e..dfa0a8563 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
@@ -35,6 +35,7 @@ import org.junit.ClassRule
import org.junit.Rule
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
+import org.mockito.Answers
import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
@@ -105,7 +106,7 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
@JvmField
val springMethodRule = SpringMethodRule()
- @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
+ @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY, answer = Answers.RETURNS_SMART_NULLS)
lateinit var restClientFactory: BluePrintRestLibPropertyService
@Autowired
@@ -130,10 +131,10 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
uploadBlueprint(blueprintName)
- // Configure mocked external services
- val expectationPerClient = uat.externalServices.associateBy(
+ // Configure mocked external services and save their expected requests for further validation
+ val requestsPerClient = uat.externalServices.associateBy(
{ service -> createRestClientMock(service.selector, service.expectations) },
- { service -> service.expectations }
+ { service -> service.expectations.map { it.request } }
)
// Run processes
@@ -143,14 +144,14 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec))
}
- // Validate request payloads to external services
- for ((mockClient, expectations) in expectationPerClient) {
- expectations.forEach { expectation ->
+ // Validate requests to external services
+ for ((mockClient, requests) in requestsPerClient) {
+ requests.forEach { request ->
verify(mockClient, atLeastOnce()).exchangeResource(
- eq(expectation.request.method),
- eq(expectation.request.path),
- argThat { assertJsonEqual(expectation.request.body, this) },
- expectation.request.requestHeadersMatcher())
+ eq(request.method),
+ eq(request.path),
+ argThat { assertJsonEqual(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())
@@ -160,7 +161,8 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
private fun createRestClientMock(selector: String, restExpectations: List<ExpectationDefinition>)
: BlueprintWebClientService {
- val restClient = mock<BlueprintWebClientService>(verboseLogging = true)
+ val restClient = mock<BlueprintWebClientService>(verboseLogging = true,
+ defaultAnswer = Answers.RETURNS_SMART_NULLS)
// Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
whenever(restClient.exchangeResource(any(), any(), any()))
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt
new file mode 100644
index 000000000..71e07ab4c
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.ccsdk.cds.blueprintsprocessor
+
+import com.google.common.collect.Maps
+import org.mockito.ArgumentMatcher
+
+class RequiredMapEntriesMatcher<K, V>(private val requiredEntries: Map<K, V>) : ArgumentMatcher<Map<K, V>> {
+ override fun matches(argument: Map<K, V>?): Boolean {
+ val missingEntries = Maps.difference(requiredEntries, argument).entriesOnlyOnLeft()
+ return missingEntries.isEmpty()
+ }
+
+ override fun toString(): String {
+ return requiredEntries.toString()
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
index ce2061168..abb1dfcd1 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
@@ -24,8 +24,6 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.node.MissingNode
-import com.nhaarman.mockitokotlin2.any
-import com.nhaarman.mockitokotlin2.eq
import org.yaml.snakeyaml.Yaml
import java.nio.file.Path
@@ -35,13 +33,8 @@ data class ProcessDefinition(val name: String, val request: JsonNode, val expect
data class RequestDefinition(val method: String,
@JsonDeserialize(using = PathDeserializer::class)
val path: String,
- @JsonAlias("content-type")
- val contentType: String? = null,
- val body: JsonNode = MissingNode.getInstance()) {
- fun requestHeadersMatcher(): Map<String, String> {
- return if (contentType != null) eq(mapOf("Content-Type" to contentType)) else any()
- }
-}
+ val headers: Map<String, String> = emptyMap(),
+ val body: JsonNode = MissingNode.getInstance())
data class ResponseDefinition(val status: Int = 200, val body: JsonNode = MissingNode.getInstance()) {
companion object {