aboutsummaryrefslogtreecommitdiffstats
path: root/cps-rest/src/test
diff options
context:
space:
mode:
authorHanif Kukkalli <lte-ng@outlook.com>2021-02-23 12:26:39 +0100
committerHanif Kukkalli <lte-ng@outlook.com>2021-02-26 11:23:28 +0000
commit83e318f8c7d3cacb24b2ef9b76162b0af12e817c (patch)
tree3a38e10ffcb878e6e61bdaeb2440d58b079467c5 /cps-rest/src/test
parent85aebca0339f9e619fa3a9fd537dc986fc7aa03a (diff)
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 <lte-ng@outlook.com> Change-Id: Ie8086ede01a9c5069b1ee75864b04a0ee5e8a4f6
Diffstat (limited to 'cps-rest/src/test')
-rw-r--r--cps-rest/src/test/groovy/org/onap/cps/rest/utils/MultipartFileUtilSpec.groovy11
1 files changed, 11 insertions, 0 deletions
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())