From 83e318f8c7d3cacb24b2ef9b76162b0af12e817c Mon Sep 17 00:00:00 2001 From: Hanif Kukkalli Date: Tue, 23 Feb 2021 12:26:39 +0100 Subject: Implement getDataNode(anchorName, xPath) in NF-Proxy Added spring-boot-starter-validation instead of cps-ri. Added test 'Data node without leaves and without children.' to MultipartFileUtilSpec groovy test Created a method getNodeByCmHandleIdAndXpath(cmHandleId, cpsPath) Added hardcoded value of NFS DataspaceName as: "NFP-Operation". Issue-ID: CPS-172 Signed-off-by: Hanif Kukkalli Change-Id: Ie8086ede01a9c5069b1ee75864b04a0ee5e8a4f6 --- .../org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cps-rest/src') diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy index 3e2bdec37e..2c3d46e5db 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy @@ -21,6 +21,8 @@ package org.onap.cps.rest.utils import org.onap.cps.spi.exceptions.CpsException import org.onap.cps.spi.exceptions.ModelValidationException +import org.onap.cps.spi.model.DataNodeBuilder +import org.onap.cps.utils.DataMapUtils import org.springframework.mock.web.MockMultipartFile import org.springframework.web.multipart.MultipartFile import spock.lang.Specification @@ -28,6 +30,15 @@ import spock.lang.Unroll class MultipartFileUtilSpec extends Specification { + def 'Data node without leaves and without children.'() { + given: 'a datanode with no leaves and no children' + def dataNodeWithoutData = new DataNodeBuilder().withXpath('some xpath').build() + when: 'it is converted to a map' + def result = DataMapUtils.toDataMap(dataNodeWithoutData) + then: 'an empty object map is returned' + result.isEmpty() + } + def 'Extract yang resource from yang file.'() { given: 'uploaded yang file' def multipartFile = new MockMultipartFile("file", "filename.yang", "text/plain", "content".getBytes()) -- cgit 1.2.3-korg