aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy/org
diff options
context:
space:
mode:
authorGandhapu, Yashwanth <gandhapu.yashwanth@wipro.com>2022-09-02 11:01:31 +0530
committerGandhapu, Yashwanth <gandhapu.yashwanth@wipro.com>2022-09-06 11:45:41 +0530
commitce559bf358caf180ba3b61d43a2cf86dd3f3e111 (patch)
tree86507cf4a6468450cbae9ecc6aa7c1365f4e40f1 /cps-service/src/test/groovy/org
parent61c5b06dcaa4e8902b946fb86e773b75ddb10a8f (diff)
Xpath to NodeId invalid
Issue-ID: CPS-1244 Signed-off-by: Gandhapu, Yashwanth <gandhapu.yashwanth@wipro.com> Change-Id: Ib091de1247cb0bb48d3157bf2c5becfc9189b773
Diffstat (limited to 'cps-service/src/test/groovy/org')
-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 25b90d702..3f190910b 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']
+ }
+
}