diff options
author | Priyank Maheshwari <priyank.maheshwari@est.tech> | 2024-12-03 13:26:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-12-03 13:26:09 +0000 |
commit | 902d17332d3e5cebe545991e01a5e55f739f0f80 (patch) | |
tree | c319db49944ee804c1d73947708391b3220d40f0 /cps-path-parser/src/test/groovy/org | |
parent | d6b552017a60769de4ec5e01274c0c1794c90f15 (diff) | |
parent | d262e1c3f4671673a02ea402366a8c9b93fe4e53 (diff) |
Merge "[Cps Path Parser] Introduce Attribute axis"
Diffstat (limited to 'cps-path-parser/src/test/groovy/org')
-rw-r--r-- | cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy index a1bf28977a..b551080b40 100644 --- a/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy +++ b/cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy @@ -34,6 +34,7 @@ class CpsPathQuerySpec extends Specification { then: 'the query has the correct default properties' assert result.cpsPathPrefixType == ABSOLUTE assert result.hasAncestorAxis() == false + assert result.hasAttributeAxis() == false assert result.hasLeafConditions() == false assert result.hasTextFunctionCondition() == false assert result.hasContainsFunctionCondition() == false @@ -107,6 +108,7 @@ class CpsPathQuerySpec extends Specification { 'parent & child with multiple OR operators' | '/parent/child[@key1=1 or @key2="abc" or @key="xyz"]/child2' || "/parent/child[@key1='1' or @key2='abc' or @key='xyz']/child2" 'parent & child with multiple AND/OR combination' | '/parent/child[@key1=1 and @key2="abc" or @key="xyz"]/child2' || "/parent/child[@key1='1' and @key2='abc' or @key='xyz']/child2" 'parent & child with multiple OR/AND combination' | '/parent/child[@key1=1 or @key2="abc" and @key="xyz"]/child2' || "/parent/child[@key1='1' or @key2='abc' and @key='xyz']/child2" + 'attribute axis' | '/parent/child/@key' || '/parent/child/@key' } def 'Parse xpath to form the Normalized xpath containing #scenario.'() { @@ -254,4 +256,20 @@ class CpsPathQuerySpec extends Specification { '/test[@name2="value2" and @name1="value1"]' || 'name2' | 'name1' } + def 'Cps Path using attribute axis.'() { + when: 'the cps path is parsed' + def result = CpsPathQuery.createFrom(cpsPath) + then: 'the query has the correct properties for attribute axis' + assert result.hasAttributeAxis() == expectAttributeAxis + assert result.attributeAxisAttributeName == expectedAttributeName + where: 'the following data is used' + cpsPath || expectAttributeAxis | expectedAttributeName + '/test' || false | '' + '/test/@id' || true | 'id' + '/test[@id="id"]' || false | '' + '/test[@id="id"]/@id' || true | 'id' + '//test/ancestor::root' || false | '' + '//test/ancestor::root/@xyz' || true | 'xyz' + } + } |