diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-02-12 19:16:47 -0500 |
---|---|---|
committer | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-02-13 22:18:14 +0000 |
commit | 387f17df8ae76c3839577785bb5a8682f41933f9 (patch) | |
tree | 138ce66b70c0f36561c7687af5e5d5ec28859f8b /ms/controllerblueprints/modules/blueprint-core/src/test | |
parent | 5bb411741e1044b622bd4a9cb6a45d5ec9f67abc (diff) |
Add Sub Attribute parsing capabilit
Change-Id: Ie353f8e5b86f7472a4790c32705f4b8c3d5e5826
Issue-ID: CCSDK-1061
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core/src/test')
3 files changed, 45 insertions, 4 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index d0bd3cf3..92e9247a 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -65,10 +65,18 @@ class BluePrintRuntimeServiceTest { BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(), "data/default-context.json", executionContext) + val assignmentParams = "{\n" + + " \"ipAddress\": \"127.0.0.1\",\n" + + " \"hostName\": \"vnf-host\"\n" + + " }" + + bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", + JacksonUtils.jsonNode(assignmentParams)) + val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device", "netconf") assertNotNull(capProperties, "Failed to populate capability property values") - assertEquals(capProperties["target-ip-address"], JacksonUtils.jsonNodeFromObject("localhost"), "Failed to populate parameter target-ip-address") + assertEquals(capProperties["target-ip-address"], "127.0.0.1".asJsonPrimitive(), "Failed to populate parameter target-ip-address") assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number") } diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt new file mode 100644 index 00000000..1f003999 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JsonParserUtilsTest.kt @@ -0,0 +1,33 @@ +/* + * Copyright © 2018 IBM. + * + * 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.apps.controllerblueprints.core.utils + +import org.junit.Test +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive +import kotlin.test.assertEquals + +class JsonParserUtilsTest { + + @Test + fun `test parse Node`() { + val dataNode = JacksonUtils.jsonNodeFromClassPathFile("data/default-context.json") + + val parsedNode = JsonParserUtils.parse(dataNode, "$.request-id") + + assertEquals(parsedNode, "12345".asJsonPrimitive(), "failed to parse json request-id") + } +}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json index 3968626b..9f733f0f 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json @@ -1,7 +1,7 @@ { - "request-id" : "12345", - "hostname" : "localhost", + "request-id": "12345", + "hostname": "localhost", "template_name": "baseconfiguration", "template_version": "1.0.0", - "action-name" : "sample-action" + "action-name": "sample-action" }
\ No newline at end of file |