aboutsummaryrefslogtreecommitdiffstats
path: root/cps-path-parser
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-08-29 20:00:40 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2024-09-04 17:21:40 +0100
commit0f225618ab5a5d918c6b1d58afcad17c99d7aad8 (patch)
tree1d1092a596a7150044b39567137f89f570c98111 /cps-path-parser
parentd196932c3ed2edbc3f0a0ce0fb097b40715ad0bb (diff)
[Cps Path Parser] Move NCMP-specific logic to NCMP
Some special case code to disable ancestor-axis was added for CM-handle search (see CPS-2308). It is now relocated to NCMP. This makes other needed improvements of Cps Path Parser easier. - Move special case code into NCMP - Add integration test to ensure CM-handle search works Issue-ID: CPS-2365 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I168d6156be559166f115aa42e21cd987d98b7d41
Diffstat (limited to 'cps-path-parser')
-rw-r--r--cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java4
-rw-r--r--cps-path-parser/src/test/groovy/org/onap/cps/cpspath/parser/CpsPathQuerySpec.groovy17
2 files changed, 0 insertions, 21 deletions
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java
index 0325bdcacb..ac535f5efc 100644
--- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java
+++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java
@@ -147,10 +147,6 @@ public class CpsPathBuilder extends CpsPathBaseListener {
cpsPathQuery.setNormalizedXpath(normalizedXpathBuilder.toString());
cpsPathQuery.setContainerNames(containerNames);
cpsPathQuery.setBooleanOperators(booleanOperators);
- if (cpsPathQuery.hasAncestorAxis() && cpsPathQuery.getXpathPrefix()
- .endsWith("/" + cpsPathQuery.getAncestorSchemaNodeIdentifier())) {
- cpsPathQuery.setAncestorSchemaNodeIdentifier("");
- }
return cpsPathQuery;
}
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 730c826332..d0df3c745a 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
@@ -253,21 +253,4 @@ class CpsPathQuerySpec extends Specification {
'/test[@name2="value2" and @name1="value1"]' || 'name2' | 'name1'
}
- def 'Ancestor axis matching prefix'() {
- when: 'building a cps path query'
- def result = parseXPathAndBuild(xpath)
- then: 'ancestor axis is removed when same as prefix'
- assert result.hasAncestorAxis() == expectAncestorAxis
- where: 'the following xpaths are used'
- xpath || expectAncestorAxis
- '//abc/def/ancestor::abc' || true
- '//abc/def/ancestor::def' || false
- '//abc/def/ancestor::ef' || true
- }
-
- def parseXPathAndBuild(xpath) {
- def cpsPathBuilder = CpsPathUtil.getCpsPathBuilder(xpath)
- cpsPathBuilder.build()
- }
-
}