summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authoraditya puthuparambil <aditya.puthuparambil@bell.ca>2022-09-20 08:47:02 +0000
committerGerrit Code Review <gerrit@onap.org>2022-09-20 08:47:02 +0000
commitdd151f17eed71ea1ef7c2e6e5fe9168a5ae37abb (patch)
tree9581774d8e6438a0eb49cdbb03f29ebdc8f59b85 /cps-service/src/test
parent9978739d2f5d5abb48b29822ac9470fc8758cd0f (diff)
parentce559bf358caf180ba3b61d43a2cf86dd3f3e111 (diff)
Merge "Xpath to NodeId invalid"
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy12
1 files changed, 12 insertions, 0 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy
index 25b90d702f..3f190910b1 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy
@@ -115,4 +115,16 @@ class YangUtilsSpec extends Specification {
noExceptionThrown()
}
+ def 'Parsing xPath to nodeId for #scenario.'() {
+ when: 'xPath is parsed'
+ def result = YangUtils.xpathToNodeIdSequence(xPath)
+ then: 'result represents an array of expected identifiers'
+ assert result == expectedNodeIdentifier
+ where: 'the following parameters are used'
+ scenario | xPath || expectedNodeIdentifier
+ 'container xpath' | '/test-tree' || ['test-tree']
+ 'xpath contains list attribute' | '/test-tree/branch[@name=\'Branch\']' || ['test-tree','branch']
+ 'xpath contains list attributes with /' | '/test-tree/branch[@name=\'/Branch\']/categories[@id=\'/broken\']' || ['test-tree','branch','categories']
+ }
+
}