summaryrefslogtreecommitdiffstats
path: root/cps-ri
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-04-04 19:00:44 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2023-04-11 17:52:05 +0100
commit96a2f7b1d9891d40cdeeaa657ee84af0d00dcc9b (patch)
tree067650443c5e2a939d21049e2b1e6d2911b0f13d /cps-ri
parentce880216ec85aa12c1fda23c3abaf4bd16d9595d (diff)
Migrate query tests to integration-test module #2
- Migrate some query tests to integration-test - Edit bookstore model to add integer leaf-list 'editions' - Lower cps-ri code coverage Issue-ID: CPS-1597 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: If50bf15ad7d7f147448f6b60d464efc1cdc91005
Diffstat (limited to 'cps-ri')
-rw-r--r--cps-ri/pom.xml4
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy26
2 files changed, 4 insertions, 26 deletions
diff --git a/cps-ri/pom.xml b/cps-ri/pom.xml
index f282069e35..3cb41303e3 100644
--- a/cps-ri/pom.xml
+++ b/cps-ri/pom.xml
@@ -32,6 +32,10 @@
<artifactId>cps-ri</artifactId>
+ <properties>
+ <minimum-coverage>0.96</minimum-coverage>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy
index 8e50017746..5f8d1caf35 100644
--- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy
+++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy
@@ -38,32 +38,6 @@ class CpsDataPersistenceQueryDataNodeSpec extends CpsPersistenceSpecBase {
static final String SET_DATA = '/data/cps-path-query.sql'
@Sql([CLEAR_DATA, SET_DATA])
- def 'Cps Path query using descendant anywhere with #scenario '() {
- when: 'a query is executed to get a data node by the given cps path'
- def result = objectUnderTest.queryDataNodes(DATASPACE_NAME, ANCHOR_FOR_SHOP_EXAMPLE, cpsPath, OMIT_DESCENDANTS)
- then: 'the correct number of data nodes are retrieved'
- result.size() == expectedXPaths.size()
- and: 'xpaths of the retrieved data nodes are as expected'
- for (int i = 0; i < result.size(); i++) {
- assert result[i].getXpath() == expectedXPaths[i]
- }
- where: 'the following data is used'
- scenario | cpsPath || expectedXPaths
- 'fully unique descendant name' | '//categories[@code=2]' || ["/shops/shop[@id='1']/categories[@code='2']", "/shops/shop[@id='2']/categories[@code='1']", "/shops/shop[@id='2']/categories[@code='2']"]
- 'descendant name match end of other node' | '//book' || ["/shops/shop[@id='1']/categories[@code='1']/book", "/shops/shop[@id='1']/categories[@code='2']/book"]
- 'descendant with text condition on leaf' | '//book/title[text()="Chapters"]' || ["/shops/shop[@id='1']/categories[@code='2']/book"]
- 'descendant with text condition case mismatch' | '//book/title[text()="chapters"]' || []
- 'descendant with text condition on int leaf' | '//book/price[text()="5"]' || ["/shops/shop[@id='1']/categories[@code='1']/book"]
- 'descendant with text condition on leaf-list' | '//book/labels[text()="special offer"]' || ["/shops/shop[@id='1']/categories[@code='1']/book"]
- 'descendant with text condition partial match' | '//book/labels[text()="special"]' || []
- 'descendant with text condition (existing) empty string' | '//book/labels[text()=""]' || ["/shops/shop[@id='1']/categories[@code='1']/book"]
- 'descendant with text condition on int leaf-list' | '//book/editions[text()="2000"]' || ["/shops/shop[@id='1']/categories[@code='2']/book"]
- 'descendant name match of leaf containing /' | '//categories/type[text()="text/with/slash"]' || ["/shops/shop[@id='1']/categories[@code='string/with/slash/']"]
- 'descendant with text condition on leaf containing /' | '//categories[@code=\'string/with/slash\']' || ["/shops/shop[@id='1']/categories[@code='string/with/slash/']"]
- 'descendant with text condition on leaf containing [' | '//book/author[@Address="String[with]square[bracket]"]'|| []
- }
-
- @Sql([CLEAR_DATA, SET_DATA])
def 'Cps Path query using descendant anywhere with #scenario condition(s) for a container element.'() {
when: 'a query is executed to get a data node by the given cps path'
def result = objectUnderTest.queryDataNodes(DATASPACE_NAME, ANCHOR_FOR_SHOP_EXAMPLE, cpsPath, OMIT_DESCENDANTS)